@audd/sdk 1.4.9 → 1.5.1
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/README.md +70 -23
- package/dist/index.cjs +311 -106
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +184 -273
- package/dist/index.d.ts +184 -273
- package/dist/index.js +310 -106
- package/dist/index.js.map +1 -1
- package/dist/longpoll.cjs +307 -74
- package/dist/longpoll.cjs.map +1 -1
- package/dist/longpoll.d.cts +21 -10
- package/dist/longpoll.d.ts +21 -10
- package/dist/longpoll.js +307 -74
- package/dist/longpoll.js.map +1 -1
- package/dist/longpollCore-DMBdcGSM.d.cts +251 -0
- package/dist/longpollCore-DMBdcGSM.d.ts +251 -0
- package/package.json +1 -1
- package/dist/http-y2YwjfAl.d.cts +0 -37
- package/dist/http-y2YwjfAl.d.ts +0 -37
package/dist/index.d.cts
CHANGED
|
@@ -1,161 +1,8 @@
|
|
|
1
|
-
import { H as HttpClient, F as FetchLike } from './
|
|
1
|
+
import { S as StreamCallbackMatch, a as StreamCallbackNotification, H as HttpClient, b as Stream, L as LongpollPoll, c as LyricsResult, F as FetchLike, R as RecognitionResult, E as EnterpriseMatch } from './longpollCore-DMBdcGSM.cjs';
|
|
2
|
+
export { d as EnterpriseChunkResult, e as StreamCallbackSong, f as StreamingProvider } from './longpollCore-DMBdcGSM.cjs';
|
|
2
3
|
|
|
3
4
|
declare const VERSION = "1.4.6";
|
|
4
5
|
|
|
5
|
-
/**
|
|
6
|
-
* Typed models. Forward-compatible: each model captures unknown keys into
|
|
7
|
-
* `extras`, mirroring audd-python's Pydantic `extra="allow"` pattern.
|
|
8
|
-
*/
|
|
9
|
-
/** Streaming providers supported by the lis.tn redirect helper. */
|
|
10
|
-
type StreamingProvider = "spotify" | "apple_music" | "deezer" | "napster" | "youtube";
|
|
11
|
-
interface RecognitionResult {
|
|
12
|
-
/** Always present on a match. */
|
|
13
|
-
timecode: string;
|
|
14
|
-
/** Set on custom-catalog matches. */
|
|
15
|
-
audioId?: number | undefined;
|
|
16
|
-
artist?: string | undefined;
|
|
17
|
-
title?: string | undefined;
|
|
18
|
-
album?: string | undefined;
|
|
19
|
-
releaseDate?: string | undefined;
|
|
20
|
-
label?: string | undefined;
|
|
21
|
-
songLink?: string | undefined;
|
|
22
|
-
isrc?: string | undefined;
|
|
23
|
-
upc?: string | undefined;
|
|
24
|
-
appleMusic?: Record<string, unknown> | undefined;
|
|
25
|
-
spotify?: Record<string, unknown> | undefined;
|
|
26
|
-
deezer?: Record<string, unknown> | undefined;
|
|
27
|
-
napster?: Record<string, unknown> | undefined;
|
|
28
|
-
musicbrainz?: ReadonlyArray<Record<string, unknown>> | undefined;
|
|
29
|
-
/** Forward-compat: any unknown keys from the server. */
|
|
30
|
-
extras: Record<string, unknown>;
|
|
31
|
-
/** Full unparsed payload for the caller's own inspection. */
|
|
32
|
-
rawResponse: Record<string, unknown>;
|
|
33
|
-
/** True when `audioId` is set (custom-catalog match). */
|
|
34
|
-
readonly isCustomMatch: boolean;
|
|
35
|
-
/** True when `audioId` is unset and `artist` or `title` are present. */
|
|
36
|
-
readonly isPublicMatch: boolean;
|
|
37
|
-
/** Cover-art URL for `lis.tn`-hosted song_links, else `null`. */
|
|
38
|
-
readonly thumbnailUrl: string | null;
|
|
39
|
-
/**
|
|
40
|
-
* Direct or redirect URL for a streaming provider, with smart fallback.
|
|
41
|
-
*
|
|
42
|
-
* Resolution order:
|
|
43
|
-
* 1. Direct URL from the metadata block (e.g. `apple_music.url`,
|
|
44
|
-
* `spotify.external_urls.spotify`, `deezer.link`, `napster.href`) when
|
|
45
|
-
* the user requested that provider via `return=`.
|
|
46
|
-
* 2. lis.tn redirect (`{songLink}?{provider}`) when `songLink` is on lis.tn.
|
|
47
|
-
* 3. `null` otherwise. YouTube has only the lis.tn-redirect path.
|
|
48
|
-
*/
|
|
49
|
-
streamingUrl(provider: StreamingProvider): string | null;
|
|
50
|
-
/** Map of every provider with a resolvable URL — direct or via lis.tn redirect. */
|
|
51
|
-
streamingUrls(): Partial<Record<StreamingProvider, string>>;
|
|
52
|
-
/**
|
|
53
|
-
* First available 30-second preview URL across providers, in priority order:
|
|
54
|
-
* `apple_music.previews[0].url` → `spotify.preview_url` → `deezer.preview`.
|
|
55
|
-
*
|
|
56
|
-
* **Note:** previews are governed by the respective providers' terms of use.
|
|
57
|
-
* The SDK consumer is responsible for honoring those terms (caching limits,
|
|
58
|
-
* attribution, redistribution constraints).
|
|
59
|
-
*/
|
|
60
|
-
previewUrl(): string | null;
|
|
61
|
-
}
|
|
62
|
-
interface EnterpriseMatch {
|
|
63
|
-
score: number;
|
|
64
|
-
timecode: string;
|
|
65
|
-
artist?: string | undefined;
|
|
66
|
-
title?: string | undefined;
|
|
67
|
-
album?: string | undefined;
|
|
68
|
-
releaseDate?: string | undefined;
|
|
69
|
-
label?: string | undefined;
|
|
70
|
-
isrc?: string | undefined;
|
|
71
|
-
upc?: string | undefined;
|
|
72
|
-
songLink?: string | undefined;
|
|
73
|
-
startOffset?: number | undefined;
|
|
74
|
-
endOffset?: number | undefined;
|
|
75
|
-
extras: Record<string, unknown>;
|
|
76
|
-
rawResponse: Record<string, unknown>;
|
|
77
|
-
readonly thumbnailUrl: string | null;
|
|
78
|
-
/** lis.tn redirect URL for the given streaming provider, or null if `songLink` is non-lis.tn. */
|
|
79
|
-
streamingUrl(provider: StreamingProvider): string | null;
|
|
80
|
-
/** All providers with a resolvable lis.tn redirect URL (or empty when `songLink` is off lis.tn). */
|
|
81
|
-
streamingUrls(): Partial<Record<StreamingProvider, string>>;
|
|
82
|
-
}
|
|
83
|
-
interface EnterpriseChunkResult {
|
|
84
|
-
songs: EnterpriseMatch[];
|
|
85
|
-
offset: string;
|
|
86
|
-
extras: Record<string, unknown>;
|
|
87
|
-
rawResponse: Record<string, unknown>;
|
|
88
|
-
}
|
|
89
|
-
interface Stream {
|
|
90
|
-
radioId: number;
|
|
91
|
-
url: string;
|
|
92
|
-
streamRunning: boolean;
|
|
93
|
-
longpollCategory?: string | undefined;
|
|
94
|
-
extras: Record<string, unknown>;
|
|
95
|
-
rawResponse: Record<string, unknown>;
|
|
96
|
-
}
|
|
97
|
-
interface StreamCallbackResultEntry {
|
|
98
|
-
artist: string;
|
|
99
|
-
title: string;
|
|
100
|
-
score: number;
|
|
101
|
-
album?: string | undefined;
|
|
102
|
-
releaseDate?: string | undefined;
|
|
103
|
-
label?: string | undefined;
|
|
104
|
-
songLink?: string | undefined;
|
|
105
|
-
appleMusic?: Record<string, unknown> | undefined;
|
|
106
|
-
spotify?: Record<string, unknown> | undefined;
|
|
107
|
-
deezer?: Record<string, unknown> | undefined;
|
|
108
|
-
napster?: Record<string, unknown> | undefined;
|
|
109
|
-
musicbrainz?: ReadonlyArray<Record<string, unknown>> | undefined;
|
|
110
|
-
extras: Record<string, unknown>;
|
|
111
|
-
rawResponse: Record<string, unknown>;
|
|
112
|
-
}
|
|
113
|
-
interface StreamCallbackResult {
|
|
114
|
-
radioId: number;
|
|
115
|
-
timestamp?: string | undefined;
|
|
116
|
-
playLength?: number | undefined;
|
|
117
|
-
results: StreamCallbackResultEntry[];
|
|
118
|
-
extras: Record<string, unknown>;
|
|
119
|
-
rawResponse: Record<string, unknown>;
|
|
120
|
-
}
|
|
121
|
-
interface StreamCallbackNotification {
|
|
122
|
-
radioId: number;
|
|
123
|
-
streamRunning?: boolean | undefined;
|
|
124
|
-
notificationCode: number;
|
|
125
|
-
notificationMessage: string;
|
|
126
|
-
extras: Record<string, unknown>;
|
|
127
|
-
rawResponse: Record<string, unknown>;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Discriminated union: a parsed callback payload is either a recognition
|
|
131
|
-
* result or a notification.
|
|
132
|
-
*/
|
|
133
|
-
interface StreamCallbackPayload {
|
|
134
|
-
/** Set when this is a recognition result delivery. */
|
|
135
|
-
result: StreamCallbackResult | null;
|
|
136
|
-
/** Set when this is a stream-state notification. */
|
|
137
|
-
notification: StreamCallbackNotification | null;
|
|
138
|
-
/** Notification time (epoch seconds). */
|
|
139
|
-
time: number | null;
|
|
140
|
-
/** Original parsed JSON body. */
|
|
141
|
-
rawPayload: Record<string, unknown>;
|
|
142
|
-
readonly isResult: boolean;
|
|
143
|
-
readonly isNotification: boolean;
|
|
144
|
-
}
|
|
145
|
-
declare function parseStreamCallback(raw: unknown): StreamCallbackPayload;
|
|
146
|
-
interface LyricsResult {
|
|
147
|
-
artist: string;
|
|
148
|
-
title: string;
|
|
149
|
-
lyrics?: string | undefined;
|
|
150
|
-
songId?: number | undefined;
|
|
151
|
-
fullTitle?: string | undefined;
|
|
152
|
-
artistId?: number | undefined;
|
|
153
|
-
songLink?: string | undefined;
|
|
154
|
-
media?: string | undefined;
|
|
155
|
-
extras: Record<string, unknown>;
|
|
156
|
-
rawResponse: Record<string, unknown>;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
6
|
/**
|
|
160
7
|
* Auto-detect what kind of audio source the caller passed and convert to
|
|
161
8
|
* the right multipart fields.
|
|
@@ -203,6 +50,169 @@ interface RetryPolicy {
|
|
|
203
50
|
backoffMaxMs: number;
|
|
204
51
|
}
|
|
205
52
|
|
|
53
|
+
/** Exception hierarchy for AudD API errors. */
|
|
54
|
+
interface AudDApiErrorFields {
|
|
55
|
+
errorCode: number;
|
|
56
|
+
message: string;
|
|
57
|
+
httpStatus: number;
|
|
58
|
+
requestId: string | null;
|
|
59
|
+
requestedParams: Record<string, unknown>;
|
|
60
|
+
requestMethod: string | null;
|
|
61
|
+
brandedMessage: string | null;
|
|
62
|
+
rawResponse: unknown;
|
|
63
|
+
}
|
|
64
|
+
type AudDApiErrorInit = Partial<AudDApiErrorFields> & Pick<AudDApiErrorFields, "errorCode" | "message" | "httpStatus">;
|
|
65
|
+
/** Base for everything thrown by this SDK. */
|
|
66
|
+
declare class AudDError extends Error {
|
|
67
|
+
name: string;
|
|
68
|
+
}
|
|
69
|
+
/** Server returned `status: error`. Carries the AudD error code + the full echo. */
|
|
70
|
+
declare class AudDAPIError extends AudDError {
|
|
71
|
+
name: string;
|
|
72
|
+
errorCode: number;
|
|
73
|
+
httpStatus: number;
|
|
74
|
+
requestId: string | null;
|
|
75
|
+
requestedParams: Record<string, unknown>;
|
|
76
|
+
requestMethod: string | null;
|
|
77
|
+
brandedMessage: string | null;
|
|
78
|
+
rawResponse: unknown;
|
|
79
|
+
/** Original `error_message` from the server. (`Error.message` may be overridden by subclasses.) */
|
|
80
|
+
serverMessage: string;
|
|
81
|
+
constructor(init: AudDApiErrorInit);
|
|
82
|
+
}
|
|
83
|
+
declare class AudDAuthenticationError extends AudDAPIError {
|
|
84
|
+
name: string;
|
|
85
|
+
}
|
|
86
|
+
declare class AudDQuotaError extends AudDAPIError {
|
|
87
|
+
name: string;
|
|
88
|
+
}
|
|
89
|
+
declare class AudDSubscriptionError extends AudDAPIError {
|
|
90
|
+
name: string;
|
|
91
|
+
}
|
|
92
|
+
declare class AudDCustomCatalogAccessError extends AudDSubscriptionError {
|
|
93
|
+
name: string;
|
|
94
|
+
}
|
|
95
|
+
declare class AudDInvalidRequestError extends AudDAPIError {
|
|
96
|
+
name: string;
|
|
97
|
+
}
|
|
98
|
+
declare class AudDInvalidAudioError extends AudDAPIError {
|
|
99
|
+
name: string;
|
|
100
|
+
}
|
|
101
|
+
declare class AudDRateLimitError extends AudDAPIError {
|
|
102
|
+
name: string;
|
|
103
|
+
}
|
|
104
|
+
declare class AudDStreamLimitError extends AudDAPIError {
|
|
105
|
+
name: string;
|
|
106
|
+
}
|
|
107
|
+
declare class AudDNotReleasedError extends AudDAPIError {
|
|
108
|
+
name: string;
|
|
109
|
+
}
|
|
110
|
+
declare class AudDBlockedError extends AudDAPIError {
|
|
111
|
+
name: string;
|
|
112
|
+
}
|
|
113
|
+
declare class AudDNeedsUpdateError extends AudDAPIError {
|
|
114
|
+
name: string;
|
|
115
|
+
}
|
|
116
|
+
declare class AudDServerError extends AudDAPIError {
|
|
117
|
+
name: string;
|
|
118
|
+
}
|
|
119
|
+
declare class AudDConnectionError extends AudDError {
|
|
120
|
+
name: string;
|
|
121
|
+
cause?: unknown;
|
|
122
|
+
constructor(message: string, cause?: unknown);
|
|
123
|
+
}
|
|
124
|
+
declare class AudDSerializationError extends AudDError {
|
|
125
|
+
name: string;
|
|
126
|
+
rawText: string;
|
|
127
|
+
constructor(message: string, rawText?: string);
|
|
128
|
+
}
|
|
129
|
+
type AudDAPIErrorCtor = new (init: AudDApiErrorInit) => AudDAPIError;
|
|
130
|
+
declare function errorClassForCode(code: number): AudDAPIErrorCtor;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Raised by `addReturnToUrl` (and therefore by `streams.setCallbackUrl`)
|
|
134
|
+
* when the URL already contains a `return` query parameter and a
|
|
135
|
+
* `returnMetadata` argument is also passed — conflicting intent.
|
|
136
|
+
*/
|
|
137
|
+
declare class DuplicateReturnParameterError extends AudDInvalidRequestError {
|
|
138
|
+
name: string;
|
|
139
|
+
constructor();
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Compute the 9-char longpoll category locally from the API token + radio_id.
|
|
143
|
+
*
|
|
144
|
+
* Formula (per docs.audd.io/streams.md): hex-MD5 of (hex-MD5 of api_token,
|
|
145
|
+
* concatenated with the radio_id rendered as a decimal string), truncated
|
|
146
|
+
* to the first 9 hex chars.
|
|
147
|
+
*
|
|
148
|
+
* Pure function — no network call. Lets servers share a longpoll category
|
|
149
|
+
* with browser/mobile clients without leaking the api_token.
|
|
150
|
+
*/
|
|
151
|
+
declare function deriveLongpollCategory(apiToken: string, radioId: number): string;
|
|
152
|
+
/**
|
|
153
|
+
* Append `?return=<metadata>` (or merge as `&return=`) to the callback URL.
|
|
154
|
+
*
|
|
155
|
+
* - If `returnMetadata` is `undefined`, returns the URL unchanged.
|
|
156
|
+
* - If the URL already has a `return` query parameter, raises rather than
|
|
157
|
+
* silently overwriting.
|
|
158
|
+
*/
|
|
159
|
+
declare function addReturnToUrl(url: string, returnMetadata: string | string[] | undefined): string;
|
|
160
|
+
/**
|
|
161
|
+
* Result of {@link parseCallback} / {@link handleCallback}.
|
|
162
|
+
*
|
|
163
|
+
* Exactly one of `match` or `notification` is non-null on success.
|
|
164
|
+
* Recognition callbacks populate `match`; lifecycle/error callbacks (e.g.
|
|
165
|
+
* "stream stopped", "can't connect") populate `notification`.
|
|
166
|
+
*/
|
|
167
|
+
interface ParsedCallback {
|
|
168
|
+
match: StreamCallbackMatch | null;
|
|
169
|
+
notification: StreamCallbackNotification | null;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Parse a callback POST body into a typed match or notification.
|
|
173
|
+
*
|
|
174
|
+
* Accepts either a parsed JSON object or a string (serialized JSON). Throws
|
|
175
|
+
* {@link AudDSerializationError} when the body is unparseable JSON, isn't an
|
|
176
|
+
* object, or carries neither a `result` nor a `notification` block.
|
|
177
|
+
*
|
|
178
|
+
* Prefer {@link handleCallback} when you have a Node `http.IncomingMessage`,
|
|
179
|
+
* a Web `Request`, or anything with a streamed body — that helper reads the
|
|
180
|
+
* body for you.
|
|
181
|
+
*/
|
|
182
|
+
declare function parseCallback(body: unknown): ParsedCallback;
|
|
183
|
+
/**
|
|
184
|
+
* Minimum shape we accept from a "request-like" object: anything that exposes
|
|
185
|
+
* a `body` (already-parsed-or-stringified JSON), or that is itself a stream we
|
|
186
|
+
* can drain.
|
|
187
|
+
*
|
|
188
|
+
* Concretely supports:
|
|
189
|
+
* - Node `http.IncomingMessage` (async-iterable of `Buffer | string`)
|
|
190
|
+
* - Web `Request` / `fetch` `Body` (has `.text()`)
|
|
191
|
+
* - Express/Fastify/Hono request (has a `.body` already populated by a JSON parser)
|
|
192
|
+
* - Plain `{ body: <parsed-json | string> }` shapes
|
|
193
|
+
*/
|
|
194
|
+
type CallbackRequestLike = {
|
|
195
|
+
text(): Promise<string>;
|
|
196
|
+
} | {
|
|
197
|
+
body?: unknown;
|
|
198
|
+
[k: string]: unknown;
|
|
199
|
+
} | AsyncIterable<unknown>;
|
|
200
|
+
/**
|
|
201
|
+
* Read and parse a callback POST body off a Node, Web, or framework-style
|
|
202
|
+
* request. Picks the right strategy by duck-typing:
|
|
203
|
+
*
|
|
204
|
+
* 1. If the request exposes a `text()` method (Web `Request`, `fetch` body),
|
|
205
|
+
* awaits it and parses the resulting string.
|
|
206
|
+
* 2. Otherwise, if the request has a `body` property that's already an object
|
|
207
|
+
* (Express/Fastify/Hono with a JSON middleware) or string, parses that
|
|
208
|
+
* directly without touching the underlying stream.
|
|
209
|
+
* 3. Otherwise, treats the request as an async-iterable of chunks
|
|
210
|
+
* (`http.IncomingMessage`) and concatenates the body before parsing.
|
|
211
|
+
*
|
|
212
|
+
* Throws {@link AudDSerializationError} on any parse failure.
|
|
213
|
+
*/
|
|
214
|
+
declare function handleCallback(req: CallbackRequestLike): Promise<ParsedCallback>;
|
|
215
|
+
|
|
206
216
|
interface SetCallbackUrlOptions {
|
|
207
217
|
returnMetadata?: string | string[];
|
|
208
218
|
}
|
|
@@ -247,18 +257,27 @@ declare class Streams {
|
|
|
247
257
|
list(): Promise<Stream[]>;
|
|
248
258
|
/** Compute the 9-char longpoll category locally — pure, no network. */
|
|
249
259
|
deriveLongpollCategory(radioId: number): string;
|
|
250
|
-
/** Parse a callback POST body into a typed `StreamCallbackPayload`. */
|
|
251
|
-
parseCallback(body: unknown): StreamCallbackPayload;
|
|
252
260
|
/**
|
|
253
|
-
*
|
|
254
|
-
*
|
|
261
|
+
* Parse a callback POST body into `{ match, notification }`. Pass an
|
|
262
|
+
* already-parsed JSON value or a string. Exactly one field is non-null on
|
|
263
|
+
* success. See {@link parseCallback} for details.
|
|
264
|
+
*/
|
|
265
|
+
parseCallback(body: unknown): ParsedCallback;
|
|
266
|
+
/**
|
|
267
|
+
* Long-poll the AudD subscription endpoint.
|
|
255
268
|
*
|
|
256
|
-
*
|
|
257
|
-
*
|
|
258
|
-
*
|
|
259
|
-
*
|
|
269
|
+
* Returns a {@link LongpollPoll} handle with three async-iterables —
|
|
270
|
+
* `matches`, `notifications`, `errors` — that are filled by a background
|
|
271
|
+
* loop. Iterate them independently or in parallel via `Promise.all([...])`.
|
|
272
|
+
*
|
|
273
|
+
* Before the first request the SDK runs a one-time `getCallbackUrl`
|
|
274
|
+
* preflight: AudD silently discards events for accounts that haven't set a
|
|
275
|
+
* callback URL, and the preflight surfaces that misconfiguration as an
|
|
276
|
+
* actionable {@link AudDInvalidRequestError}. Pass `skipCallbackCheck: true`
|
|
277
|
+
* to bypass.
|
|
260
278
|
*/
|
|
261
|
-
longpoll(category: string, opts?: LongpollOptions):
|
|
279
|
+
longpoll(category: string, opts?: LongpollOptions): Promise<LongpollPoll>;
|
|
280
|
+
private preflightCallbackUrl;
|
|
262
281
|
}
|
|
263
282
|
|
|
264
283
|
interface CustomCatalogAddOptions {
|
|
@@ -424,112 +443,4 @@ declare class AudD {
|
|
|
424
443
|
[Symbol.asyncDispose](): Promise<void>;
|
|
425
444
|
}
|
|
426
445
|
|
|
427
|
-
|
|
428
|
-
interface AudDApiErrorFields {
|
|
429
|
-
errorCode: number;
|
|
430
|
-
message: string;
|
|
431
|
-
httpStatus: number;
|
|
432
|
-
requestId: string | null;
|
|
433
|
-
requestedParams: Record<string, unknown>;
|
|
434
|
-
requestMethod: string | null;
|
|
435
|
-
brandedMessage: string | null;
|
|
436
|
-
rawResponse: unknown;
|
|
437
|
-
}
|
|
438
|
-
type AudDApiErrorInit = Partial<AudDApiErrorFields> & Pick<AudDApiErrorFields, "errorCode" | "message" | "httpStatus">;
|
|
439
|
-
/** Base for everything thrown by this SDK. */
|
|
440
|
-
declare class AudDError extends Error {
|
|
441
|
-
name: string;
|
|
442
|
-
}
|
|
443
|
-
/** Server returned `status: error`. Carries the AudD error code + the full echo. */
|
|
444
|
-
declare class AudDAPIError extends AudDError {
|
|
445
|
-
name: string;
|
|
446
|
-
errorCode: number;
|
|
447
|
-
httpStatus: number;
|
|
448
|
-
requestId: string | null;
|
|
449
|
-
requestedParams: Record<string, unknown>;
|
|
450
|
-
requestMethod: string | null;
|
|
451
|
-
brandedMessage: string | null;
|
|
452
|
-
rawResponse: unknown;
|
|
453
|
-
/** Original `error_message` from the server. (`Error.message` may be overridden by subclasses.) */
|
|
454
|
-
serverMessage: string;
|
|
455
|
-
constructor(init: AudDApiErrorInit);
|
|
456
|
-
}
|
|
457
|
-
declare class AudDAuthenticationError extends AudDAPIError {
|
|
458
|
-
name: string;
|
|
459
|
-
}
|
|
460
|
-
declare class AudDQuotaError extends AudDAPIError {
|
|
461
|
-
name: string;
|
|
462
|
-
}
|
|
463
|
-
declare class AudDSubscriptionError extends AudDAPIError {
|
|
464
|
-
name: string;
|
|
465
|
-
}
|
|
466
|
-
declare class AudDCustomCatalogAccessError extends AudDSubscriptionError {
|
|
467
|
-
name: string;
|
|
468
|
-
}
|
|
469
|
-
declare class AudDInvalidRequestError extends AudDAPIError {
|
|
470
|
-
name: string;
|
|
471
|
-
}
|
|
472
|
-
declare class AudDInvalidAudioError extends AudDAPIError {
|
|
473
|
-
name: string;
|
|
474
|
-
}
|
|
475
|
-
declare class AudDRateLimitError extends AudDAPIError {
|
|
476
|
-
name: string;
|
|
477
|
-
}
|
|
478
|
-
declare class AudDStreamLimitError extends AudDAPIError {
|
|
479
|
-
name: string;
|
|
480
|
-
}
|
|
481
|
-
declare class AudDNotReleasedError extends AudDAPIError {
|
|
482
|
-
name: string;
|
|
483
|
-
}
|
|
484
|
-
declare class AudDBlockedError extends AudDAPIError {
|
|
485
|
-
name: string;
|
|
486
|
-
}
|
|
487
|
-
declare class AudDNeedsUpdateError extends AudDAPIError {
|
|
488
|
-
name: string;
|
|
489
|
-
}
|
|
490
|
-
declare class AudDServerError extends AudDAPIError {
|
|
491
|
-
name: string;
|
|
492
|
-
}
|
|
493
|
-
declare class AudDConnectionError extends AudDError {
|
|
494
|
-
name: string;
|
|
495
|
-
cause?: unknown;
|
|
496
|
-
constructor(message: string, cause?: unknown);
|
|
497
|
-
}
|
|
498
|
-
declare class AudDSerializationError extends AudDError {
|
|
499
|
-
name: string;
|
|
500
|
-
rawText: string;
|
|
501
|
-
constructor(message: string, rawText?: string);
|
|
502
|
-
}
|
|
503
|
-
type AudDAPIErrorCtor = new (init: AudDApiErrorInit) => AudDAPIError;
|
|
504
|
-
declare function errorClassForCode(code: number): AudDAPIErrorCtor;
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Raised by `addReturnToUrl` (and therefore by `streams.setCallbackUrl`)
|
|
508
|
-
* when the URL already contains a `return` query parameter and a
|
|
509
|
-
* `returnMetadata` argument is also passed — conflicting intent.
|
|
510
|
-
*/
|
|
511
|
-
declare class DuplicateReturnParameterError extends AudDInvalidRequestError {
|
|
512
|
-
name: string;
|
|
513
|
-
constructor();
|
|
514
|
-
}
|
|
515
|
-
/**
|
|
516
|
-
* Compute the 9-char longpoll category locally from the API token + radio_id.
|
|
517
|
-
*
|
|
518
|
-
* Formula (per docs.audd.io/streams.md): hex-MD5 of (hex-MD5 of api_token,
|
|
519
|
-
* concatenated with the radio_id rendered as a decimal string), truncated
|
|
520
|
-
* to the first 9 hex chars.
|
|
521
|
-
*
|
|
522
|
-
* Pure function — no network call. Lets servers share a longpoll category
|
|
523
|
-
* with browser/mobile clients without leaking the api_token.
|
|
524
|
-
*/
|
|
525
|
-
declare function deriveLongpollCategory(apiToken: string, radioId: number): string;
|
|
526
|
-
/**
|
|
527
|
-
* Append `?return=<metadata>` (or merge as `&return=`) to the callback URL.
|
|
528
|
-
*
|
|
529
|
-
* - If `returnMetadata` is `undefined`, returns the URL unchanged.
|
|
530
|
-
* - If the URL already has a `return` query parameter, raises rather than
|
|
531
|
-
* silently overwriting.
|
|
532
|
-
*/
|
|
533
|
-
declare function addReturnToUrl(url: string, returnMetadata: string | string[] | undefined): string;
|
|
534
|
-
|
|
535
|
-
export { type AddStreamOptions, Advanced, AudD, AudDAPIError, AudDAuthenticationError, AudDBlockedError, AudDConnectionError, AudDCustomCatalogAccessError, AudDError, type AudDEvent, type AudDEventKind, AudDInvalidAudioError, AudDInvalidRequestError, AudDNeedsUpdateError, AudDNotReleasedError, type AudDOptions, AudDQuotaError, AudDRateLimitError, AudDSerializationError, AudDServerError, AudDStreamLimitError, AudDSubscriptionError, CustomCatalog, type CustomCatalogAddOptions, DuplicateReturnParameterError, type EnterpriseChunkResult, type EnterpriseMatch, type LongpollOptions, type LyricsResult, type OnEventHook, type RecognitionResult, type RecognizeEnterpriseOptions, type RecognizeOptions, type ReturnMetadata, type SetCallbackUrlOptions, type Source, type StreamCallbackNotification, type StreamCallbackPayload, type StreamCallbackResult, type StreamCallbackResultEntry, type Stream as StreamRecord, type StreamingProvider, Streams, VERSION, addReturnToUrl, deriveLongpollCategory, errorClassForCode, parseStreamCallback as parseCallback };
|
|
446
|
+
export { type AddStreamOptions, Advanced, AudD, AudDAPIError, AudDAuthenticationError, AudDBlockedError, AudDConnectionError, AudDCustomCatalogAccessError, AudDError, type AudDEvent, type AudDEventKind, AudDInvalidAudioError, AudDInvalidRequestError, AudDNeedsUpdateError, AudDNotReleasedError, type AudDOptions, AudDQuotaError, AudDRateLimitError, AudDSerializationError, AudDServerError, AudDStreamLimitError, AudDSubscriptionError, CustomCatalog, type CustomCatalogAddOptions, DuplicateReturnParameterError, EnterpriseMatch, type LongpollOptions, LongpollPoll, LyricsResult, type OnEventHook, type ParsedCallback, RecognitionResult, type RecognizeEnterpriseOptions, type RecognizeOptions, type ReturnMetadata, type SetCallbackUrlOptions, type Source, StreamCallbackMatch, StreamCallbackNotification, Stream as StreamRecord, Streams, VERSION, addReturnToUrl, deriveLongpollCategory, errorClassForCode, handleCallback, parseCallback };
|