@saavn-labs/sdk 0.1.0

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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +339 -0
  3. package/dist/core/models/album.d.ts +32 -0
  4. package/dist/core/models/album.js +1 -0
  5. package/dist/core/models/artist.d.ts +61 -0
  6. package/dist/core/models/artist.js +1 -0
  7. package/dist/core/models/index.d.ts +4 -0
  8. package/dist/core/models/index.js +4 -0
  9. package/dist/core/models/playlist.d.ts +35 -0
  10. package/dist/core/models/playlist.js +1 -0
  11. package/dist/core/models/song.d.ts +52 -0
  12. package/dist/core/models/song.js +1 -0
  13. package/dist/core/modules/album.module.d.ts +82 -0
  14. package/dist/core/modules/album.module.js +74 -0
  15. package/dist/core/modules/artist.module.d.ts +97 -0
  16. package/dist/core/modules/artist.module.js +49 -0
  17. package/dist/core/modules/extras.module.d.ts +385 -0
  18. package/dist/core/modules/extras.module.js +64 -0
  19. package/dist/core/modules/playlist.module.d.ts +79 -0
  20. package/dist/core/modules/playlist.module.js +74 -0
  21. package/dist/core/modules/song.module.d.ts +91 -0
  22. package/dist/core/modules/song.module.js +97 -0
  23. package/dist/helpers/errors.d.ts +25 -0
  24. package/dist/helpers/errors.js +84 -0
  25. package/dist/helpers/experimental/stream-urls/index.d.ts +20 -0
  26. package/dist/helpers/experimental/stream-urls/index.js +33 -0
  27. package/dist/helpers/experimental/stream-urls/stream-urls.edge.d.ts +4 -0
  28. package/dist/helpers/experimental/stream-urls/stream-urls.edge.js +38 -0
  29. package/dist/helpers/experimental/stream-urls/stream-urls.node.d.ts +4 -0
  30. package/dist/helpers/experimental/stream-urls/stream-urls.node.js +27 -0
  31. package/dist/helpers/fetch.d.ts +38 -0
  32. package/dist/helpers/fetch.js +38 -0
  33. package/dist/helpers/utils.d.ts +13 -0
  34. package/dist/helpers/utils.js +58 -0
  35. package/dist/index.d.ts +10 -0
  36. package/dist/index.js +8 -0
  37. package/dist/saavn/common-mapper.d.ts +77 -0
  38. package/dist/saavn/common-mapper.js +348 -0
  39. package/dist/saavn/entities/album.entity.d.ts +151 -0
  40. package/dist/saavn/entities/album.entity.js +25 -0
  41. package/dist/saavn/entities/artist.entity.d.ts +274 -0
  42. package/dist/saavn/entities/artist.entity.js +49 -0
  43. package/dist/saavn/entities/base.d.ts +117 -0
  44. package/dist/saavn/entities/base.js +71 -0
  45. package/dist/saavn/entities/extras.d.ts +102 -0
  46. package/dist/saavn/entities/extras.js +43 -0
  47. package/dist/saavn/entities/index.d.ts +6 -0
  48. package/dist/saavn/entities/index.js +6 -0
  49. package/dist/saavn/entities/playlist.entity.d.ts +143 -0
  50. package/dist/saavn/entities/playlist.entity.js +55 -0
  51. package/dist/saavn/entities/show.entity.d.ts +14 -0
  52. package/dist/saavn/entities/show.entity.js +14 -0
  53. package/dist/saavn/entities/song.entity.d.ts +142 -0
  54. package/dist/saavn/entities/song.entity.js +48 -0
  55. package/dist/saavn/operations/get-details/index.d.ts +755 -0
  56. package/dist/saavn/operations/get-details/index.js +34 -0
  57. package/dist/saavn/operations/get-details/mapper.ops.d.ts +35 -0
  58. package/dist/saavn/operations/get-details/mapper.ops.js +55 -0
  59. package/dist/saavn/operations/get-details/schema.ops.d.ts +706 -0
  60. package/dist/saavn/operations/get-details/schema.ops.js +49 -0
  61. package/dist/saavn/operations/get-reco/index.d.ts +144 -0
  62. package/dist/saavn/operations/get-reco/index.js +19 -0
  63. package/dist/saavn/operations/get-reco/mapper.ops.d.ts +36 -0
  64. package/dist/saavn/operations/get-reco/mapper.ops.js +43 -0
  65. package/dist/saavn/operations/get-reco/schema.ops.d.ts +103 -0
  66. package/dist/saavn/operations/get-reco/schema.ops.js +28 -0
  67. package/dist/saavn/operations/get-trending/index.d.ts +288 -0
  68. package/dist/saavn/operations/get-trending/index.js +24 -0
  69. package/dist/saavn/operations/get-trending/mapper.ops.d.ts +13 -0
  70. package/dist/saavn/operations/get-trending/mapper.ops.js +134 -0
  71. package/dist/saavn/operations/get-trending/schema.ops.d.ts +272 -0
  72. package/dist/saavn/operations/get-trending/schema.ops.js +34 -0
  73. package/dist/saavn/operations/index.d.ts +6 -0
  74. package/dist/saavn/operations/index.js +6 -0
  75. package/dist/saavn/operations/search-results/index.d.ts +790 -0
  76. package/dist/saavn/operations/search-results/index.js +29 -0
  77. package/dist/saavn/operations/search-results/mapper.ops.d.ts +413 -0
  78. package/dist/saavn/operations/search-results/mapper.ops.js +80 -0
  79. package/dist/saavn/operations/search-results/schema.ops.d.ts +366 -0
  80. package/dist/saavn/operations/search-results/schema.ops.js +101 -0
  81. package/dist/saavn/operations/web-api/index.d.ts +604 -0
  82. package/dist/saavn/operations/web-api/index.js +29 -0
  83. package/dist/saavn/operations/web-api/mapper.ops.d.ts +11 -0
  84. package/dist/saavn/operations/web-api/mapper.ops.js +23 -0
  85. package/dist/saavn/operations/web-api/schema.ops.d.ts +582 -0
  86. package/dist/saavn/operations/web-api/schema.ops.js +50 -0
  87. package/dist/saavn/operations/web-radio/index.d.ts +181 -0
  88. package/dist/saavn/operations/web-radio/index.js +19 -0
  89. package/dist/saavn/operations/web-radio/mapper.ops.d.ts +14 -0
  90. package/dist/saavn/operations/web-radio/mapper.ops.js +35 -0
  91. package/dist/saavn/operations/web-radio/schema.ops.d.ts +162 -0
  92. package/dist/saavn/operations/web-radio/schema.ops.js +56 -0
  93. package/dist/saavn/primitives/enums.d.ts +17 -0
  94. package/dist/saavn/primitives/enums.js +4 -0
  95. package/dist/saavn/primitives/string.d.ts +5 -0
  96. package/dist/saavn/primitives/string.js +22 -0
  97. package/dist/saavn/run-operation.d.ts +12 -0
  98. package/dist/saavn/run-operation.js +39 -0
  99. package/dist/schemas/index.d.ts +2188 -0
  100. package/dist/schemas/index.js +14 -0
  101. package/dist/types.d.ts +24 -0
  102. package/dist/types.js +1 -0
  103. package/package.json +82 -0
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ import { mapAlbum, mapArtist, mapPlaylist, mapSong } from '../../common-mapper';
3
+ import { SaavnWebAPISchema } from './schema.ops';
4
+ export const SaavnWebAPIMapper = {
5
+ album: (data) => {
6
+ return mapAlbum(data);
7
+ },
8
+ artist: (data) => {
9
+ return mapArtist(data);
10
+ },
11
+ label: (data) => {
12
+ // TODO: Implement label mapping
13
+ return data;
14
+ },
15
+ playlist: (data) => {
16
+ return mapPlaylist(data);
17
+ },
18
+ songs: (data) => {
19
+ return {
20
+ songs: data.songs.map(mapSong),
21
+ };
22
+ },
23
+ };
@@ -0,0 +1,582 @@
1
+ import { z } from 'zod';
2
+ export declare const SaavnWebAPISchema: {
3
+ readonly album: {
4
+ readonly params: z.ZodObject<{
5
+ token: z.ZodString;
6
+ type: z.ZodLiteral<"album">;
7
+ }, z.core.$strict>;
8
+ readonly response: z.ZodLazy<z.ZodObject<{
9
+ id: z.ZodString;
10
+ title: z.ZodString;
11
+ subtitle: z.ZodString;
12
+ type: z.ZodLiteral<"album">;
13
+ image: z.ZodString;
14
+ perma_url: z.ZodString;
15
+ explicit_content: z.ZodString;
16
+ header_desc: z.ZodString;
17
+ play_count: z.ZodString;
18
+ language: z.ZodString;
19
+ year: z.ZodString;
20
+ list_count: z.ZodString;
21
+ list_type: z.ZodLiteral<"song">;
22
+ list: z.ZodArray<z.ZodLazy<z.ZodObject<{
23
+ id: z.ZodString;
24
+ title: z.ZodString;
25
+ subtitle: z.ZodString;
26
+ type: z.ZodLiteral<"song">;
27
+ perma_url: z.ZodString;
28
+ image: z.ZodString;
29
+ explicit_content: z.ZodString;
30
+ header_desc: z.ZodString;
31
+ language: z.ZodString;
32
+ year: z.ZodString;
33
+ play_count: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
34
+ more_info: z.ZodObject<{
35
+ music: z.ZodString;
36
+ album_id: z.ZodString;
37
+ album: z.ZodString;
38
+ label: z.ZodString;
39
+ label_id: z.ZodNullable<z.ZodString>;
40
+ origin: z.ZodString;
41
+ is_dolby_content: z.ZodBoolean;
42
+ encrypted_media_url: z.ZodString;
43
+ encrypted_drm_media_url: z.ZodString;
44
+ album_url: z.ZodString;
45
+ duration: z.ZodString;
46
+ has_lyrics: z.ZodString;
47
+ lyrics_snippet: z.ZodString;
48
+ lyrics_id: z.ZodOptional<z.ZodString>;
49
+ copyright_text: z.ZodString;
50
+ release_date: z.ZodNullable<z.ZodString>;
51
+ label_url: z.ZodOptional<z.ZodString>;
52
+ vcode: z.ZodOptional<z.ZodString>;
53
+ vlink: z.ZodOptional<z.ZodString>;
54
+ artistMap: z.ZodLazy<z.ZodObject<{
55
+ primary_artists: z.ZodArray<z.ZodObject<{
56
+ id: z.ZodString;
57
+ name: z.ZodString;
58
+ role: z.ZodString;
59
+ image: z.ZodString;
60
+ type: z.ZodLiteral<"artist">;
61
+ perma_url: z.ZodString;
62
+ }, z.core.$loose>>;
63
+ featured_artists: z.ZodArray<z.ZodObject<{
64
+ id: z.ZodString;
65
+ name: z.ZodString;
66
+ role: z.ZodString;
67
+ image: z.ZodString;
68
+ type: z.ZodLiteral<"artist">;
69
+ perma_url: z.ZodString;
70
+ }, z.core.$loose>>;
71
+ artists: z.ZodArray<z.ZodObject<{
72
+ id: z.ZodString;
73
+ name: z.ZodString;
74
+ role: z.ZodString;
75
+ image: z.ZodString;
76
+ type: z.ZodLiteral<"artist">;
77
+ perma_url: z.ZodString;
78
+ }, z.core.$loose>>;
79
+ }, z.core.$loose>>;
80
+ }, z.core.$loose>;
81
+ }, z.core.$loose>>>;
82
+ more_info: z.ZodObject<{
83
+ song_count: z.ZodString;
84
+ copyright_text: z.ZodString;
85
+ is_dolby_content: z.ZodBoolean;
86
+ label_url: z.ZodString;
87
+ artistMap: z.ZodObject<{
88
+ primary_artists: z.ZodArray<z.ZodObject<{
89
+ id: z.ZodString;
90
+ name: z.ZodString;
91
+ role: z.ZodString;
92
+ image: z.ZodString;
93
+ type: z.ZodLiteral<"artist">;
94
+ perma_url: z.ZodString;
95
+ }, z.core.$loose>>;
96
+ featured_artists: z.ZodArray<z.ZodObject<{
97
+ id: z.ZodString;
98
+ name: z.ZodString;
99
+ role: z.ZodString;
100
+ image: z.ZodString;
101
+ type: z.ZodLiteral<"artist">;
102
+ perma_url: z.ZodString;
103
+ }, z.core.$loose>>;
104
+ artists: z.ZodArray<z.ZodObject<{
105
+ id: z.ZodString;
106
+ name: z.ZodString;
107
+ role: z.ZodString;
108
+ image: z.ZodString;
109
+ type: z.ZodLiteral<"artist">;
110
+ perma_url: z.ZodString;
111
+ }, z.core.$loose>>;
112
+ }, z.core.$loose>;
113
+ }, z.core.$loose>;
114
+ }, z.core.$loose>>;
115
+ };
116
+ readonly artist: {
117
+ readonly params: z.ZodObject<{
118
+ token: z.ZodString;
119
+ type: z.ZodLiteral<"artist">;
120
+ n_song: z.ZodOptional<z.ZodString>;
121
+ n_album: z.ZodOptional<z.ZodString>;
122
+ category: z.ZodOptional<z.ZodEnum<{
123
+ "": "";
124
+ alphabetical: "alphabetical";
125
+ latest: "latest";
126
+ }>>;
127
+ sort_order: z.ZodOptional<z.ZodEnum<{
128
+ asc: "asc";
129
+ desc: "desc";
130
+ }>>;
131
+ }, z.core.$strict>;
132
+ readonly response: z.ZodLazy<z.ZodObject<{
133
+ type: z.ZodLiteral<"artist">;
134
+ image: z.ZodString;
135
+ name: z.ZodString;
136
+ artistId: z.ZodString;
137
+ subtitle: z.ZodString;
138
+ follower_count: z.ZodString;
139
+ isVerified: z.ZodBoolean;
140
+ isRadioPresent: z.ZodBoolean;
141
+ dominantLanguage: z.ZodString;
142
+ dominantType: z.ZodString;
143
+ bio: z.ZodString;
144
+ dob: z.ZodString;
145
+ fb: z.ZodString;
146
+ twitter: z.ZodString;
147
+ wiki: z.ZodString;
148
+ availableLanguages: z.ZodArray<z.ZodString>;
149
+ fan_count: z.ZodString;
150
+ is_followed: z.ZodBoolean;
151
+ topSongs: z.ZodArray<z.ZodLazy<z.ZodObject<{
152
+ id: z.ZodString;
153
+ title: z.ZodString;
154
+ subtitle: z.ZodString;
155
+ type: z.ZodLiteral<"song">;
156
+ perma_url: z.ZodString;
157
+ image: z.ZodString;
158
+ explicit_content: z.ZodString;
159
+ header_desc: z.ZodString;
160
+ language: z.ZodString;
161
+ year: z.ZodString;
162
+ play_count: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
163
+ more_info: z.ZodObject<{
164
+ music: z.ZodString;
165
+ album_id: z.ZodString;
166
+ album: z.ZodString;
167
+ label: z.ZodString;
168
+ label_id: z.ZodNullable<z.ZodString>;
169
+ origin: z.ZodString;
170
+ is_dolby_content: z.ZodBoolean;
171
+ encrypted_media_url: z.ZodString;
172
+ encrypted_drm_media_url: z.ZodString;
173
+ album_url: z.ZodString;
174
+ duration: z.ZodString;
175
+ has_lyrics: z.ZodString;
176
+ lyrics_snippet: z.ZodString;
177
+ lyrics_id: z.ZodOptional<z.ZodString>;
178
+ copyright_text: z.ZodString;
179
+ release_date: z.ZodNullable<z.ZodString>;
180
+ label_url: z.ZodOptional<z.ZodString>;
181
+ vcode: z.ZodOptional<z.ZodString>;
182
+ vlink: z.ZodOptional<z.ZodString>;
183
+ artistMap: z.ZodLazy<z.ZodObject<{
184
+ primary_artists: z.ZodArray<z.ZodObject<{
185
+ id: z.ZodString;
186
+ name: z.ZodString;
187
+ role: z.ZodString;
188
+ image: z.ZodString;
189
+ type: z.ZodLiteral<"artist">;
190
+ perma_url: z.ZodString;
191
+ }, z.core.$loose>>;
192
+ featured_artists: z.ZodArray<z.ZodObject<{
193
+ id: z.ZodString;
194
+ name: z.ZodString;
195
+ role: z.ZodString;
196
+ image: z.ZodString;
197
+ type: z.ZodLiteral<"artist">;
198
+ perma_url: z.ZodString;
199
+ }, z.core.$loose>>;
200
+ artists: z.ZodArray<z.ZodObject<{
201
+ id: z.ZodString;
202
+ name: z.ZodString;
203
+ role: z.ZodString;
204
+ image: z.ZodString;
205
+ type: z.ZodLiteral<"artist">;
206
+ perma_url: z.ZodString;
207
+ }, z.core.$loose>>;
208
+ }, z.core.$loose>>;
209
+ }, z.core.$loose>;
210
+ }, z.core.$loose>>>;
211
+ topAlbums: z.ZodArray<z.ZodObject<{
212
+ id: z.ZodString;
213
+ title: z.ZodString;
214
+ subtitle: z.ZodString;
215
+ type: z.ZodLiteral<"album">;
216
+ image: z.ZodString;
217
+ perma_url: z.ZodString;
218
+ explicit_content: z.ZodString;
219
+ header_desc: z.ZodString;
220
+ language: z.ZodString;
221
+ year: z.ZodString;
222
+ play_count: z.ZodString;
223
+ more_info: z.ZodObject<{
224
+ query: z.ZodString;
225
+ text: z.ZodString;
226
+ music: z.ZodNullable<z.ZodString>;
227
+ song_count: z.ZodString;
228
+ artistMap: z.ZodObject<{
229
+ primary_artists: z.ZodArray<z.ZodObject<{
230
+ id: z.ZodString;
231
+ name: z.ZodString;
232
+ role: z.ZodString;
233
+ image: z.ZodString;
234
+ type: z.ZodLiteral<"artist">;
235
+ perma_url: z.ZodString;
236
+ }, z.core.$loose>>;
237
+ featured_artists: z.ZodArray<z.ZodObject<{
238
+ id: z.ZodString;
239
+ name: z.ZodString;
240
+ role: z.ZodString;
241
+ image: z.ZodString;
242
+ type: z.ZodLiteral<"artist">;
243
+ perma_url: z.ZodString;
244
+ }, z.core.$loose>>;
245
+ artists: z.ZodArray<z.ZodObject<{
246
+ id: z.ZodString;
247
+ name: z.ZodString;
248
+ role: z.ZodString;
249
+ image: z.ZodString;
250
+ type: z.ZodLiteral<"artist">;
251
+ perma_url: z.ZodString;
252
+ }, z.core.$loose>>;
253
+ }, z.core.$loose>;
254
+ }, z.core.$loose>;
255
+ }, z.core.$loose>>;
256
+ topEpisodes: z.ZodArray<z.ZodAny>;
257
+ dedicated_artist_playlist: z.ZodArray<z.ZodObject<{
258
+ id: z.ZodString;
259
+ title: z.ZodString;
260
+ subtitle: z.ZodString;
261
+ type: z.ZodLiteral<"playlist">;
262
+ image: z.ZodString;
263
+ perma_url: z.ZodString;
264
+ explicit_content: z.ZodString;
265
+ more_info: z.ZodObject<{
266
+ firstname: z.ZodString;
267
+ lastname: z.ZodOptional<z.ZodString>;
268
+ artist_name: z.ZodNullable<z.ZodArray<z.ZodString>>;
269
+ entity_type: z.ZodString;
270
+ is_dolby_content: z.ZodNullable<z.ZodBoolean>;
271
+ language: z.ZodString;
272
+ uid: z.ZodString;
273
+ song_count: z.ZodString;
274
+ }, z.core.$loose>;
275
+ }, z.core.$loose>>;
276
+ featured_artist_playlist: z.ZodArray<z.ZodObject<{
277
+ id: z.ZodString;
278
+ title: z.ZodString;
279
+ subtitle: z.ZodString;
280
+ type: z.ZodLiteral<"playlist">;
281
+ image: z.ZodString;
282
+ perma_url: z.ZodString;
283
+ explicit_content: z.ZodString;
284
+ more_info: z.ZodObject<{
285
+ firstname: z.ZodString;
286
+ lastname: z.ZodOptional<z.ZodString>;
287
+ artist_name: z.ZodNullable<z.ZodArray<z.ZodString>>;
288
+ entity_type: z.ZodString;
289
+ is_dolby_content: z.ZodNullable<z.ZodBoolean>;
290
+ language: z.ZodString;
291
+ uid: z.ZodString;
292
+ song_count: z.ZodString;
293
+ }, z.core.$loose>;
294
+ }, z.core.$loose>>;
295
+ singles: z.ZodArray<z.ZodObject<{
296
+ id: z.ZodString;
297
+ title: z.ZodString;
298
+ subtitle: z.ZodString;
299
+ type: z.ZodLiteral<"album">;
300
+ image: z.ZodString;
301
+ perma_url: z.ZodString;
302
+ explicit_content: z.ZodString;
303
+ header_desc: z.ZodString;
304
+ language: z.ZodString;
305
+ year: z.ZodString;
306
+ play_count: z.ZodString;
307
+ more_info: z.ZodObject<{
308
+ query: z.ZodString;
309
+ text: z.ZodString;
310
+ music: z.ZodNullable<z.ZodString>;
311
+ song_count: z.ZodString;
312
+ artistMap: z.ZodObject<{
313
+ primary_artists: z.ZodArray<z.ZodObject<{
314
+ id: z.ZodString;
315
+ name: z.ZodString;
316
+ role: z.ZodString;
317
+ image: z.ZodString;
318
+ type: z.ZodLiteral<"artist">;
319
+ perma_url: z.ZodString;
320
+ }, z.core.$loose>>;
321
+ featured_artists: z.ZodArray<z.ZodObject<{
322
+ id: z.ZodString;
323
+ name: z.ZodString;
324
+ role: z.ZodString;
325
+ image: z.ZodString;
326
+ type: z.ZodLiteral<"artist">;
327
+ perma_url: z.ZodString;
328
+ }, z.core.$loose>>;
329
+ artists: z.ZodArray<z.ZodObject<{
330
+ id: z.ZodString;
331
+ name: z.ZodString;
332
+ role: z.ZodString;
333
+ image: z.ZodString;
334
+ type: z.ZodLiteral<"artist">;
335
+ perma_url: z.ZodString;
336
+ }, z.core.$loose>>;
337
+ }, z.core.$loose>;
338
+ }, z.core.$loose>;
339
+ }, z.core.$loose>>;
340
+ latest_release: z.ZodArray<z.ZodObject<{
341
+ id: z.ZodString;
342
+ title: z.ZodString;
343
+ subtitle: z.ZodString;
344
+ type: z.ZodLiteral<"album">;
345
+ image: z.ZodString;
346
+ perma_url: z.ZodString;
347
+ explicit_content: z.ZodString;
348
+ header_desc: z.ZodString;
349
+ language: z.ZodString;
350
+ year: z.ZodString;
351
+ play_count: z.ZodString;
352
+ more_info: z.ZodObject<{
353
+ query: z.ZodString;
354
+ text: z.ZodString;
355
+ music: z.ZodNullable<z.ZodString>;
356
+ song_count: z.ZodString;
357
+ artistMap: z.ZodObject<{
358
+ primary_artists: z.ZodArray<z.ZodObject<{
359
+ id: z.ZodString;
360
+ name: z.ZodString;
361
+ role: z.ZodString;
362
+ image: z.ZodString;
363
+ type: z.ZodLiteral<"artist">;
364
+ perma_url: z.ZodString;
365
+ }, z.core.$loose>>;
366
+ featured_artists: z.ZodArray<z.ZodObject<{
367
+ id: z.ZodString;
368
+ name: z.ZodString;
369
+ role: z.ZodString;
370
+ image: z.ZodString;
371
+ type: z.ZodLiteral<"artist">;
372
+ perma_url: z.ZodString;
373
+ }, z.core.$loose>>;
374
+ artists: z.ZodArray<z.ZodObject<{
375
+ id: z.ZodString;
376
+ name: z.ZodString;
377
+ role: z.ZodString;
378
+ image: z.ZodString;
379
+ type: z.ZodLiteral<"artist">;
380
+ perma_url: z.ZodString;
381
+ }, z.core.$loose>>;
382
+ }, z.core.$loose>;
383
+ }, z.core.$loose>;
384
+ description: z.ZodString;
385
+ }, z.core.$loose>>;
386
+ similarArtists: z.ZodArray<z.ZodAny>;
387
+ urls: z.ZodObject<{
388
+ albums: z.ZodString;
389
+ bio: z.ZodString;
390
+ comments: z.ZodString;
391
+ songs: z.ZodString;
392
+ overview: z.ZodString;
393
+ }, z.core.$loose>;
394
+ }, z.core.$loose>>;
395
+ };
396
+ readonly label: {
397
+ readonly params: z.ZodObject<{
398
+ token: z.ZodString;
399
+ type: z.ZodLiteral<"label">;
400
+ n_song: z.ZodOptional<z.ZodString>;
401
+ n_album: z.ZodOptional<z.ZodString>;
402
+ }, z.core.$strict>;
403
+ readonly response: z.ZodAny;
404
+ };
405
+ readonly playlist: {
406
+ readonly params: z.ZodObject<{
407
+ token: z.ZodString;
408
+ type: z.ZodLiteral<"playlist">;
409
+ n: z.ZodOptional<z.ZodString>;
410
+ }, z.core.$strict>;
411
+ readonly response: z.ZodLazy<z.ZodObject<{
412
+ id: z.ZodString;
413
+ title: z.ZodString;
414
+ subtitle: z.ZodString;
415
+ type: z.ZodLiteral<"playlist">;
416
+ image: z.ZodString;
417
+ perma_url: z.ZodString;
418
+ explicit_content: z.ZodString;
419
+ header_desc: z.ZodString;
420
+ language: z.ZodString;
421
+ year: z.ZodString;
422
+ play_count: z.ZodString;
423
+ list_count: z.ZodString;
424
+ list_type: z.ZodString;
425
+ list: z.ZodArray<z.ZodLazy<z.ZodObject<{
426
+ id: z.ZodString;
427
+ title: z.ZodString;
428
+ subtitle: z.ZodString;
429
+ type: z.ZodLiteral<"song">;
430
+ perma_url: z.ZodString;
431
+ image: z.ZodString;
432
+ explicit_content: z.ZodString;
433
+ header_desc: z.ZodString;
434
+ language: z.ZodString;
435
+ year: z.ZodString;
436
+ play_count: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
437
+ more_info: z.ZodObject<{
438
+ music: z.ZodString;
439
+ album_id: z.ZodString;
440
+ album: z.ZodString;
441
+ label: z.ZodString;
442
+ label_id: z.ZodNullable<z.ZodString>;
443
+ origin: z.ZodString;
444
+ is_dolby_content: z.ZodBoolean;
445
+ encrypted_media_url: z.ZodString;
446
+ encrypted_drm_media_url: z.ZodString;
447
+ album_url: z.ZodString;
448
+ duration: z.ZodString;
449
+ has_lyrics: z.ZodString;
450
+ lyrics_snippet: z.ZodString;
451
+ lyrics_id: z.ZodOptional<z.ZodString>;
452
+ copyright_text: z.ZodString;
453
+ release_date: z.ZodNullable<z.ZodString>;
454
+ label_url: z.ZodOptional<z.ZodString>;
455
+ vcode: z.ZodOptional<z.ZodString>;
456
+ vlink: z.ZodOptional<z.ZodString>;
457
+ artistMap: z.ZodLazy<z.ZodObject<{
458
+ primary_artists: z.ZodArray<z.ZodObject<{
459
+ id: z.ZodString;
460
+ name: z.ZodString;
461
+ role: z.ZodString;
462
+ image: z.ZodString;
463
+ type: z.ZodLiteral<"artist">;
464
+ perma_url: z.ZodString;
465
+ }, z.core.$loose>>;
466
+ featured_artists: z.ZodArray<z.ZodObject<{
467
+ id: z.ZodString;
468
+ name: z.ZodString;
469
+ role: z.ZodString;
470
+ image: z.ZodString;
471
+ type: z.ZodLiteral<"artist">;
472
+ perma_url: z.ZodString;
473
+ }, z.core.$loose>>;
474
+ artists: z.ZodArray<z.ZodObject<{
475
+ id: z.ZodString;
476
+ name: z.ZodString;
477
+ role: z.ZodString;
478
+ image: z.ZodString;
479
+ type: z.ZodLiteral<"artist">;
480
+ perma_url: z.ZodString;
481
+ }, z.core.$loose>>;
482
+ }, z.core.$loose>>;
483
+ }, z.core.$loose>;
484
+ }, z.core.$loose>>>;
485
+ more_info: z.ZodObject<{
486
+ uid: z.ZodString;
487
+ contents: z.ZodString;
488
+ is_dolby_content: z.ZodBoolean;
489
+ last_updated: z.ZodString;
490
+ username: z.ZodString;
491
+ firstname: z.ZodString;
492
+ lastname: z.ZodString;
493
+ is_followed: z.ZodString;
494
+ follower_count: z.ZodString;
495
+ fan_count: z.ZodString;
496
+ playlist_type: z.ZodString;
497
+ images: z.ZodArray<z.ZodAny>;
498
+ user_image: z.ZodString;
499
+ initials: z.ZodString;
500
+ custom_username: z.ZodString;
501
+ video_count: z.ZodString;
502
+ artists: z.ZodArray<z.ZodObject<{
503
+ id: z.ZodString;
504
+ name: z.ZodString;
505
+ role: z.ZodString;
506
+ image: z.ZodString;
507
+ type: z.ZodLiteral<"artist">;
508
+ perma_url: z.ZodString;
509
+ }, z.core.$loose>>;
510
+ subtitle_desc: z.ZodArray<z.ZodString>;
511
+ }, z.core.$loose>;
512
+ }, z.core.$loose>>;
513
+ };
514
+ readonly songs: {
515
+ readonly params: z.ZodObject<{
516
+ token: z.ZodString;
517
+ type: z.ZodLiteral<"song">;
518
+ }, z.core.$strict>;
519
+ readonly response: z.ZodObject<{
520
+ songs: z.ZodArray<z.ZodObject<{
521
+ id: z.ZodString;
522
+ title: z.ZodString;
523
+ subtitle: z.ZodString;
524
+ type: z.ZodLiteral<"song">;
525
+ perma_url: z.ZodString;
526
+ image: z.ZodString;
527
+ explicit_content: z.ZodString;
528
+ header_desc: z.ZodString;
529
+ language: z.ZodString;
530
+ year: z.ZodString;
531
+ play_count: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
532
+ more_info: z.ZodObject<{
533
+ music: z.ZodString;
534
+ album_id: z.ZodString;
535
+ album: z.ZodString;
536
+ label: z.ZodString;
537
+ label_id: z.ZodNullable<z.ZodString>;
538
+ origin: z.ZodString;
539
+ is_dolby_content: z.ZodBoolean;
540
+ encrypted_media_url: z.ZodString;
541
+ encrypted_drm_media_url: z.ZodString;
542
+ album_url: z.ZodString;
543
+ duration: z.ZodString;
544
+ has_lyrics: z.ZodString;
545
+ lyrics_snippet: z.ZodString;
546
+ lyrics_id: z.ZodOptional<z.ZodString>;
547
+ copyright_text: z.ZodString;
548
+ release_date: z.ZodNullable<z.ZodString>;
549
+ label_url: z.ZodOptional<z.ZodString>;
550
+ vcode: z.ZodOptional<z.ZodString>;
551
+ vlink: z.ZodOptional<z.ZodString>;
552
+ artistMap: z.ZodLazy<z.ZodObject<{
553
+ primary_artists: z.ZodArray<z.ZodObject<{
554
+ id: z.ZodString;
555
+ name: z.ZodString;
556
+ role: z.ZodString;
557
+ image: z.ZodString;
558
+ type: z.ZodLiteral<"artist">;
559
+ perma_url: z.ZodString;
560
+ }, z.core.$loose>>;
561
+ featured_artists: z.ZodArray<z.ZodObject<{
562
+ id: z.ZodString;
563
+ name: z.ZodString;
564
+ role: z.ZodString;
565
+ image: z.ZodString;
566
+ type: z.ZodLiteral<"artist">;
567
+ perma_url: z.ZodString;
568
+ }, z.core.$loose>>;
569
+ artists: z.ZodArray<z.ZodObject<{
570
+ id: z.ZodString;
571
+ name: z.ZodString;
572
+ role: z.ZodString;
573
+ image: z.ZodString;
574
+ type: z.ZodLiteral<"artist">;
575
+ perma_url: z.ZodString;
576
+ }, z.core.$loose>>;
577
+ }, z.core.$loose>>;
578
+ }, z.core.$loose>;
579
+ }, z.core.$loose>>;
580
+ }, z.core.$loose>;
581
+ };
582
+ };
@@ -0,0 +1,50 @@
1
+ import { z } from 'zod';
2
+ import { NonEmptyString, PositiveString } from '../../primitives/string';
3
+ import { SaavnSortBySchema, SaavnSortOrderSchema, } from '../../primitives/enums';
4
+ import { SaavnAlbumEntity, SaavnArtistEntity, SaavnPlaylistEntity, SaavnSongEntity, } from '../../entities';
5
+ export const SaavnWebAPISchema = {
6
+ album: {
7
+ params: z.strictObject({
8
+ token: NonEmptyString,
9
+ type: z.literal('album'),
10
+ }),
11
+ response: SaavnAlbumEntity,
12
+ },
13
+ artist: {
14
+ params: z.strictObject({
15
+ token: NonEmptyString,
16
+ type: z.literal('artist'),
17
+ n_song: PositiveString.optional(),
18
+ n_album: PositiveString.optional(),
19
+ category: SaavnSortBySchema.optional(),
20
+ sort_order: SaavnSortOrderSchema.optional(),
21
+ }),
22
+ response: SaavnArtistEntity,
23
+ },
24
+ label: {
25
+ params: z.strictObject({
26
+ token: NonEmptyString,
27
+ type: z.literal('label'),
28
+ n_song: PositiveString.optional(),
29
+ n_album: PositiveString.optional(),
30
+ }),
31
+ response: z.any(),
32
+ },
33
+ playlist: {
34
+ params: z.strictObject({
35
+ token: NonEmptyString,
36
+ type: z.literal('playlist'),
37
+ n: PositiveString.optional(),
38
+ }),
39
+ response: SaavnPlaylistEntity,
40
+ },
41
+ songs: {
42
+ params: z.strictObject({
43
+ token: NonEmptyString,
44
+ type: z.literal('song'),
45
+ }),
46
+ response: z.looseObject({
47
+ songs: z.array(SaavnSongEntity),
48
+ }),
49
+ },
50
+ };