@sync.so/sdk 0.1.9 → 0.2.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/Client.d.ts +3 -0
- package/Client.js +7 -2
- package/api/resources/batch/client/Client.d.ts +89 -0
- package/api/resources/batch/client/Client.js +297 -0
- package/api/resources/batch/client/index.d.ts +1 -0
- package/api/resources/batch/client/index.js +17 -0
- package/api/resources/batch/client/requests/CreateBatchRequest.d.ts +21 -0
- package/api/resources/batch/client/requests/CreateBatchRequest.js +5 -0
- package/api/resources/batch/client/requests/ListBatchesRequest.d.ts +22 -0
- package/api/resources/batch/client/requests/ListBatchesRequest.js +5 -0
- package/api/resources/batch/client/requests/index.d.ts +2 -0
- package/api/resources/batch/client/requests/index.js +2 -0
- package/api/resources/batch/index.d.ts +1 -0
- package/api/resources/batch/index.js +17 -0
- package/api/resources/common/errors/PaymentRequiredError.d.ts +9 -0
- package/api/resources/common/errors/PaymentRequiredError.js +52 -0
- package/api/resources/common/errors/TooManyRequestsError.d.ts +9 -0
- package/api/resources/common/errors/TooManyRequestsError.js +52 -0
- package/api/resources/common/errors/index.d.ts +2 -0
- package/api/resources/common/errors/index.js +2 -0
- package/api/resources/common/types/ActiveSpeaker.d.ts +10 -0
- package/api/resources/common/types/ActiveSpeaker.js +5 -0
- package/api/resources/common/types/BatchId.d.ts +7 -0
- package/api/resources/common/types/BatchId.js +5 -0
- package/api/resources/common/types/BatchMetrics.d.ts +13 -0
- package/api/resources/common/types/BatchMetrics.js +5 -0
- package/api/resources/common/types/BatchResponse.d.ts +17 -0
- package/api/resources/common/types/BatchResponse.js +5 -0
- package/api/resources/common/types/BatchStatus.d.ts +14 -0
- package/api/resources/common/types/BatchStatus.js +13 -0
- package/api/resources/common/types/CreateBatchResponse.d.ts +5 -0
- package/api/resources/common/types/CreateBatchResponse.js +5 -0
- package/api/resources/common/types/CreateGenerationDto.d.ts +2 -0
- package/api/resources/common/types/Generation.d.ts +2 -0
- package/api/resources/common/types/GenerationOptions.d.ts +6 -14
- package/api/resources/common/types/Model.d.ts +1 -4
- package/api/resources/common/types/Model.js +0 -3
- package/api/resources/common/types/SyncMode.d.ts +20 -2
- package/api/resources/common/types/SyncMode.js +1 -1
- package/api/resources/common/types/ValidationResponse.d.ts +7 -0
- package/api/resources/common/types/ValidationResponse.js +5 -0
- package/api/resources/common/types/index.d.ts +7 -0
- package/api/resources/common/types/index.js +7 -0
- package/api/resources/generations/client/Client.d.ts +19 -0
- package/api/resources/generations/client/Client.js +93 -4
- package/api/resources/generations/client/requests/CreateGenerationRequest.d.ts +17 -0
- package/api/resources/generations/client/requests/CreateGenerationRequest.js +5 -0
- package/api/resources/generations/client/requests/index.d.ts +1 -0
- package/api/resources/index.d.ts +2 -0
- package/api/resources/index.js +3 -1
- package/api/resources/webhooks/types/GenerationNotification.d.ts +2 -0
- package/core/form-data-utils/FormDataWrapper.d.ts +63 -0
- package/core/form-data-utils/FormDataWrapper.js +227 -0
- package/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/core/form-data-utils/index.d.ts +2 -0
- package/core/form-data-utils/index.js +20 -0
- package/core/index.d.ts +1 -0
- package/core/index.js +1 -0
- package/dist/Client.d.ts +3 -0
- package/dist/Client.js +7 -2
- package/dist/api/resources/batch/client/Client.d.ts +89 -0
- package/dist/api/resources/batch/client/Client.js +297 -0
- package/dist/api/resources/batch/client/index.d.ts +1 -0
- package/dist/api/resources/batch/client/index.js +17 -0
- package/dist/api/resources/batch/client/requests/CreateBatchRequest.d.ts +21 -0
- package/dist/api/resources/batch/client/requests/CreateBatchRequest.js +5 -0
- package/dist/api/resources/batch/client/requests/ListBatchesRequest.d.ts +22 -0
- package/dist/api/resources/batch/client/requests/ListBatchesRequest.js +5 -0
- package/dist/api/resources/batch/client/requests/index.d.ts +2 -0
- package/dist/api/resources/batch/client/requests/index.js +2 -0
- package/dist/api/resources/batch/index.d.ts +1 -0
- package/dist/api/resources/batch/index.js +17 -0
- package/dist/api/resources/common/errors/PaymentRequiredError.d.ts +9 -0
- package/dist/api/resources/common/errors/PaymentRequiredError.js +52 -0
- package/dist/api/resources/common/errors/TooManyRequestsError.d.ts +9 -0
- package/dist/api/resources/common/errors/TooManyRequestsError.js +52 -0
- package/dist/api/resources/common/errors/index.d.ts +2 -0
- package/dist/api/resources/common/errors/index.js +2 -0
- package/dist/api/resources/common/types/ActiveSpeaker.d.ts +10 -0
- package/dist/api/resources/common/types/ActiveSpeaker.js +5 -0
- package/dist/api/resources/common/types/BatchId.d.ts +7 -0
- package/dist/api/resources/common/types/BatchId.js +5 -0
- package/dist/api/resources/common/types/BatchMetrics.d.ts +13 -0
- package/dist/api/resources/common/types/BatchMetrics.js +5 -0
- package/dist/api/resources/common/types/BatchResponse.d.ts +17 -0
- package/dist/api/resources/common/types/BatchResponse.js +5 -0
- package/dist/api/resources/common/types/BatchStatus.d.ts +14 -0
- package/dist/api/resources/common/types/BatchStatus.js +13 -0
- package/dist/api/resources/common/types/CreateBatchResponse.d.ts +5 -0
- package/dist/api/resources/common/types/CreateBatchResponse.js +5 -0
- package/dist/api/resources/common/types/CreateGenerationDto.d.ts +2 -0
- package/dist/api/resources/common/types/Generation.d.ts +2 -0
- package/dist/api/resources/common/types/GenerationOptions.d.ts +6 -14
- package/dist/api/resources/common/types/Model.d.ts +1 -4
- package/dist/api/resources/common/types/Model.js +0 -3
- package/dist/api/resources/common/types/SyncMode.d.ts +20 -2
- package/dist/api/resources/common/types/SyncMode.js +1 -1
- package/dist/api/resources/common/types/ValidationResponse.d.ts +7 -0
- package/dist/api/resources/common/types/ValidationResponse.js +5 -0
- package/dist/api/resources/common/types/index.d.ts +7 -0
- package/dist/api/resources/common/types/index.js +7 -0
- package/dist/api/resources/generations/client/Client.d.ts +19 -0
- package/dist/api/resources/generations/client/Client.js +93 -4
- package/dist/api/resources/generations/client/requests/CreateGenerationRequest.d.ts +17 -0
- package/dist/api/resources/generations/client/requests/CreateGenerationRequest.js +5 -0
- package/dist/api/resources/generations/client/requests/index.d.ts +1 -0
- package/dist/api/resources/index.d.ts +2 -0
- package/dist/api/resources/index.js +3 -1
- package/dist/api/resources/webhooks/types/GenerationNotification.d.ts +2 -0
- package/dist/core/form-data-utils/FormDataWrapper.d.ts +63 -0
- package/dist/core/form-data-utils/FormDataWrapper.js +227 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.d.ts +4 -0
- package/dist/core/form-data-utils/encodeAsFormParameter.js +18 -0
- package/dist/core/form-data-utils/index.d.ts +2 -0
- package/dist/core/form-data-utils/index.js +20 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/environments.d.ts +2 -1
- package/dist/environments.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/environments.d.ts +2 -1
- package/environments.js +1 -0
- package/package.json +3 -2
- package/reference.md +272 -0
- package/version.d.ts +1 -1
- package/version.js +1 -1
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
39
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
40
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
41
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
42
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
43
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
44
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
45
|
+
});
|
|
46
|
+
};
|
|
47
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
+
};
|
|
50
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
51
|
+
exports.Batch = void 0;
|
|
52
|
+
const environments = __importStar(require("../../../../environments"));
|
|
53
|
+
const core = __importStar(require("../../../../core"));
|
|
54
|
+
const Sync = __importStar(require("../../../index"));
|
|
55
|
+
const url_join_1 = __importDefault(require("url-join"));
|
|
56
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
57
|
+
class Batch {
|
|
58
|
+
constructor(_options) {
|
|
59
|
+
this._options = _options;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* API for [Batch Processing](/api-reference/guides/batch-processing). Available only for `Scale` and `Enterprise` plans.
|
|
63
|
+
*
|
|
64
|
+
* @param {File | fs.ReadStream | Blob} input
|
|
65
|
+
* @param {Sync.CreateBatchRequest} request
|
|
66
|
+
* @param {Batch.RequestOptions} requestOptions - Request-specific configuration.
|
|
67
|
+
*
|
|
68
|
+
* @throws {@link Sync.BadRequestError}
|
|
69
|
+
* @throws {@link Sync.UnauthorizedError}
|
|
70
|
+
* @throws {@link Sync.PaymentRequiredError}
|
|
71
|
+
* @throws {@link Sync.TooManyRequestsError}
|
|
72
|
+
* @throws {@link Sync.InternalServerError}
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* await client.batch.create(fs.createReadStream("/path/to/your/file"), {
|
|
76
|
+
* webhook_url: "https://your-webhook-url.com/batch-webhook",
|
|
77
|
+
* dry_run: false
|
|
78
|
+
* })
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* await client.batch.create(fs.createReadStream("/path/to/your/file"), {
|
|
82
|
+
* dry_run: true
|
|
83
|
+
* })
|
|
84
|
+
*/
|
|
85
|
+
create(input, request, requestOptions) {
|
|
86
|
+
return core.HttpResponsePromise.fromPromise(this.__create(input, request, requestOptions));
|
|
87
|
+
}
|
|
88
|
+
__create(input, request, requestOptions) {
|
|
89
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
var _a, _b, _c;
|
|
91
|
+
const _request = yield core.newFormData();
|
|
92
|
+
yield _request.appendFile("input", input);
|
|
93
|
+
if (request.webhook_url != null) {
|
|
94
|
+
_request.append("webhook_url", request.webhook_url);
|
|
95
|
+
}
|
|
96
|
+
if (request.dry_run != null) {
|
|
97
|
+
_request.append("dry_run", request.dry_run.toString());
|
|
98
|
+
}
|
|
99
|
+
const _maybeEncodedRequest = yield _request.getRequest();
|
|
100
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
101
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SyncEnvironment.Default, "/v2/batch"),
|
|
102
|
+
method: "POST",
|
|
103
|
+
headers: Object.assign(Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.2.1", "User-Agent": "@sync.so/sdk/0.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), _maybeEncodedRequest.headers), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
104
|
+
requestType: "file",
|
|
105
|
+
duplex: _maybeEncodedRequest.duplex,
|
|
106
|
+
body: _maybeEncodedRequest.body,
|
|
107
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
108
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
109
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
110
|
+
});
|
|
111
|
+
if (_response.ok) {
|
|
112
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
113
|
+
}
|
|
114
|
+
if (_response.error.reason === "status-code") {
|
|
115
|
+
switch (_response.error.statusCode) {
|
|
116
|
+
case 400:
|
|
117
|
+
throw new Sync.BadRequestError(_response.error.body, _response.rawResponse);
|
|
118
|
+
case 401:
|
|
119
|
+
throw new Sync.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
120
|
+
case 402:
|
|
121
|
+
throw new Sync.PaymentRequiredError(_response.error.body, _response.rawResponse);
|
|
122
|
+
case 429:
|
|
123
|
+
throw new Sync.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
124
|
+
case 500:
|
|
125
|
+
throw new Sync.InternalServerError(_response.error.body, _response.rawResponse);
|
|
126
|
+
default:
|
|
127
|
+
throw new errors.SyncError({
|
|
128
|
+
statusCode: _response.error.statusCode,
|
|
129
|
+
body: _response.error.body,
|
|
130
|
+
rawResponse: _response.rawResponse,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
switch (_response.error.reason) {
|
|
135
|
+
case "non-json":
|
|
136
|
+
throw new errors.SyncError({
|
|
137
|
+
statusCode: _response.error.statusCode,
|
|
138
|
+
body: _response.error.rawBody,
|
|
139
|
+
rawResponse: _response.rawResponse,
|
|
140
|
+
});
|
|
141
|
+
case "timeout":
|
|
142
|
+
throw new errors.SyncTimeoutError("Timeout exceeded when calling POST /v2/batch.");
|
|
143
|
+
case "unknown":
|
|
144
|
+
throw new errors.SyncError({
|
|
145
|
+
message: _response.error.errorMessage,
|
|
146
|
+
rawResponse: _response.rawResponse,
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Retrieve details about a specific batch, including its current status, processing metrics, and output file URL when available.
|
|
153
|
+
*
|
|
154
|
+
* @param {Sync.BatchId} id - The unique identifier of the batch
|
|
155
|
+
* @param {Batch.RequestOptions} requestOptions - Request-specific configuration.
|
|
156
|
+
*
|
|
157
|
+
* @throws {@link Sync.UnauthorizedError}
|
|
158
|
+
* @throws {@link Sync.NotFoundError}
|
|
159
|
+
* @throws {@link Sync.InternalServerError}
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* await client.batch.get("batch_abc123")
|
|
163
|
+
*/
|
|
164
|
+
get(id, requestOptions) {
|
|
165
|
+
return core.HttpResponsePromise.fromPromise(this.__get(id, requestOptions));
|
|
166
|
+
}
|
|
167
|
+
__get(id, requestOptions) {
|
|
168
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
169
|
+
var _a, _b, _c;
|
|
170
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
171
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SyncEnvironment.Default, `/v2/batch/${encodeURIComponent(id)}`),
|
|
172
|
+
method: "GET",
|
|
173
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.2.1", "User-Agent": "@sync.so/sdk/0.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
174
|
+
contentType: "application/json",
|
|
175
|
+
requestType: "json",
|
|
176
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
177
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
178
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
179
|
+
});
|
|
180
|
+
if (_response.ok) {
|
|
181
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
182
|
+
}
|
|
183
|
+
if (_response.error.reason === "status-code") {
|
|
184
|
+
switch (_response.error.statusCode) {
|
|
185
|
+
case 401:
|
|
186
|
+
throw new Sync.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
187
|
+
case 404:
|
|
188
|
+
throw new Sync.NotFoundError(_response.error.body, _response.rawResponse);
|
|
189
|
+
case 500:
|
|
190
|
+
throw new Sync.InternalServerError(_response.error.body, _response.rawResponse);
|
|
191
|
+
default:
|
|
192
|
+
throw new errors.SyncError({
|
|
193
|
+
statusCode: _response.error.statusCode,
|
|
194
|
+
body: _response.error.body,
|
|
195
|
+
rawResponse: _response.rawResponse,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
switch (_response.error.reason) {
|
|
200
|
+
case "non-json":
|
|
201
|
+
throw new errors.SyncError({
|
|
202
|
+
statusCode: _response.error.statusCode,
|
|
203
|
+
body: _response.error.rawBody,
|
|
204
|
+
rawResponse: _response.rawResponse,
|
|
205
|
+
});
|
|
206
|
+
case "timeout":
|
|
207
|
+
throw new errors.SyncTimeoutError("Timeout exceeded when calling GET /v2/batch/{id}.");
|
|
208
|
+
case "unknown":
|
|
209
|
+
throw new errors.SyncError({
|
|
210
|
+
message: _response.error.errorMessage,
|
|
211
|
+
rawResponse: _response.rawResponse,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* List all batches for your organization with optional filtering by status and creation date. Results are ordered by creation date (newest first).
|
|
218
|
+
*
|
|
219
|
+
* @param {Sync.ListBatchesRequest} request
|
|
220
|
+
* @param {Batch.RequestOptions} requestOptions - Request-specific configuration.
|
|
221
|
+
*
|
|
222
|
+
* @throws {@link Sync.UnauthorizedError}
|
|
223
|
+
* @throws {@link Sync.InternalServerError}
|
|
224
|
+
*
|
|
225
|
+
* @example
|
|
226
|
+
* await client.batch.list()
|
|
227
|
+
*/
|
|
228
|
+
list(request = {}, requestOptions) {
|
|
229
|
+
return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
|
|
230
|
+
}
|
|
231
|
+
__list() {
|
|
232
|
+
return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
|
|
233
|
+
var _a, _b, _c;
|
|
234
|
+
const { status, created_after: createdAfter, created_before: createdBefore } = request;
|
|
235
|
+
const _queryParams = {};
|
|
236
|
+
if (status != null) {
|
|
237
|
+
_queryParams["status"] = status;
|
|
238
|
+
}
|
|
239
|
+
if (createdAfter != null) {
|
|
240
|
+
_queryParams["created_after"] = createdAfter;
|
|
241
|
+
}
|
|
242
|
+
if (createdBefore != null) {
|
|
243
|
+
_queryParams["created_before"] = createdBefore;
|
|
244
|
+
}
|
|
245
|
+
const _response = yield ((_a = this._options.fetcher) !== null && _a !== void 0 ? _a : core.fetcher)({
|
|
246
|
+
url: (0, url_join_1.default)((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.SyncEnvironment.Default, "/v2/batch"),
|
|
247
|
+
method: "GET",
|
|
248
|
+
headers: Object.assign(Object.assign({ "X-Fern-Language": "JavaScript", "X-Fern-SDK-Name": "@sync.so/sdk", "X-Fern-SDK-Version": "0.2.1", "User-Agent": "@sync.so/sdk/0.2.1", "X-Fern-Runtime": core.RUNTIME.type, "X-Fern-Runtime-Version": core.RUNTIME.version }, (yield this._getCustomAuthorizationHeaders())), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers),
|
|
249
|
+
contentType: "application/json",
|
|
250
|
+
queryParameters: _queryParams,
|
|
251
|
+
requestType: "json",
|
|
252
|
+
timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
|
|
253
|
+
maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
|
|
254
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
255
|
+
});
|
|
256
|
+
if (_response.ok) {
|
|
257
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
258
|
+
}
|
|
259
|
+
if (_response.error.reason === "status-code") {
|
|
260
|
+
switch (_response.error.statusCode) {
|
|
261
|
+
case 401:
|
|
262
|
+
throw new Sync.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
263
|
+
case 500:
|
|
264
|
+
throw new Sync.InternalServerError(_response.error.body, _response.rawResponse);
|
|
265
|
+
default:
|
|
266
|
+
throw new errors.SyncError({
|
|
267
|
+
statusCode: _response.error.statusCode,
|
|
268
|
+
body: _response.error.body,
|
|
269
|
+
rawResponse: _response.rawResponse,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
switch (_response.error.reason) {
|
|
274
|
+
case "non-json":
|
|
275
|
+
throw new errors.SyncError({
|
|
276
|
+
statusCode: _response.error.statusCode,
|
|
277
|
+
body: _response.error.rawBody,
|
|
278
|
+
rawResponse: _response.rawResponse,
|
|
279
|
+
});
|
|
280
|
+
case "timeout":
|
|
281
|
+
throw new errors.SyncTimeoutError("Timeout exceeded when calling GET /v2/batch.");
|
|
282
|
+
case "unknown":
|
|
283
|
+
throw new errors.SyncError({
|
|
284
|
+
message: _response.error.errorMessage,
|
|
285
|
+
rawResponse: _response.rawResponse,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
});
|
|
289
|
+
}
|
|
290
|
+
_getCustomAuthorizationHeaders() {
|
|
291
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
292
|
+
const apiKeyValue = yield core.Supplier.get(this._options.apiKey);
|
|
293
|
+
return { "x-api-key": apiKeyValue };
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
exports.Batch = Batch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./requests";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./requests"), exports);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* webhook_url: "https://your-webhook-url.com/batch-webhook",
|
|
8
|
+
* dry_run: false
|
|
9
|
+
* }
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* {
|
|
13
|
+
* dry_run: true
|
|
14
|
+
* }
|
|
15
|
+
*/
|
|
16
|
+
export interface CreateBatchRequest {
|
|
17
|
+
/** Optional webhook URL to receive batch completion notifications. A POST request will be sent when the batch completes or fails. */
|
|
18
|
+
webhook_url?: string;
|
|
19
|
+
/** When true, validates the input file without processing. Returns validation status without creating generations. */
|
|
20
|
+
dry_run?: boolean;
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Sync from "../../../../index";
|
|
5
|
+
/**
|
|
6
|
+
* @example
|
|
7
|
+
* {}
|
|
8
|
+
*/
|
|
9
|
+
export interface ListBatchesRequest {
|
|
10
|
+
/**
|
|
11
|
+
* Filter batches by status
|
|
12
|
+
*/
|
|
13
|
+
status?: Sync.BatchStatus;
|
|
14
|
+
/**
|
|
15
|
+
* Filter batches created after this datetime (ISO 8601 format)
|
|
16
|
+
*/
|
|
17
|
+
created_after?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Filter batches created before this datetime (ISO 8601 format)
|
|
20
|
+
*/
|
|
21
|
+
created_before?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./client";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./client"), exports);
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../../../errors/index";
|
|
5
|
+
import * as Sync from "../../../index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare class PaymentRequiredError extends errors.SyncError {
|
|
8
|
+
constructor(body: Sync.GenerationError, rawResponse?: core.RawResponse);
|
|
9
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.PaymentRequiredError = void 0;
|
|
40
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
41
|
+
class PaymentRequiredError extends errors.SyncError {
|
|
42
|
+
constructor(body, rawResponse) {
|
|
43
|
+
super({
|
|
44
|
+
message: "PaymentRequiredError",
|
|
45
|
+
statusCode: 402,
|
|
46
|
+
body: body,
|
|
47
|
+
rawResponse: rawResponse,
|
|
48
|
+
});
|
|
49
|
+
Object.setPrototypeOf(this, PaymentRequiredError.prototype);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.PaymentRequiredError = PaymentRequiredError;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as errors from "../../../../errors/index";
|
|
5
|
+
import * as Sync from "../../../index";
|
|
6
|
+
import * as core from "../../../../core";
|
|
7
|
+
export declare class TooManyRequestsError extends errors.SyncError {
|
|
8
|
+
constructor(body: Sync.GenerationError, rawResponse?: core.RawResponse);
|
|
9
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
4
|
+
*/
|
|
5
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
8
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
9
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
10
|
+
}
|
|
11
|
+
Object.defineProperty(o, k2, desc);
|
|
12
|
+
}) : (function(o, m, k, k2) {
|
|
13
|
+
if (k2 === undefined) k2 = k;
|
|
14
|
+
o[k2] = m[k];
|
|
15
|
+
}));
|
|
16
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
17
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
18
|
+
}) : function(o, v) {
|
|
19
|
+
o["default"] = v;
|
|
20
|
+
});
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.TooManyRequestsError = void 0;
|
|
40
|
+
const errors = __importStar(require("../../../../errors/index"));
|
|
41
|
+
class TooManyRequestsError extends errors.SyncError {
|
|
42
|
+
constructor(body, rawResponse) {
|
|
43
|
+
super({
|
|
44
|
+
message: "TooManyRequestsError",
|
|
45
|
+
statusCode: 429,
|
|
46
|
+
body: body,
|
|
47
|
+
rawResponse: rawResponse,
|
|
48
|
+
});
|
|
49
|
+
Object.setPrototypeOf(this, TooManyRequestsError.prototype);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.TooManyRequestsError = TooManyRequestsError;
|
|
@@ -18,3 +18,5 @@ __exportStar(require("./BadRequestError"), exports);
|
|
|
18
18
|
__exportStar(require("./InternalServerError"), exports);
|
|
19
19
|
__exportStar(require("./NotFoundError"), exports);
|
|
20
20
|
__exportStar(require("./UnauthorizedError"), exports);
|
|
21
|
+
__exportStar(require("./TooManyRequestsError"), exports);
|
|
22
|
+
__exportStar(require("./PaymentRequiredError"), exports);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Active speaker detection configuration
|
|
6
|
+
*/
|
|
7
|
+
export interface ActiveSpeaker {
|
|
8
|
+
/** Whether to automatically detect and apply generation to the active speaker */
|
|
9
|
+
auto_detect?: boolean;
|
|
10
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
export interface BatchMetrics {
|
|
5
|
+
/** Total number of generation requests in the batch. */
|
|
6
|
+
total_generations: number;
|
|
7
|
+
/** Number of successfully completed generations. */
|
|
8
|
+
success_count: number;
|
|
9
|
+
/** Number of failed generations. */
|
|
10
|
+
failed_count: number;
|
|
11
|
+
/** Number of generations still pending or processing. */
|
|
12
|
+
pending_count: number;
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
import * as Sync from "../../../index";
|
|
5
|
+
export interface BatchResponse {
|
|
6
|
+
id: Sync.BatchId;
|
|
7
|
+
/** The date and time the batch was created. */
|
|
8
|
+
created_at: string;
|
|
9
|
+
/** The current status of the batch. */
|
|
10
|
+
status: Sync.BatchStatus;
|
|
11
|
+
/** Metrics about the batch processing progress. */
|
|
12
|
+
metrics: Sync.BatchMetrics;
|
|
13
|
+
/** The webhook URL for batch status notifications. */
|
|
14
|
+
webhookUrl?: string;
|
|
15
|
+
/** The URL to download the batch results file (available when completed). */
|
|
16
|
+
outputUrl: string;
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* The status of the batch processing.
|
|
6
|
+
*/
|
|
7
|
+
export type BatchStatus = "PENDING" | "JOBS_CREATED" | "PROCESSING" | "COMPLETED" | "FAILED";
|
|
8
|
+
export declare const BatchStatus: {
|
|
9
|
+
readonly Pending: "PENDING";
|
|
10
|
+
readonly JobsCreated: "JOBS_CREATED";
|
|
11
|
+
readonly Processing: "PROCESSING";
|
|
12
|
+
readonly Completed: "COMPLETED";
|
|
13
|
+
readonly Failed: "FAILED";
|
|
14
|
+
};
|