Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kellnerd/musicbrainz-ts
MusicBrainz API client which aims for fully typed results
https://github.com/kellnerd/musicbrainz-ts
api-client deno musicbrainz musicbrainz-api typescript
Last synced: 3 months ago
JSON representation
MusicBrainz API client which aims for fully typed results
- Host: GitHub
- URL: https://github.com/kellnerd/musicbrainz-ts
- Owner: kellnerd
- License: mit
- Created: 2024-03-19T19:22:34.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-06-30T14:22:45.000Z (6 months ago)
- Last Synced: 2024-10-05T01:49:46.296Z (3 months ago)
- Topics: api-client, deno, musicbrainz, musicbrainz-api, typescript
- Language: TypeScript
- Homepage: https://jsr.io/@kellnerd/musicbrainz
- Size: 151 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# MusicBrainz
[MusicBrainz] [API] client which aims for fully typed results.
## Example
```ts
import { MusicBrainzClient } from "@kellnerd/musicbrainz";const client = new MusicBrainzClient();
// Lookup a group artist by MBID and include its artist relationships.
// Type of the result is affected by the specified include parameters.
const group = await client.lookup(
"artist",
"83d91898-7763-47d7-b03b-b92132375c47",
{ inc: ["artist-rels"] },
);// Find the members of the group from its relationships.
// Property `relations` only exists because a relationship include was specified.
const members = group.relations
// Filter by type name (for illustration, ideally you should use "type-id").
.filter((rel) => rel.type === "member of band")
// Extract the target artist. The `artist` property is guaranteed to exist
// and not optional because "artist-rels" is the only relationship include.
.map((rel) => rel.artist);console.log(members);
```[MusicBrainz]: https://musicbrainz.org/
[API]: https://musicbrainz.org/doc/MusicBrainz_API