@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,34 @@
|
|
|
1
|
+
import { SaavnGetDetailsMapper } from './mapper.ops';
|
|
2
|
+
import { SaavnGetDetailsSchema } from './schema.ops';
|
|
3
|
+
export const SaavnGetDetails = {
|
|
4
|
+
album: {
|
|
5
|
+
call: 'content.getAlbumDetails',
|
|
6
|
+
schema: SaavnGetDetailsSchema.album,
|
|
7
|
+
mapper: SaavnGetDetailsMapper.album,
|
|
8
|
+
},
|
|
9
|
+
artist: {
|
|
10
|
+
call: 'artist.getArtistPageDetails',
|
|
11
|
+
schema: SaavnGetDetailsSchema.artist,
|
|
12
|
+
mapper: SaavnGetDetailsMapper.artist,
|
|
13
|
+
},
|
|
14
|
+
playlist: {
|
|
15
|
+
call: 'playlist.getDetails',
|
|
16
|
+
schema: SaavnGetDetailsSchema.playlist,
|
|
17
|
+
mapper: SaavnGetDetailsMapper.playlist,
|
|
18
|
+
},
|
|
19
|
+
songs: {
|
|
20
|
+
call: 'song.getDetails',
|
|
21
|
+
schema: SaavnGetDetailsSchema.songs,
|
|
22
|
+
mapper: SaavnGetDetailsMapper.songs,
|
|
23
|
+
},
|
|
24
|
+
topAlbumsOfTheYear: {
|
|
25
|
+
call: 'content.getTopAlbumsOfTheYear',
|
|
26
|
+
schema: SaavnGetDetailsSchema.topAlbumsOfTheYear,
|
|
27
|
+
mapper: SaavnGetDetailsMapper.topAlbumsOfTheYear,
|
|
28
|
+
},
|
|
29
|
+
topSearches: {
|
|
30
|
+
call: 'content.getTopSearches',
|
|
31
|
+
schema: SaavnGetDetailsSchema.topSearches,
|
|
32
|
+
mapper: SaavnGetDetailsMapper.topSearches,
|
|
33
|
+
},
|
|
34
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { SaavnGetDetailsSchema } from './schema.ops';
|
|
3
|
+
export declare const SaavnGetDetailsMapper: {
|
|
4
|
+
album: (data: z.infer<typeof SaavnGetDetailsSchema.album.response>) => import("../../../core/models").Album;
|
|
5
|
+
artist: (data: z.infer<typeof SaavnGetDetailsSchema.artist.response>) => import("../../../core/models").Artist;
|
|
6
|
+
playlist: (data: z.infer<typeof SaavnGetDetailsSchema.playlist.response>) => import("../../../core/models").Playlist;
|
|
7
|
+
songs: (data: z.infer<typeof SaavnGetDetailsSchema.songs.response>) => {
|
|
8
|
+
songs: import("../../../core/models").Song[];
|
|
9
|
+
};
|
|
10
|
+
topAlbumsOfTheYear: (data: z.infer<typeof SaavnGetDetailsSchema.topAlbumsOfTheYear.response>) => import("../../../core/models").Album[];
|
|
11
|
+
topSearches: (data: z.infer<typeof SaavnGetDetailsSchema.topSearches.response>) => ({
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
subtitle: string;
|
|
15
|
+
url: string;
|
|
16
|
+
images: import("../../..").Image[];
|
|
17
|
+
type: "album" | "artist" | "song";
|
|
18
|
+
} | {
|
|
19
|
+
type: "album";
|
|
20
|
+
album: string;
|
|
21
|
+
id: string;
|
|
22
|
+
title: string;
|
|
23
|
+
subtitle: string;
|
|
24
|
+
url: string;
|
|
25
|
+
images: import("../../..").Image[];
|
|
26
|
+
} | {
|
|
27
|
+
type: "song";
|
|
28
|
+
album: string;
|
|
29
|
+
id: string;
|
|
30
|
+
title: string;
|
|
31
|
+
subtitle: string;
|
|
32
|
+
url: string;
|
|
33
|
+
images: import("../../..").Image[];
|
|
34
|
+
})[];
|
|
35
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { mapAlbum, mapArtist, mapPlaylist, mapSong, parseImageUrls, } from '../../common-mapper';
|
|
3
|
+
import { SaavnGetDetailsSchema } from './schema.ops';
|
|
4
|
+
export const SaavnGetDetailsMapper = {
|
|
5
|
+
album: (data) => {
|
|
6
|
+
return mapAlbum(data);
|
|
7
|
+
},
|
|
8
|
+
artist: (data) => {
|
|
9
|
+
return mapArtist(data);
|
|
10
|
+
},
|
|
11
|
+
playlist: (data) => {
|
|
12
|
+
return mapPlaylist(data);
|
|
13
|
+
},
|
|
14
|
+
songs: (data) => {
|
|
15
|
+
return {
|
|
16
|
+
songs: data.songs.map(mapSong),
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
topAlbumsOfTheYear: (data) => {
|
|
20
|
+
return data.map(mapAlbum);
|
|
21
|
+
},
|
|
22
|
+
topSearches: (data) => {
|
|
23
|
+
return data.map((item) => {
|
|
24
|
+
const baseItem = {
|
|
25
|
+
id: item.id,
|
|
26
|
+
title: item.title,
|
|
27
|
+
subtitle: item.subtitle,
|
|
28
|
+
url: item.perma_url,
|
|
29
|
+
images: parseImageUrls(item.image),
|
|
30
|
+
type: item.type,
|
|
31
|
+
};
|
|
32
|
+
if (item.type === 'album') {
|
|
33
|
+
return {
|
|
34
|
+
...baseItem,
|
|
35
|
+
type: 'album',
|
|
36
|
+
album: item.more_info?.album,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
else if (item.type === 'artist') {
|
|
40
|
+
return {
|
|
41
|
+
...baseItem,
|
|
42
|
+
type: 'artist',
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
else if (item.type === 'song') {
|
|
46
|
+
return {
|
|
47
|
+
...baseItem,
|
|
48
|
+
type: 'song',
|
|
49
|
+
album: item.more_info?.album,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
return baseItem;
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|