@rixl/sdk 0.1.0 → 0.2.2
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 +163 -88
- package/dist/index.d.ts +1665 -5
- package/dist/index.js +1021 -5
- package/dist/index.js.map +1 -0
- package/package.json +34 -30
- package/dist/feeds/index.d.ts +0 -21
- package/dist/feeds/index.js +0 -21
- package/dist/feeds/item/creators/index.d.ts +0 -21
- package/dist/feeds/item/creators/index.js +0 -20
- package/dist/feeds/item/creators/item/index.d.ts +0 -42
- package/dist/feeds/item/creators/item/index.js +0 -28
- package/dist/feeds/item/index.d.ts +0 -58
- package/dist/feeds/item/index.js +0 -44
- package/dist/feeds/item/item/index.d.ts +0 -29
- package/dist/feeds/item/item/index.js +0 -28
- package/dist/images/index.d.ts +0 -68
- package/dist/images/index.js +0 -46
- package/dist/images/item/index.d.ts +0 -48
- package/dist/images/item/index.js +0 -43
- package/dist/images/upload/complete/index.d.ts +0 -35
- package/dist/images/upload/complete/index.js +0 -36
- package/dist/images/upload/index.d.ts +0 -24
- package/dist/images/upload/index.js +0 -24
- package/dist/images/upload/init/index.d.ts +0 -33
- package/dist/images/upload/init/index.js +0 -33
- package/dist/models/github_com_rixlhq_api_db_sqlc/index.d.ts +0 -13
- package/dist/models/github_com_rixlhq_api_db_sqlc/index.js +0 -16
- package/dist/models/github_com_rixlhq_api_internal_errors/index.d.ts +0 -37
- package/dist/models/github_com_rixlhq_api_internal_errors/index.js +0 -40
- package/dist/models/github_com_rixlhq_api_internal_videos/index.d.ts +0 -72
- package/dist/models/github_com_rixlhq_api_internal_videos/index.js +0 -65
- package/dist/models/github_com_rixlhq_api_internal_videos_handler_upload/index.d.ts +0 -70
- package/dist/models/github_com_rixlhq_api_internal_videos_handler_upload/index.js +0 -78
- package/dist/models/github_com_rixlhq_api_internal_videos_types/index.d.ts +0 -30
- package/dist/models/github_com_rixlhq_api_internal_videos_types/index.js +0 -38
- package/dist/models/index.d.ts +0 -548
- package/dist/models/index.js +0 -543
- package/dist/models/internal_images_handler/index.d.ts +0 -98
- package/dist/models/internal_images_handler/index.js +0 -112
- package/dist/models/internal_videos_handler_subtitles/index.d.ts +0 -30
- package/dist/models/internal_videos_handler_subtitles/index.js +0 -38
- package/dist/models/pagination/index.d.ts +0 -125
- package/dist/models/pagination/index.js +0 -153
- package/dist/rixlClient.d.ts +0 -34
- package/dist/rixlClient.js +0 -69
- package/dist/videos/index.d.ts +0 -73
- package/dist/videos/index.js +0 -52
- package/dist/videos/item/audioTracks/index.d.ts +0 -38
- package/dist/videos/item/audioTracks/index.js +0 -33
- package/dist/videos/item/audioTracks/item/index.d.ts +0 -70
- package/dist/videos/item/audioTracks/item/index.js +0 -67
- package/dist/videos/item/chapters/index.d.ts +0 -50
- package/dist/videos/item/chapters/index.js +0 -46
- package/dist/videos/item/delete/index.d.ts +0 -30
- package/dist/videos/item/delete/index.js +0 -28
- package/dist/videos/item/index.d.ts +0 -61
- package/dist/videos/item/index.js +0 -63
- package/dist/videos/item/subtitles/index.d.ts +0 -38
- package/dist/videos/item/subtitles/index.js +0 -33
- package/dist/videos/item/subtitles/item/index.d.ts +0 -70
- package/dist/videos/item/subtitles/item/index.js +0 -67
- package/dist/videos/item/thumbnail/index.d.ts +0 -59
- package/dist/videos/item/thumbnail/index.js +0 -68
- package/dist/videos/languages/index.d.ts +0 -27
- package/dist/videos/languages/index.js +0 -22
- package/dist/videos/upload/complete/index.d.ts +0 -35
- package/dist/videos/upload/complete/index.js +0 -36
- package/dist/videos/upload/index.d.ts +0 -24
- package/dist/videos/upload/index.js +0 -24
- package/dist/videos/upload/init/index.d.ts +0 -34
- package/dist/videos/upload/init/index.js +0 -35
package/dist/index.js
CHANGED
|
@@ -1,5 +1,1021 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
//#region src/core/bodySerializer.gen.ts
|
|
2
|
+
const serializeFormDataPair = (data, key, value) => {
|
|
3
|
+
if (typeof value === "string" || value instanceof Blob) data.append(key, value);
|
|
4
|
+
else if (value instanceof Date) data.append(key, value.toISOString());
|
|
5
|
+
else data.append(key, JSON.stringify(value));
|
|
6
|
+
};
|
|
7
|
+
const formDataBodySerializer = { bodySerializer: (body) => {
|
|
8
|
+
const data = new FormData();
|
|
9
|
+
Object.entries(body).forEach(([key, value]) => {
|
|
10
|
+
if (value === void 0 || value === null) return;
|
|
11
|
+
if (Array.isArray(value)) value.forEach((v) => serializeFormDataPair(data, key, v));
|
|
12
|
+
else serializeFormDataPair(data, key, value);
|
|
13
|
+
});
|
|
14
|
+
return data;
|
|
15
|
+
} };
|
|
16
|
+
const jsonBodySerializer = { bodySerializer: (body) => JSON.stringify(body, (_key, value) => typeof value === "bigint" ? value.toString() : value) };
|
|
17
|
+
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/core/params.gen.ts
|
|
20
|
+
const extraPrefixes = Object.entries({
|
|
21
|
+
$body_: "body",
|
|
22
|
+
$headers_: "headers",
|
|
23
|
+
$path_: "path",
|
|
24
|
+
$query_: "query"
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region src/core/serverSentEvents.gen.ts
|
|
29
|
+
function createSseClient({ onRequest, onSseError, onSseEvent, responseTransformer, responseValidator, sseDefaultRetryDelay, sseMaxRetryAttempts, sseMaxRetryDelay, sseSleepFn, url, ...options }) {
|
|
30
|
+
let lastEventId;
|
|
31
|
+
const sleep = sseSleepFn ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
32
|
+
const createStream = async function* () {
|
|
33
|
+
let retryDelay = sseDefaultRetryDelay ?? 3e3;
|
|
34
|
+
let attempt = 0;
|
|
35
|
+
const signal = options.signal ?? new AbortController().signal;
|
|
36
|
+
while (true) {
|
|
37
|
+
if (signal.aborted) break;
|
|
38
|
+
attempt++;
|
|
39
|
+
const headers = options.headers instanceof Headers ? options.headers : new Headers(options.headers);
|
|
40
|
+
if (lastEventId !== void 0) headers.set("Last-Event-ID", lastEventId);
|
|
41
|
+
try {
|
|
42
|
+
const requestInit = {
|
|
43
|
+
redirect: "follow",
|
|
44
|
+
...options,
|
|
45
|
+
body: options.serializedBody,
|
|
46
|
+
headers,
|
|
47
|
+
signal
|
|
48
|
+
};
|
|
49
|
+
let request = new Request(url, requestInit);
|
|
50
|
+
if (onRequest) request = await onRequest(url, requestInit);
|
|
51
|
+
const response = await (options.fetch ?? globalThis.fetch)(request);
|
|
52
|
+
if (!response.ok) throw new Error(`SSE failed: ${response.status} ${response.statusText}`);
|
|
53
|
+
if (!response.body) throw new Error("No body in SSE response");
|
|
54
|
+
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
55
|
+
let buffer = "";
|
|
56
|
+
const abortHandler = () => {
|
|
57
|
+
try {
|
|
58
|
+
reader.cancel();
|
|
59
|
+
} catch {}
|
|
60
|
+
};
|
|
61
|
+
signal.addEventListener("abort", abortHandler);
|
|
62
|
+
try {
|
|
63
|
+
while (true) {
|
|
64
|
+
const { done, value } = await reader.read();
|
|
65
|
+
if (done) break;
|
|
66
|
+
buffer += value;
|
|
67
|
+
buffer = buffer.replace(/\r\n?/g, "\n");
|
|
68
|
+
const chunks = buffer.split("\n\n");
|
|
69
|
+
buffer = chunks.pop() ?? "";
|
|
70
|
+
for (const chunk of chunks) {
|
|
71
|
+
const lines = chunk.split("\n");
|
|
72
|
+
const dataLines = [];
|
|
73
|
+
let eventName;
|
|
74
|
+
for (const line of lines) if (line.startsWith("data:")) dataLines.push(line.replace(/^data:\s*/, ""));
|
|
75
|
+
else if (line.startsWith("event:")) eventName = line.replace(/^event:\s*/, "");
|
|
76
|
+
else if (line.startsWith("id:")) lastEventId = line.replace(/^id:\s*/, "");
|
|
77
|
+
else if (line.startsWith("retry:")) {
|
|
78
|
+
const parsed = Number.parseInt(line.replace(/^retry:\s*/, ""), 10);
|
|
79
|
+
if (!Number.isNaN(parsed)) retryDelay = parsed;
|
|
80
|
+
}
|
|
81
|
+
let data;
|
|
82
|
+
let parsedJson = false;
|
|
83
|
+
if (dataLines.length) {
|
|
84
|
+
const rawData = dataLines.join("\n");
|
|
85
|
+
try {
|
|
86
|
+
data = JSON.parse(rawData);
|
|
87
|
+
parsedJson = true;
|
|
88
|
+
} catch {
|
|
89
|
+
data = rawData;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (parsedJson) {
|
|
93
|
+
if (responseValidator) await responseValidator(data);
|
|
94
|
+
if (responseTransformer) data = await responseTransformer(data);
|
|
95
|
+
}
|
|
96
|
+
onSseEvent?.({
|
|
97
|
+
data,
|
|
98
|
+
event: eventName,
|
|
99
|
+
id: lastEventId,
|
|
100
|
+
retry: retryDelay
|
|
101
|
+
});
|
|
102
|
+
if (dataLines.length) yield data;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
} finally {
|
|
106
|
+
signal.removeEventListener("abort", abortHandler);
|
|
107
|
+
reader.releaseLock();
|
|
108
|
+
}
|
|
109
|
+
break;
|
|
110
|
+
} catch (error) {
|
|
111
|
+
onSseError?.(error);
|
|
112
|
+
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) break;
|
|
113
|
+
await sleep(Math.min(retryDelay * 2 ** (attempt - 1), sseMaxRetryDelay ?? 3e4));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
return { stream: createStream() };
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
//#endregion
|
|
121
|
+
//#region src/core/pathSerializer.gen.ts
|
|
122
|
+
const separatorArrayExplode = (style) => {
|
|
123
|
+
switch (style) {
|
|
124
|
+
case "label": return ".";
|
|
125
|
+
case "matrix": return ";";
|
|
126
|
+
case "simple": return ",";
|
|
127
|
+
default: return "&";
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
const separatorArrayNoExplode = (style) => {
|
|
131
|
+
switch (style) {
|
|
132
|
+
case "form": return ",";
|
|
133
|
+
case "pipeDelimited": return "|";
|
|
134
|
+
case "spaceDelimited": return "%20";
|
|
135
|
+
default: return ",";
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const separatorObjectExplode = (style) => {
|
|
139
|
+
switch (style) {
|
|
140
|
+
case "label": return ".";
|
|
141
|
+
case "matrix": return ";";
|
|
142
|
+
case "simple": return ",";
|
|
143
|
+
default: return "&";
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
const serializeArrayParam = ({ allowReserved, explode, name, style, value }) => {
|
|
147
|
+
if (!explode) {
|
|
148
|
+
const joinedValues = (allowReserved ? value : value.map((v) => encodeURIComponent(v))).join(separatorArrayNoExplode(style));
|
|
149
|
+
switch (style) {
|
|
150
|
+
case "label": return `.${joinedValues}`;
|
|
151
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
152
|
+
case "simple": return joinedValues;
|
|
153
|
+
default: return `${name}=${joinedValues}`;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
const separator = separatorArrayExplode(style);
|
|
157
|
+
const joinedValues = value.map((v) => {
|
|
158
|
+
if (style === "label" || style === "simple") return allowReserved ? v : encodeURIComponent(v);
|
|
159
|
+
return serializePrimitiveParam({
|
|
160
|
+
allowReserved,
|
|
161
|
+
name,
|
|
162
|
+
value: v
|
|
163
|
+
});
|
|
164
|
+
}).join(separator);
|
|
165
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
166
|
+
};
|
|
167
|
+
const serializePrimitiveParam = ({ allowReserved, name, value }) => {
|
|
168
|
+
if (value === void 0 || value === null) return "";
|
|
169
|
+
if (typeof value === "object") throw new Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
|
|
170
|
+
return `${name}=${allowReserved ? value : encodeURIComponent(value)}`;
|
|
171
|
+
};
|
|
172
|
+
const serializeObjectParam = ({ allowReserved, explode, name, style, value, valueOnly }) => {
|
|
173
|
+
if (value instanceof Date) return valueOnly ? value.toISOString() : `${name}=${value.toISOString()}`;
|
|
174
|
+
if (style !== "deepObject" && !explode) {
|
|
175
|
+
let values = [];
|
|
176
|
+
Object.entries(value).forEach(([key, v]) => {
|
|
177
|
+
values = [
|
|
178
|
+
...values,
|
|
179
|
+
key,
|
|
180
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
181
|
+
];
|
|
182
|
+
});
|
|
183
|
+
const joinedValues = values.join(",");
|
|
184
|
+
switch (style) {
|
|
185
|
+
case "form": return `${name}=${joinedValues}`;
|
|
186
|
+
case "label": return `.${joinedValues}`;
|
|
187
|
+
case "matrix": return `;${name}=${joinedValues}`;
|
|
188
|
+
default: return joinedValues;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
const separator = separatorObjectExplode(style);
|
|
192
|
+
const joinedValues = Object.entries(value).map(([key, v]) => serializePrimitiveParam({
|
|
193
|
+
allowReserved,
|
|
194
|
+
name: style === "deepObject" ? `${name}[${key}]` : key,
|
|
195
|
+
value: v
|
|
196
|
+
})).join(separator);
|
|
197
|
+
return style === "label" || style === "matrix" ? separator + joinedValues : joinedValues;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
//#endregion
|
|
201
|
+
//#region src/core/utils.gen.ts
|
|
202
|
+
const PATH_PARAM_RE = /\{[^{}]+\}/g;
|
|
203
|
+
const defaultPathSerializer = ({ path, url: _url }) => {
|
|
204
|
+
let url = _url;
|
|
205
|
+
const matches = _url.match(PATH_PARAM_RE);
|
|
206
|
+
if (matches) for (const match of matches) {
|
|
207
|
+
let explode = false;
|
|
208
|
+
let name = match.substring(1, match.length - 1);
|
|
209
|
+
let style = "simple";
|
|
210
|
+
if (name.endsWith("*")) {
|
|
211
|
+
explode = true;
|
|
212
|
+
name = name.substring(0, name.length - 1);
|
|
213
|
+
}
|
|
214
|
+
if (name.startsWith(".")) {
|
|
215
|
+
name = name.substring(1);
|
|
216
|
+
style = "label";
|
|
217
|
+
} else if (name.startsWith(";")) {
|
|
218
|
+
name = name.substring(1);
|
|
219
|
+
style = "matrix";
|
|
220
|
+
}
|
|
221
|
+
const value = path[name];
|
|
222
|
+
if (value === void 0 || value === null) continue;
|
|
223
|
+
if (Array.isArray(value)) {
|
|
224
|
+
url = url.replace(match, serializeArrayParam({
|
|
225
|
+
explode,
|
|
226
|
+
name,
|
|
227
|
+
style,
|
|
228
|
+
value
|
|
229
|
+
}));
|
|
230
|
+
continue;
|
|
231
|
+
}
|
|
232
|
+
if (typeof value === "object") {
|
|
233
|
+
url = url.replace(match, serializeObjectParam({
|
|
234
|
+
explode,
|
|
235
|
+
name,
|
|
236
|
+
style,
|
|
237
|
+
value,
|
|
238
|
+
valueOnly: true
|
|
239
|
+
}));
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
if (style === "matrix") {
|
|
243
|
+
url = url.replace(match, `;${serializePrimitiveParam({
|
|
244
|
+
name,
|
|
245
|
+
value
|
|
246
|
+
})}`);
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
const replaceValue = encodeURIComponent(style === "label" ? `.${value}` : value);
|
|
250
|
+
url = url.replace(match, replaceValue);
|
|
251
|
+
}
|
|
252
|
+
return url;
|
|
253
|
+
};
|
|
254
|
+
const getUrl = ({ baseUrl, path, query, querySerializer, url: _url }) => {
|
|
255
|
+
const pathUrl = _url.startsWith("/") ? _url : `/${_url}`;
|
|
256
|
+
let url = (baseUrl ?? "") + pathUrl;
|
|
257
|
+
if (path) url = defaultPathSerializer({
|
|
258
|
+
path,
|
|
259
|
+
url
|
|
260
|
+
});
|
|
261
|
+
let search = query ? querySerializer(query) : "";
|
|
262
|
+
if (search.startsWith("?")) search = search.substring(1);
|
|
263
|
+
if (search) url += `?${search}`;
|
|
264
|
+
return url;
|
|
265
|
+
};
|
|
266
|
+
function getValidRequestBody(options) {
|
|
267
|
+
const hasBody = options.body !== void 0;
|
|
268
|
+
if (hasBody && options.bodySerializer) {
|
|
269
|
+
if ("serializedBody" in options) return options.serializedBody !== void 0 && options.serializedBody !== "" ? options.serializedBody : null;
|
|
270
|
+
return options.body !== "" ? options.body : null;
|
|
271
|
+
}
|
|
272
|
+
if (hasBody) return options.body;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
//#endregion
|
|
276
|
+
//#region src/core/auth.gen.ts
|
|
277
|
+
const getAuthToken = async (auth, callback) => {
|
|
278
|
+
const token = typeof callback === "function" ? await callback(auth) : callback;
|
|
279
|
+
if (!token) return;
|
|
280
|
+
if (auth.scheme === "bearer") return `Bearer ${token}`;
|
|
281
|
+
if (auth.scheme === "basic") return `Basic ${btoa(token)}`;
|
|
282
|
+
return token;
|
|
283
|
+
};
|
|
284
|
+
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/client/utils.gen.ts
|
|
287
|
+
const createQuerySerializer = ({ parameters = {}, ...args } = {}) => {
|
|
288
|
+
const querySerializer = (queryParams) => {
|
|
289
|
+
const search = [];
|
|
290
|
+
if (queryParams && typeof queryParams === "object") for (const name in queryParams) {
|
|
291
|
+
const value = queryParams[name];
|
|
292
|
+
if (value === void 0 || value === null) continue;
|
|
293
|
+
const options = parameters[name] || args;
|
|
294
|
+
if (Array.isArray(value)) {
|
|
295
|
+
const serializedArray = serializeArrayParam({
|
|
296
|
+
allowReserved: options.allowReserved,
|
|
297
|
+
explode: true,
|
|
298
|
+
name,
|
|
299
|
+
style: "form",
|
|
300
|
+
value,
|
|
301
|
+
...options.array
|
|
302
|
+
});
|
|
303
|
+
if (serializedArray) search.push(serializedArray);
|
|
304
|
+
} else if (typeof value === "object") {
|
|
305
|
+
const serializedObject = serializeObjectParam({
|
|
306
|
+
allowReserved: options.allowReserved,
|
|
307
|
+
explode: true,
|
|
308
|
+
name,
|
|
309
|
+
style: "deepObject",
|
|
310
|
+
value,
|
|
311
|
+
...options.object
|
|
312
|
+
});
|
|
313
|
+
if (serializedObject) search.push(serializedObject);
|
|
314
|
+
} else {
|
|
315
|
+
const serializedPrimitive = serializePrimitiveParam({
|
|
316
|
+
allowReserved: options.allowReserved,
|
|
317
|
+
name,
|
|
318
|
+
value
|
|
319
|
+
});
|
|
320
|
+
if (serializedPrimitive) search.push(serializedPrimitive);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
return search.join("&");
|
|
324
|
+
};
|
|
325
|
+
return querySerializer;
|
|
326
|
+
};
|
|
327
|
+
/**
|
|
328
|
+
* Infers parseAs value from provided Content-Type header.
|
|
329
|
+
*/
|
|
330
|
+
const getParseAs = (contentType) => {
|
|
331
|
+
if (!contentType) return "stream";
|
|
332
|
+
const cleanContent = contentType.split(";")[0]?.trim();
|
|
333
|
+
if (!cleanContent) return;
|
|
334
|
+
if (cleanContent.startsWith("application/json") || cleanContent.endsWith("+json")) return "json";
|
|
335
|
+
if (cleanContent === "multipart/form-data") return "formData";
|
|
336
|
+
if ([
|
|
337
|
+
"application/",
|
|
338
|
+
"audio/",
|
|
339
|
+
"image/",
|
|
340
|
+
"video/"
|
|
341
|
+
].some((type) => cleanContent.startsWith(type))) return "blob";
|
|
342
|
+
if (cleanContent.startsWith("text/")) return "text";
|
|
343
|
+
};
|
|
344
|
+
const checkForExistence = (options, name) => {
|
|
345
|
+
if (!name) return false;
|
|
346
|
+
if (options.headers.has(name) || options.query?.[name] || options.headers.get("Cookie")?.includes(`${name}=`)) return true;
|
|
347
|
+
return false;
|
|
348
|
+
};
|
|
349
|
+
const setAuthParams = async ({ security, ...options }) => {
|
|
350
|
+
for (const auth of security) {
|
|
351
|
+
if (checkForExistence(options, auth.name)) continue;
|
|
352
|
+
const token = await getAuthToken(auth, options.auth);
|
|
353
|
+
if (!token) continue;
|
|
354
|
+
const name = auth.name ?? "Authorization";
|
|
355
|
+
switch (auth.in) {
|
|
356
|
+
case "query":
|
|
357
|
+
if (!options.query) options.query = {};
|
|
358
|
+
options.query[name] = token;
|
|
359
|
+
break;
|
|
360
|
+
case "cookie":
|
|
361
|
+
options.headers.append("Cookie", `${name}=${token}`);
|
|
362
|
+
break;
|
|
363
|
+
default:
|
|
364
|
+
options.headers.set(name, token);
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
};
|
|
369
|
+
const buildUrl = (options) => getUrl({
|
|
370
|
+
baseUrl: options.baseUrl,
|
|
371
|
+
path: options.path,
|
|
372
|
+
query: options.query,
|
|
373
|
+
querySerializer: typeof options.querySerializer === "function" ? options.querySerializer : createQuerySerializer(options.querySerializer),
|
|
374
|
+
url: options.url
|
|
375
|
+
});
|
|
376
|
+
const mergeConfigs = (a, b) => {
|
|
377
|
+
const config = {
|
|
378
|
+
...a,
|
|
379
|
+
...b
|
|
380
|
+
};
|
|
381
|
+
if (config.baseUrl?.endsWith("/")) config.baseUrl = config.baseUrl.substring(0, config.baseUrl.length - 1);
|
|
382
|
+
config.headers = mergeHeaders(a.headers, b.headers);
|
|
383
|
+
return config;
|
|
384
|
+
};
|
|
385
|
+
const headersEntries = (headers) => {
|
|
386
|
+
const entries = [];
|
|
387
|
+
headers.forEach((value, key) => {
|
|
388
|
+
entries.push([key, value]);
|
|
389
|
+
});
|
|
390
|
+
return entries;
|
|
391
|
+
};
|
|
392
|
+
const mergeHeaders = (...headers) => {
|
|
393
|
+
const mergedHeaders = new Headers();
|
|
394
|
+
for (const header of headers) {
|
|
395
|
+
if (!header) continue;
|
|
396
|
+
const iterator = header instanceof Headers ? headersEntries(header) : Object.entries(header);
|
|
397
|
+
for (const [key, value] of iterator) if (value === null) mergedHeaders.delete(key);
|
|
398
|
+
else if (Array.isArray(value)) for (const v of value) mergedHeaders.append(key, v);
|
|
399
|
+
else if (value !== void 0) mergedHeaders.set(key, typeof value === "object" ? JSON.stringify(value) : value);
|
|
400
|
+
}
|
|
401
|
+
return mergedHeaders;
|
|
402
|
+
};
|
|
403
|
+
var Interceptors = class {
|
|
404
|
+
fns = [];
|
|
405
|
+
clear() {
|
|
406
|
+
this.fns = [];
|
|
407
|
+
}
|
|
408
|
+
eject(id) {
|
|
409
|
+
const index = this.getInterceptorIndex(id);
|
|
410
|
+
if (this.fns[index]) this.fns[index] = null;
|
|
411
|
+
}
|
|
412
|
+
exists(id) {
|
|
413
|
+
const index = this.getInterceptorIndex(id);
|
|
414
|
+
return Boolean(this.fns[index]);
|
|
415
|
+
}
|
|
416
|
+
getInterceptorIndex(id) {
|
|
417
|
+
if (typeof id === "number") return this.fns[id] ? id : -1;
|
|
418
|
+
return this.fns.indexOf(id);
|
|
419
|
+
}
|
|
420
|
+
update(id, fn) {
|
|
421
|
+
const index = this.getInterceptorIndex(id);
|
|
422
|
+
if (this.fns[index]) {
|
|
423
|
+
this.fns[index] = fn;
|
|
424
|
+
return id;
|
|
425
|
+
}
|
|
426
|
+
return false;
|
|
427
|
+
}
|
|
428
|
+
use(fn) {
|
|
429
|
+
this.fns.push(fn);
|
|
430
|
+
return this.fns.length - 1;
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
const createInterceptors = () => ({
|
|
434
|
+
error: new Interceptors(),
|
|
435
|
+
request: new Interceptors(),
|
|
436
|
+
response: new Interceptors()
|
|
437
|
+
});
|
|
438
|
+
const defaultQuerySerializer = createQuerySerializer({
|
|
439
|
+
allowReserved: false,
|
|
440
|
+
array: {
|
|
441
|
+
explode: true,
|
|
442
|
+
style: "form"
|
|
443
|
+
},
|
|
444
|
+
object: {
|
|
445
|
+
explode: true,
|
|
446
|
+
style: "deepObject"
|
|
447
|
+
}
|
|
448
|
+
});
|
|
449
|
+
const defaultHeaders = { "Content-Type": "application/json" };
|
|
450
|
+
const createConfig = (override = {}) => ({
|
|
451
|
+
...jsonBodySerializer,
|
|
452
|
+
headers: defaultHeaders,
|
|
453
|
+
parseAs: "auto",
|
|
454
|
+
querySerializer: defaultQuerySerializer,
|
|
455
|
+
...override
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
//#endregion
|
|
459
|
+
//#region src/client/client.gen.ts
|
|
460
|
+
const createClient = (config = {}) => {
|
|
461
|
+
let _config = mergeConfigs(createConfig(), config);
|
|
462
|
+
const getConfig = () => ({ ..._config });
|
|
463
|
+
const setConfig = (config) => {
|
|
464
|
+
_config = mergeConfigs(_config, config);
|
|
465
|
+
return getConfig();
|
|
466
|
+
};
|
|
467
|
+
const interceptors = createInterceptors();
|
|
468
|
+
const beforeRequest = async (options) => {
|
|
469
|
+
const opts = {
|
|
470
|
+
..._config,
|
|
471
|
+
...options,
|
|
472
|
+
fetch: options.fetch ?? _config.fetch ?? globalThis.fetch,
|
|
473
|
+
headers: mergeHeaders(_config.headers, options.headers),
|
|
474
|
+
serializedBody: void 0
|
|
475
|
+
};
|
|
476
|
+
if (opts.security) await setAuthParams({
|
|
477
|
+
...opts,
|
|
478
|
+
security: opts.security
|
|
479
|
+
});
|
|
480
|
+
if (opts.requestValidator) await opts.requestValidator(opts);
|
|
481
|
+
if (opts.body !== void 0 && opts.bodySerializer) opts.serializedBody = opts.bodySerializer(opts.body);
|
|
482
|
+
if (opts.body === void 0 || opts.serializedBody === "") opts.headers.delete("Content-Type");
|
|
483
|
+
const resolvedOpts = opts;
|
|
484
|
+
return {
|
|
485
|
+
opts: resolvedOpts,
|
|
486
|
+
url: buildUrl(resolvedOpts)
|
|
487
|
+
};
|
|
488
|
+
};
|
|
489
|
+
const request = async (options) => {
|
|
490
|
+
const throwOnError = options.throwOnError ?? _config.throwOnError;
|
|
491
|
+
const responseStyle = options.responseStyle ?? _config.responseStyle;
|
|
492
|
+
let request;
|
|
493
|
+
let response;
|
|
494
|
+
try {
|
|
495
|
+
const { opts, url } = await beforeRequest(options);
|
|
496
|
+
const requestInit = {
|
|
497
|
+
redirect: "follow",
|
|
498
|
+
...opts,
|
|
499
|
+
body: getValidRequestBody(opts)
|
|
500
|
+
};
|
|
501
|
+
request = new Request(url, requestInit);
|
|
502
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
503
|
+
const _fetch = opts.fetch;
|
|
504
|
+
response = await _fetch(request);
|
|
505
|
+
for (const fn of interceptors.response.fns) if (fn) response = await fn(response, request, opts);
|
|
506
|
+
const result = {
|
|
507
|
+
request,
|
|
508
|
+
response
|
|
509
|
+
};
|
|
510
|
+
if (response.ok) {
|
|
511
|
+
const parseAs = (opts.parseAs === "auto" ? getParseAs(response.headers.get("Content-Type")) : opts.parseAs) ?? "json";
|
|
512
|
+
if (response.status === 204 || response.headers.get("Content-Length") === "0") {
|
|
513
|
+
let emptyData;
|
|
514
|
+
switch (parseAs) {
|
|
515
|
+
case "arrayBuffer":
|
|
516
|
+
case "blob":
|
|
517
|
+
case "text":
|
|
518
|
+
emptyData = await response[parseAs]();
|
|
519
|
+
break;
|
|
520
|
+
case "formData":
|
|
521
|
+
emptyData = new FormData();
|
|
522
|
+
break;
|
|
523
|
+
case "stream":
|
|
524
|
+
emptyData = response.body;
|
|
525
|
+
break;
|
|
526
|
+
default:
|
|
527
|
+
emptyData = {};
|
|
528
|
+
break;
|
|
529
|
+
}
|
|
530
|
+
return opts.responseStyle === "data" ? emptyData : {
|
|
531
|
+
data: emptyData,
|
|
532
|
+
...result
|
|
533
|
+
};
|
|
534
|
+
}
|
|
535
|
+
let data;
|
|
536
|
+
switch (parseAs) {
|
|
537
|
+
case "arrayBuffer":
|
|
538
|
+
case "blob":
|
|
539
|
+
case "formData":
|
|
540
|
+
case "text":
|
|
541
|
+
data = await response[parseAs]();
|
|
542
|
+
break;
|
|
543
|
+
case "json": {
|
|
544
|
+
const text = await response.text();
|
|
545
|
+
data = text ? JSON.parse(text) : {};
|
|
546
|
+
break;
|
|
547
|
+
}
|
|
548
|
+
case "stream": return opts.responseStyle === "data" ? response.body : {
|
|
549
|
+
data: response.body,
|
|
550
|
+
...result
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
if (parseAs === "json") {
|
|
554
|
+
if (opts.responseValidator) await opts.responseValidator(data);
|
|
555
|
+
if (opts.responseTransformer) data = await opts.responseTransformer(data);
|
|
556
|
+
}
|
|
557
|
+
return opts.responseStyle === "data" ? data : {
|
|
558
|
+
data,
|
|
559
|
+
...result
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
const textError = await response.text();
|
|
563
|
+
let jsonError;
|
|
564
|
+
try {
|
|
565
|
+
jsonError = JSON.parse(textError);
|
|
566
|
+
} catch {}
|
|
567
|
+
throw jsonError ?? textError;
|
|
568
|
+
} catch (error) {
|
|
569
|
+
let finalError = error;
|
|
570
|
+
for (const fn of interceptors.error.fns) if (fn) finalError = await fn(finalError, response, request, options);
|
|
571
|
+
finalError = finalError || {};
|
|
572
|
+
if (throwOnError) throw finalError;
|
|
573
|
+
return responseStyle === "data" ? void 0 : {
|
|
574
|
+
error: finalError,
|
|
575
|
+
request,
|
|
576
|
+
response
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
};
|
|
580
|
+
const makeMethodFn = (method) => (options) => request({
|
|
581
|
+
...options,
|
|
582
|
+
method
|
|
583
|
+
});
|
|
584
|
+
const makeSseFn = (method) => async (options) => {
|
|
585
|
+
const { opts, url } = await beforeRequest(options);
|
|
586
|
+
return createSseClient({
|
|
587
|
+
...opts,
|
|
588
|
+
body: opts.body,
|
|
589
|
+
method,
|
|
590
|
+
onRequest: async (url, init) => {
|
|
591
|
+
let request = new Request(url, init);
|
|
592
|
+
for (const fn of interceptors.request.fns) if (fn) request = await fn(request, opts);
|
|
593
|
+
return request;
|
|
594
|
+
},
|
|
595
|
+
serializedBody: getValidRequestBody(opts),
|
|
596
|
+
url
|
|
597
|
+
});
|
|
598
|
+
};
|
|
599
|
+
const _buildUrl = (options) => buildUrl({
|
|
600
|
+
..._config,
|
|
601
|
+
...options
|
|
602
|
+
});
|
|
603
|
+
return {
|
|
604
|
+
buildUrl: _buildUrl,
|
|
605
|
+
connect: makeMethodFn("CONNECT"),
|
|
606
|
+
delete: makeMethodFn("DELETE"),
|
|
607
|
+
get: makeMethodFn("GET"),
|
|
608
|
+
getConfig,
|
|
609
|
+
head: makeMethodFn("HEAD"),
|
|
610
|
+
interceptors,
|
|
611
|
+
options: makeMethodFn("OPTIONS"),
|
|
612
|
+
patch: makeMethodFn("PATCH"),
|
|
613
|
+
post: makeMethodFn("POST"),
|
|
614
|
+
put: makeMethodFn("PUT"),
|
|
615
|
+
request,
|
|
616
|
+
setConfig,
|
|
617
|
+
sse: {
|
|
618
|
+
connect: makeSseFn("CONNECT"),
|
|
619
|
+
delete: makeSseFn("DELETE"),
|
|
620
|
+
get: makeSseFn("GET"),
|
|
621
|
+
head: makeSseFn("HEAD"),
|
|
622
|
+
options: makeSseFn("OPTIONS"),
|
|
623
|
+
patch: makeSseFn("PATCH"),
|
|
624
|
+
post: makeSseFn("POST"),
|
|
625
|
+
put: makeSseFn("PUT"),
|
|
626
|
+
trace: makeSseFn("TRACE")
|
|
627
|
+
},
|
|
628
|
+
trace: makeMethodFn("TRACE")
|
|
629
|
+
};
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
//#endregion
|
|
633
|
+
//#region src/client.gen.ts
|
|
634
|
+
const client = createClient(createConfig());
|
|
635
|
+
|
|
636
|
+
//#endregion
|
|
637
|
+
//#region src/sdk.gen.ts
|
|
638
|
+
/**
|
|
639
|
+
* List posts in a feed
|
|
640
|
+
*
|
|
641
|
+
* Retrieve posts in a feed, with pagination.
|
|
642
|
+
*/
|
|
643
|
+
const getFeedsByFeedId = (options) => (options.client ?? client).get({
|
|
644
|
+
url: "/feeds/{feedId}",
|
|
645
|
+
...options
|
|
646
|
+
});
|
|
647
|
+
/**
|
|
648
|
+
* Get a post
|
|
649
|
+
*
|
|
650
|
+
* Retrieve a post from feed by its ID
|
|
651
|
+
*/
|
|
652
|
+
const getFeedsByFeedIdByPostId = (options) => (options.client ?? client).get({
|
|
653
|
+
url: "/feeds/{feedId}/{postId}",
|
|
654
|
+
...options
|
|
655
|
+
});
|
|
656
|
+
/**
|
|
657
|
+
* List posts by creator
|
|
658
|
+
*
|
|
659
|
+
* Retrieve posts in a feed by a specific creator, with pagination.
|
|
660
|
+
*/
|
|
661
|
+
const getFeedsByFeedIdCreatorsByCreatorId = (options) => (options.client ?? client).get({
|
|
662
|
+
url: "/feeds/{feedId}/creators/{creatorId}",
|
|
663
|
+
...options
|
|
664
|
+
});
|
|
665
|
+
/**
|
|
666
|
+
* List images for a project
|
|
667
|
+
*
|
|
668
|
+
* Retrieve all images for a specific project, with pagination and sorting.
|
|
669
|
+
*/
|
|
670
|
+
const getImages = (options) => (options?.client ?? client).get({
|
|
671
|
+
security: [{
|
|
672
|
+
name: "X-API-Key",
|
|
673
|
+
type: "apiKey"
|
|
674
|
+
}],
|
|
675
|
+
url: "/images",
|
|
676
|
+
...options
|
|
677
|
+
});
|
|
678
|
+
/**
|
|
679
|
+
* Delete image
|
|
680
|
+
*
|
|
681
|
+
* delete an image by marking it as deleted
|
|
682
|
+
*/
|
|
683
|
+
const deleteImagesByImageId = (options) => (options.client ?? client).delete({
|
|
684
|
+
security: [{
|
|
685
|
+
name: "X-API-Key",
|
|
686
|
+
type: "apiKey"
|
|
687
|
+
}],
|
|
688
|
+
url: "/images/{imageId}",
|
|
689
|
+
...options
|
|
690
|
+
});
|
|
691
|
+
/**
|
|
692
|
+
* Get image
|
|
693
|
+
*
|
|
694
|
+
* Retrieve an image by its ID for a specific project.
|
|
695
|
+
*/
|
|
696
|
+
const getImagesByImageId = (options) => (options.client ?? client).get({
|
|
697
|
+
security: [{
|
|
698
|
+
name: "X-API-Key",
|
|
699
|
+
type: "apiKey"
|
|
700
|
+
}],
|
|
701
|
+
url: "/images/{imageId}",
|
|
702
|
+
...options
|
|
703
|
+
});
|
|
704
|
+
/**
|
|
705
|
+
* Upload: Mark as complete
|
|
706
|
+
*
|
|
707
|
+
* Complete the upload process and create the image record using API key authentication
|
|
708
|
+
*/
|
|
709
|
+
const postImagesUploadComplete = (options) => (options.client ?? client).post({
|
|
710
|
+
security: [{
|
|
711
|
+
name: "X-API-Key",
|
|
712
|
+
type: "apiKey"
|
|
713
|
+
}],
|
|
714
|
+
url: "/images/upload/complete",
|
|
715
|
+
...options,
|
|
716
|
+
headers: {
|
|
717
|
+
"Content-Type": "application/json",
|
|
718
|
+
...options.headers
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
/**
|
|
722
|
+
* Upload: Init
|
|
723
|
+
*
|
|
724
|
+
* Initialize a presigned URL upload for an image file using API key authentication
|
|
725
|
+
*/
|
|
726
|
+
const postImagesUploadInit = (options) => (options.client ?? client).post({
|
|
727
|
+
security: [{
|
|
728
|
+
name: "X-API-Key",
|
|
729
|
+
type: "apiKey"
|
|
730
|
+
}],
|
|
731
|
+
url: "/images/upload/init",
|
|
732
|
+
...options,
|
|
733
|
+
headers: {
|
|
734
|
+
"Content-Type": "application/json",
|
|
735
|
+
...options.headers
|
|
736
|
+
}
|
|
737
|
+
});
|
|
738
|
+
/**
|
|
739
|
+
* List videos for a project
|
|
740
|
+
*
|
|
741
|
+
* Retrieve all videos for a specific project, with pagination and sorting.
|
|
742
|
+
*/
|
|
743
|
+
const getVideos = (options) => (options?.client ?? client).get({
|
|
744
|
+
security: [{
|
|
745
|
+
name: "X-API-Key",
|
|
746
|
+
type: "apiKey"
|
|
747
|
+
}],
|
|
748
|
+
url: "/videos",
|
|
749
|
+
...options
|
|
750
|
+
});
|
|
751
|
+
/**
|
|
752
|
+
* Get a video
|
|
753
|
+
*
|
|
754
|
+
* Retrieve a video by its ID for a specific project.
|
|
755
|
+
*/
|
|
756
|
+
const getVideosByVideoId = (options) => (options.client ?? client).get({
|
|
757
|
+
security: [{
|
|
758
|
+
name: "X-API-Key",
|
|
759
|
+
type: "apiKey"
|
|
760
|
+
}],
|
|
761
|
+
url: "/videos/{videoId}",
|
|
762
|
+
...options
|
|
763
|
+
});
|
|
764
|
+
/**
|
|
765
|
+
* Delete all audio tracks
|
|
766
|
+
*
|
|
767
|
+
* Remove all additional audio tracks from a video using API key authentication
|
|
768
|
+
*/
|
|
769
|
+
const deleteVideosByVideoIdAudioTracks = (options) => (options.client ?? client).delete({
|
|
770
|
+
security: [{
|
|
771
|
+
name: "X-API-Key",
|
|
772
|
+
type: "apiKey"
|
|
773
|
+
}],
|
|
774
|
+
url: "/videos/{videoId}/audio-tracks",
|
|
775
|
+
...options
|
|
776
|
+
});
|
|
777
|
+
/**
|
|
778
|
+
* Bulk upsert video audio tracks
|
|
779
|
+
*
|
|
780
|
+
* Replace all audio tracks with the provided ones using API key authentication
|
|
781
|
+
*/
|
|
782
|
+
const postVideosByVideoIdAudioTracks = (options) => (options.client ?? client).post({
|
|
783
|
+
...formDataBodySerializer,
|
|
784
|
+
security: [{
|
|
785
|
+
name: "X-API-Key",
|
|
786
|
+
type: "apiKey"
|
|
787
|
+
}],
|
|
788
|
+
url: "/videos/{videoId}/audio-tracks",
|
|
789
|
+
...options,
|
|
790
|
+
headers: {
|
|
791
|
+
"Content-Type": null,
|
|
792
|
+
...options.headers
|
|
793
|
+
}
|
|
794
|
+
});
|
|
795
|
+
/**
|
|
796
|
+
* Delete audio track
|
|
797
|
+
*
|
|
798
|
+
* Remove an additional audio track from a video using API key authentication
|
|
799
|
+
*/
|
|
800
|
+
const deleteVideosByVideoIdAudioTracksByTrackId = (options) => (options.client ?? client).delete({
|
|
801
|
+
security: [{
|
|
802
|
+
name: "X-API-Key",
|
|
803
|
+
type: "apiKey"
|
|
804
|
+
}],
|
|
805
|
+
url: "/videos/{videoId}/audio-tracks/{trackId}",
|
|
806
|
+
...options
|
|
807
|
+
});
|
|
808
|
+
/**
|
|
809
|
+
* Delete audio track by language
|
|
810
|
+
*
|
|
811
|
+
* Remove an audio track for a specific language using API key authentication
|
|
812
|
+
*/
|
|
813
|
+
const deleteVideosByVideoIdAudioTracksLanguageByLangCode = (options) => (options.client ?? client).delete({
|
|
814
|
+
security: [{
|
|
815
|
+
name: "X-API-Key",
|
|
816
|
+
type: "apiKey"
|
|
817
|
+
}],
|
|
818
|
+
url: "/videos/{videoId}/audio-tracks/language/{lang_code}",
|
|
819
|
+
...options
|
|
820
|
+
});
|
|
821
|
+
/**
|
|
822
|
+
* Upsert video audio track
|
|
823
|
+
*
|
|
824
|
+
* Add or replace an audio track for a specific language using API key authentication
|
|
825
|
+
*/
|
|
826
|
+
const putVideosByVideoIdAudioTracksLanguageByLangCode = (options) => (options.client ?? client).put({
|
|
827
|
+
...formDataBodySerializer,
|
|
828
|
+
security: [{
|
|
829
|
+
name: "X-API-Key",
|
|
830
|
+
type: "apiKey"
|
|
831
|
+
}],
|
|
832
|
+
url: "/videos/{videoId}/audio-tracks/language/{lang_code}",
|
|
833
|
+
...options,
|
|
834
|
+
headers: {
|
|
835
|
+
"Content-Type": null,
|
|
836
|
+
...options.headers
|
|
837
|
+
}
|
|
838
|
+
});
|
|
839
|
+
/**
|
|
840
|
+
* Delete video chapters
|
|
841
|
+
*
|
|
842
|
+
* Remove all chapters from a video using API key authentication
|
|
843
|
+
*/
|
|
844
|
+
const deleteVideosByVideoIdChapters = (options) => (options.client ?? client).delete({
|
|
845
|
+
security: [{
|
|
846
|
+
name: "X-API-Key",
|
|
847
|
+
type: "apiKey"
|
|
848
|
+
}],
|
|
849
|
+
url: "/videos/{videoId}/chapters",
|
|
850
|
+
...options
|
|
851
|
+
});
|
|
852
|
+
/**
|
|
853
|
+
* Update video chapters
|
|
854
|
+
*
|
|
855
|
+
* Replace all chapters for a video (atomic PUT operation) using API key authentication
|
|
856
|
+
*/
|
|
857
|
+
const putVideosByVideoIdChapters = (options) => (options.client ?? client).put({
|
|
858
|
+
security: [{
|
|
859
|
+
name: "X-API-Key",
|
|
860
|
+
type: "apiKey"
|
|
861
|
+
}],
|
|
862
|
+
url: "/videos/{videoId}/chapters",
|
|
863
|
+
...options,
|
|
864
|
+
headers: {
|
|
865
|
+
"Content-Type": "application/json",
|
|
866
|
+
...options.headers
|
|
867
|
+
}
|
|
868
|
+
});
|
|
869
|
+
/**
|
|
870
|
+
* Delete video
|
|
871
|
+
*
|
|
872
|
+
* Delete a video by its ID within a project
|
|
873
|
+
*/
|
|
874
|
+
const deleteVideosByVideoIdDelete = (options) => (options.client ?? client).delete({
|
|
875
|
+
security: [{
|
|
876
|
+
name: "X-API-Key",
|
|
877
|
+
type: "apiKey"
|
|
878
|
+
}],
|
|
879
|
+
url: "/videos/{videoId}/delete",
|
|
880
|
+
...options
|
|
881
|
+
});
|
|
882
|
+
/**
|
|
883
|
+
* Delete all subtitles
|
|
884
|
+
*
|
|
885
|
+
* Remove all subtitles from a video using API key authentication
|
|
886
|
+
*/
|
|
887
|
+
const deleteVideosByVideoIdSubtitles = (options) => (options.client ?? client).delete({
|
|
888
|
+
security: [{
|
|
889
|
+
name: "X-API-Key",
|
|
890
|
+
type: "apiKey"
|
|
891
|
+
}],
|
|
892
|
+
url: "/videos/{videoId}/subtitles",
|
|
893
|
+
...options
|
|
894
|
+
});
|
|
895
|
+
/**
|
|
896
|
+
* Bulk upsert video subtitles
|
|
897
|
+
*
|
|
898
|
+
* Replace all subtitles with the provided ones using API key authentication
|
|
899
|
+
*/
|
|
900
|
+
const postVideosByVideoIdSubtitles = (options) => (options.client ?? client).post({
|
|
901
|
+
...formDataBodySerializer,
|
|
902
|
+
security: [{
|
|
903
|
+
name: "X-API-Key",
|
|
904
|
+
type: "apiKey"
|
|
905
|
+
}],
|
|
906
|
+
url: "/videos/{videoId}/subtitles",
|
|
907
|
+
...options,
|
|
908
|
+
headers: {
|
|
909
|
+
"Content-Type": null,
|
|
910
|
+
...options.headers
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
/**
|
|
914
|
+
* Delete subtitle
|
|
915
|
+
*
|
|
916
|
+
* Remove a subtitle from a video using API key authentication
|
|
917
|
+
*/
|
|
918
|
+
const deleteVideosByVideoIdSubtitlesBySubtitleId = (options) => (options.client ?? client).delete({
|
|
919
|
+
security: [{
|
|
920
|
+
name: "X-API-Key",
|
|
921
|
+
type: "apiKey"
|
|
922
|
+
}],
|
|
923
|
+
url: "/videos/{videoId}/subtitles/{subtitleId}",
|
|
924
|
+
...options
|
|
925
|
+
});
|
|
926
|
+
/**
|
|
927
|
+
* Delete subtitle by language
|
|
928
|
+
*
|
|
929
|
+
* Remove a subtitle for a specific language using API key authentication
|
|
930
|
+
*/
|
|
931
|
+
const deleteVideosByVideoIdSubtitlesLanguageByLangCode = (options) => (options.client ?? client).delete({
|
|
932
|
+
security: [{
|
|
933
|
+
name: "X-API-Key",
|
|
934
|
+
type: "apiKey"
|
|
935
|
+
}],
|
|
936
|
+
url: "/videos/{videoId}/subtitles/language/{lang_code}",
|
|
937
|
+
...options
|
|
938
|
+
});
|
|
939
|
+
/**
|
|
940
|
+
* Upsert video subtitle
|
|
941
|
+
*
|
|
942
|
+
* Add or replace a subtitle for a specific language using API key authentication
|
|
943
|
+
*/
|
|
944
|
+
const putVideosByVideoIdSubtitlesLanguageByLangCode = (options) => (options.client ?? client).put({
|
|
945
|
+
...formDataBodySerializer,
|
|
946
|
+
security: [{
|
|
947
|
+
name: "X-API-Key",
|
|
948
|
+
type: "apiKey"
|
|
949
|
+
}],
|
|
950
|
+
url: "/videos/{videoId}/subtitles/language/{lang_code}",
|
|
951
|
+
...options,
|
|
952
|
+
headers: {
|
|
953
|
+
"Content-Type": null,
|
|
954
|
+
...options.headers
|
|
955
|
+
}
|
|
956
|
+
});
|
|
957
|
+
/**
|
|
958
|
+
* Update video thumbnail
|
|
959
|
+
*
|
|
960
|
+
* Update the thumbnail image for an existing video using API key authentication
|
|
961
|
+
*/
|
|
962
|
+
const putVideosByVideoIdThumbnail = (options) => (options.client ?? client).put({
|
|
963
|
+
...formDataBodySerializer,
|
|
964
|
+
security: [{
|
|
965
|
+
name: "X-API-Key",
|
|
966
|
+
type: "apiKey"
|
|
967
|
+
}],
|
|
968
|
+
url: "/videos/{videoId}/thumbnail",
|
|
969
|
+
...options,
|
|
970
|
+
headers: {
|
|
971
|
+
"Content-Type": null,
|
|
972
|
+
...options.headers
|
|
973
|
+
}
|
|
974
|
+
});
|
|
975
|
+
/**
|
|
976
|
+
* List available subtitle languages
|
|
977
|
+
*
|
|
978
|
+
* Get list of supported languages for subtitles
|
|
979
|
+
*/
|
|
980
|
+
const getVideosLanguages = (options) => (options?.client ?? client).get({
|
|
981
|
+
url: "/videos/languages",
|
|
982
|
+
...options
|
|
983
|
+
});
|
|
984
|
+
/**
|
|
985
|
+
* Upload: Mark as complete
|
|
986
|
+
*
|
|
987
|
+
* Mark a video upload as complete after successful upload to storage using API key authentication
|
|
988
|
+
*/
|
|
989
|
+
const postVideosUploadComplete = (options) => (options.client ?? client).post({
|
|
990
|
+
security: [{
|
|
991
|
+
name: "X-API-Key",
|
|
992
|
+
type: "apiKey"
|
|
993
|
+
}],
|
|
994
|
+
url: "/videos/upload/complete",
|
|
995
|
+
...options,
|
|
996
|
+
headers: {
|
|
997
|
+
"Content-Type": "application/json",
|
|
998
|
+
...options.headers
|
|
999
|
+
}
|
|
1000
|
+
});
|
|
1001
|
+
/**
|
|
1002
|
+
* Upload: Init
|
|
1003
|
+
*
|
|
1004
|
+
* Initialize a video upload and get presigned URLs for video and poster using API key authentication
|
|
1005
|
+
*/
|
|
1006
|
+
const postVideosUploadInit = (options) => (options.client ?? client).post({
|
|
1007
|
+
security: [{
|
|
1008
|
+
name: "X-API-Key",
|
|
1009
|
+
type: "apiKey"
|
|
1010
|
+
}],
|
|
1011
|
+
url: "/videos/upload/init",
|
|
1012
|
+
...options,
|
|
1013
|
+
headers: {
|
|
1014
|
+
"Content-Type": "application/json",
|
|
1015
|
+
...options.headers
|
|
1016
|
+
}
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
//#endregion
|
|
1020
|
+
export { deleteImagesByImageId, deleteVideosByVideoIdAudioTracks, deleteVideosByVideoIdAudioTracksByTrackId, deleteVideosByVideoIdAudioTracksLanguageByLangCode, deleteVideosByVideoIdChapters, deleteVideosByVideoIdDelete, deleteVideosByVideoIdSubtitles, deleteVideosByVideoIdSubtitlesBySubtitleId, deleteVideosByVideoIdSubtitlesLanguageByLangCode, getFeedsByFeedId, getFeedsByFeedIdByPostId, getFeedsByFeedIdCreatorsByCreatorId, getImages, getImagesByImageId, getVideos, getVideosByVideoId, getVideosLanguages, postImagesUploadComplete, postImagesUploadInit, postVideosByVideoIdAudioTracks, postVideosByVideoIdSubtitles, postVideosUploadComplete, postVideosUploadInit, putVideosByVideoIdAudioTracksLanguageByLangCode, putVideosByVideoIdChapters, putVideosByVideoIdSubtitlesLanguageByLangCode, putVideosByVideoIdThumbnail };
|
|
1021
|
+
//# sourceMappingURL=index.js.map
|