@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.
- package/LICENSE +21 -0
- package/README.md +339 -0
- package/dist/core/models/album.d.ts +32 -0
- package/dist/core/models/album.js +1 -0
- package/dist/core/models/artist.d.ts +61 -0
- package/dist/core/models/artist.js +1 -0
- package/dist/core/models/index.d.ts +4 -0
- package/dist/core/models/index.js +4 -0
- package/dist/core/models/playlist.d.ts +35 -0
- package/dist/core/models/playlist.js +1 -0
- package/dist/core/models/song.d.ts +52 -0
- package/dist/core/models/song.js +1 -0
- package/dist/core/modules/album.module.d.ts +82 -0
- package/dist/core/modules/album.module.js +74 -0
- package/dist/core/modules/artist.module.d.ts +97 -0
- package/dist/core/modules/artist.module.js +49 -0
- package/dist/core/modules/extras.module.d.ts +385 -0
- package/dist/core/modules/extras.module.js +64 -0
- package/dist/core/modules/playlist.module.d.ts +79 -0
- package/dist/core/modules/playlist.module.js +74 -0
- package/dist/core/modules/song.module.d.ts +91 -0
- package/dist/core/modules/song.module.js +97 -0
- package/dist/helpers/errors.d.ts +25 -0
- package/dist/helpers/errors.js +84 -0
- package/dist/helpers/experimental/stream-urls/index.d.ts +20 -0
- package/dist/helpers/experimental/stream-urls/index.js +33 -0
- package/dist/helpers/experimental/stream-urls/stream-urls.edge.d.ts +4 -0
- package/dist/helpers/experimental/stream-urls/stream-urls.edge.js +38 -0
- package/dist/helpers/experimental/stream-urls/stream-urls.node.d.ts +4 -0
- package/dist/helpers/experimental/stream-urls/stream-urls.node.js +27 -0
- package/dist/helpers/fetch.d.ts +38 -0
- package/dist/helpers/fetch.js +38 -0
- package/dist/helpers/utils.d.ts +13 -0
- package/dist/helpers/utils.js +58 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +8 -0
- package/dist/saavn/common-mapper.d.ts +77 -0
- package/dist/saavn/common-mapper.js +348 -0
- package/dist/saavn/entities/album.entity.d.ts +151 -0
- package/dist/saavn/entities/album.entity.js +25 -0
- package/dist/saavn/entities/artist.entity.d.ts +274 -0
- package/dist/saavn/entities/artist.entity.js +49 -0
- package/dist/saavn/entities/base.d.ts +117 -0
- package/dist/saavn/entities/base.js +71 -0
- package/dist/saavn/entities/extras.d.ts +102 -0
- package/dist/saavn/entities/extras.js +43 -0
- package/dist/saavn/entities/index.d.ts +6 -0
- package/dist/saavn/entities/index.js +6 -0
- package/dist/saavn/entities/playlist.entity.d.ts +143 -0
- package/dist/saavn/entities/playlist.entity.js +55 -0
- package/dist/saavn/entities/show.entity.d.ts +14 -0
- package/dist/saavn/entities/show.entity.js +14 -0
- package/dist/saavn/entities/song.entity.d.ts +142 -0
- package/dist/saavn/entities/song.entity.js +48 -0
- package/dist/saavn/operations/get-details/index.d.ts +755 -0
- package/dist/saavn/operations/get-details/index.js +34 -0
- package/dist/saavn/operations/get-details/mapper.ops.d.ts +35 -0
- package/dist/saavn/operations/get-details/mapper.ops.js +55 -0
- package/dist/saavn/operations/get-details/schema.ops.d.ts +706 -0
- package/dist/saavn/operations/get-details/schema.ops.js +49 -0
- package/dist/saavn/operations/get-reco/index.d.ts +144 -0
- package/dist/saavn/operations/get-reco/index.js +19 -0
- package/dist/saavn/operations/get-reco/mapper.ops.d.ts +36 -0
- package/dist/saavn/operations/get-reco/mapper.ops.js +43 -0
- package/dist/saavn/operations/get-reco/schema.ops.d.ts +103 -0
- package/dist/saavn/operations/get-reco/schema.ops.js +28 -0
- package/dist/saavn/operations/get-trending/index.d.ts +288 -0
- package/dist/saavn/operations/get-trending/index.js +24 -0
- package/dist/saavn/operations/get-trending/mapper.ops.d.ts +13 -0
- package/dist/saavn/operations/get-trending/mapper.ops.js +134 -0
- package/dist/saavn/operations/get-trending/schema.ops.d.ts +272 -0
- package/dist/saavn/operations/get-trending/schema.ops.js +34 -0
- package/dist/saavn/operations/index.d.ts +6 -0
- package/dist/saavn/operations/index.js +6 -0
- package/dist/saavn/operations/search-results/index.d.ts +790 -0
- package/dist/saavn/operations/search-results/index.js +29 -0
- package/dist/saavn/operations/search-results/mapper.ops.d.ts +413 -0
- package/dist/saavn/operations/search-results/mapper.ops.js +80 -0
- package/dist/saavn/operations/search-results/schema.ops.d.ts +366 -0
- package/dist/saavn/operations/search-results/schema.ops.js +101 -0
- package/dist/saavn/operations/web-api/index.d.ts +604 -0
- package/dist/saavn/operations/web-api/index.js +29 -0
- package/dist/saavn/operations/web-api/mapper.ops.d.ts +11 -0
- package/dist/saavn/operations/web-api/mapper.ops.js +23 -0
- package/dist/saavn/operations/web-api/schema.ops.d.ts +582 -0
- package/dist/saavn/operations/web-api/schema.ops.js +50 -0
- package/dist/saavn/operations/web-radio/index.d.ts +181 -0
- package/dist/saavn/operations/web-radio/index.js +19 -0
- package/dist/saavn/operations/web-radio/mapper.ops.d.ts +14 -0
- package/dist/saavn/operations/web-radio/mapper.ops.js +35 -0
- package/dist/saavn/operations/web-radio/schema.ops.d.ts +162 -0
- package/dist/saavn/operations/web-radio/schema.ops.js +56 -0
- package/dist/saavn/primitives/enums.d.ts +17 -0
- package/dist/saavn/primitives/enums.js +4 -0
- package/dist/saavn/primitives/string.d.ts +5 -0
- package/dist/saavn/primitives/string.js +22 -0
- package/dist/saavn/run-operation.d.ts +12 -0
- package/dist/saavn/run-operation.js +39 -0
- package/dist/schemas/index.d.ts +2188 -0
- package/dist/schemas/index.js +14 -0
- package/dist/types.d.ts +24 -0
- package/dist/types.js +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { SaavnSearchResultsMapper } from './mapper.ops';
|
|
2
|
+
import { SaavnSearchResultsSchema } from './schema.ops';
|
|
3
|
+
export const SaavnSearchResults = {
|
|
4
|
+
all: {
|
|
5
|
+
call: 'autocomplete.get',
|
|
6
|
+
schema: SaavnSearchResultsSchema.all,
|
|
7
|
+
mapper: SaavnSearchResultsMapper.all,
|
|
8
|
+
},
|
|
9
|
+
albums: {
|
|
10
|
+
call: 'search.getAlbumResults',
|
|
11
|
+
schema: SaavnSearchResultsSchema.albums,
|
|
12
|
+
mapper: SaavnSearchResultsMapper.albums,
|
|
13
|
+
},
|
|
14
|
+
artists: {
|
|
15
|
+
call: 'search.getArtistResults',
|
|
16
|
+
schema: SaavnSearchResultsSchema.artists,
|
|
17
|
+
mapper: SaavnSearchResultsMapper.artists,
|
|
18
|
+
},
|
|
19
|
+
playlists: {
|
|
20
|
+
call: 'search.getPlaylistResults',
|
|
21
|
+
schema: SaavnSearchResultsSchema.playlists,
|
|
22
|
+
mapper: SaavnSearchResultsMapper.playlists,
|
|
23
|
+
},
|
|
24
|
+
songs: {
|
|
25
|
+
call: 'search.getResults',
|
|
26
|
+
schema: SaavnSearchResultsSchema.songs,
|
|
27
|
+
mapper: SaavnSearchResultsMapper.songs,
|
|
28
|
+
},
|
|
29
|
+
};
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SaavnSearchResultsSchema } from './schema.ops';
|
|
3
|
+
export declare const SaavnSearchResultsMapper: {
|
|
4
|
+
all: (data: z.infer<typeof SaavnSearchResultsSchema.all.response>) => {
|
|
5
|
+
albums: {
|
|
6
|
+
position: number;
|
|
7
|
+
data: ({
|
|
8
|
+
id: any;
|
|
9
|
+
type: "song";
|
|
10
|
+
title: any;
|
|
11
|
+
subtitle: any;
|
|
12
|
+
description: any;
|
|
13
|
+
url: any;
|
|
14
|
+
images: import("../../..").Image[];
|
|
15
|
+
flags: {
|
|
16
|
+
isExplicit: boolean;
|
|
17
|
+
isRadioPresent?: undefined;
|
|
18
|
+
};
|
|
19
|
+
name?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
id: any;
|
|
22
|
+
type: "album";
|
|
23
|
+
title: any;
|
|
24
|
+
subtitle: any;
|
|
25
|
+
description: any;
|
|
26
|
+
url: any;
|
|
27
|
+
images: import("../../..").Image[];
|
|
28
|
+
flags: {
|
|
29
|
+
isExplicit: boolean;
|
|
30
|
+
isRadioPresent?: undefined;
|
|
31
|
+
};
|
|
32
|
+
name?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
id: any;
|
|
35
|
+
type: "artist";
|
|
36
|
+
name: any;
|
|
37
|
+
url: any;
|
|
38
|
+
images: import("../../..").Image[];
|
|
39
|
+
flags: {
|
|
40
|
+
isRadioPresent: any;
|
|
41
|
+
isExplicit?: undefined;
|
|
42
|
+
};
|
|
43
|
+
title?: undefined;
|
|
44
|
+
subtitle?: undefined;
|
|
45
|
+
description?: undefined;
|
|
46
|
+
} | {
|
|
47
|
+
id: any;
|
|
48
|
+
type: "playlist";
|
|
49
|
+
title: any;
|
|
50
|
+
subtitle: any;
|
|
51
|
+
description: any;
|
|
52
|
+
url: any;
|
|
53
|
+
images: import("../../..").Image[];
|
|
54
|
+
flags: {
|
|
55
|
+
isExplicit: boolean;
|
|
56
|
+
isRadioPresent?: undefined;
|
|
57
|
+
};
|
|
58
|
+
name?: undefined;
|
|
59
|
+
} | {
|
|
60
|
+
id: any;
|
|
61
|
+
type: "show";
|
|
62
|
+
title: any;
|
|
63
|
+
subtitle: any;
|
|
64
|
+
description: any;
|
|
65
|
+
url: any;
|
|
66
|
+
images: import("../../..").Image[];
|
|
67
|
+
flags?: undefined;
|
|
68
|
+
name?: undefined;
|
|
69
|
+
} | null)[];
|
|
70
|
+
};
|
|
71
|
+
artists: {
|
|
72
|
+
position: number;
|
|
73
|
+
data: ({
|
|
74
|
+
id: any;
|
|
75
|
+
type: "song";
|
|
76
|
+
title: any;
|
|
77
|
+
subtitle: any;
|
|
78
|
+
description: any;
|
|
79
|
+
url: any;
|
|
80
|
+
images: import("../../..").Image[];
|
|
81
|
+
flags: {
|
|
82
|
+
isExplicit: boolean;
|
|
83
|
+
isRadioPresent?: undefined;
|
|
84
|
+
};
|
|
85
|
+
name?: undefined;
|
|
86
|
+
} | {
|
|
87
|
+
id: any;
|
|
88
|
+
type: "album";
|
|
89
|
+
title: any;
|
|
90
|
+
subtitle: any;
|
|
91
|
+
description: any;
|
|
92
|
+
url: any;
|
|
93
|
+
images: import("../../..").Image[];
|
|
94
|
+
flags: {
|
|
95
|
+
isExplicit: boolean;
|
|
96
|
+
isRadioPresent?: undefined;
|
|
97
|
+
};
|
|
98
|
+
name?: undefined;
|
|
99
|
+
} | {
|
|
100
|
+
id: any;
|
|
101
|
+
type: "artist";
|
|
102
|
+
name: any;
|
|
103
|
+
url: any;
|
|
104
|
+
images: import("../../..").Image[];
|
|
105
|
+
flags: {
|
|
106
|
+
isRadioPresent: any;
|
|
107
|
+
isExplicit?: undefined;
|
|
108
|
+
};
|
|
109
|
+
title?: undefined;
|
|
110
|
+
subtitle?: undefined;
|
|
111
|
+
description?: undefined;
|
|
112
|
+
} | {
|
|
113
|
+
id: any;
|
|
114
|
+
type: "playlist";
|
|
115
|
+
title: any;
|
|
116
|
+
subtitle: any;
|
|
117
|
+
description: any;
|
|
118
|
+
url: any;
|
|
119
|
+
images: import("../../..").Image[];
|
|
120
|
+
flags: {
|
|
121
|
+
isExplicit: boolean;
|
|
122
|
+
isRadioPresent?: undefined;
|
|
123
|
+
};
|
|
124
|
+
name?: undefined;
|
|
125
|
+
} | {
|
|
126
|
+
id: any;
|
|
127
|
+
type: "show";
|
|
128
|
+
title: any;
|
|
129
|
+
subtitle: any;
|
|
130
|
+
description: any;
|
|
131
|
+
url: any;
|
|
132
|
+
images: import("../../..").Image[];
|
|
133
|
+
flags?: undefined;
|
|
134
|
+
name?: undefined;
|
|
135
|
+
} | null)[];
|
|
136
|
+
};
|
|
137
|
+
playlists: {
|
|
138
|
+
position: number;
|
|
139
|
+
data: ({
|
|
140
|
+
id: any;
|
|
141
|
+
type: "song";
|
|
142
|
+
title: any;
|
|
143
|
+
subtitle: any;
|
|
144
|
+
description: any;
|
|
145
|
+
url: any;
|
|
146
|
+
images: import("../../..").Image[];
|
|
147
|
+
flags: {
|
|
148
|
+
isExplicit: boolean;
|
|
149
|
+
isRadioPresent?: undefined;
|
|
150
|
+
};
|
|
151
|
+
name?: undefined;
|
|
152
|
+
} | {
|
|
153
|
+
id: any;
|
|
154
|
+
type: "album";
|
|
155
|
+
title: any;
|
|
156
|
+
subtitle: any;
|
|
157
|
+
description: any;
|
|
158
|
+
url: any;
|
|
159
|
+
images: import("../../..").Image[];
|
|
160
|
+
flags: {
|
|
161
|
+
isExplicit: boolean;
|
|
162
|
+
isRadioPresent?: undefined;
|
|
163
|
+
};
|
|
164
|
+
name?: undefined;
|
|
165
|
+
} | {
|
|
166
|
+
id: any;
|
|
167
|
+
type: "artist";
|
|
168
|
+
name: any;
|
|
169
|
+
url: any;
|
|
170
|
+
images: import("../../..").Image[];
|
|
171
|
+
flags: {
|
|
172
|
+
isRadioPresent: any;
|
|
173
|
+
isExplicit?: undefined;
|
|
174
|
+
};
|
|
175
|
+
title?: undefined;
|
|
176
|
+
subtitle?: undefined;
|
|
177
|
+
description?: undefined;
|
|
178
|
+
} | {
|
|
179
|
+
id: any;
|
|
180
|
+
type: "playlist";
|
|
181
|
+
title: any;
|
|
182
|
+
subtitle: any;
|
|
183
|
+
description: any;
|
|
184
|
+
url: any;
|
|
185
|
+
images: import("../../..").Image[];
|
|
186
|
+
flags: {
|
|
187
|
+
isExplicit: boolean;
|
|
188
|
+
isRadioPresent?: undefined;
|
|
189
|
+
};
|
|
190
|
+
name?: undefined;
|
|
191
|
+
} | {
|
|
192
|
+
id: any;
|
|
193
|
+
type: "show";
|
|
194
|
+
title: any;
|
|
195
|
+
subtitle: any;
|
|
196
|
+
description: any;
|
|
197
|
+
url: any;
|
|
198
|
+
images: import("../../..").Image[];
|
|
199
|
+
flags?: undefined;
|
|
200
|
+
name?: undefined;
|
|
201
|
+
} | null)[];
|
|
202
|
+
};
|
|
203
|
+
shows: {
|
|
204
|
+
position: number;
|
|
205
|
+
data: ({
|
|
206
|
+
id: any;
|
|
207
|
+
type: "song";
|
|
208
|
+
title: any;
|
|
209
|
+
subtitle: any;
|
|
210
|
+
description: any;
|
|
211
|
+
url: any;
|
|
212
|
+
images: import("../../..").Image[];
|
|
213
|
+
flags: {
|
|
214
|
+
isExplicit: boolean;
|
|
215
|
+
isRadioPresent?: undefined;
|
|
216
|
+
};
|
|
217
|
+
name?: undefined;
|
|
218
|
+
} | {
|
|
219
|
+
id: any;
|
|
220
|
+
type: "album";
|
|
221
|
+
title: any;
|
|
222
|
+
subtitle: any;
|
|
223
|
+
description: any;
|
|
224
|
+
url: any;
|
|
225
|
+
images: import("../../..").Image[];
|
|
226
|
+
flags: {
|
|
227
|
+
isExplicit: boolean;
|
|
228
|
+
isRadioPresent?: undefined;
|
|
229
|
+
};
|
|
230
|
+
name?: undefined;
|
|
231
|
+
} | {
|
|
232
|
+
id: any;
|
|
233
|
+
type: "artist";
|
|
234
|
+
name: any;
|
|
235
|
+
url: any;
|
|
236
|
+
images: import("../../..").Image[];
|
|
237
|
+
flags: {
|
|
238
|
+
isRadioPresent: any;
|
|
239
|
+
isExplicit?: undefined;
|
|
240
|
+
};
|
|
241
|
+
title?: undefined;
|
|
242
|
+
subtitle?: undefined;
|
|
243
|
+
description?: undefined;
|
|
244
|
+
} | {
|
|
245
|
+
id: any;
|
|
246
|
+
type: "playlist";
|
|
247
|
+
title: any;
|
|
248
|
+
subtitle: any;
|
|
249
|
+
description: any;
|
|
250
|
+
url: any;
|
|
251
|
+
images: import("../../..").Image[];
|
|
252
|
+
flags: {
|
|
253
|
+
isExplicit: boolean;
|
|
254
|
+
isRadioPresent?: undefined;
|
|
255
|
+
};
|
|
256
|
+
name?: undefined;
|
|
257
|
+
} | {
|
|
258
|
+
id: any;
|
|
259
|
+
type: "show";
|
|
260
|
+
title: any;
|
|
261
|
+
subtitle: any;
|
|
262
|
+
description: any;
|
|
263
|
+
url: any;
|
|
264
|
+
images: import("../../..").Image[];
|
|
265
|
+
flags?: undefined;
|
|
266
|
+
name?: undefined;
|
|
267
|
+
} | null)[];
|
|
268
|
+
};
|
|
269
|
+
songs: {
|
|
270
|
+
position: number;
|
|
271
|
+
data: ({
|
|
272
|
+
id: any;
|
|
273
|
+
type: "song";
|
|
274
|
+
title: any;
|
|
275
|
+
subtitle: any;
|
|
276
|
+
description: any;
|
|
277
|
+
url: any;
|
|
278
|
+
images: import("../../..").Image[];
|
|
279
|
+
flags: {
|
|
280
|
+
isExplicit: boolean;
|
|
281
|
+
isRadioPresent?: undefined;
|
|
282
|
+
};
|
|
283
|
+
name?: undefined;
|
|
284
|
+
} | {
|
|
285
|
+
id: any;
|
|
286
|
+
type: "album";
|
|
287
|
+
title: any;
|
|
288
|
+
subtitle: any;
|
|
289
|
+
description: any;
|
|
290
|
+
url: any;
|
|
291
|
+
images: import("../../..").Image[];
|
|
292
|
+
flags: {
|
|
293
|
+
isExplicit: boolean;
|
|
294
|
+
isRadioPresent?: undefined;
|
|
295
|
+
};
|
|
296
|
+
name?: undefined;
|
|
297
|
+
} | {
|
|
298
|
+
id: any;
|
|
299
|
+
type: "artist";
|
|
300
|
+
name: any;
|
|
301
|
+
url: any;
|
|
302
|
+
images: import("../../..").Image[];
|
|
303
|
+
flags: {
|
|
304
|
+
isRadioPresent: any;
|
|
305
|
+
isExplicit?: undefined;
|
|
306
|
+
};
|
|
307
|
+
title?: undefined;
|
|
308
|
+
subtitle?: undefined;
|
|
309
|
+
description?: undefined;
|
|
310
|
+
} | {
|
|
311
|
+
id: any;
|
|
312
|
+
type: "playlist";
|
|
313
|
+
title: any;
|
|
314
|
+
subtitle: any;
|
|
315
|
+
description: any;
|
|
316
|
+
url: any;
|
|
317
|
+
images: import("../../..").Image[];
|
|
318
|
+
flags: {
|
|
319
|
+
isExplicit: boolean;
|
|
320
|
+
isRadioPresent?: undefined;
|
|
321
|
+
};
|
|
322
|
+
name?: undefined;
|
|
323
|
+
} | {
|
|
324
|
+
id: any;
|
|
325
|
+
type: "show";
|
|
326
|
+
title: any;
|
|
327
|
+
subtitle: any;
|
|
328
|
+
description: any;
|
|
329
|
+
url: any;
|
|
330
|
+
images: import("../../..").Image[];
|
|
331
|
+
flags?: undefined;
|
|
332
|
+
name?: undefined;
|
|
333
|
+
} | null)[];
|
|
334
|
+
};
|
|
335
|
+
topquery: {
|
|
336
|
+
position: any;
|
|
337
|
+
data: any;
|
|
338
|
+
};
|
|
339
|
+
};
|
|
340
|
+
albums: (data: z.infer<typeof SaavnSearchResultsSchema.albums.response>) => {
|
|
341
|
+
total: number;
|
|
342
|
+
start: number;
|
|
343
|
+
results: import("../../../core/models").Album[];
|
|
344
|
+
};
|
|
345
|
+
artists: (data: z.infer<typeof SaavnSearchResultsSchema.artists.response>) => {
|
|
346
|
+
total: number;
|
|
347
|
+
start: number;
|
|
348
|
+
results: {
|
|
349
|
+
flags: {
|
|
350
|
+
isRadioPresent: boolean;
|
|
351
|
+
isFollowed: boolean;
|
|
352
|
+
};
|
|
353
|
+
id: string;
|
|
354
|
+
type: "artist";
|
|
355
|
+
name: string;
|
|
356
|
+
subtitle?: string;
|
|
357
|
+
url: string;
|
|
358
|
+
images: import("../../..").Image[];
|
|
359
|
+
stats?: {
|
|
360
|
+
followerCount?: number;
|
|
361
|
+
fanCount?: number;
|
|
362
|
+
};
|
|
363
|
+
language?: {
|
|
364
|
+
primary?: string;
|
|
365
|
+
available?: string[];
|
|
366
|
+
};
|
|
367
|
+
profile?: {
|
|
368
|
+
bio?: import("../../..").BioSection[];
|
|
369
|
+
dob?: string;
|
|
370
|
+
};
|
|
371
|
+
links?: {
|
|
372
|
+
saavn?: {
|
|
373
|
+
overview?: string;
|
|
374
|
+
albums?: string;
|
|
375
|
+
songs?: string;
|
|
376
|
+
bio?: string;
|
|
377
|
+
comments?: string;
|
|
378
|
+
};
|
|
379
|
+
social?: {
|
|
380
|
+
wiki?: string;
|
|
381
|
+
facebook?: string;
|
|
382
|
+
twitter?: string;
|
|
383
|
+
};
|
|
384
|
+
};
|
|
385
|
+
songs?: {
|
|
386
|
+
top?: import("../../../core/models").Song[];
|
|
387
|
+
latest?: import("../../../core/models").Song[];
|
|
388
|
+
};
|
|
389
|
+
albums?: {
|
|
390
|
+
top?: import("../../../core/models").Album[];
|
|
391
|
+
singles?: import("../../../core/models").Album[];
|
|
392
|
+
latest?: import("../../../core/models").Album[];
|
|
393
|
+
};
|
|
394
|
+
playlists?: {
|
|
395
|
+
dedicated?: import("../../../core/models").Playlist[];
|
|
396
|
+
featured?: import("../../../core/models").Playlist[];
|
|
397
|
+
};
|
|
398
|
+
related?: {
|
|
399
|
+
similar?: import("../../../core/models").Artist[];
|
|
400
|
+
};
|
|
401
|
+
}[];
|
|
402
|
+
};
|
|
403
|
+
playlists: (data: z.infer<typeof SaavnSearchResultsSchema.playlists.response>) => {
|
|
404
|
+
total: number;
|
|
405
|
+
start: number;
|
|
406
|
+
results: import("../../../core/models").Playlist[];
|
|
407
|
+
};
|
|
408
|
+
songs: (data: z.infer<typeof SaavnSearchResultsSchema.songs.response>) => {
|
|
409
|
+
total: number;
|
|
410
|
+
start: number;
|
|
411
|
+
results: import("../../../core/models").Song[];
|
|
412
|
+
};
|
|
413
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { mapAlbumEdgeCase, mapPlaylistEdgeCase, mapSong, mapArtistBase, mapSearchAllBase, } from '../../common-mapper';
|
|
3
|
+
import { SaavnSearchResultsSchema } from './schema.ops';
|
|
4
|
+
function normalizeSection(section) {
|
|
5
|
+
return {
|
|
6
|
+
position: section?.position ?? 0,
|
|
7
|
+
data: section?.data ?? [],
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function normalizeTopQuery(topquery) {
|
|
11
|
+
if (!topquery || Array.isArray(topquery)) {
|
|
12
|
+
return { position: 0, data: [] };
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
position: topquery.position ?? 0,
|
|
16
|
+
data: topquery.data ?? [],
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export const SaavnSearchResultsMapper = {
|
|
20
|
+
all: (data) => {
|
|
21
|
+
const albums = normalizeSection(data.albums);
|
|
22
|
+
const artists = normalizeSection(data.artists);
|
|
23
|
+
const playlists = normalizeSection(data.playlists);
|
|
24
|
+
const songs = normalizeSection(data.songs);
|
|
25
|
+
const shows = normalizeSection(data.shows);
|
|
26
|
+
const topquery = normalizeTopQuery(data.topquery);
|
|
27
|
+
return {
|
|
28
|
+
albums: {
|
|
29
|
+
position: albums.position,
|
|
30
|
+
data: albums.data.map(mapSearchAllBase).filter(Boolean),
|
|
31
|
+
},
|
|
32
|
+
artists: {
|
|
33
|
+
position: artists.position,
|
|
34
|
+
data: artists.data.map(mapSearchAllBase).filter(Boolean),
|
|
35
|
+
},
|
|
36
|
+
playlists: {
|
|
37
|
+
position: playlists.position,
|
|
38
|
+
data: playlists.data.map(mapSearchAllBase).filter(Boolean),
|
|
39
|
+
},
|
|
40
|
+
shows: {
|
|
41
|
+
position: shows.position,
|
|
42
|
+
data: shows.data.map(mapSearchAllBase).filter(Boolean),
|
|
43
|
+
},
|
|
44
|
+
songs: {
|
|
45
|
+
position: songs.position,
|
|
46
|
+
data: songs.data.map(mapSearchAllBase).filter(Boolean),
|
|
47
|
+
},
|
|
48
|
+
topquery: {
|
|
49
|
+
position: topquery.position,
|
|
50
|
+
data: topquery.data.map(mapSearchAllBase).filter(Boolean),
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
},
|
|
54
|
+
albums: (data) => ({
|
|
55
|
+
total: data.total,
|
|
56
|
+
start: data.start,
|
|
57
|
+
results: data.results.map(mapAlbumEdgeCase),
|
|
58
|
+
}),
|
|
59
|
+
artists: (data) => ({
|
|
60
|
+
total: data.total,
|
|
61
|
+
start: data.start,
|
|
62
|
+
results: data.results.map((artist) => ({
|
|
63
|
+
...mapArtistBase(artist),
|
|
64
|
+
flags: {
|
|
65
|
+
isRadioPresent: artist.isRadioPresent,
|
|
66
|
+
isFollowed: artist.is_followed,
|
|
67
|
+
},
|
|
68
|
+
})),
|
|
69
|
+
}),
|
|
70
|
+
playlists: (data) => ({
|
|
71
|
+
total: data.total,
|
|
72
|
+
start: data.start,
|
|
73
|
+
results: data.results.map(mapPlaylistEdgeCase),
|
|
74
|
+
}),
|
|
75
|
+
songs: (data) => ({
|
|
76
|
+
total: data.total,
|
|
77
|
+
start: data.start,
|
|
78
|
+
results: data.results.map(mapSong),
|
|
79
|
+
}),
|
|
80
|
+
};
|