lionralfs / discogs-client Goto Github PK
View Code? Open in Web Editor NEWA JavaScript Discogs Client for browsers and Node.js (ESM and CommonJS)
License: Other
A JavaScript Discogs Client for browsers and Node.js (ESM and CommonJS)
License: Other
Hi, first of all I would like to thank you for this package. I was able to integrate very smoothly with the authentication mechanism and a great advantage is that it has defined types! However, I encountered a problem.
Issue:
The process of authenticating the user and retrieving their data using the client.getIdentity()
method works fine but when I try to retrieve the wantlist using client.user().wantlist().getReleases("my_username")
I get a 403
with an error:
DiscogsError: You are not allowed to view this resource. Please authenticate as the owner to view this content.
After more research, I came across this thread on the discogs forum: https://www.discogs.com/forum/thread/1032532
Looks like at some point discogs changed oauth_signature_method
from PLAINTEXT
to HMAC-SHA1
.
When I tested this in Insomnia by setting oauth_consumer_key
, oauth_consumer_secret
, oauth_token_key
, oauth_token_secret
and oauth_signature_method
to HMAC-SHA1
- everything works fine and I am able to download the wantlist for the logged-in user.
If I call getArtistReleases
I get the list of releases, but I am missing the uri
from them. I do get it if I individually call getRelease
, though. So if I want to catalogue all the uri
s in a given discography, I would have to:
getArtistReleases
(n queries if multiple pages)getRelease
(n queries).This is an incredibly expensive thing just to get the catalogue from an artist.
Is this a problem from the base Discogs API?
Line 5 in 0f0c3d8
discogs-client/lib/database.ts
Line 178 in 0f0c3d8
Hello,
Firstly, I'd like to say thank you for this library. It's been incredibly useful in my project.
I've noticed that not all TypeScript types are exported from the library, which makes it difficult to use certain features in a type-safe manner.
For example:
GetProfileResponse
from https://github.com/lionralfs/discogs-client/blob/main/lib/user.ts
WantlistEntryResponse
from https://github.com/lionralfs/discogs-client/blob/main/lib/wantlist.ts
Could you please export all the TypeScript types from the library? This includes types, type aliases, unions and any other types defined within the codebase and based on Discogs API.
Currently, to access the necessary types, I have to use Awaited<ReturnType<typeof T>>
of my custom T
method.
import apiClient from '@/service/api/apiClient'
export type DiscogsUser = Awaited<ReturnType<typeof getUser>>;
export const getUser = async (username: string) => {
const user = await apiClient.user().getProfile(username);
return user.data
}
Thank you for considering this request. I believe it will make the library even more robust and user-friendly for the community.
The CJS bundle currently includes node-fetch instead of require
ing it.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.