am-api

Crates.ioam-api
lib.rsam-api
version1.1.0
sourcesrc
created_at2023-11-22 17:08:48.951686
updated_at2024-09-16 19:23:12.578482
descriptionA library for interfacing with the Apple Music API
homepagehttps://github.com/localcc/am-api
repositoryhttps://github.com/localcc/am-api
max_upload_size
id1045371
size213,903
(localcc)

documentation

https://docs.rs/am-api

README

am-api

Apple Music API bindings for rust.

Examples

Fetching an album by id

async fn fetch_album() -> Result<(), Error> {
    let developer_token = "DEVELOPER_TOKEN";
    let media_user_token = "MEDIA_USER_TOKEN";

    let client = ApiClient::new(
        developer_token,
        media_user_token,
        celes::Country::the_united_states_of_america()
    )
        .expect("failed to create api client");

    let album = Album::get()
        .one(&client, "1676791755")
        .await?
        .expect("album fetch returned none");

    let attributes = album
        .attributes
        .expect("album fetch returned an album without attributes");

    assert_eq!(attributes.name, "Unrequited Love - EP");

    Ok(())
}

More examples can be found in the tests folder.

Installation

To add this library to your project use

cargo add am-api

Features

  • rustls-tls pure rust tls implementation (enabled by default)

  • native-tls native platform tls implementation

Commit count: 1

cargo fmt