All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.sonallux.spotify.api.apis.search.SearchRequest Maven / Gradle / Ivy

The newest version!
package de.sonallux.spotify.api.apis.search;

import com.fasterxml.jackson.core.type.TypeReference;
import de.sonallux.spotify.api.http.ApiCall;
import de.sonallux.spotify.api.http.ApiClient;
import de.sonallux.spotify.api.http.Request;
import de.sonallux.spotify.api.models.*;

/**
 * 

Search for Item request

* *

Response

*

Search response

*/ public class SearchRequest { private static final TypeReference RESPONSE_TYPE = new TypeReference<>() {}; private final ApiClient apiClient; private final Request request; /** * Search for Item request * @param apiClient

The API client

* @param q

Your search query.

You can narrow down your search using field filters. The available filters are album, artist, track, year, upc, tag:hipster, tag:new, isrc, and genre. Each field filter only applies to certain result types.

The artist and year filters can be used while searching albums, artists and tracks. You can filter on a single year or a range (e.g. 1955-1960).
The album filter can be used while searching albums and tracks.
The genre filter can be used while searching artists and tracks.
The isrc and track filters can be used while searching tracks.
The upc, tag:new and tag:hipster filters can only be used while searching albums. The tag:new filter will return albums released in the past two weeks and tag:hipster can be used to return only albums with the lowest 10% popularity.

* @param type

A comma-separated list of item types to search across. Search results include hits from all the specified item types. For example: q=abacab&type=album,track returns both albums and tracks matching "abacab".

*/ public SearchRequest(ApiClient apiClient, String q, java.util.List type) { this.apiClient = apiClient; this.request = new Request("GET", "/search") .addQueryParameter("q", String.valueOf(q)) .addQueryParameter("type", String.valueOf(type)) ; } /** * @param market

An ISO 3166-1 alpha-2 country code. If a country code is specified, only content that is available in that market will be returned.
If a valid user access token is specified in the request header, the country associated with the user account will take priority over this parameter.
Note: If neither market or user country are provided, the content is considered unavailable for the client.
Users can view the country that is associated with their account in the account settings.

* @return this request */ public SearchRequest market(String market) { this.request.addQueryParameter("market", String.valueOf(market)); return this; } /** * @param limit

The maximum number of results to return in each item type.

* @return this request */ public SearchRequest limit(int limit) { this.request.addQueryParameter("limit", String.valueOf(limit)); return this; } /** * @param offset

The index of the first result to return. Use with limit to get the next page of search results.

* @return this request */ public SearchRequest offset(int offset) { this.request.addQueryParameter("offset", String.valueOf(offset)); return this; } /** * @param includeExternal

If include_external=audio is specified it signals that the client can play externally hosted audio content, and marks the content as playable in the response. By default externally hosted audio content is marked as unplayable in the response.

* @return this request */ public SearchRequest includeExternal(String includeExternal) { this.request.addQueryParameter("include_external", String.valueOf(includeExternal)); return this; } /** * Build the request into an executable api call * @return an executable api call */ public ApiCall build() { return apiClient.createApiCall(request, RESPONSE_TYPE); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy