prawn 0.0.3

Rust Client for the Tidal API providing comprehensive API coverag, and easy OAuth management
Documentation
/*
 * TIDAL API
 *
 * The TIDAL API is a [JSON:API](https://jsonapi.org/)–compliant web API that exposes TIDAL’s music, metadata, and user-related functionality through a consistent, resource-oriented design. More information and API management are available at [developer.tidal.com](developer.tidal.com)
 *
 * The version of the OpenAPI document: 1.0.36
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
#[serde(default)]
pub struct PlaylistsAttributes {
    /// Access type
    #[serde(rename = "accessType")]
    pub access_type: AccessType,
    /// Indicates if the playlist has a duration and set number of tracks
    #[serde(rename = "bounded")]
    pub bounded: bool,
    /// Datetime of playlist creation (ISO 8601)
    #[serde(rename = "createdAt")]
    pub created_at: String,
    /// Playlist description
    #[serde(rename = "description", skip_serializing_if = "Option::is_none")]
    pub description: Option<String>,
    /// Duration of playlist (ISO 8601)
    #[serde(rename = "duration", skip_serializing_if = "Option::is_none")]
    pub duration: Option<String>,
    #[serde(rename = "externalLinks")]
    pub external_links: Vec<models::ExternalLink>,
    /// Datetime of last modification of the playlist (ISO 8601)
    #[serde(rename = "lastModifiedAt")]
    pub last_modified_at: String,
    /// Playlist name
    #[serde(rename = "name")]
    pub name: String,
    /// The amount of followers of the playlist
    #[serde(rename = "numberOfFollowers")]
    pub number_of_followers: i32,
    /// Number of items in the playlist
    #[serde(rename = "numberOfItems", skip_serializing_if = "Option::is_none")]
    pub number_of_items: Option<i32>,
    /// The type of the playlist
    #[serde(rename = "playlistType")]
    pub playlist_type: PlaylistType,
}

impl PlaylistsAttributes {
    pub fn new(access_type: AccessType, bounded: bool, created_at: String, external_links: Vec<models::ExternalLink>, last_modified_at: String, name: String, number_of_followers: i32, playlist_type: PlaylistType) -> PlaylistsAttributes {
        PlaylistsAttributes {
            access_type,
            bounded,
            created_at,
            description: None,
            duration: None,
            external_links,
            last_modified_at,
            name,
            number_of_followers,
            number_of_items: None,
            playlist_type,
        }
    }
}
/// Access type
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum AccessType {
    #[serde(rename = "PUBLIC")]
    Public,
    #[serde(rename = "UNLISTED")]
    Unlisted,
}

impl Default for AccessType {
    fn default() -> AccessType {
        Self::Public
    }
}
/// The type of the playlist
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum PlaylistType {
    #[serde(rename = "EDITORIAL")]
    Editorial,
    #[serde(rename = "USER")]
    User,
    #[serde(rename = "MIX")]
    Mix,
    #[serde(rename = "ARTIST")]
    Artist,
}

impl Default for PlaylistType {
    fn default() -> PlaylistType {
        Self::Editorial
    }
}