jacquard-api 0.11.0

Generated AT Protocol API bindings for Jacquard
Documentation
// @generated by jacquard-lexicon. DO NOT EDIT.
//
// Lexicon: app.rocksky.scrobble.createScrobble
//
// This file was automatically generated from Lexicon schemas.
// Any manual changes will be overwritten on the next regeneration.

#[allow(unused_imports)]
use alloc::collections::BTreeMap;

#[allow(unused_imports)]
use core::marker::PhantomData;
use jacquard_common::CowStr;
use jacquard_common::types::string::UriValue;
use jacquard_derive::{IntoStatic, lexicon};
use serde::{Serialize, Deserialize};
use crate::app_rocksky::scrobble::ScrobbleViewBasic;

#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic, Default)]
#[serde(rename_all = "camelCase")]
pub struct CreateScrobble<'a> {
    ///The album of the track being scrobbled
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub album: Option<CowStr<'a>>,
    ///The URL of the album art for the track
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub album_art: Option<UriValue<'a>>,
    ///The Apple Music link for the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub apple_music_link: Option<UriValue<'a>>,
    ///The artist of the track being scrobbled
    #[serde(borrow)]
    pub artist: CowStr<'a>,
    ///The URL of the artist's picture, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub artist_picture: Option<UriValue<'a>>,
    ///The composer of the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub composer: Option<CowStr<'a>>,
    ///The copyright message for the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub copyright_message: Option<CowStr<'a>>,
    ///The Deezer link for the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub deezer_link: Option<UriValue<'a>>,
    ///The disc number of the track in the album, if applicable
    #[serde(skip_serializing_if = "Option::is_none")]
    pub disc_number: Option<i64>,
    ///The duration of the track in seconds
    #[serde(skip_serializing_if = "Option::is_none")]
    pub duration: Option<i64>,
    ///The record label of the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub label: Option<CowStr<'a>>,
    ///The Last.fm link for the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub lastfm_link: Option<UriValue<'a>>,
    ///The lyrics of the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub lyrics: Option<CowStr<'a>>,
    ///The MusicBrainz ID of the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub mb_id: Option<CowStr<'a>>,
    ///The release date of the track, formatted as YYYY-MM-DD
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub release_date: Option<CowStr<'a>>,
    ///The Spotify link for the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub spotify_link: Option<UriValue<'a>>,
    ///The Tidal link for the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub tidal_link: Option<UriValue<'a>>,
    ///The timestamp of the scrobble in milliseconds since epoch
    #[serde(skip_serializing_if = "Option::is_none")]
    pub timestamp: Option<i64>,
    ///The title of the track being scrobbled
    #[serde(borrow)]
    pub title: CowStr<'a>,
    ///The track number of the track in the album
    #[serde(skip_serializing_if = "Option::is_none")]
    pub track_number: Option<i64>,
    ///The year the track was released
    #[serde(skip_serializing_if = "Option::is_none")]
    pub year: Option<i64>,
    ///The Youtube link for the track, if available
    #[serde(skip_serializing_if = "Option::is_none")]
    #[serde(borrow)]
    pub youtube_link: Option<UriValue<'a>>,
}


#[lexicon]
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, IntoStatic)]
#[serde(rename_all = "camelCase")]
pub struct CreateScrobbleOutput<'a> {
    #[serde(flatten)]
    #[serde(borrow)]
    pub value: ScrobbleViewBasic<'a>,
}

/// Response type for app.rocksky.scrobble.createScrobble
pub struct CreateScrobbleResponse;
impl jacquard_common::xrpc::XrpcResp for CreateScrobbleResponse {
    const NSID: &'static str = "app.rocksky.scrobble.createScrobble";
    const ENCODING: &'static str = "application/json";
    type Output<'de> = CreateScrobbleOutput<'de>;
    type Err<'de> = jacquard_common::xrpc::GenericError<'de>;
}

impl<'a> jacquard_common::xrpc::XrpcRequest for CreateScrobble<'a> {
    const NSID: &'static str = "app.rocksky.scrobble.createScrobble";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Response = CreateScrobbleResponse;
}

/// Endpoint type for app.rocksky.scrobble.createScrobble
pub struct CreateScrobbleRequest;
impl jacquard_common::xrpc::XrpcEndpoint for CreateScrobbleRequest {
    const PATH: &'static str = "/xrpc/app.rocksky.scrobble.createScrobble";
    const METHOD: jacquard_common::xrpc::XrpcMethod = jacquard_common::xrpc::XrpcMethod::Procedure(
        "application/json",
    );
    type Request<'de> = CreateScrobble<'de>;
    type Response = CreateScrobbleResponse;
}