VinylVault / TSDiscogsTool

Tool to talk to Discogs API V2
MIT License
1 stars 1 forks source link

TS/JS Discogs APIv2 Library Version 0.0.5(1)

(Starting to add PUT, POST, DELETE endpoints, this will not see a formal release until all are complete)

Tool to talk to Discogs API V2

Currently, Only Supports Personal Access Key.


Installation

This library is libraried on NPM, to install, execute the command :

npm i js_ts_discogs_api_v2_library

Add the following to your .env file (or create a new one)

Exclude sections in []

DISCOGS_API_TOKEN="" [This is Your Personal Access Token, get one here : https://www.discogs.com/settings/developers and click "Generate New Token", Paste the token here]

DISCOGS_USER_NAME = "" [Your Discogs UserProfile Name]

DISCOGS_CURRENCY_MARK = "" [Options are : USD GBP EUR CAD AUD JPY CHF MXN BRL NZD SEK ZAR - per Discogs API]

DISCOGS_PER_PAGE=500 [In Testing 500 is the maximum successful, default is 50, change this to your desired number, 500 or less.]


Usage

After installing via NPM (see top of this file), at the top of your .ts file you need to import into your project in the usual way.

We advise to import as Discogs but that is of course up to you.

Once imported, you will need to define a variable that you use through your code to call the construct ...
const discogs = new Discogs({});

You are now set up to connect to the Discogs API and start using the data provided.

To Display RateLimit Information

console.log(discogs.getRatelimit());

USER INFORMATION

GET const user = await discogs.getUser();

POST const editUser = await discogs.editUser("[Name]" , "[HomePage]", "[Location]", "[Profile]", "[Currency]");
If any of the above need to be changed they should MUST be left in order and marked as "". When this happens the field will NOT be updated, all other fields will be updated, if a field needs to be blanked, please set to " ".

SUPPORTED OPTIONS FOR DISCOGS VARIABLES

Some of the variables have a limited set of options defined by Discogs.

SORT FIELD

SORT ORDER

COLLECTION INFORMATION

RELEASE INFORMATION

ARTIST INFORMATION

LABEL INFORMATION

WANTLIST INFORMATION

Suggestions, Updates & Errors

If you choose to use this library, and run into a problem, please log an issue or raise a PR, we are committed to this project in the long term and will act on all Issues promptly.

If you have suggestions for further functionality that is not already in the roadmap, please raise an Issue, we will add it to the list.

Thanks

Thanks go out to Mike Elsmore. Without your help and support this project would never have got off the ground.

Thanks go to Discogs for enabling an API

Thanks go to Bartve for Disconnect which although now unsupported, is a great library. Disconnect was part of the inspiration for this Library.

Thanks go to Joalla for Discogs_Client which was part of the inspiration for this library. I used this library extensively when I created a Python / Django version of the VinylVault Website

License

MIT

Other Resources

Discogs API Documentation

RichCodesWeb on Twitch - I live stream here most days writing code, it is where the development of this is being completed, as well as other projects.

Come ask me questions, and / or make suggestions in livechat to shape further development of this library and add-on modules.