Search in sources :

Example 16 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project musiccabinet by hakko.

the class UserRecommendedArtistsClient method getUserRecommendedArtists.

public WSResponse getUserRecommendedArtists(String lastFmUsername) throws ApplicationException {
    LastFmUser user = lastFmDao.getLastFmUser(lastFmUsername);
    WebserviceInvocation webserviceInvocation = new WebserviceInvocation(USER_GET_RECOMMENDED_ARTISTS, user);
    List<NameValuePair> params = getDefaultParameterList();
    params.add(new BasicNameValuePair(PARAM_METHOD, METHOD));
    params.add(new BasicNameValuePair(PARAM_LIMIT, "100"));
    params.add(new BasicNameValuePair(PARAM_SK, user.getSessionKey()));
    return executeWSRequest(webserviceInvocation, params);
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) LastFmUser(com.github.hakko.musiccabinet.domain.model.library.LastFmUser) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)

Example 17 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project musiccabinet by hakko.

the class UserTopArtistsClient method getUserTopArtists.

public WSResponse getUserTopArtists(LastFmUser user, Period period) throws ApplicationException {
    WebserviceInvocation webserviceInvocation = new WebserviceInvocation(USER_GET_TOP_ARTISTS, user, period.getDays());
    List<NameValuePair> params = getDefaultParameterList();
    params.add(new BasicNameValuePair(PARAM_METHOD, METHOD));
    params.add(new BasicNameValuePair(PARAM_USER, user.getLastFmUsername()));
    params.add(new BasicNameValuePair(PARAM_PERIOD, period.getDescription()));
    return executeWSRequest(webserviceInvocation, params);
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)

Example 18 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project musiccabinet by hakko.

the class ArtistQueryClient method get.

public String get(String artistName) throws ApplicationException {
    WebserviceInvocation invocation = new WebserviceInvocation(MB_ARTIST_QUERY, new Artist(artistName));
    List<NameValuePair> params = new ArrayList<>();
    params.add(new BasicNameValuePair(QUERY, ARTIST + escape(artistName)));
    params.add(new BasicNameValuePair(LIMIT, ONE));
    return executeWSRequest(invocation, PATH, params);
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) ArrayList(java.util.ArrayList) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)

Example 19 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project musiccabinet by hakko.

the class ReleaseClient method get.

public String get(String artistName, String mbid, int offset) throws ApplicationException {
    WebserviceInvocation invocation = new WebserviceInvocation(MB_RELEASE_GROUPS, new Artist(artistName));
    List<NameValuePair> params = new ArrayList<>();
    params.add(new BasicNameValuePair(QUERY, format(PATTERN, mbid)));
    params.add(new BasicNameValuePair(LIMIT, HUNDRED));
    params.add(new BasicNameValuePair(OFFSET, valueOf(offset)));
    return executeWSRequest(invocation, PATH, params);
}
Also used : Artist(com.github.hakko.musiccabinet.domain.model.music.Artist) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) ArrayList(java.util.ArrayList) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)

Example 20 with BasicNameValuePair

use of org.apache.http.message.BasicNameValuePair in project musiccabinet by hakko.

the class ArtistSimilarityClient method getArtistSimilarity.

public WSResponse getArtistSimilarity(Artist artist) throws ApplicationException {
    WebserviceInvocation webserviceInvocation = new WebserviceInvocation(ARTIST_GET_SIMILAR, artist);
    List<NameValuePair> params = getDefaultParameterList();
    params.add(new BasicNameValuePair(PARAM_METHOD, METHOD));
    params.add(new BasicNameValuePair(PARAM_ARTIST, artist.getName()));
    return executeWSRequest(webserviceInvocation, params);
}
Also used : BasicNameValuePair(org.apache.http.message.BasicNameValuePair) NameValuePair(org.apache.http.NameValuePair) BasicNameValuePair(org.apache.http.message.BasicNameValuePair) WebserviceInvocation(com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)

Aggregations

BasicNameValuePair (org.apache.http.message.BasicNameValuePair)289 NameValuePair (org.apache.http.NameValuePair)199 ArrayList (java.util.ArrayList)187 UrlEncodedFormEntity (org.apache.http.client.entity.UrlEncodedFormEntity)101 HttpPost (org.apache.http.client.methods.HttpPost)87 HttpResponse (org.apache.http.HttpResponse)77 HttpEntity (org.apache.http.HttpEntity)58 IOException (java.io.IOException)55 DefaultHttpClient (org.apache.http.impl.client.DefaultHttpClient)33 Test (org.junit.Test)32 HttpGet (org.apache.http.client.methods.HttpGet)29 ClientProtocolException (org.apache.http.client.ClientProtocolException)28 CSVReader (com.talend.csv.CSVReader)27 HttpClient (org.apache.http.client.HttpClient)25 UnsupportedEncodingException (java.io.UnsupportedEncodingException)23 HashMap (java.util.HashMap)20 JSONObject (org.json.JSONObject)20 Map (java.util.Map)19 URI (java.net.URI)16 WebserviceInvocation (com.github.hakko.musiccabinet.domain.model.library.WebserviceInvocation)15