Skip to content

Latest commit

 

History

History
123 lines (82 loc) · 3.33 KB

readme.md

File metadata and controls

123 lines (82 loc) · 3.33 KB

MonstercatNet

License: MIT NuGet Build status CodeFactor codecov

MonstercatNet is a .NET wrapper around the API that drives monstercat.com written in C#.

Supported Platforms

Since this library relies on refit for setting up the API endpoints, there are limitations. You can find the limitations here.

Installation

You can find the latest nuget package here.

Changelog

See here

Usage

creating the api client

using SoftThorn.MonstercatNet;

var httpClient  = new HttpClient().UseMonstercatApiV2();
var client = MonstercatApi.Create(httpClient);

creating the cdn client

using SoftThorn.MonstercatNet;

var httpClient  = new HttpClient().UseMonstercatCdn();
var client = MonstercatCdn.Create(httpClient);

NOTE: The HttpClient for the CDN should be a different instance than the one for the API, as they use a different BaseAddress.

signing in

using SoftThorn.MonstercatNet;

var credentials = new ApiCredentials()
{
    Email = "", // your account e-mail
    Password = "" // your password
};

await client.Login(credentials);

searching for music

using SoftThorn.MonstercatNet;

var tracks = await client.SearchTracks(new TrackSearchRequest()
{
    Limit = 1,
    Skip = 0,
    Creatorfriendly = true,
    Genres = new[] { "Drumstep" },
    ReleaseTypes = new[] { "Album" },
    Tags = new[] { "Uncaged", "Energetic" },
});

getting albumns, EPs and singles (releases)

using SoftThorn.MonstercatNet;

var releases = await client.GetReleases(new ReleaseBrowseRequest()
{
    Limit = 1,
    Skip = 0
});

getting release details

using SoftThorn.MonstercatNet;

var release = await client.GetRelease("the release catalogId which looks like this MCRLX001-8");

getting release cover

using SoftThorn.MonstercatNet;

var cdn = MonstercatCdn.Create(new HttpClient(new HttpLoggingHandler()).UseMonstercatCdn());

var builder = ReleaseCoverArtBuilder
    .Create()
    .ForRelease(new TrackRelease() { CatalogId = "the release catalog Id which looks like this 2FMCS1347" };);

var releaseCoverBytes = await cdn.GetReleaseCoverAsByteArray(builder);
var releaseCoverStream = await cdn.GetReleaseCoverAsStream(builder);

Endpoints

The currently implemented and supported endpoints can be found here

Versions

See here

Contributing

See here


A special thanks goes out to defvs who with many others documented the unofficial API.