spotify-cli / schemas/common
schemas/common
Shared Zod schemas used across multiple Spotify API response types.
Type Aliases
ExternalUrls
ExternalUrls =
z.infer<typeofExternalUrlsSchema>
Defined in: src/schemas/common.ts:76
External URL links for a Spotify resource.
Image
Image =
z.infer<typeofImageSchema>
Defined in: src/schemas/common.ts:73
A Spotify image (album art, profile picture, etc.).
Variables
ExternalIdsSchema
constExternalIdsSchema:ZodObject<{ean:ZodOptional<ZodString>;isrc:ZodOptional<ZodString>;upc:ZodOptional<ZodString>; },"strip",ZodTypeAny, {ean?:string;isrc?:string;upc?:string; }, {ean?:string;isrc?:string;upc?:string; }>
Defined in: src/schemas/common.ts:22
Schema for external identifiers (ISRC, EAN, UPC).
ExternalUrlsSchema
constExternalUrlsSchema:ZodObject<{spotify:ZodOptional<ZodString>; },"strip",ZodTypeAny, {spotify?:string; }, {spotify?:string; }>
Defined in: src/schemas/common.ts:17
Schema for external URL links (e.g. Spotify web player URL).
FollowersSchema
constFollowersSchema:ZodObject<{href:ZodNullable<ZodString>;total:ZodNumber; },"strip",ZodTypeAny, {href:string|null;total:number; }, {href:string|null;total:number; }>
Defined in: src/schemas/common.ts:29
Schema for follower count information.
ImageSchema
constImageSchema: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; }>
Defined in: src/schemas/common.ts:10
Schema for a Spotify image object (album art, profile picture, etc.).
Functions
CursorPagingSchema()
CursorPagingSchema<
T>(itemSchema):ZodObject<{cursors:ZodObject<{after:ZodOptional<ZodNullable<ZodString>>;before:ZodOptional<ZodNullable<ZodString>>; },"strip",ZodTypeAny, {after?:string|null;before?:string|null; }, {after?:string|null;before?:string|null; }>;href:ZodString;items:ZodArray<T,"many">;limit:ZodNumber;next:ZodNullable<ZodString>;total:ZodOptional<ZodNumber>; },"strip",ZodTypeAny, {cursors: {after?:string|null;before?:string|null; };href:string;items:T["_output"][];limit:number;next:string|null;total?:number; }, {cursors: {after?:string|null;before?:string|null; };href:string;items:T["_input"][];limit:number;next:string|null;total?:number; }>
Defined in: src/schemas/common.ts:58
Creates a Zod schema for Spotify's cursor-based paginated responses.
Type Parameters
T
T extends ZodTypeAny
The Zod schema type for individual items in the page.
Parameters
itemSchema
T
Schema used to validate each item in the items array.
Returns
ZodObject<{ cursors: ZodObject<{ after: ZodOptional<ZodNullable<ZodString>>; before: ZodOptional<ZodNullable<ZodString>>; }, "strip", ZodTypeAny, { after?: string | null; before?: string | null; }, { after?: string | null; before?: string | null; }>; href: ZodString; items: ZodArray<T, "many">; limit: ZodNumber; next: ZodNullable<ZodString>; total: ZodOptional<ZodNumber>; }, "strip", ZodTypeAny, { cursors: { after?: string | null; before?: string | null; }; href: string; items: T["_output"][]; limit: number; next: string | null; total?: number; }, { cursors: { after?: string | null; before?: string | null; }; href: string; items: T["_input"][]; limit: number; next: string | null; total?: number; }>
A Zod object schema representing a cursor-paginated response.
PagingSchema()
PagingSchema<
T>(itemSchema):ZodObject<{href:ZodString;items:ZodArray<T,"many">;limit:ZodNumber;next:ZodNullable<ZodString>;offset:ZodNumber;previous:ZodNullable<ZodString>;total:ZodNumber; },"strip",ZodTypeAny, {href:string;items:T["_output"][];limit:number;next:string|null;offset:number;previous:string|null;total:number; }, {href:string;items:T["_input"][];limit:number;next:string|null;offset:number;previous:string|null;total:number; }>
Defined in: src/schemas/common.ts:40
Creates a Zod schema for Spotify's offset-based paginated responses.
Type Parameters
T
T extends ZodTypeAny
The Zod schema type for individual items in the page.
Parameters
itemSchema
T
Schema used to validate each item in the items array.
Returns
ZodObject<{ href: ZodString; items: ZodArray<T, "many">; limit: ZodNumber; next: ZodNullable<ZodString>; offset: ZodNumber; previous: ZodNullable<ZodString>; total: ZodNumber; }, "strip", ZodTypeAny, { href: string; items: T["_output"][]; limit: number; next: string | null; offset: number; previous: string | null; total: number; }, { href: string; items: T["_input"][]; limit: number; next: string | null; offset: number; previous: string | null; total: number; }>
A Zod object schema representing a paginated response.