@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
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Saavn Labs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,339 @@
1
+ # @saavn-labs/sdk
2
+
3
+ A low-level, type-safe TypeScript SDK over **JioSaavn’s native API**, built for developers who want **full control, predictable contracts, and long-term stability**.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@saavn-labs/sdk?logo=npm&style=for-the-badge)](https://www.npmjs.com/package/@saavn-labs/sdk)
6
+ [![downloads](https://img.shields.io/npm/dm/@saavn-labs/sdk?style=for-the-badge)](https://www.npmjs.com/package/@saavn-labs/sdk)
7
+ [![license](https://img.shields.io/npm/l/@saavn-labs/sdk?style=for-the-badge)](./LICENSE)
8
+
9
+ **This is not a product API. This is the foundation everything else is built on.**
10
+
11
+ This SDK mirrors Saavn’s native operations at the boundary, while exposing stable, domain-level outputs to consumers.
12
+
13
+ ---
14
+
15
+ ## Why This Exists
16
+
17
+ Most existing JioSaavn libraries try to be helpful and end up **fragile** over time.
18
+
19
+ **They:**
20
+
21
+ - Hide real endpoints behind opinionated helpers
22
+ - Partially normalize data and silently drop fields
23
+ - Break when upstream responses change
24
+ - Offer little or no runtime validation
25
+
26
+ **This SDK takes a different path:**
27
+
28
+ - **Endpoint-first at the integration boundary** — calls and params map directly to Saavn endpoints
29
+ - **Schema-driven** — responses are validated with Zod, not guessed
30
+ - **Domain-oriented outputs** — raw payloads are bridged to stable SDK entities instead of leaky, ad-hoc shapes
31
+ - **Power-preserving** — nothing is stripped or hidden unless intentionally normalized
32
+
33
+ This package is the **single source of truth** for interacting with JioSaavn’s native API in a safe, explicit, and future-proof way.
34
+
35
+ ---
36
+
37
+ ## What This SDK Guarantees
38
+
39
+ ### Input Stability
40
+
41
+ - Parameters map **1:1** to JioSaavn's native API
42
+ - No silent rewrites
43
+ - No hidden defaults
44
+
45
+ **If an endpoint accepts a parameter, you control it.**
46
+
47
+ ### Output Stability
48
+
49
+ - Every response is validated with **Zod**
50
+ - Data types are normalized where it matters (numbers, booleans, arrays)
51
+ - Keys and shapes are predictable
52
+
53
+ **Once published, output shapes only change in a major version.**
54
+
55
+ ### Freedom
56
+
57
+ - Call any supported endpoint directly
58
+ - Access the full response, not a trimmed model
59
+ - Use the request layer to hit native endpoints even before first-class SDK support exists
60
+
61
+ ---
62
+
63
+ ## Design Principles
64
+
65
+ 1. **SDK, not client** — You compose workflows; the SDK exposes primitives
66
+ 2. **Validation before convenience** — Runtime safety comes first
67
+ 3. **No over-normalization** — Real upstream data with minimal transformation
68
+ 4. **Operation-aware** — Built around how Saavn actually works
69
+ 5. **Boundary clarity** — Endpoint-first at ingress, domain-oriented at the SDK surface
70
+
71
+ ---
72
+
73
+ ## Architecture
74
+
75
+ ```
76
+ @saavn-labs/sdk
77
+ ├── saavn # ODD: Native Saavn operations, params, and raw response schemas
78
+ ├── core # DDD: Stable SDK entities, primitives, and modules
79
+ ├── mappers # Bridges from Saavn responses to domain entities
80
+ ├── transport # Request lifecycle, fetch utilities, and user-agent rotation
81
+ └── types # Public TypeScript types and endpoint contracts
82
+ ```
83
+
84
+ - **`saavn/` (Operations-Driven Design)** mirrors JioSaavn’s native calls (`call`, `params`, `response`) and stays close to upstream payloads.
85
+ - **`core/` (Domain-Driven Design)** is the long-lived surface for consumers; shapes change only in majors.
86
+ - **`mappers/`** connect raw Saavn responses to domain entities when normalization is needed.
87
+ - **`transport/`** provides the thin HTTP layer (`fetchFromSaavn`) with context selection, UA rotation, and timeouts.
88
+
89
+ ### Operations currently modeled (0.x)
90
+
91
+ - `get-details` (song, album, artist, playlist, top albums of the year, top searches)
92
+ - `get-reco` (album, playlist, song)
93
+ - `get-trending` (all, albums, playlists, songs)
94
+ - `search-results`
95
+ - `web-api`
96
+ - `web-radio`
97
+
98
+ Each operation ships Zod schemas for both parameters and raw responses, validated against recorded Postman fixtures in `tests/postman/collections`.
99
+
100
+ ---
101
+
102
+ ## Installation
103
+
104
+ ```bash
105
+ # npm
106
+ npm install @saavn-labs/sdk
107
+
108
+ # pnpm
109
+ pnpm add @saavn-labs/sdk
110
+
111
+ # yarn
112
+ yarn add @saavn-labs/sdk
113
+
114
+ # bun
115
+ bun add @saavn-labs/sdk
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Examples
121
+
122
+ Minimal, copy-pasteable examples showing **explicit SDK usage**.
123
+
124
+ **Important:** All SDK methods use **object-based parameters**. See [docs/overview.md](./docs/overview.md) and [docs/modules/](./docs/modules/) for detailed documentation.
125
+
126
+ ---
127
+
128
+ ### 1. Get Songs by ID
129
+
130
+ ```ts
131
+ import { Song } from '@saavn-labs/sdk';
132
+
133
+ async function main() {
134
+ // Get a song by its ID
135
+ const result = await Song.getById({ songIds: '9fH2K1aB' });
136
+
137
+ // Or with multiple IDs
138
+ const many = await Song.getById({ songIds: ['id1', 'id2', 'id3'] });
139
+
140
+ console.log(result.title);
141
+ }
142
+
143
+ main();
144
+ ```
145
+
146
+ ---
147
+
148
+ ### 2. Get Song by Permalink
149
+
150
+ ```ts
151
+ import { Song } from '@saavn-labs/sdk';
152
+
153
+ async function main() {
154
+ // Get a song by its permalink
155
+ const song = await Song.getByPermalink({
156
+ permalink: 'https://www.jiosaavn.com/song/tum-hi-ho/EToxUyFpcwQ',
157
+ });
158
+
159
+ console.log(song.id, song.title, song.duration);
160
+ }
161
+
162
+ main();
163
+ ```
164
+
165
+ ---
166
+
167
+ ### 3. Search Songs
168
+
169
+ ```ts
170
+ import { Song } from '@saavn-labs/sdk';
171
+
172
+ async function main() {
173
+ // Search for a keyword
174
+ const results = await Song.search({
175
+ query: 'lofi',
176
+ limit: 10, // optional, defaults to 10
177
+ offset: 1, // optional, defaults to 1
178
+ });
179
+
180
+ console.log('Total results:', results.total);
181
+
182
+ for (const song of results.results) {
183
+ console.log(song.title, '-', song.subtitle);
184
+ }
185
+ }
186
+
187
+ main();
188
+ ```
189
+
190
+ ---
191
+
192
+ ---
193
+
194
+ ### 4. Get Trending Albums
195
+
196
+ ```ts
197
+ import { Album } from '@saavn-labs/sdk';
198
+
199
+ async function main() {
200
+ // Get Trending Hindi Albums
201
+ const trending = await Album.getTrending({ language: 'hindi' });
202
+
203
+ console.log(`Found ${trending.length} trending albums`);
204
+ trending.slice(0, 5).forEach((album) => {
205
+ console.log(album.title);
206
+ });
207
+ }
208
+
209
+ main();
210
+ ```
211
+
212
+ ---
213
+
214
+ ### 5. Cross-Entity Search
215
+
216
+ ```ts
217
+ import { Extras } from '@saavn-labs/sdk';
218
+
219
+ async function main() {
220
+ // Search across all entities
221
+ const results = await Extras.searchAll({ query: 'bollywood' });
222
+
223
+ console.log('Found', results.items?.length ?? 0, 'results');
224
+ }
225
+
226
+ main();
227
+ ```
228
+
229
+ ---
230
+
231
+ ## 📚 Full Module Documentation
232
+
233
+ - **[Album Module](./docs/modules/album.md)** — Fetch, search, trending, and recommendations
234
+ - **[Artist Module](./docs/modules/artist.md)** — Fetch and search artists
235
+ - **[Song Module](./docs/modules/track.md)** — Full song API with streaming support
236
+ - **[Playlist Module](./docs/modules/playlist.md)** — Playlist operations
237
+ - **[Extras Module](./docs/modules/extras.md)** — Cross-entity utilities
238
+
239
+ ---
240
+
241
+ ## Error Handling
242
+
243
+ All SDK methods throw `SDKError` on failure. See [docs/errors.md](./docs/errors.md) for error codes and handling patterns.
244
+
245
+ ```ts
246
+ import { Album, SDKError } from '@saavn-labs/sdk';
247
+
248
+ try {
249
+ const album = await Album.getById({ albumId: '12345' });
250
+ } catch (err) {
251
+ if (err instanceof SDKError) {
252
+ console.error(`Error [${err.code}]: ${err.message}`);
253
+ }
254
+ }
255
+ ```
256
+
257
+ ---
258
+
259
+ ## Runtime Support
260
+
261
+ Works everywhere modern JavaScript runs:
262
+
263
+ - **Node.js** 18+
264
+ - **Bun**
265
+ - **Deno**
266
+ - **Cloudflare Workers**
267
+ - **Vercel Edge/Serverless Functions**
268
+ - **AWS Lambda (Node runtime)**
269
+
270
+ ---
271
+
272
+ ## What This SDK Does NOT Do
273
+
274
+ - No UI abstractions
275
+ - No opinionated feature helpers
276
+ - No media hosting or caching
277
+ - No promises about upstream API permanence
278
+
279
+ **It gives you tools, not guardrails.**
280
+
281
+ For more details on design decisions, see [docs/overview.md](./docs/overview.md).
282
+
283
+ ---
284
+
285
+ ## Who This Is For
286
+
287
+ - Backend engineers building music platforms
288
+ - Developers working close to Saavn's ecosystem
289
+ - Library authors building their own abstractions
290
+ - Anyone who needs full, predictable access to the API
291
+
292
+ **If you want a drop-in music service, this is not it.**
293
+
294
+ ---
295
+
296
+ ## Development & Examples
297
+
298
+ See [examples/README.md](./examples/README.md) for a fully-working example server demonstrating proper SDK usage with real-world patterns.
299
+
300
+ ```bash
301
+ # Run the example server
302
+ bun run examples:api
303
+ # Then visit http://localhost:3000
304
+ ```
305
+
306
+ ## Contributing
307
+
308
+ Contributions are welcome.
309
+
310
+ - Keep changes focused and explicit
311
+ - Add tests for new operations or schemas
312
+ - Avoid introducing opinionated abstractions
313
+ - Update module documentation in `docs/modules/` when adding new methods
314
+
315
+ Tests currently replay Postman fixtures through Vitest to ensure param/response schemas stay in sync with upstream payloads.
316
+
317
+ ---
318
+
319
+ ## Legal Notice
320
+
321
+ **This is an unofficial SDK.**
322
+
323
+ - Not affiliated with or endorsed by JioSaavn
324
+ - Does not host or redistribute media content
325
+ - All data and URLs are fetched from publicly accessible endpoints
326
+
327
+ **Usage compliance is the sole responsibility of the end user.**
328
+
329
+ ---
330
+
331
+ ## License
332
+
333
+ **MIT** © 2025 Saavn Labs
334
+
335
+ See [LICENSE](./LICENSE) for details.
336
+
337
+ ---
338
+
339
+ Built by **Saavn Labs** with a focus on correctness and longevity.
@@ -0,0 +1,32 @@
1
+ import type { Image } from '../../types';
2
+ import type { Artist, Song } from '.';
3
+ export interface Album {
4
+ id: string;
5
+ type: 'album';
6
+ title: string;
7
+ subtitle?: string;
8
+ description?: string;
9
+ url: string;
10
+ images: Image[];
11
+ language?: string;
12
+ year?: number;
13
+ stats?: {
14
+ playCount?: number;
15
+ songCount?: number;
16
+ };
17
+ flags?: {
18
+ isExplicit?: boolean;
19
+ isDolby?: boolean;
20
+ };
21
+ artists?: {
22
+ primary: Artist[];
23
+ featured: Artist[];
24
+ all: Artist[];
25
+ };
26
+ songs?: Song[];
27
+ meta?: {
28
+ copyright?: string;
29
+ labelUrl?: string;
30
+ releaseDate?: string;
31
+ };
32
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,61 @@
1
+ import type { Image } from '../../types';
2
+ import type { Album, Playlist, Song } from '.';
3
+ export interface BioSection {
4
+ title: string;
5
+ text: string;
6
+ sequence: number;
7
+ }
8
+ export interface Artist {
9
+ id: string;
10
+ type: 'artist';
11
+ name: string;
12
+ subtitle?: string;
13
+ url: string;
14
+ images: Image[];
15
+ stats?: {
16
+ followerCount?: number;
17
+ fanCount?: number;
18
+ };
19
+ flags?: {
20
+ isVerified?: boolean;
21
+ isRadioPresent?: boolean;
22
+ };
23
+ language?: {
24
+ primary?: string;
25
+ available?: string[];
26
+ };
27
+ profile?: {
28
+ bio?: BioSection[];
29
+ dob?: string;
30
+ };
31
+ links?: {
32
+ saavn?: {
33
+ overview?: string;
34
+ albums?: string;
35
+ songs?: string;
36
+ bio?: string;
37
+ comments?: string;
38
+ };
39
+ social?: {
40
+ wiki?: string;
41
+ facebook?: string;
42
+ twitter?: string;
43
+ };
44
+ };
45
+ songs?: {
46
+ top?: Song[];
47
+ latest?: Song[];
48
+ };
49
+ albums?: {
50
+ top?: Album[];
51
+ singles?: Album[];
52
+ latest?: Album[];
53
+ };
54
+ playlists?: {
55
+ dedicated?: Playlist[];
56
+ featured?: Playlist[];
57
+ };
58
+ related?: {
59
+ similar?: Artist[];
60
+ };
61
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export * from './album';
2
+ export * from './artist';
3
+ export * from './song';
4
+ export * from './playlist';
@@ -0,0 +1,4 @@
1
+ export * from './album';
2
+ export * from './artist';
3
+ export * from './song';
4
+ export * from './playlist';
@@ -0,0 +1,35 @@
1
+ import type { Image } from '../../types';
2
+ import type { Artist, Song } from '.';
3
+ export interface Playlist {
4
+ id: string;
5
+ type: 'playlist';
6
+ title: string;
7
+ subtitle?: string;
8
+ description?: string;
9
+ url: string;
10
+ images: Image[];
11
+ stats?: {
12
+ songCount?: number;
13
+ followerCount?: number;
14
+ fanCount?: number;
15
+ duration?: string;
16
+ };
17
+ flags?: {
18
+ isExplicit?: boolean;
19
+ isWeekly?: boolean;
20
+ isDolby?: boolean;
21
+ isFollowed?: boolean;
22
+ };
23
+ songs?: Song[];
24
+ artists?: Artist[];
25
+ owner?: {
26
+ id?: string;
27
+ name?: string;
28
+ isOfficial?: boolean;
29
+ };
30
+ meta?: {
31
+ playlistType?: 'chart' | 'editorial' | 'radio' | 'user';
32
+ language?: string;
33
+ lastUpdated?: number;
34
+ };
35
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ import type { Image } from '../../types';
2
+ import type { Artist } from '.';
3
+ export interface Song {
4
+ id: string;
5
+ type: 'song';
6
+ title: string;
7
+ subtitle?: string;
8
+ url: string;
9
+ images: Image[];
10
+ album?: {
11
+ id?: string;
12
+ title?: string;
13
+ url?: string;
14
+ };
15
+ artists?: {
16
+ primary?: Artist[];
17
+ featured?: Artist[];
18
+ all?: Artist[];
19
+ };
20
+ duration?: number;
21
+ language?: string;
22
+ year?: number;
23
+ stats?: {
24
+ playCount?: number;
25
+ };
26
+ flags?: {
27
+ isExplicit?: boolean;
28
+ hasLyrics?: boolean;
29
+ isDolby?: boolean;
30
+ };
31
+ lyrics?: {
32
+ id?: string;
33
+ snippet?: string;
34
+ };
35
+ media?: {
36
+ encryptedUrl?: string;
37
+ previewUrl?: string;
38
+ jiotune?: {
39
+ id: string;
40
+ url: string;
41
+ };
42
+ };
43
+ meta?: {
44
+ copyright?: string;
45
+ label?: {
46
+ id?: string;
47
+ name?: string;
48
+ url?: string;
49
+ };
50
+ releaseDate?: string;
51
+ };
52
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Fetch an album by Saavn ID.
3
+ *
4
+ * @param params - Parameters object
5
+ * @param params.albumId - Saavn album ID
6
+ * @returns Normalized album object
7
+ */
8
+ declare function getById({ albumId }: {
9
+ albumId: string;
10
+ }): Promise<import("../models").Album>;
11
+ /**
12
+ * Fetch an album by permalink.
13
+ *
14
+ * @param params - Parameters object
15
+ * @param params.permalink - Album permalink string
16
+ * @returns Normalized album object
17
+ */
18
+ declare function getByPermalink({ permalink }: {
19
+ permalink: string;
20
+ }): Promise<import("../models").Album>;
21
+ /**
22
+ * Fetch album recommendations by Saavn ID.
23
+ *
24
+ * @param params - Parameters object
25
+ * @param params.albumId - Saavn album ID
26
+ * @returns List of recommended albums
27
+ */
28
+ declare function getRecommendations({ albumId }: {
29
+ albumId: string;
30
+ }): Promise<{
31
+ id: string;
32
+ type: "album";
33
+ title: string;
34
+ subtitle: string;
35
+ description: string;
36
+ url: string;
37
+ images: import("../..").Image[];
38
+ language: string;
39
+ year: number;
40
+ stats: {
41
+ playCount: number;
42
+ };
43
+ flags: {
44
+ isExplicit: boolean;
45
+ };
46
+ }[]>;
47
+ /**
48
+ * Get trending albums by language.
49
+ *
50
+ * @param params - Parameters object
51
+ * @param params.language - Language code
52
+ * @returns List of trending albums
53
+ */
54
+ declare function getTrending({ language }: {
55
+ language: string;
56
+ }): Promise<import("../models").Album[]>;
57
+ /**
58
+ * Search for albums by query.
59
+ *
60
+ * @param params - Parameters object
61
+ * @param params.query - Search query string
62
+ * @param params.limit - Number of results to return (default: 10)
63
+ * @param params.offset - Offset for pagination (default: 1)
64
+ * @returns List of matching albums
65
+ */
66
+ declare function search({ query, limit, offset, }: {
67
+ query: string;
68
+ limit?: number;
69
+ offset?: number;
70
+ }): Promise<{
71
+ total: number;
72
+ start: number;
73
+ results: import("../models").Album[];
74
+ }>;
75
+ export declare const AlbumModule: {
76
+ getById: typeof getById;
77
+ getByPermalink: typeof getByPermalink;
78
+ getRecommendations: typeof getRecommendations;
79
+ getTrending: typeof getTrending;
80
+ search: typeof search;
81
+ };
82
+ export {};