@rawcast/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.
@@ -0,0 +1,43 @@
1
+ import { SourcesResponse } from '../response';
2
+ import type { HttpTransport } from '../transport';
3
+ import type { DownloadResult, GetMovieDownloadOptions, GetMovieSourcesOptions, MediaDownloadResult } from '../types';
4
+ export declare class MoviesResource {
5
+ private readonly transport;
6
+ constructor(transport: HttpTransport);
7
+ /**
8
+ * Resolves ranked streaming servers, adaptive HLS/DASH playlists, and subtitles for a movie.
9
+ *
10
+ * @param tmdbId TMDB Movie ID (e.g. 550 for Fight Club)
11
+ * @param options Optional language or title parameters
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * const sources = await rawcast.movies.getSources('550');
16
+ * const stream = sources.bestStream({ preferFormat: 'hls', maxQuality: '1080p' });
17
+ * console.log(stream.manifestUrl);
18
+ * ```
19
+ */
20
+ getSources(tmdbId: string | number, options?: GetMovieSourcesOptions): Promise<SourcesResponse>;
21
+ /**
22
+ * Fetches direct MP4 video download URLs with RFC 6266 filename attachment headers.
23
+ *
24
+ * @param tmdbId TMDB Movie ID
25
+ * @param options Target quality (e.g. '1080p', '720p') and preferred audio
26
+ *
27
+ * @example
28
+ * ```typescript
29
+ * // Fetch single quality download:
30
+ * const download = await rawcast.movies.getDownload('550', { quality: '1080p' });
31
+ * console.log(download.downloadUrl, download.filename);
32
+ *
33
+ * // Fetch all available qualities:
34
+ * const list = await rawcast.movies.getDownload('550');
35
+ * console.log(list.downloads);
36
+ * ```
37
+ */
38
+ getDownload(tmdbId: string | number, options: GetMovieDownloadOptions & {
39
+ quality: NonNullable<GetMovieDownloadOptions['quality']>;
40
+ }): Promise<DownloadResult>;
41
+ getDownload(tmdbId: string | number, options?: GetMovieDownloadOptions): Promise<DownloadResult | MediaDownloadResult>;
42
+ }
43
+ //# sourceMappingURL=movies.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"movies.d.ts","sourceRoot":"","sources":["../../src/resources/movies.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,cAAc,EACd,uBAAuB,EACvB,sBAAsB,EACtB,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAElB,qBAAa,cAAc;IACb,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD;;;;;;;;;;;;OAYG;IACU,UAAU,CACrB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,eAAe,CAAC;IAe3B;;;;;;;;;;;;;;;;OAgBG;IACU,WAAW,CACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,EAAE,uBAAuB,GAAG;QAAE,OAAO,EAAE,WAAW,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC,CAAA;KAAE,GAC9F,OAAO,CAAC,cAAc,CAAC;IACb,WAAW,CACtB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,cAAc,GAAG,mBAAmB,CAAC;CAgBjD"}
@@ -0,0 +1,48 @@
1
+ import type { HttpTransport } from '../transport';
2
+ export interface ResolveUrlOptions {
3
+ /**
4
+ * If true, signals the resolver to attach Content-Disposition headers for direct download.
5
+ */
6
+ download?: boolean;
7
+ /**
8
+ * Custom filename title override for download attachment.
9
+ */
10
+ title?: string;
11
+ }
12
+ export declare class ResolveResource {
13
+ private readonly transport;
14
+ constructor(transport: HttpTransport);
15
+ /**
16
+ * Constructs the full public resolution URL for a stream token.
17
+ * Can be passed directly into video player `src` (Video.js, Hls.js, Plyr, or HTML5 `<video>`).
18
+ *
19
+ * @param token Stream token from `stream.token`
20
+ * @param options Download flag and title options
21
+ */
22
+ getStreamUrl(token: string, options?: ResolveUrlOptions): string;
23
+ /**
24
+ * Constructs the direct download URL for a stream token.
25
+ * Triggers an immediate browser download attachment.
26
+ *
27
+ * @param token Stream token from `stream.token`
28
+ * @param options Custom filename title override
29
+ */
30
+ getDownloadUrl(token: string, options?: {
31
+ title?: string;
32
+ }): string;
33
+ /**
34
+ * Constructs the proxied HLS master playlist URL for an HLS stream token.
35
+ *
36
+ * @param token Stream token from `stream.token`
37
+ */
38
+ getHlsManifestUrl(token: string): string;
39
+ /**
40
+ * Resolves a token and returns the underlying upstream CDN video URL directly
41
+ * by following the HTTP 302 redirect.
42
+ *
43
+ * @param token Stream token
44
+ * @param options Download flag and title options
45
+ */
46
+ resolveDirect(token: string, options?: ResolveUrlOptions): Promise<string>;
47
+ }
48
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/resources/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD;;;;;;OAMG;IACI,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,MAAM;IAU3E;;;;;;OAMG;IACI,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAAG,MAAM;IAS9E;;;;OAIG;IACI,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAK/C;;;;;;OAMG;IACU,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC;CA6B5F"}
@@ -0,0 +1,52 @@
1
+ import type { HttpTransport } from '../transport';
2
+ import type { GetSubtitlesOptions, GetTvSubtitlesOptions, SubtitleTrack } from '../types';
3
+ export interface SubtitlesListResult {
4
+ subtitles: SubtitleTrack[];
5
+ }
6
+ export declare class SubtitlesResource {
7
+ private readonly transport;
8
+ constructor(transport: HttpTransport);
9
+ /**
10
+ * Fetches the complete list of available subtitle tracks for a movie.
11
+ *
12
+ * @param tmdbId TMDB Movie ID
13
+ * @param options Language filter options (e.g. { lang: 'en' })
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const { subtitles } = await rawcast.subtitles.getMovie(550, { lang: 'en' });
18
+ * console.log(subtitles);
19
+ * ```
20
+ */
21
+ getMovie(tmdbId: string | number, options?: GetSubtitlesOptions): Promise<SubtitlesListResult>;
22
+ /**
23
+ * Fetches the complete list of available subtitle tracks for a TV episode.
24
+ *
25
+ * @param tmdbId TMDB TV Show ID or options object
26
+ * @param season Season number (1-indexed)
27
+ * @param episode Episode number (1-indexed)
28
+ * @param options Language filter options
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const { subtitles } = await rawcast.subtitles.getTv(1399, 1, 1, { lang: 'en' });
33
+ * ```
34
+ */
35
+ getTv(tmdbIdOrOptions: string | number | (GetTvSubtitlesOptions & {
36
+ tmdbId: string | number;
37
+ }), season?: number, episode?: number, options?: GetSubtitlesOptions): Promise<SubtitlesListResult>;
38
+ /**
39
+ * Builds the formatted WebVTT proxy URL for a raw upstream subtitle URL.
40
+ * Useful for passing directly to `<track src="..." />` in HTML5 video, Video.js, or Plyr.
41
+ *
42
+ * @param rawSubtitleUrl Upstream SRT or VTT URL
43
+ */
44
+ getVttUrl(rawSubtitleUrl: string): string;
45
+ /**
46
+ * Fetches and converts a remote SRT/VTT subtitle file to standardized WebVTT plain text.
47
+ *
48
+ * @param rawSubtitleUrl Upstream subtitle URL
49
+ */
50
+ fetchVtt(rawSubtitleUrl: string): Promise<string>;
51
+ }
52
+ //# sourceMappingURL=subtitles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subtitles.d.ts","sourceRoot":"","sources":["../../src/resources/subtitles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE1F,MAAM,WAAW,mBAAmB;IAClC,SAAS,EAAE,aAAa,EAAE,CAAC;CAC5B;AAED,qBAAa,iBAAiB;IAChB,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD;;;;;;;;;;;OAWG;IACU,QAAQ,CACnB,MAAM,EAAE,MAAM,GAAG,MAAM,EACvB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,mBAAmB,CAAC;IAS/B;;;;;;;;;;;;OAYG;IACU,KAAK,CAChB,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,CAAC,qBAAqB,GAAG;QAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC,EACxF,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,mBAAmB,CAAC;IA8B/B;;;;;OAKG;IACI,SAAS,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM;IAKhD;;;;OAIG;IACU,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAK/D"}
@@ -0,0 +1,48 @@
1
+ import { SourcesResponse } from '../response';
2
+ import type { HttpTransport } from '../transport';
3
+ import type { DownloadResult, GetTvDownloadOptions, GetTvSourcesOptions, MediaDownloadResult } from '../types';
4
+ export declare class TvResource {
5
+ private readonly transport;
6
+ constructor(transport: HttpTransport);
7
+ /**
8
+ * Resolves ranked streaming servers, adaptive HLS/DASH playlists, and subtitles for a TV episode.
9
+ *
10
+ * @param tmdbId TMDB TV Show ID (e.g. 1399 for Game of Thrones) or options object
11
+ * @param season Season number (1-indexed)
12
+ * @param episode Episode number (1-indexed)
13
+ * @param options Optional audio language or title override
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * const sources = await rawcast.tv.getSources(1399, 1, 1);
18
+ * const stream = sources.bestStream({ preferFormat: 'hls' });
19
+ * console.log(stream.manifestUrl);
20
+ * ```
21
+ */
22
+ getSources(tmdbIdOrOptions: string | number | GetTvSourcesOptions, season?: number, episode?: number, options?: {
23
+ lang?: string;
24
+ preferredLang?: string;
25
+ title?: string;
26
+ }): Promise<SourcesResponse>;
27
+ /**
28
+ * Fetches direct MP4 video download URLs with RFC 6266 filename attachment headers for a TV episode.
29
+ *
30
+ * @param tmdbId TMDB TV Show ID or options object
31
+ * @param season Season number (1-indexed)
32
+ * @param episode Episode number (1-indexed)
33
+ * @param options Target quality (e.g. '1080p', '720p') and filename title override
34
+ *
35
+ * @example
36
+ * ```typescript
37
+ * // Fetch single quality download:
38
+ * const download = await rawcast.tv.getDownload(1399, 1, 1, { quality: '1080p' });
39
+ * console.log(download.downloadUrl, download.filename);
40
+ *
41
+ * // Fetch all available qualities:
42
+ * const list = await rawcast.tv.getDownload(1399, 1, 1);
43
+ * console.log(list.downloads);
44
+ * ```
45
+ */
46
+ getDownload(tmdbIdOrOptions: string | number | GetTvDownloadOptions, season?: number, episode?: number, options?: Omit<GetTvDownloadOptions, 'season' | 'episode'>): Promise<DownloadResult | MediaDownloadResult>;
47
+ }
48
+ //# sourceMappingURL=tv.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tv.d.ts","sourceRoot":"","sources":["../../src/resources/tv.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAElB,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,aAAa;IAErD;;;;;;;;;;;;;;OAcG;IACU,UAAU,CACrB,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,mBAAmB,EACtD,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GACtE,OAAO,CAAC,eAAe,CAAC;IAuC3B;;;;;;;;;;;;;;;;;;OAkBG;IACU,WAAW,CACtB,eAAe,EAAE,MAAM,GAAG,MAAM,GAAG,oBAAoB,EACvD,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,OAAO,GAAE,IAAI,CAAC,oBAAoB,EAAE,QAAQ,GAAG,SAAS,CAAM,GAC7D,OAAO,CAAC,cAAc,GAAG,mBAAmB,CAAC;CAuCjD"}
@@ -0,0 +1,46 @@
1
+ import type { BestStreamOptions, ServerGroup, StreamItem, SubtitleTrack } from './types';
2
+ /**
3
+ * Rich wrapper class around media sources response, providing stream selection
4
+ * algorithms and subtitle helpers.
5
+ */
6
+ export declare class SourcesResponse {
7
+ readonly servers: ServerGroup[];
8
+ readonly subtitles: SubtitleTrack[];
9
+ constructor(data: {
10
+ servers?: ServerGroup[];
11
+ subtitles?: SubtitleTrack[];
12
+ });
13
+ /**
14
+ * Flattened list of all available stream renditions across all server groups.
15
+ */
16
+ get allStreams(): StreamItem[];
17
+ /**
18
+ * All HLS (.m3u8) streams across all servers.
19
+ */
20
+ get hlsStreams(): StreamItem[];
21
+ /**
22
+ * All MPEG-DASH (.mpd) streams across all servers.
23
+ */
24
+ get dashStreams(): StreamItem[];
25
+ /**
26
+ * All direct MP4 video streams across all servers.
27
+ */
28
+ get mp4Streams(): StreamItem[];
29
+ /**
30
+ * Selects the single best stream according to format preference, audio, and quality criteria.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * const stream = sources.bestStream({ preferFormat: 'hls', maxQuality: '1080p' });
35
+ * console.log(stream.manifestUrl);
36
+ * ```
37
+ */
38
+ bestStream(options?: BestStreamOptions): StreamItem | null;
39
+ /**
40
+ * Filters subtitles matching the requested language name or ISO code.
41
+ *
42
+ * @param languageOrCode e.g. "English", "en", "Spanish", "es"
43
+ */
44
+ subtitlesByLang(languageOrCode: string): SubtitleTrack[];
45
+ }
46
+ //# sourceMappingURL=response.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"response.d.ts","sourceRoot":"","sources":["../src/response.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAazF;;;GAGG;AACH,qBAAa,eAAe;IAC1B,SAAgB,OAAO,EAAE,WAAW,EAAE,CAAC;IACvC,SAAgB,SAAS,EAAE,aAAa,EAAE,CAAC;gBAE/B,IAAI,EAAE;QAAE,OAAO,CAAC,EAAE,WAAW,EAAE,CAAC;QAAC,SAAS,CAAC,EAAE,aAAa,EAAE,CAAA;KAAE;IAK1E;;OAEG;IACH,IAAW,UAAU,IAAI,UAAU,EAAE,CAEpC;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,UAAU,EAAE,CAEpC;IAED;;OAEG;IACH,IAAW,WAAW,IAAI,UAAU,EAAE,CAErC;IAED;;OAEG;IACH,IAAW,UAAU,IAAI,UAAU,EAAE,CAEpC;IAED;;;;;;;;OAQG;IACI,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,UAAU,GAAG,IAAI;IAyErE;;;;OAIG;IACI,eAAe,CAAC,cAAc,EAAE,MAAM,GAAG,aAAa,EAAE;CAUhE"}
@@ -0,0 +1,23 @@
1
+ import type { QuotaState, RawcastOptions } from './types';
2
+ export declare class HttpTransport {
3
+ readonly baseUrl: string;
4
+ private readonly apiKey;
5
+ private readonly timeoutMs;
6
+ private readonly maxRetries;
7
+ private readonly fetchFn;
8
+ readonly quota: QuotaState;
9
+ constructor(options: RawcastOptions);
10
+ private updateQuotaHeaders;
11
+ private sleep;
12
+ getBaseUrl(): string;
13
+ getApiKey(): string;
14
+ getFetch(): typeof fetch;
15
+ rawFetch(endpoint: string, options?: RequestInit & {
16
+ skipAuth?: boolean;
17
+ }): Promise<Response>;
18
+ request<T>(endpoint: string, options?: RequestInit & {
19
+ timeoutMs?: number;
20
+ skipAuth?: boolean;
21
+ }): Promise<T>;
22
+ }
23
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../src/transport.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE1D,qBAAa,aAAa;IACxB,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAe;IAEvC,SAAgB,KAAK,EAAE,UAAU,CAK/B;gBAEU,OAAO,EAAE,cAAc;IAoBnC,OAAO,CAAC,kBAAkB;YAcZ,KAAK;IAIZ,UAAU,IAAI,MAAM;IAIpB,SAAS,IAAI,MAAM;IAInB,QAAQ,IAAI,OAAO,KAAK;IAIlB,QAAQ,CACnB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,WAAW,GAAG;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAO,GACjD,OAAO,CAAC,QAAQ,CAAC;IAgBP,OAAO,CAAC,CAAC,EACpB,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,WAAW,GAAG;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAO,GACrE,OAAO,CAAC,CAAC,CAAC;CAmId"}
@@ -0,0 +1,205 @@
1
+ import type { DownloadOption, MediaDownloadResult, MovieMetadata, ServerGroup, StreamItem, SubtitleTrack, TvEpisodeMetadata, TvMetadata, TvSeasonInfo } from '@rawcast/shared';
2
+ export type { DownloadOption, MediaDownloadResult, MovieMetadata, ServerGroup, StreamItem, SubtitleTrack, TvEpisodeMetadata, TvMetadata, TvSeasonInfo, };
3
+ export interface HealthStatus {
4
+ status: string;
5
+ timestamp: string;
6
+ version: string;
7
+ uptime: number;
8
+ }
9
+ export interface ProviderHealthDashboard {
10
+ status: string;
11
+ healthyCount: number;
12
+ degradedCount: number;
13
+ downCount: number;
14
+ totalProviders: number;
15
+ timestamp: string;
16
+ servers: Record<string, string>;
17
+ }
18
+ /**
19
+ * Configuration options for the Rawcast SDK client.
20
+ */
21
+ export interface RawcastOptions {
22
+ /**
23
+ * Your Rawcast API key (starts with rc_live_).
24
+ */
25
+ apiKey: string;
26
+ /**
27
+ * Base URL of the Rawcast API.
28
+ * @default "https://zeroms.space/v1"
29
+ */
30
+ baseUrl?: string;
31
+ /**
32
+ * Request timeout in milliseconds.
33
+ * @default 25000
34
+ */
35
+ timeoutMs?: number;
36
+ /**
37
+ * Maximum number of automatic retries on rate limits (HTTP 429) or transient 5xx errors.
38
+ * @default 2
39
+ */
40
+ maxRetries?: number;
41
+ /**
42
+ * Custom fetch implementation (useful for testing, mocked environments, or specialized proxies).
43
+ */
44
+ fetch?: typeof fetch;
45
+ }
46
+ /**
47
+ * Snapshot of the active rate-limit and quota headers returned by the API.
48
+ */
49
+ export interface QuotaState {
50
+ /**
51
+ * Monthly request limit for your current subscription tier.
52
+ */
53
+ limit: number | null;
54
+ /**
55
+ * Remaining requests allowed in the current billing cycle.
56
+ */
57
+ remaining: number | null;
58
+ /**
59
+ * Unix timestamp (in seconds) when the quota resets.
60
+ */
61
+ reset: number | null;
62
+ /**
63
+ * Timestamp of the most recent quota header capture.
64
+ */
65
+ lastUpdated: number | null;
66
+ }
67
+ /**
68
+ * Options for resolving movie streams.
69
+ */
70
+ export interface GetMovieSourcesOptions {
71
+ /**
72
+ * Preferred audio or subtitle language (e.g. 'en', 'es', 'fr', 'hi').
73
+ * @default 'en'
74
+ */
75
+ lang?: string;
76
+ /**
77
+ * Optional custom title override for generated download filenames.
78
+ */
79
+ title?: string;
80
+ }
81
+ /**
82
+ * Options for resolving TV episode streams.
83
+ */
84
+ export interface GetTvSourcesOptions {
85
+ /**
86
+ * TMDB TV Show ID (e.g. '1399' for Game of Thrones).
87
+ */
88
+ tmdbId: string | number;
89
+ /**
90
+ * Season number (1-indexed).
91
+ */
92
+ season: number;
93
+ /**
94
+ * Episode number (1-indexed).
95
+ */
96
+ episode: number;
97
+ /**
98
+ * Preferred audio or subtitle language (e.g. 'en', 'es').
99
+ * @default 'en'
100
+ */
101
+ lang?: string;
102
+ /**
103
+ * Alias for lang.
104
+ */
105
+ preferredLang?: string;
106
+ /**
107
+ * Optional custom title override.
108
+ */
109
+ title?: string;
110
+ }
111
+ /**
112
+ * Options for fetching direct MP4 download links.
113
+ */
114
+ export interface GetMovieDownloadOptions {
115
+ /**
116
+ * Desired video quality ('1080p', '720p', '480p', '360p').
117
+ */
118
+ quality?: '1080p' | '720p' | '480p' | '360p' | 'highest' | 'auto';
119
+ /**
120
+ * Preferred audio language.
121
+ */
122
+ lang?: string;
123
+ /**
124
+ * Custom title override for RFC 6266 filename attachment.
125
+ */
126
+ title?: string;
127
+ }
128
+ export interface GetTvDownloadOptions extends GetMovieDownloadOptions {
129
+ /**
130
+ * Optional TMDB ID if passing all options in a single object.
131
+ */
132
+ tmdbId?: string | number;
133
+ /**
134
+ * Season number (1-indexed).
135
+ */
136
+ season: number;
137
+ /**
138
+ * Episode number (1-indexed).
139
+ */
140
+ episode: number;
141
+ }
142
+ /**
143
+ * Direct MP4 download result.
144
+ */
145
+ export interface DownloadResult {
146
+ tmdbId: string;
147
+ mediaType: 'movie' | 'tv';
148
+ title: string;
149
+ quality: string;
150
+ format: 'mp4';
151
+ url: string;
152
+ downloadUrl: string;
153
+ filename: string;
154
+ }
155
+ /**
156
+ * Options for querying subtitles.
157
+ */
158
+ export interface GetSubtitlesOptions {
159
+ /**
160
+ * Filter subtitles by 2-letter ISO language code (e.g. 'en', 'es', 'fr').
161
+ */
162
+ lang?: string;
163
+ }
164
+ export interface GetTvSubtitlesOptions extends GetSubtitlesOptions {
165
+ season: number;
166
+ episode: number;
167
+ }
168
+ /**
169
+ * Options for querying TV show metadata.
170
+ */
171
+ export interface GetTvMetadataOptions {
172
+ /**
173
+ * Target season to fetch detailed episode breakdown.
174
+ */
175
+ season?: number;
176
+ /**
177
+ * Localization language for overview and titles.
178
+ * @default 'en-US'
179
+ */
180
+ lang?: string;
181
+ }
182
+ /**
183
+ * Filter and ranking criteria for picking the best stream.
184
+ */
185
+ export interface BestStreamOptions {
186
+ /**
187
+ * Preferred streaming format.
188
+ * @default 'hls'
189
+ */
190
+ preferFormat?: 'hls' | 'dash' | 'mp4';
191
+ /**
192
+ * Maximum acceptable video quality (e.g. '1080p', '720p').
193
+ */
194
+ maxQuality?: '1080p' | '720p' | '480p' | '360p';
195
+ /**
196
+ * Preferred audio language track.
197
+ * @default 'English'
198
+ */
199
+ preferredAudio?: string;
200
+ /**
201
+ * Whether to require a stream with download attachment headers.
202
+ */
203
+ requireDownload?: boolean;
204
+ }
205
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,UAAU,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,YAAY,EACb,MAAM,iBAAiB,CAAC;AAEzB,YA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O,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,CAAC;IAEtC;;OAEG;IACH,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAEhD;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B"}
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "@rawcast/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Official TypeScript/JavaScript SDK for Rawcast Media Resolution API",
5
+ "author": "Rawcast Team",
6
+ "license": "MIT",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.mjs",
9
+ "types": "./dist/index.d.ts",
10
+ "files": ["dist", "README.md"],
11
+ "exports": {
12
+ ".": {
13
+ "import": {
14
+ "types": "./dist/index.d.ts",
15
+ "default": "./dist/index.mjs"
16
+ },
17
+ "require": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.cjs"
20
+ }
21
+ }
22
+ },
23
+ "scripts": {
24
+ "build": "bun build ./src/index.ts --outfile ./dist/index.mjs --target node --format esm && bun build ./src/index.ts --outfile ./dist/index.cjs --target node --format cjs && tsc -p tsconfig.build.json",
25
+ "typecheck": "tsc --noEmit",
26
+ "test": "bun test"
27
+ },
28
+ "dependencies": {},
29
+ "devDependencies": {
30
+ "@rawcast/shared": "workspace:*",
31
+ "@types/node": "^22.0.0",
32
+ "typescript": "^5.7.3"
33
+ }
34
+ }