All information contained within this repository is referenced from the Spotify Web API Reference website
-
The base http client code is contained within the class called : Spotify Client
-
The Rest API methods that interact with the Retrofit interface are located at the class called : Spotify Rest API
-
The Interfaces corresponding to section in the Web API Reference are located in the Model folder located here : Model
-
Majority of requests are made via Retrofit interface, only 1 request is made via Selenium, and that is generating the access tokens! The tests listed under this folder have been tested for functionality, if any functions do not function properly, please raise an issue! Raise an issue here
All additions and recommendations are welcome!
- Please check the Project Tab for Updates on current objectives
- How to use the Java-Spotify-API wrapper
-
SpotifyClient client = new SpotifyClient();
- creates an instance of SpotifyClient with empty API key and Secret Key
-
SpotifyClient client = new SpotifyClient("apikey","secretkey");
- creates an instance of SpotifyClient with API key
"apikey"
and Secret Key"secretkey"
recommended usage
- creates an instance of SpotifyClient with API key
-
SpotifyClient client = new SpotifyClient("apikey","secretkey","accessToken");
- creates an instance of SpotifyClient with API key
"apikey"
and Secret Key"secretkey"
as well as access token"accessToken"
- creates an instance of SpotifyClient with API key
- For reference on Implementation of SpotifyClient in coordination with SpotifyRestAPI, check the Test package (specifically the getRequests package)
Step 1 : Create an instance of SpotifyClient, follow the steps under the SpotifyClient Section
Step 2 : Add username or email,password,and this redirect uri: http://localhost:8888/callback/
and add these values by acquiring an instance of the Spotify Login by using the method client.getLogin();
, and using the appropriate methods outlined:
-
setEmailOrUsername(String usernameoremail);
- sets your email or username for acquiring access token
-
setPassword(String password)
- sets your password for logging into spotify to acquire token
-
setRedirectUri(String redirectUri);
- sets your redirect uri for acquiring the token
Step 3 : Acquire the access token by calling the method client.requestAuthCodeFlowCode(SpotifyClient client);
Step 1 : Access Album Instance by the method getAlbum()
available with your SpotifyClient instance
Step 2 : Access the methods in the album instance, such as addAlbumId, and the setter and getters for individual query options for each request, all parameters are supplied in the tests file, under each type of request.
Step 1 : Access Artist Instance by the method getArtists()
available with your SpotifyClient instance
Step 2 : Access the methods in the artist interface, such as addArtistId, and the setter and getters for individual query parameters, all query parameters are supplied in the tests file, under each type of request.
Step 1
- Access browse seed instance by utilizing the method
.getSeed()
with your SpotifyClient instance- Once the seed instance has been created, add Artist, Track IDs by utilizing the method
.addSeedArtist("ID")
and.addSeedTrack("ID")
, and also adding the genre name (as a String) with the method.addSeedGenre(String genreName)
- Once the seed instance has been created, add Artist, Track IDs by utilizing the method
Step 2
- Once the seed has been given values for either artist, track, or genre, observe which instances need to be utilized for individual method calls by referencing this file : BrowseTest.java