Package de.jsone_studios.wrapper.spotify
Class AuthenticatedSpotifyApi
- java.lang.Object
-
- de.jsone_studios.wrapper.spotify.SpotifyWebApi
-
- de.jsone_studios.wrapper.spotify.AuthenticatedSpotifyApi
-
- All Implemented Interfaces:
SpotifyApi
public class AuthenticatedSpotifyApi extends SpotifyWebApi
-
-
Field Summary
-
Fields inherited from class de.jsone_studios.wrapper.spotify.SpotifyWebApi
SPOTIFY_WEB_API_ENDPOINT
-
-
Constructor Summary
Constructors Constructor Description AuthenticatedSpotifyApi(AuthenticationProvider authProvider)AuthenticatedSpotifyApi(AuthenticationProvider authProvider, okhttp3.HttpUrl baseUrlWebApi, okhttp3.HttpUrl baseUrlAuthApi)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> retrofit2.Response<T>callApi(retrofit2.Call<T> call)SpotifyAuthApigetAuthApi()booleangetAuthTokensFromAuthCode(String authCode, String redirectUri)Request a access-token and refresh-token from an authorization code.-
Methods inherited from class de.jsone_studios.wrapper.spotify.SpotifyWebApi
getAlbumsService, getArtistsService, getBrowseService, getFollowService, getLibraryService, getPersonalizationService, getPlaylistsService, getPlaylistTracksService, getRetrofit, getSearchService, getTracksService, getUsersProfileService
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.jsone_studios.wrapper.spotify.SpotifyApi
callApiAndReturnBody, getBody, getErrorBody, getErrorDetailsFromResponse
-
-
-
-
Constructor Detail
-
AuthenticatedSpotifyApi
public AuthenticatedSpotifyApi(AuthenticationProvider authProvider, okhttp3.HttpUrl baseUrlWebApi, okhttp3.HttpUrl baseUrlAuthApi)
-
AuthenticatedSpotifyApi
public AuthenticatedSpotifyApi(AuthenticationProvider authProvider)
-
-
Method Detail
-
getAuthApi
public SpotifyAuthApi getAuthApi()
-
getAuthTokensFromAuthCode
public boolean getAuthTokensFromAuthCode(String authCode, String redirectUri)
Request a access-token and refresh-token from an authorization code. The tokens are passed toAuthenticationProvider.onNewAuthTokens(AuthTokens).- Parameters:
authCode- the authorization code returned form an authorization requestredirectUri- the redirect URI used for the authorization request- Returns:
trueif new tokens were requested successfully,falseotherwise
-
callApi
public <T> retrofit2.Response<T> callApi(retrofit2.Call<T> call) throws SpotifyApiException- Throws:
SpotifyApiException
-
-