@keystrokehq/spotify 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +113 -0
- package/dist/_official/index.d.mts +32 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +1 -0
- package/dist/_runtime/index.mjs +1 -0
- package/dist/albums.d.mts +265 -0
- package/dist/albums.mjs +72 -0
- package/dist/artists.d.mts +237 -0
- package/dist/artists.mjs +84 -0
- package/dist/audio-analysis.d.mts +91 -0
- package/dist/audio-analysis.mjs +19 -0
- package/dist/audio-features.d.mts +61 -0
- package/dist/audio-features.mjs +31 -0
- package/dist/audiobooks.d.mts +176 -0
- package/dist/audiobooks.mjs +59 -0
- package/dist/browse.d.mts +74 -0
- package/dist/browse.mjs +31 -0
- package/dist/categories.d.mts +118 -0
- package/dist/categories.mjs +66 -0
- package/dist/chapters.d.mts +163 -0
- package/dist/chapters.mjs +39 -0
- package/dist/client.d.mts +3486 -0
- package/dist/client.mjs +758 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/episodes.d.mts +149 -0
- package/dist/episodes.mjs +39 -0
- package/dist/errors.d.mts +34 -0
- package/dist/errors.mjs +89 -0
- package/dist/events.d.mts +613 -0
- package/dist/events.mjs +55 -0
- package/dist/factory-tZba6Hij.mjs +8 -0
- package/dist/follow.d.mts +83 -0
- package/dist/follow.mjs +65 -0
- package/dist/genres.d.mts +14 -0
- package/dist/genres.mjs +19 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-DQ5Egd4f.d.mts +41 -0
- package/dist/integration-ykoImsCq.mjs +78 -0
- package/dist/library.d.mts +472 -0
- package/dist/library.mjs +225 -0
- package/dist/markets.d.mts +14 -0
- package/dist/markets.mjs +20 -0
- package/dist/me.d.mts +169 -0
- package/dist/me.mjs +58 -0
- package/dist/messaging.d.mts +1 -0
- package/dist/messaging.mjs +1 -0
- package/dist/operations.d.mts +6 -0
- package/dist/operations.mjs +237 -0
- package/dist/player.d.mts +877 -0
- package/dist/player.mjs +220 -0
- package/dist/playlists.d.mts +546 -0
- package/dist/playlists.mjs +243 -0
- package/dist/recommendations.d.mts +144 -0
- package/dist/recommendations.mjs +137 -0
- package/dist/schemas.d.mts +3312 -0
- package/dist/schemas.mjs +460 -0
- package/dist/search.d.mts +389 -0
- package/dist/search.mjs +42 -0
- package/dist/shows.d.mts +159 -0
- package/dist/shows.mjs +59 -0
- package/dist/tracks.d.mts +173 -0
- package/dist/tracks.mjs +37 -0
- package/dist/triggers.d.mts +45 -0
- package/dist/triggers.mjs +201 -0
- package/dist/users.d.mts +35 -0
- package/dist/users.mjs +20 -0
- package/dist/verification.d.mts +1 -0
- package/dist/verification.mjs +1 -0
- package/package.json +187 -0
package/dist/schemas.mjs
ADDED
|
@@ -0,0 +1,460 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas.ts
|
|
4
|
+
const spotifyIdSchema = z.string().min(1);
|
|
5
|
+
const spotifyUriSchema = z.string().min(1);
|
|
6
|
+
const spotifyMarketSchema = z.string().length(2);
|
|
7
|
+
const spotifyTimestampSchema = z.iso.datetime();
|
|
8
|
+
const spotifyExternalUrlsSchema = z.object({ spotify: z.url().optional() });
|
|
9
|
+
const spotifyExternalIdsSchema = z.object({
|
|
10
|
+
isrc: z.string().optional(),
|
|
11
|
+
ean: z.string().optional(),
|
|
12
|
+
upc: z.string().optional()
|
|
13
|
+
});
|
|
14
|
+
const spotifyImageSchema = z.object({
|
|
15
|
+
url: z.url(),
|
|
16
|
+
height: z.number().int().nullable(),
|
|
17
|
+
width: z.number().int().nullable()
|
|
18
|
+
});
|
|
19
|
+
const spotifyNamedReferenceSchema = z.object({ name: z.string().min(1) });
|
|
20
|
+
const spotifyFollowersSchema = z.object({
|
|
21
|
+
href: z.url().nullable().optional(),
|
|
22
|
+
total: z.number().int().nonnegative()
|
|
23
|
+
});
|
|
24
|
+
const spotifyRestrictionsSchema = z.object({ reason: z.string().min(1) });
|
|
25
|
+
const spotifyCopyrightSchema = z.object({
|
|
26
|
+
text: z.string().min(1),
|
|
27
|
+
type: z.string().min(1)
|
|
28
|
+
});
|
|
29
|
+
const spotifyResumePointSchema = z.object({
|
|
30
|
+
fullyPlayed: z.boolean(),
|
|
31
|
+
resumePositionMs: z.number().int().nonnegative()
|
|
32
|
+
});
|
|
33
|
+
const spotifyUserSchema = z.object({
|
|
34
|
+
displayName: z.string().nullable().optional(),
|
|
35
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
36
|
+
followers: spotifyFollowersSchema.optional(),
|
|
37
|
+
href: z.url().optional(),
|
|
38
|
+
id: spotifyIdSchema,
|
|
39
|
+
type: z.literal("user"),
|
|
40
|
+
uri: spotifyUriSchema.optional(),
|
|
41
|
+
email: z.email().optional(),
|
|
42
|
+
country: spotifyMarketSchema.optional(),
|
|
43
|
+
product: z.string().min(1).optional(),
|
|
44
|
+
images: z.array(spotifyImageSchema).optional()
|
|
45
|
+
});
|
|
46
|
+
const spotifyArtistSummarySchema = z.object({
|
|
47
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
48
|
+
href: z.url().optional(),
|
|
49
|
+
id: spotifyIdSchema,
|
|
50
|
+
name: z.string().min(1),
|
|
51
|
+
type: z.literal("artist"),
|
|
52
|
+
uri: spotifyUriSchema.optional()
|
|
53
|
+
});
|
|
54
|
+
const spotifyArtistSchema = spotifyArtistSummarySchema.extend({
|
|
55
|
+
followers: spotifyFollowersSchema.optional(),
|
|
56
|
+
genres: z.array(z.string().min(1)).optional(),
|
|
57
|
+
images: z.array(spotifyImageSchema).optional(),
|
|
58
|
+
popularity: z.number().int().min(0).max(100).optional()
|
|
59
|
+
});
|
|
60
|
+
const spotifyAlbumSummarySchema = z.object({
|
|
61
|
+
albumType: z.enum([
|
|
62
|
+
"album",
|
|
63
|
+
"single",
|
|
64
|
+
"compilation"
|
|
65
|
+
]).optional(),
|
|
66
|
+
artists: z.array(spotifyArtistSummarySchema),
|
|
67
|
+
availableMarkets: z.array(spotifyMarketSchema).optional(),
|
|
68
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
69
|
+
href: z.url().optional(),
|
|
70
|
+
id: spotifyIdSchema,
|
|
71
|
+
images: z.array(spotifyImageSchema),
|
|
72
|
+
name: z.string().min(1),
|
|
73
|
+
releaseDate: z.string().min(1).optional(),
|
|
74
|
+
releaseDatePrecision: z.enum([
|
|
75
|
+
"year",
|
|
76
|
+
"month",
|
|
77
|
+
"day"
|
|
78
|
+
]).optional(),
|
|
79
|
+
totalTracks: z.number().int().nonnegative().optional(),
|
|
80
|
+
type: z.literal("album"),
|
|
81
|
+
uri: spotifyUriSchema.optional()
|
|
82
|
+
});
|
|
83
|
+
const spotifyAlbumSchema = spotifyAlbumSummarySchema.extend({
|
|
84
|
+
copyrights: z.array(spotifyCopyrightSchema).optional(),
|
|
85
|
+
genres: z.array(z.string().min(1)).optional(),
|
|
86
|
+
label: z.string().min(1).optional(),
|
|
87
|
+
popularity: z.number().int().min(0).max(100).optional(),
|
|
88
|
+
restrictions: spotifyRestrictionsSchema.optional()
|
|
89
|
+
});
|
|
90
|
+
const spotifyTrackSchema = z.object({
|
|
91
|
+
album: spotifyAlbumSummarySchema.optional(),
|
|
92
|
+
artists: z.array(spotifyArtistSummarySchema),
|
|
93
|
+
availableMarkets: z.array(spotifyMarketSchema).optional(),
|
|
94
|
+
discNumber: z.number().int().positive().optional(),
|
|
95
|
+
durationMs: z.number().int().nonnegative(),
|
|
96
|
+
explicit: z.boolean(),
|
|
97
|
+
externalIds: spotifyExternalIdsSchema.optional(),
|
|
98
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
99
|
+
href: z.url().optional(),
|
|
100
|
+
id: spotifyIdSchema,
|
|
101
|
+
isLocal: z.boolean().optional(),
|
|
102
|
+
isPlayable: z.boolean().optional(),
|
|
103
|
+
name: z.string().min(1),
|
|
104
|
+
popularity: z.number().int().min(0).max(100).optional(),
|
|
105
|
+
previewUrl: z.union([z.url(), z.null()]).optional(),
|
|
106
|
+
restrictions: spotifyRestrictionsSchema.optional(),
|
|
107
|
+
trackNumber: z.number().int().positive().optional(),
|
|
108
|
+
type: z.literal("track"),
|
|
109
|
+
uri: spotifyUriSchema.optional()
|
|
110
|
+
});
|
|
111
|
+
const spotifyShowSummarySchema = z.object({
|
|
112
|
+
availableMarkets: z.array(spotifyMarketSchema).optional(),
|
|
113
|
+
copyrights: z.array(spotifyCopyrightSchema).optional(),
|
|
114
|
+
description: z.string().optional(),
|
|
115
|
+
explicit: z.boolean().optional(),
|
|
116
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
117
|
+
href: z.url().optional(),
|
|
118
|
+
id: spotifyIdSchema,
|
|
119
|
+
images: z.array(spotifyImageSchema),
|
|
120
|
+
languages: z.array(z.string().min(1)).optional(),
|
|
121
|
+
mediaType: z.string().min(1).optional(),
|
|
122
|
+
name: z.string().min(1),
|
|
123
|
+
publisher: z.string().min(1).optional(),
|
|
124
|
+
totalEpisodes: z.number().int().nonnegative().optional(),
|
|
125
|
+
type: z.literal("show"),
|
|
126
|
+
uri: spotifyUriSchema.optional()
|
|
127
|
+
});
|
|
128
|
+
const spotifyShowSchema = spotifyShowSummarySchema.extend({
|
|
129
|
+
htmlDescription: z.string().optional(),
|
|
130
|
+
isExternallyHosted: z.boolean().optional()
|
|
131
|
+
});
|
|
132
|
+
const spotifyEpisodeSchema = z.object({
|
|
133
|
+
audioPreviewUrl: z.union([z.url(), z.null()]).optional(),
|
|
134
|
+
description: z.string().optional(),
|
|
135
|
+
durationMs: z.number().int().nonnegative(),
|
|
136
|
+
explicit: z.boolean(),
|
|
137
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
138
|
+
href: z.url().optional(),
|
|
139
|
+
htmlDescription: z.string().optional(),
|
|
140
|
+
id: spotifyIdSchema,
|
|
141
|
+
images: z.array(spotifyImageSchema),
|
|
142
|
+
isExternallyHosted: z.boolean().optional(),
|
|
143
|
+
isPlayable: z.boolean().optional(),
|
|
144
|
+
language: z.string().min(1).optional(),
|
|
145
|
+
languages: z.array(z.string().min(1)).optional(),
|
|
146
|
+
name: z.string().min(1),
|
|
147
|
+
releaseDate: z.string().min(1).optional(),
|
|
148
|
+
releaseDatePrecision: z.enum([
|
|
149
|
+
"year",
|
|
150
|
+
"month",
|
|
151
|
+
"day"
|
|
152
|
+
]).optional(),
|
|
153
|
+
resumePoint: spotifyResumePointSchema.optional(),
|
|
154
|
+
restrictions: spotifyRestrictionsSchema.optional(),
|
|
155
|
+
show: spotifyShowSummarySchema.optional(),
|
|
156
|
+
type: z.literal("episode"),
|
|
157
|
+
uri: spotifyUriSchema.optional()
|
|
158
|
+
});
|
|
159
|
+
const spotifyAudiobookSummarySchema = z.object({
|
|
160
|
+
authors: z.array(spotifyNamedReferenceSchema).optional(),
|
|
161
|
+
availableMarkets: z.array(spotifyMarketSchema).optional(),
|
|
162
|
+
copyrights: z.array(spotifyCopyrightSchema).optional(),
|
|
163
|
+
description: z.string().optional(),
|
|
164
|
+
explicit: z.boolean().optional(),
|
|
165
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
166
|
+
href: z.url().optional(),
|
|
167
|
+
htmlDescription: z.string().optional(),
|
|
168
|
+
id: spotifyIdSchema,
|
|
169
|
+
images: z.array(spotifyImageSchema),
|
|
170
|
+
languages: z.array(z.string().min(1)).optional(),
|
|
171
|
+
mediaType: z.string().min(1).optional(),
|
|
172
|
+
name: z.string().min(1),
|
|
173
|
+
narrators: z.array(spotifyNamedReferenceSchema).optional(),
|
|
174
|
+
publisher: z.string().min(1).optional(),
|
|
175
|
+
totalChapters: z.number().int().nonnegative().optional(),
|
|
176
|
+
type: z.literal("audiobook"),
|
|
177
|
+
uri: spotifyUriSchema.optional()
|
|
178
|
+
});
|
|
179
|
+
const spotifyAudiobookSchema = spotifyAudiobookSummarySchema;
|
|
180
|
+
const spotifyChapterSchema = z.object({
|
|
181
|
+
audioPreviewUrl: z.union([z.url(), z.null()]).optional(),
|
|
182
|
+
audiobook: spotifyAudiobookSummarySchema.optional(),
|
|
183
|
+
availableMarkets: z.array(spotifyMarketSchema).optional(),
|
|
184
|
+
chapterNumber: z.number().int().positive().optional(),
|
|
185
|
+
description: z.string().optional(),
|
|
186
|
+
durationMs: z.number().int().nonnegative(),
|
|
187
|
+
explicit: z.boolean(),
|
|
188
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
189
|
+
href: z.url().optional(),
|
|
190
|
+
htmlDescription: z.string().optional(),
|
|
191
|
+
id: spotifyIdSchema,
|
|
192
|
+
images: z.array(spotifyImageSchema),
|
|
193
|
+
isPlayable: z.boolean().optional(),
|
|
194
|
+
languages: z.array(z.string().min(1)).optional(),
|
|
195
|
+
name: z.string().min(1),
|
|
196
|
+
releaseDate: z.string().min(1).optional(),
|
|
197
|
+
releaseDatePrecision: z.enum([
|
|
198
|
+
"year",
|
|
199
|
+
"month",
|
|
200
|
+
"day"
|
|
201
|
+
]).optional(),
|
|
202
|
+
resumePoint: spotifyResumePointSchema.optional(),
|
|
203
|
+
restrictions: spotifyRestrictionsSchema.optional(),
|
|
204
|
+
type: z.literal("chapter"),
|
|
205
|
+
uri: spotifyUriSchema.optional()
|
|
206
|
+
});
|
|
207
|
+
const spotifyTrackOrEpisodeSchema = z.discriminatedUnion("type", [spotifyTrackSchema, spotifyEpisodeSchema]);
|
|
208
|
+
const spotifyPlaylistSchema = z.object({
|
|
209
|
+
collaborative: z.boolean(),
|
|
210
|
+
description: z.string().nullable().optional(),
|
|
211
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
212
|
+
followers: spotifyFollowersSchema.optional(),
|
|
213
|
+
href: z.url().optional(),
|
|
214
|
+
id: spotifyIdSchema,
|
|
215
|
+
images: z.array(spotifyImageSchema),
|
|
216
|
+
name: z.string().min(1),
|
|
217
|
+
owner: spotifyUserSchema,
|
|
218
|
+
public: z.boolean().nullable().optional(),
|
|
219
|
+
snapshotId: z.string().min(1).optional(),
|
|
220
|
+
tracks: z.object({
|
|
221
|
+
href: z.url().optional(),
|
|
222
|
+
total: z.number().int().nonnegative().optional()
|
|
223
|
+
}).optional(),
|
|
224
|
+
type: z.literal("playlist"),
|
|
225
|
+
uri: spotifyUriSchema.optional()
|
|
226
|
+
});
|
|
227
|
+
const spotifyPlaylistImageSchema = spotifyImageSchema;
|
|
228
|
+
const spotifyPlaylistItemSchema = z.object({
|
|
229
|
+
addedAt: z.union([spotifyTimestampSchema, z.null()]).optional(),
|
|
230
|
+
addedBy: spotifyUserSchema.optional(),
|
|
231
|
+
isLocal: z.boolean(),
|
|
232
|
+
track: spotifyTrackOrEpisodeSchema.nullish()
|
|
233
|
+
});
|
|
234
|
+
const spotifyDeviceSchema = z.object({
|
|
235
|
+
id: z.string().nullable().optional(),
|
|
236
|
+
isActive: z.boolean(),
|
|
237
|
+
isPrivateSession: z.boolean(),
|
|
238
|
+
isRestricted: z.boolean(),
|
|
239
|
+
name: z.string().min(1),
|
|
240
|
+
type: z.string().min(1),
|
|
241
|
+
volumePercent: z.number().int().min(0).max(100).nullable().optional(),
|
|
242
|
+
supportsVolume: z.boolean().optional()
|
|
243
|
+
});
|
|
244
|
+
const spotifyPlaybackContextSchema = z.object({
|
|
245
|
+
externalUrls: spotifyExternalUrlsSchema.optional(),
|
|
246
|
+
href: z.url().optional(),
|
|
247
|
+
type: z.string().min(1),
|
|
248
|
+
uri: spotifyUriSchema.optional()
|
|
249
|
+
});
|
|
250
|
+
const spotifyPlaybackStateSchema = z.object({
|
|
251
|
+
context: spotifyPlaybackContextSchema.nullish(),
|
|
252
|
+
device: spotifyDeviceSchema,
|
|
253
|
+
item: spotifyTrackOrEpisodeSchema.nullish(),
|
|
254
|
+
isPlaying: z.boolean(),
|
|
255
|
+
progressMs: z.number().int().nonnegative().nullable(),
|
|
256
|
+
repeatState: z.enum([
|
|
257
|
+
"off",
|
|
258
|
+
"track",
|
|
259
|
+
"context"
|
|
260
|
+
]),
|
|
261
|
+
shuffleState: z.boolean(),
|
|
262
|
+
timestamp: z.number().int().nonnegative(),
|
|
263
|
+
currentlyPlayingType: z.enum([
|
|
264
|
+
"track",
|
|
265
|
+
"episode",
|
|
266
|
+
"ad",
|
|
267
|
+
"unknown"
|
|
268
|
+
]).optional(),
|
|
269
|
+
actions: z.record(z.string(), z.boolean()).optional()
|
|
270
|
+
});
|
|
271
|
+
const spotifyQueueSchema = z.object({
|
|
272
|
+
currentlyPlaying: spotifyTrackOrEpisodeSchema.nullish(),
|
|
273
|
+
queue: z.array(spotifyTrackOrEpisodeSchema)
|
|
274
|
+
});
|
|
275
|
+
const spotifyRecentlyPlayedItemSchema = z.object({
|
|
276
|
+
context: spotifyPlaybackContextSchema.nullish(),
|
|
277
|
+
playedAt: spotifyTimestampSchema,
|
|
278
|
+
track: spotifyTrackSchema
|
|
279
|
+
});
|
|
280
|
+
const spotifySavedAlbumItemSchema = z.object({
|
|
281
|
+
addedAt: spotifyTimestampSchema,
|
|
282
|
+
album: spotifyAlbumSchema
|
|
283
|
+
});
|
|
284
|
+
const spotifySavedTrackItemSchema = z.object({
|
|
285
|
+
addedAt: spotifyTimestampSchema,
|
|
286
|
+
track: spotifyTrackSchema
|
|
287
|
+
});
|
|
288
|
+
const spotifySavedShowItemSchema = z.object({
|
|
289
|
+
addedAt: spotifyTimestampSchema,
|
|
290
|
+
show: spotifyShowSchema
|
|
291
|
+
});
|
|
292
|
+
const spotifySavedEpisodeItemSchema = z.object({
|
|
293
|
+
addedAt: spotifyTimestampSchema,
|
|
294
|
+
episode: spotifyEpisodeSchema
|
|
295
|
+
});
|
|
296
|
+
const spotifySavedAudiobookItemSchema = z.object({
|
|
297
|
+
addedAt: spotifyTimestampSchema,
|
|
298
|
+
audiobook: spotifyAudiobookSchema
|
|
299
|
+
});
|
|
300
|
+
const spotifyCategorySchema = z.object({
|
|
301
|
+
href: z.url().optional(),
|
|
302
|
+
icons: z.array(spotifyImageSchema),
|
|
303
|
+
id: z.string().min(1),
|
|
304
|
+
name: z.string().min(1)
|
|
305
|
+
});
|
|
306
|
+
const spotifyAudioFeaturesSchema = z.object({
|
|
307
|
+
acousticness: z.number(),
|
|
308
|
+
analysisUrl: z.url().optional(),
|
|
309
|
+
danceability: z.number(),
|
|
310
|
+
durationMs: z.number().int().nonnegative(),
|
|
311
|
+
energy: z.number(),
|
|
312
|
+
id: spotifyIdSchema,
|
|
313
|
+
instrumentalness: z.number(),
|
|
314
|
+
key: z.number().int(),
|
|
315
|
+
liveness: z.number(),
|
|
316
|
+
loudness: z.number(),
|
|
317
|
+
mode: z.number().int(),
|
|
318
|
+
speechiness: z.number(),
|
|
319
|
+
tempo: z.number(),
|
|
320
|
+
timeSignature: z.number().int(),
|
|
321
|
+
trackHref: z.url().optional(),
|
|
322
|
+
type: z.literal("audio_features"),
|
|
323
|
+
uri: spotifyUriSchema.optional(),
|
|
324
|
+
valence: z.number()
|
|
325
|
+
});
|
|
326
|
+
const spotifyTimeIntervalSchema = z.object({
|
|
327
|
+
start: z.number(),
|
|
328
|
+
duration: z.number(),
|
|
329
|
+
confidence: z.number().optional()
|
|
330
|
+
});
|
|
331
|
+
const spotifyAudioSectionSchema = spotifyTimeIntervalSchema.extend({
|
|
332
|
+
loudness: z.number().optional(),
|
|
333
|
+
tempo: z.number().optional(),
|
|
334
|
+
tempoConfidence: z.number().optional(),
|
|
335
|
+
key: z.number().int().optional(),
|
|
336
|
+
keyConfidence: z.number().optional(),
|
|
337
|
+
mode: z.number().int().optional(),
|
|
338
|
+
modeConfidence: z.number().optional(),
|
|
339
|
+
timeSignature: z.number().int().optional(),
|
|
340
|
+
timeSignatureConfidence: z.number().optional()
|
|
341
|
+
});
|
|
342
|
+
const spotifyAudioSegmentSchema = spotifyTimeIntervalSchema.extend({
|
|
343
|
+
loudnessStart: z.number().optional(),
|
|
344
|
+
loudnessMax: z.number().optional(),
|
|
345
|
+
loudnessMaxTime: z.number().optional(),
|
|
346
|
+
loudnessEnd: z.number().optional(),
|
|
347
|
+
pitches: z.array(z.number()).optional(),
|
|
348
|
+
timbre: z.array(z.number()).optional()
|
|
349
|
+
});
|
|
350
|
+
const spotifyAudioAnalysisSchema = z.object({
|
|
351
|
+
bars: z.array(spotifyTimeIntervalSchema).optional(),
|
|
352
|
+
beats: z.array(spotifyTimeIntervalSchema).optional(),
|
|
353
|
+
meta: z.object({
|
|
354
|
+
analyzerVersion: z.string().optional(),
|
|
355
|
+
platform: z.string().optional(),
|
|
356
|
+
detailedStatus: z.string().optional(),
|
|
357
|
+
statusCode: z.number().int().optional(),
|
|
358
|
+
timestamp: z.number().int().optional(),
|
|
359
|
+
analysisTime: z.number().optional(),
|
|
360
|
+
inputProcess: z.string().optional()
|
|
361
|
+
}).optional(),
|
|
362
|
+
sections: z.array(spotifyAudioSectionSchema).optional(),
|
|
363
|
+
segments: z.array(spotifyAudioSegmentSchema).optional(),
|
|
364
|
+
tatums: z.array(spotifyTimeIntervalSchema).optional(),
|
|
365
|
+
track: z.object({
|
|
366
|
+
duration: z.number().optional(),
|
|
367
|
+
sampleMd5: z.string().optional(),
|
|
368
|
+
offsetSeconds: z.number().optional(),
|
|
369
|
+
windowSeconds: z.number().optional(),
|
|
370
|
+
analysisSampleRate: z.number().optional(),
|
|
371
|
+
analysisChannels: z.number().optional(),
|
|
372
|
+
endOfFadeIn: z.number().optional(),
|
|
373
|
+
startOfFadeOut: z.number().optional(),
|
|
374
|
+
loudness: z.number().optional(),
|
|
375
|
+
tempo: z.number().optional(),
|
|
376
|
+
tempoConfidence: z.number().optional(),
|
|
377
|
+
timeSignature: z.number().optional(),
|
|
378
|
+
timeSignatureConfidence: z.number().optional(),
|
|
379
|
+
key: z.number().optional(),
|
|
380
|
+
keyConfidence: z.number().optional(),
|
|
381
|
+
mode: z.number().optional(),
|
|
382
|
+
modeConfidence: z.number().optional(),
|
|
383
|
+
codestring: z.string().optional(),
|
|
384
|
+
codeVersion: z.number().optional(),
|
|
385
|
+
echoprintstring: z.string().optional(),
|
|
386
|
+
echoprintVersion: z.number().optional(),
|
|
387
|
+
synchstring: z.string().optional(),
|
|
388
|
+
synchVersion: z.number().optional(),
|
|
389
|
+
rhythmstring: z.string().optional(),
|
|
390
|
+
rhythmVersion: z.number().optional()
|
|
391
|
+
}).optional()
|
|
392
|
+
});
|
|
393
|
+
const spotifyRecommendationSeedSchema = z.object({
|
|
394
|
+
afterFilteringSize: z.number().int().nonnegative().optional(),
|
|
395
|
+
afterRelinkingSize: z.number().int().nonnegative().optional(),
|
|
396
|
+
href: z.url().optional(),
|
|
397
|
+
id: z.string().min(1),
|
|
398
|
+
initialPoolSize: z.number().int().nonnegative().optional(),
|
|
399
|
+
type: z.string().min(1)
|
|
400
|
+
});
|
|
401
|
+
const spotifyRecommendationsSchema = z.object({
|
|
402
|
+
seeds: z.array(spotifyRecommendationSeedSchema),
|
|
403
|
+
tracks: z.array(spotifyTrackSchema)
|
|
404
|
+
});
|
|
405
|
+
const spotifyBooleanListSchema = z.array(z.boolean());
|
|
406
|
+
const spotifyMutationSuccessSchema = z.object({ success: z.literal(true) });
|
|
407
|
+
const spotifySnapshotResponseSchema = z.object({ snapshotId: z.string().min(1) });
|
|
408
|
+
function createSpotifyOffsetPageSchema(item) {
|
|
409
|
+
return z.object({
|
|
410
|
+
href: z.url().optional(),
|
|
411
|
+
items: z.array(item),
|
|
412
|
+
limit: z.number().int().nonnegative(),
|
|
413
|
+
nextPageToken: z.string().min(1).optional(),
|
|
414
|
+
offset: z.number().int().nonnegative(),
|
|
415
|
+
previousPageToken: z.string().min(1).optional(),
|
|
416
|
+
total: z.number().int().nonnegative().optional()
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
function createSpotifyCursorPageSchema(item) {
|
|
420
|
+
return z.object({
|
|
421
|
+
href: z.url().optional(),
|
|
422
|
+
items: z.array(item),
|
|
423
|
+
limit: z.number().int().nonnegative(),
|
|
424
|
+
nextPageToken: z.string().min(1).optional(),
|
|
425
|
+
previousPageToken: z.string().min(1).optional(),
|
|
426
|
+
total: z.number().int().nonnegative().optional(),
|
|
427
|
+
cursors: z.object({
|
|
428
|
+
after: z.string().optional(),
|
|
429
|
+
before: z.string().optional()
|
|
430
|
+
}).optional()
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
const spotifyAlbumPageSchema = createSpotifyOffsetPageSchema(spotifyAlbumSummarySchema);
|
|
434
|
+
const spotifyArtistPageSchema = createSpotifyOffsetPageSchema(spotifyArtistSchema);
|
|
435
|
+
const spotifyTrackPageSchema = createSpotifyOffsetPageSchema(spotifyTrackSchema);
|
|
436
|
+
const spotifyShowPageSchema = createSpotifyOffsetPageSchema(spotifyShowSummarySchema);
|
|
437
|
+
const spotifyEpisodePageSchema = createSpotifyOffsetPageSchema(spotifyEpisodeSchema);
|
|
438
|
+
const spotifyAudiobookPageSchema = createSpotifyOffsetPageSchema(spotifyAudiobookSummarySchema);
|
|
439
|
+
const spotifyChapterPageSchema = createSpotifyOffsetPageSchema(spotifyChapterSchema);
|
|
440
|
+
const spotifyPlaylistPageSchema = createSpotifyOffsetPageSchema(spotifyPlaylistSchema);
|
|
441
|
+
const spotifyPlaylistItemPageSchema = createSpotifyOffsetPageSchema(spotifyPlaylistItemSchema);
|
|
442
|
+
const spotifyCategoryPageSchema = createSpotifyOffsetPageSchema(spotifyCategorySchema);
|
|
443
|
+
const spotifySavedAlbumPageSchema = createSpotifyOffsetPageSchema(spotifySavedAlbumItemSchema);
|
|
444
|
+
const spotifySavedTrackPageSchema = createSpotifyOffsetPageSchema(spotifySavedTrackItemSchema);
|
|
445
|
+
const spotifySavedShowPageSchema = createSpotifyOffsetPageSchema(spotifySavedShowItemSchema);
|
|
446
|
+
const spotifySavedEpisodePageSchema = createSpotifyOffsetPageSchema(spotifySavedEpisodeItemSchema);
|
|
447
|
+
const spotifySavedAudiobookPageSchema = createSpotifyOffsetPageSchema(spotifySavedAudiobookItemSchema);
|
|
448
|
+
const spotifyRecentlyPlayedPageSchema = createSpotifyCursorPageSchema(spotifyRecentlyPlayedItemSchema);
|
|
449
|
+
const spotifySearchResultSchema = z.object({
|
|
450
|
+
albums: spotifyAlbumPageSchema.optional(),
|
|
451
|
+
artists: spotifyArtistPageSchema.optional(),
|
|
452
|
+
playlists: spotifyPlaylistPageSchema.optional(),
|
|
453
|
+
tracks: spotifyTrackPageSchema.optional(),
|
|
454
|
+
shows: spotifyShowPageSchema.optional(),
|
|
455
|
+
episodes: spotifyEpisodePageSchema.optional(),
|
|
456
|
+
audiobooks: spotifyAudiobookPageSchema.optional()
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
//#endregion
|
|
460
|
+
export { createSpotifyCursorPageSchema, createSpotifyOffsetPageSchema, spotifyAlbumPageSchema, spotifyAlbumSchema, spotifyAlbumSummarySchema, spotifyArtistPageSchema, spotifyArtistSchema, spotifyArtistSummarySchema, spotifyAudioAnalysisSchema, spotifyAudioFeaturesSchema, spotifyAudiobookPageSchema, spotifyAudiobookSchema, spotifyAudiobookSummarySchema, spotifyBooleanListSchema, spotifyCategoryPageSchema, spotifyCategorySchema, spotifyChapterPageSchema, spotifyChapterSchema, spotifyCopyrightSchema, spotifyDeviceSchema, spotifyEpisodePageSchema, spotifyEpisodeSchema, spotifyExternalIdsSchema, spotifyExternalUrlsSchema, spotifyFollowersSchema, spotifyIdSchema, spotifyImageSchema, spotifyMarketSchema, spotifyMutationSuccessSchema, spotifyNamedReferenceSchema, spotifyPlaybackContextSchema, spotifyPlaybackStateSchema, spotifyPlaylistImageSchema, spotifyPlaylistItemPageSchema, spotifyPlaylistItemSchema, spotifyPlaylistPageSchema, spotifyPlaylistSchema, spotifyQueueSchema, spotifyRecentlyPlayedItemSchema, spotifyRecentlyPlayedPageSchema, spotifyRecommendationSeedSchema, spotifyRecommendationsSchema, spotifyRestrictionsSchema, spotifyResumePointSchema, spotifySavedAlbumItemSchema, spotifySavedAlbumPageSchema, spotifySavedAudiobookItemSchema, spotifySavedAudiobookPageSchema, spotifySavedEpisodeItemSchema, spotifySavedEpisodePageSchema, spotifySavedShowItemSchema, spotifySavedShowPageSchema, spotifySavedTrackItemSchema, spotifySavedTrackPageSchema, spotifySearchResultSchema, spotifyShowPageSchema, spotifyShowSchema, spotifyShowSummarySchema, spotifySnapshotResponseSchema, spotifyTimestampSchema, spotifyTrackOrEpisodeSchema, spotifyTrackPageSchema, spotifyTrackSchema, spotifyUriSchema, spotifyUserSchema };
|