Coder Social home page Coder Social logo

cthacker-udel / java-spotify-api Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 4.34 MB

Unofficial Java-based Wrapper for Spotify Rest API using only Retrofit, GSON, Selenium and WebDriver Manager (to generate access tokens)!

Java 100.00%
java-spotify-api wrapper retrofit-interface spotify-api spotify-web-api spotify spotify-playlist spotify-connect spotify-sdk spotify-library

java-spotify-api's Introduction

Public Rest API for Spotify - Cameron Thacker (4/1/2021)

Version dependencies Retrofit Gson Selenium WebdriverManager

GitHub stars

General API Information

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

Usage

  • How to use the Java-Spotify-API wrapper
    • Create an instance of SpotifyClient by calling the constructors listed in this file
    • When you create an instance of SpotifyClient using the constructors listed above, you can utilize the methods listed in SpotifyRestAPI listed in this file

Examples

  • 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
  • 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"

  • 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)

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

java-spotify-api's People

Contributors

cthacker-udel avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

simpleappred

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.