spotify-cli / schemas/track
schemas/track
Zod schemas for Spotify track objects.
Type Aliases
AudioFeatures
AudioFeatures =
z.infer<typeofAudioFeaturesSchema>
Defined in: src/schemas/track.ts:101
Audio features for a track (danceability, energy, tempo, etc.).
SavedTrack
SavedTrack =
z.infer<typeofSavedTrackSchema>
Defined in: src/schemas/track.ts:98
A saved track from the user's library.
SimplifiedTrack
SimplifiedTrack =
z.infer<typeofSimplifiedTrackSchema>
Defined in: src/schemas/track.ts:95
A simplified track (no album, used in album listings).
Track
Track =
z.infer<typeofTrackSchema>
Defined in: src/schemas/track.ts:92
A full Spotify track.
Variables
AudioFeaturesSchema
constAudioFeaturesSchema:ZodObject<{acousticness:ZodNumber;danceability:ZodNumber;duration_ms:ZodNumber;energy:ZodNumber;id:ZodString;instrumentalness:ZodNumber;key:ZodNumber;liveness:ZodNumber;loudness:ZodNumber;mode:ZodNumber;speechiness:ZodNumber;tempo:ZodNumber;time_signature:ZodNumber;uri:ZodString;valence:ZodNumber; },"strip",ZodTypeAny, {acousticness:number;danceability:number;duration_ms:number;energy:number;id:string;instrumentalness:number;key:number;liveness:number;loudness:number;mode:number;speechiness:number;tempo:number;time_signature:number;uri:string;valence:number; }, {acousticness:number;danceability:number;duration_ms:number;energy:number;id:string;instrumentalness:number;key:number;liveness:number;loudness:number;mode:number;speechiness:number;tempo:number;time_signature:number;uri:string;valence:number; }>
Defined in: src/schemas/track.ts:73
Schema for audio features analysis data.
Contains acoustic attributes like danceability, energy, tempo, key, loudness, and more — values are typically 0.0 to 1.0 (except tempo, loudness, key, duration_ms, time_signature).
SavedTrackSchema
constSavedTrackSchema:ZodObject<{added_at:ZodString;track:ZodObject<{album:ZodObject<{album_type:ZodString;external_urls:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>;href:ZodString;id:ZodString;images:ZodArray<ZodObject<{height:ZodNullable<ZodNumber>;url:ZodString;width:ZodNullable<ZodNumber>; },"strip",ZodTypeAny, {height:number|null;url:string;width:number|null; }, {height:number|null;url:string;width:number|null; }>,"many">;name:ZodString;release_date:ZodString;uri:ZodString; },"strip",ZodTypeAny, {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; }, {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; }>;artists:ZodArray<ZodObject<{external_urls:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>;href:ZodString;id:ZodString;name:ZodString;type:ZodLiteral<"artist">;uri:ZodString; },"strip",ZodTypeAny, {external_urls: {spotify?:string; };href:string;id:string;name:string;type:"artist";uri:string; }, {external_urls: {spotify?:string; };href:string;id:string;name:string;type:"artist";uri:string; }>,"many">;disc_number:ZodNumber;duration_ms:ZodNumber;explicit:ZodBoolean;external_ids:ZodOptional<ZodObject<{ean:ZodOptional<ZodString>;isrc:ZodOptional<ZodString>;upc:ZodOptional<ZodString>; },"strip",ZodTypeAny, {ean?:string;isrc?:string;upc?:string; }, {ean?:string;isrc?:string;upc?:string; }>>;external_urls:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>;href:ZodString;id:ZodString;is_local:ZodBoolean;name:ZodString;popularity:ZodOptional<ZodNumber>;preview_url:ZodOptional<ZodNullable<ZodString>>;track_number:ZodNumber;type:ZodLiteral<"track">;uri:ZodString; },"strip",ZodTypeAny, {album: {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; };artists:object[];disc_number:number;duration_ms:number;explicit:boolean;external_ids?: {ean?:string;isrc?:string;upc?:string; };external_urls: {spotify?:string; };href:string;id:string;is_local:boolean;name:string;popularity?:number;preview_url?:string|null;track_number:number;type:"track";uri:string; }, {album: {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; };artists:object[];disc_number:number;duration_ms:number;explicit:boolean;external_ids?: {ean?:string;isrc?:string;upc?:string; };external_urls: {spotify?:string; };href:string;id:string;is_local:boolean;name:string;popularity?:number;preview_url?:string|null;track_number:number;type:"track";uri:string; }>; },"strip",ZodTypeAny, {added_at:string;track: {album: {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; };artists:object[];disc_number:number;duration_ms:number;explicit:boolean;external_ids?: {ean?:string;isrc?:string;upc?:string; };external_urls: {spotify?:string; };href:string;id:string;is_local:boolean;name:string;popularity?:number;preview_url?:string|null;track_number:number;type:"track";uri:string; }; }, {added_at:string;track: {album: {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; };artists:object[];disc_number:number;duration_ms:number;explicit:boolean;external_ids?: {ean?:string;isrc?:string;upc?:string; };external_urls: {spotify?:string; };href:string;id:string;is_local:boolean;name:string;popularity?:number;preview_url?:string|null;track_number:number;type:"track";uri:string; }; }>
Defined in: src/schemas/track.ts:61
Schema for a saved track (wraps a track with an added_at timestamp).
SimplifiedTrackSchema
constSimplifiedTrackSchema:ZodObject<{artists:ZodArray<ZodObject<{external_urls:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>;href:ZodString;id:ZodString;name:ZodString;type:ZodLiteral<"artist">;uri:ZodString; },"strip",ZodTypeAny, {external_urls: {spotify?:string; };href:string;id:string;name:string;type:"artist";uri:string; }, {external_urls: {spotify?:string; };href:string;id:string;name:string;type:"artist";uri:string; }>,"many">;disc_number:ZodNumber;duration_ms:ZodNumber;explicit:ZodBoolean;external_urls:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>;href:ZodString;id:ZodString;is_local:ZodBoolean;name:ZodString;preview_url:ZodOptional<ZodNullable<ZodString>>;track_number:ZodNumber;type:ZodLiteral<"track">;uri:ZodString; },"strip",ZodTypeAny, {artists:object[];disc_number:number;duration_ms:number;explicit:boolean;external_urls: {spotify?:string; };href:string;id:string;is_local:boolean;name:string;preview_url?:string|null;track_number:number;type:"track";uri:string; }, {artists:object[];disc_number:number;duration_ms:number;explicit:boolean;external_urls: {spotify?:string; };href:string;id:string;is_local:boolean;name:string;preview_url?:string|null;track_number:number;type:"track";uri:string; }>
Defined in: src/schemas/track.ts:44
Schema for a simplified track (no album info, used in album track listings).
TrackSchema
constTrackSchema:ZodObject<{album:ZodObject<{album_type:ZodString;external_urls:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>;href:ZodString;id:ZodString;images:ZodArray<ZodObject<{height:ZodNullable<ZodNumber>;url:ZodString;width:ZodNullable<ZodNumber>; },"strip",ZodTypeAny, {height:number|null;url:string;width:number|null; }, {height:number|null;url:string;width:number|null; }>,"many">;name:ZodString;release_date:ZodString;uri:ZodString; },"strip",ZodTypeAny, {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; }, {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; }>;artists:ZodArray<ZodObject<{external_urls:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>;href:ZodString;id:ZodString;name:ZodString;type:ZodLiteral<"artist">;uri:ZodString; },"strip",ZodTypeAny, {external_urls: {spotify?:string; };href:string;id:string;name:string;type:"artist";uri:string; }, {external_urls: {spotify?:string; };href:string;id:string;name:string;type:"artist";uri:string; }>,"many">;disc_number:ZodNumber;duration_ms:ZodNumber;explicit:ZodBoolean;external_ids:ZodOptional<ZodObject<{ean:ZodOptional<ZodString>;isrc:ZodOptional<ZodString>;upc:ZodOptional<ZodString>; },"strip",ZodTypeAny, {ean?:string;isrc?:string;upc?:string; }, {ean?:string;isrc?:string;upc?:string; }>>;external_urls:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>;href:ZodString;id:ZodString;is_local:ZodBoolean;name:ZodString;popularity:ZodOptional<ZodNumber>;preview_url:ZodOptional<ZodNullable<ZodString>>;track_number:ZodNumber;type:ZodLiteral<"track">;uri:ZodString; },"strip",ZodTypeAny, {album: {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; };artists:object[];disc_number:number;duration_ms:number;explicit:boolean;external_ids?: {ean?:string;isrc?:string;upc?:string; };external_urls: {spotify?:string; };href:string;id:string;is_local:boolean;name:string;popularity?:number;preview_url?:string|null;track_number:number;type:"track";uri:string; }, {album: {album_type:string;external_urls: {spotify?:string; };href:string;id:string;images:object[];name:string;release_date:string;uri:string; };artists:object[];disc_number:number;duration_ms:number;explicit:boolean;external_ids?: {ean?:string;isrc?:string;upc?:string; };external_urls: {spotify?:string; };href:string;id:string;is_local:boolean;name:string;popularity?:number;preview_url?:string|null;track_number:number;type:"track";uri:string; }>
Defined in: src/schemas/track.ts:24
Schema for a full track object.