Skip to content

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

License

Notifications You must be signed in to change notification settings

Insire/MonstercatNet

Repository files navigation

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.

About

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

Topics

Resources

License

Stars

Watchers

Forks

Languages