Coder Social home page Coder Social logo

spotify4java's Introduction

Spotify for Java (Still under development)

Spotify api wrapper for java. JavaDocs

Written for enjoyment and a way to learn java concepts that I have rarely/never used. Demonstrated usage of OAuth 2.0 and java reflections, generics, networking, and concurrency.

Latest: v1.5.0

Maven

<dependency>
    <groupId>dev.gruncan.s4j</groupId>
    <artifactId>S4J</artifactId>
    <version>1.5.0</version>
</dependency>

Version Roadmap

  • v1.0.0: WebAPI
  • v2.0.0: AdAPI
  • v3.0.0: Embeds
  • v4.0.0: Open Access

Most often all rquests will be implemented before x.5.0 and all serialization before next major version

How it do

Firstly create an app at spotify's dashboard https://developer.spotify.com/dashboard/applications

Example:

SpotifyClient spotifyClient = new SpotifyClientBuilder("CLIENT_ID", "CLIENT_SECRET", "REDIRECT_URL")
                                                        .getBuiltClient();
  • CLIENT_ID is found at your newly create app's dashboard
  • CLIENT_SECRET is again found at your app's dashboard
  • REDRIECT_URL has to be set in your app's dashboard

getBuiltClient() will make/create the necessary requests/server following spotify's OAuth 2.0 authentication framework

If however you already have an access_token you can use:

SpotifyClient spotifyClient = SpotifyClient.buildFromToken("access_token");

Executing Requests

Executing a request is as simple as instantiating your chosen request class with selected constructor parameters for said request and executing it with your spotifyClient executeRequest

Example:

public static void main(String[] args){
    SpotifyClient spotifyClient = new SpotifyClientBuilder("CLIENT_ID", "CLIENT_SECRET", "REDIRECT_URL").getBuiltClient();
    TrackGet trackGet = new TrackGet("Track_id");
    SpotifyResponse response = spotifyClient.executeRequest(trackGet);
    JSONObject jsonObject = response.getJsonObject();
    System.out.println(jsonObject.toString());
}

Returns a SpotifyResponse that encapsulates the json response from the spotify api

All Json classes were taken from https://github.com/tdunning/open-json with only minor edits.

Requests modelled by this api so far

Album:

Artists:

Audiobooks:

Categories:

Chapters:

Episodes:

Genres:

Markets:

Me:
Playlists:

Search:

Shows:

Tracks:

User:

Scored through requests are implemented but API endpoints do not work on spotify's end.

Future Plans

  • Bring back Spring support for handling user authentication
  • Add more branches of api requests not just web api
  • Optimise multiple call different threads

spotify4java's People

Contributors

gruncan avatar

Watchers

 avatar

spotify4java's Issues

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.