@proxyrequest/sdk 1.0.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/README.md +42 -8
- package/SECURITY.md +1 -1
- package/dist/index.cjs +631 -257
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +218 -59
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +218 -59
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +632 -256
- package/dist/index.js.map +1 -1
- package/dist/{models-VMmyyuf_.d.cts → models-BDeknFzS.d.cts} +12 -9
- package/dist/models-BDeknFzS.d.cts.map +1 -0
- package/dist/{models-ECy_bhdn.d.ts → models-CNN_LuGV.d.ts} +12 -9
- package/dist/models-CNN_LuGV.d.ts.map +1 -0
- package/dist/models.d.cts +2 -2
- package/dist/models.d.ts +2 -2
- package/dist/openapi.d.cts +1 -1
- package/dist/openapi.d.ts +1 -1
- package/dist/{schema-CvCxeox5.d.cts → schema-BNl4txEF.d.cts} +757 -402
- package/dist/schema-BNl4txEF.d.cts.map +1 -0
- package/dist/{schema-CvCxeox5.d.ts → schema-BNl4txEF.d.ts} +757 -402
- package/dist/schema-BNl4txEF.d.ts.map +1 -0
- package/docs/SDK-AUDIT.md +273 -0
- package/docs/backend-compatibility.md +66 -0
- package/docs/errors-and-pagination.md +1 -1
- package/docs/getting-started.md +1 -2
- package/docs/releasing.md +13 -3
- package/docs/reseller-workflow.md +1 -1
- package/docs/webhooks.md +4 -7
- package/package.json +3 -2
- package/dist/models-ECy_bhdn.d.ts.map +0 -1
- package/dist/models-VMmyyuf_.d.cts.map +0 -1
- package/dist/schema-CvCxeox5.d.cts.map +0 -1
- package/dist/schema-CvCxeox5.d.ts.map +0 -1
package/dist/index.js
CHANGED
|
@@ -14,6 +14,8 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
14
14
|
requestId;
|
|
15
15
|
retryAfter;
|
|
16
16
|
contentLanguage;
|
|
17
|
+
currentEtag;
|
|
18
|
+
idempotencyKey;
|
|
17
19
|
headers;
|
|
18
20
|
rawBody;
|
|
19
21
|
cause;
|
|
@@ -26,12 +28,14 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
26
28
|
this.requestId = options.requestId;
|
|
27
29
|
this.retryAfter = options.retryAfter;
|
|
28
30
|
this.contentLanguage = options.contentLanguage;
|
|
31
|
+
this.currentEtag = options.currentEtag;
|
|
32
|
+
this.idempotencyKey = options.idempotencyKey;
|
|
29
33
|
this.headers = options.headers ?? {};
|
|
30
34
|
this.rawBody = options.rawBody ?? /* @__PURE__ */ new Uint8Array();
|
|
31
35
|
this.cause = options.cause;
|
|
32
36
|
}
|
|
33
37
|
static async fromResponse(response) {
|
|
34
|
-
const headers = headersToRecord(response.headers);
|
|
38
|
+
const headers = headersToRecord$1(response.headers);
|
|
35
39
|
let rawBody = /* @__PURE__ */ new Uint8Array();
|
|
36
40
|
try {
|
|
37
41
|
rawBody = new Uint8Array(await response.clone().arrayBuffer());
|
|
@@ -45,6 +49,7 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
45
49
|
const requestId = header(headers, "x-request-id", "x-correlation-id");
|
|
46
50
|
const retryAfter = numberHeader(headers, "retry-after");
|
|
47
51
|
const contentLanguage = header(headers, "content-language");
|
|
52
|
+
const currentEtag = header(headers, "etag");
|
|
48
53
|
return new ApiError(detail ?? `ProxyRequest API returned HTTP ${statusCode}.`, {
|
|
49
54
|
kind,
|
|
50
55
|
statusCode,
|
|
@@ -53,6 +58,7 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
53
58
|
...requestId === void 0 ? {} : { requestId },
|
|
54
59
|
...retryAfter === void 0 ? {} : { retryAfter },
|
|
55
60
|
...contentLanguage === void 0 ? {} : { contentLanguage },
|
|
61
|
+
...currentEtag === void 0 ? {} : { currentEtag },
|
|
56
62
|
headers,
|
|
57
63
|
rawBody
|
|
58
64
|
});
|
|
@@ -70,6 +76,23 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
70
76
|
...cause === void 0 ? {} : { cause }
|
|
71
77
|
});
|
|
72
78
|
}
|
|
79
|
+
withIdempotencyKey(idempotencyKey) {
|
|
80
|
+
if (idempotencyKey === void 0 || this.idempotencyKey === idempotencyKey) return this;
|
|
81
|
+
return new ApiError(this.message, {
|
|
82
|
+
kind: this.kind,
|
|
83
|
+
...this.statusCode === void 0 ? {} : { statusCode: this.statusCode },
|
|
84
|
+
...this.detail === void 0 ? {} : { detail: this.detail },
|
|
85
|
+
fieldErrors: { ...this.fieldErrors },
|
|
86
|
+
...this.requestId === void 0 ? {} : { requestId: this.requestId },
|
|
87
|
+
...this.retryAfter === void 0 ? {} : { retryAfter: this.retryAfter },
|
|
88
|
+
...this.contentLanguage === void 0 ? {} : { contentLanguage: this.contentLanguage },
|
|
89
|
+
...this.currentEtag === void 0 ? {} : { currentEtag: this.currentEtag },
|
|
90
|
+
idempotencyKey,
|
|
91
|
+
headers: { ...this.headers },
|
|
92
|
+
rawBody: this.rawBody,
|
|
93
|
+
...this.cause === void 0 ? {} : { cause: this.cause }
|
|
94
|
+
});
|
|
95
|
+
}
|
|
73
96
|
};
|
|
74
97
|
var PaginationError = class extends ProxyRequestError {
|
|
75
98
|
name = "PaginationError";
|
|
@@ -83,11 +106,12 @@ function kindForStatus(statusCode) {
|
|
|
83
106
|
if (statusCode === 403) return "permission";
|
|
84
107
|
if (statusCode === 404) return "not_found";
|
|
85
108
|
if (statusCode === 409) return "conflict";
|
|
109
|
+
if (statusCode === 412) return "precondition";
|
|
86
110
|
if (statusCode === 429) return "rate_limit";
|
|
87
111
|
if (statusCode >= 500) return "server";
|
|
88
112
|
return "unexpected";
|
|
89
113
|
}
|
|
90
|
-
function headersToRecord(headers) {
|
|
114
|
+
function headersToRecord$1(headers) {
|
|
91
115
|
return Object.fromEntries([...headers.entries()].map(([key, value]) => [key.toLowerCase(), value]));
|
|
92
116
|
}
|
|
93
117
|
function header(headers, ...names) {
|
|
@@ -192,7 +216,11 @@ var APIKeysResource = class {
|
|
|
192
216
|
}
|
|
193
217
|
/** List API keys */
|
|
194
218
|
async list(options = {}) {
|
|
195
|
-
return this
|
|
219
|
+
return (await this.listWithResponse(options)).data;
|
|
220
|
+
}
|
|
221
|
+
/** List API keys; include response metadata. */
|
|
222
|
+
async listWithResponse(options = {}) {
|
|
223
|
+
return this.#client._callWithResponse({
|
|
196
224
|
operationId: "api_keys_list",
|
|
197
225
|
method: "GET",
|
|
198
226
|
path: "/api-keys"
|
|
@@ -207,7 +235,11 @@ var APIKeysResource = class {
|
|
|
207
235
|
}
|
|
208
236
|
/** Create an API key */
|
|
209
237
|
async create(options = {}) {
|
|
210
|
-
return this
|
|
238
|
+
return (await this.createWithResponse(options)).data;
|
|
239
|
+
}
|
|
240
|
+
/** Create an API key; include response metadata. */
|
|
241
|
+
async createWithResponse(options = {}) {
|
|
242
|
+
return this.#client._callWithResponse({
|
|
211
243
|
operationId: "api_keys_create",
|
|
212
244
|
method: "POST",
|
|
213
245
|
path: "/api-keys"
|
|
@@ -219,13 +251,21 @@ var APIKeysResource = class {
|
|
|
219
251
|
}
|
|
220
252
|
/** Revoke an API key */
|
|
221
253
|
async delete(options) {
|
|
222
|
-
return this
|
|
254
|
+
return (await this.deleteWithResponse(options)).data;
|
|
255
|
+
}
|
|
256
|
+
/** Revoke an API key; include response metadata. */
|
|
257
|
+
async deleteWithResponse(options) {
|
|
258
|
+
return this.#client._callWithResponse({
|
|
223
259
|
operationId: "api_keys_destroy",
|
|
224
260
|
method: "DELETE",
|
|
225
|
-
path: "/api-keys/{id}"
|
|
261
|
+
path: "/api-keys/{id}",
|
|
262
|
+
idempotent: true
|
|
226
263
|
}, {
|
|
227
264
|
path: { id: options.id },
|
|
228
|
-
headers: {
|
|
265
|
+
headers: {
|
|
266
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
267
|
+
"Accept-Language": options.acceptLanguage
|
|
268
|
+
},
|
|
229
269
|
...options.request === void 0 ? {} : { request: options.request }
|
|
230
270
|
});
|
|
231
271
|
}
|
|
@@ -237,7 +277,11 @@ var AffiliatesResource = class {
|
|
|
237
277
|
}
|
|
238
278
|
/** List referred customers */
|
|
239
279
|
async list(options = {}) {
|
|
240
|
-
return this
|
|
280
|
+
return (await this.listWithResponse(options)).data;
|
|
281
|
+
}
|
|
282
|
+
/** List referred customers; include response metadata. */
|
|
283
|
+
async listWithResponse(options = {}) {
|
|
284
|
+
return this.#client._callWithResponse({
|
|
241
285
|
operationId: "affiliates_list",
|
|
242
286
|
method: "GET",
|
|
243
287
|
path: "/affiliates"
|
|
@@ -252,7 +296,11 @@ var AffiliatesResource = class {
|
|
|
252
296
|
}
|
|
253
297
|
/** List affiliate reward entries */
|
|
254
298
|
async listRewards(options = {}) {
|
|
255
|
-
return this
|
|
299
|
+
return (await this.listRewardsWithResponse(options)).data;
|
|
300
|
+
}
|
|
301
|
+
/** List affiliate reward entries; include response metadata. */
|
|
302
|
+
async listRewardsWithResponse(options = {}) {
|
|
303
|
+
return this.#client._callWithResponse({
|
|
256
304
|
operationId: "affiliates_rewards_list",
|
|
257
305
|
method: "GET",
|
|
258
306
|
path: "/affiliates/rewards"
|
|
@@ -267,7 +315,11 @@ var AffiliatesResource = class {
|
|
|
267
315
|
}
|
|
268
316
|
/** Get affiliate earnings over time */
|
|
269
317
|
async getRewardsOverall(options = {}) {
|
|
270
|
-
return this
|
|
318
|
+
return (await this.getRewardsOverallWithResponse(options)).data;
|
|
319
|
+
}
|
|
320
|
+
/** Get affiliate earnings over time; include response metadata. */
|
|
321
|
+
async getRewardsOverallWithResponse(options = {}) {
|
|
322
|
+
return this.#client._callWithResponse({
|
|
271
323
|
operationId: "affiliates_rewards_overall_retrieve",
|
|
272
324
|
method: "GET",
|
|
273
325
|
path: "/affiliates/rewards/overall"
|
|
@@ -284,7 +336,11 @@ var AnalyticsResource = class {
|
|
|
284
336
|
}
|
|
285
337
|
/** List data transactions */
|
|
286
338
|
async getTransactions(options) {
|
|
287
|
-
return this
|
|
339
|
+
return (await this.getTransactionsWithResponse(options)).data;
|
|
340
|
+
}
|
|
341
|
+
/** List data transactions; include response metadata. */
|
|
342
|
+
async getTransactionsWithResponse(options) {
|
|
343
|
+
return this.#client._callWithResponse({
|
|
288
344
|
operationId: "analytics_transactions_retrieve",
|
|
289
345
|
method: "GET",
|
|
290
346
|
path: "/analytics/{id}/transactions"
|
|
@@ -306,7 +362,11 @@ var AnalyticsResource = class {
|
|
|
306
362
|
}
|
|
307
363
|
/** List active proxy connections */
|
|
308
364
|
async getConnections(options = {}) {
|
|
309
|
-
return this
|
|
365
|
+
return (await this.getConnectionsWithResponse(options)).data;
|
|
366
|
+
}
|
|
367
|
+
/** List active proxy connections; include response metadata. */
|
|
368
|
+
async getConnectionsWithResponse(options = {}) {
|
|
369
|
+
return this.#client._callWithResponse({
|
|
310
370
|
operationId: "analytics_connections_retrieve",
|
|
311
371
|
method: "GET",
|
|
312
372
|
path: "/analytics/connections"
|
|
@@ -323,7 +383,11 @@ var AnalyticsResource = class {
|
|
|
323
383
|
}
|
|
324
384
|
/** List top destination domains */
|
|
325
385
|
async listDomains(options = {}) {
|
|
326
|
-
return this
|
|
386
|
+
return (await this.listDomainsWithResponse(options)).data;
|
|
387
|
+
}
|
|
388
|
+
/** List top destination domains; include response metadata. */
|
|
389
|
+
async listDomainsWithResponse(options = {}) {
|
|
390
|
+
return this.#client._callWithResponse({
|
|
327
391
|
operationId: "analytics_domains_retrieve",
|
|
328
392
|
method: "GET",
|
|
329
393
|
path: "/analytics/domains"
|
|
@@ -348,7 +412,11 @@ var AnalyticsResource = class {
|
|
|
348
412
|
}
|
|
349
413
|
/** List proxy request activity */
|
|
350
414
|
async listFeed(options = {}) {
|
|
351
|
-
return this
|
|
415
|
+
return (await this.listFeedWithResponse(options)).data;
|
|
416
|
+
}
|
|
417
|
+
/** List proxy request activity; include response metadata. */
|
|
418
|
+
async listFeedWithResponse(options = {}) {
|
|
419
|
+
return this.#client._callWithResponse({
|
|
352
420
|
operationId: "analytics_feed_retrieve",
|
|
353
421
|
method: "GET",
|
|
354
422
|
path: "/analytics/feed"
|
|
@@ -375,7 +443,11 @@ var AnalyticsResource = class {
|
|
|
375
443
|
}
|
|
376
444
|
/** List proxy error logs */
|
|
377
445
|
async listLogs(options = {}) {
|
|
378
|
-
return this
|
|
446
|
+
return (await this.listLogsWithResponse(options)).data;
|
|
447
|
+
}
|
|
448
|
+
/** List proxy error logs; include response metadata. */
|
|
449
|
+
async listLogsWithResponse(options = {}) {
|
|
450
|
+
return this.#client._callWithResponse({
|
|
379
451
|
operationId: "analytics_logs_retrieve",
|
|
380
452
|
method: "GET",
|
|
381
453
|
path: "/analytics/logs"
|
|
@@ -402,7 +474,11 @@ var AnalyticsResource = class {
|
|
|
402
474
|
}
|
|
403
475
|
/** Get traffic totals over time */
|
|
404
476
|
async getOverall(options = {}) {
|
|
405
|
-
return this
|
|
477
|
+
return (await this.getOverallWithResponse(options)).data;
|
|
478
|
+
}
|
|
479
|
+
/** Get traffic totals over time; include response metadata. */
|
|
480
|
+
async getOverallWithResponse(options = {}) {
|
|
481
|
+
return this.#client._callWithResponse({
|
|
406
482
|
operationId: "analytics_overall_retrieve",
|
|
407
483
|
method: "GET",
|
|
408
484
|
path: "/analytics/overall"
|
|
@@ -429,7 +505,11 @@ var AuthorizationResource = class {
|
|
|
429
505
|
}
|
|
430
506
|
/** Sign in with email or username */
|
|
431
507
|
async login(options) {
|
|
432
|
-
return this
|
|
508
|
+
return (await this.loginWithResponse(options)).data;
|
|
509
|
+
}
|
|
510
|
+
/** Sign in with email or username; include response metadata. */
|
|
511
|
+
async loginWithResponse(options) {
|
|
512
|
+
return this.#client._callWithResponse({
|
|
433
513
|
operationId: "login_create",
|
|
434
514
|
method: "POST",
|
|
435
515
|
path: "/login"
|
|
@@ -441,7 +521,11 @@ var AuthorizationResource = class {
|
|
|
441
521
|
}
|
|
442
522
|
/** Sign in with Google */
|
|
443
523
|
async loginWithGoogle(options) {
|
|
444
|
-
return this
|
|
524
|
+
return (await this.loginWithGoogleWithResponse(options)).data;
|
|
525
|
+
}
|
|
526
|
+
/** Sign in with Google; include response metadata. */
|
|
527
|
+
async loginWithGoogleWithResponse(options) {
|
|
528
|
+
return this.#client._callWithResponse({
|
|
445
529
|
operationId: "login_google_create",
|
|
446
530
|
method: "POST",
|
|
447
531
|
path: "/login/google"
|
|
@@ -451,9 +535,29 @@ var AuthorizationResource = class {
|
|
|
451
535
|
...options.request === void 0 ? {} : { request: options.request }
|
|
452
536
|
});
|
|
453
537
|
}
|
|
538
|
+
/** Complete two-factor sign-in */
|
|
539
|
+
async verifyOtp(options) {
|
|
540
|
+
return (await this.verifyOtpWithResponse(options)).data;
|
|
541
|
+
}
|
|
542
|
+
/** Complete two-factor sign-in; include response metadata. */
|
|
543
|
+
async verifyOtpWithResponse(options) {
|
|
544
|
+
return this.#client._callWithResponse({
|
|
545
|
+
operationId: "login_otp_create",
|
|
546
|
+
method: "POST",
|
|
547
|
+
path: "/login/otp"
|
|
548
|
+
}, {
|
|
549
|
+
headers: { "Accept-Language": options.acceptLanguage },
|
|
550
|
+
body: options.body,
|
|
551
|
+
...options.request === void 0 ? {} : { request: options.request }
|
|
552
|
+
});
|
|
553
|
+
}
|
|
454
554
|
/** Send a password recovery email */
|
|
455
555
|
async recoverPassword(options) {
|
|
456
|
-
return this
|
|
556
|
+
return (await this.recoverPasswordWithResponse(options)).data;
|
|
557
|
+
}
|
|
558
|
+
/** Send a password recovery email; include response metadata. */
|
|
559
|
+
async recoverPasswordWithResponse(options) {
|
|
560
|
+
return this.#client._callWithResponse({
|
|
457
561
|
operationId: "recover_password_create",
|
|
458
562
|
method: "POST",
|
|
459
563
|
path: "/recover-password"
|
|
@@ -465,7 +569,11 @@ var AuthorizationResource = class {
|
|
|
465
569
|
}
|
|
466
570
|
/** Refresh an access token */
|
|
467
571
|
async refresh(options) {
|
|
468
|
-
return this
|
|
572
|
+
return (await this.refreshWithResponse(options)).data;
|
|
573
|
+
}
|
|
574
|
+
/** Refresh an access token; include response metadata. */
|
|
575
|
+
async refreshWithResponse(options) {
|
|
576
|
+
return this.#client._callWithResponse({
|
|
469
577
|
operationId: "refresh_create",
|
|
470
578
|
method: "POST",
|
|
471
579
|
path: "/refresh"
|
|
@@ -477,7 +585,11 @@ var AuthorizationResource = class {
|
|
|
477
585
|
}
|
|
478
586
|
/** Create a customer account */
|
|
479
587
|
async signup(options) {
|
|
480
|
-
return this
|
|
588
|
+
return (await this.signupWithResponse(options)).data;
|
|
589
|
+
}
|
|
590
|
+
/** Create a customer account; include response metadata. */
|
|
591
|
+
async signupWithResponse(options) {
|
|
592
|
+
return this.#client._callWithResponse({
|
|
481
593
|
operationId: "signup_create",
|
|
482
594
|
method: "POST",
|
|
483
595
|
path: "/signup"
|
|
@@ -495,7 +607,11 @@ var CouponsResource = class {
|
|
|
495
607
|
}
|
|
496
608
|
/** List available coupons */
|
|
497
609
|
async list(options = {}) {
|
|
498
|
-
return this
|
|
610
|
+
return (await this.listWithResponse(options)).data;
|
|
611
|
+
}
|
|
612
|
+
/** List available coupons; include response metadata. */
|
|
613
|
+
async listWithResponse(options = {}) {
|
|
614
|
+
return this.#client._callWithResponse({
|
|
499
615
|
operationId: "coupons_list",
|
|
500
616
|
method: "GET",
|
|
501
617
|
path: "/coupons"
|
|
@@ -514,19 +630,31 @@ var CouponsResource = class {
|
|
|
514
630
|
}
|
|
515
631
|
/** Create a coupon */
|
|
516
632
|
async create(options) {
|
|
517
|
-
return this
|
|
633
|
+
return (await this.createWithResponse(options)).data;
|
|
634
|
+
}
|
|
635
|
+
/** Create a coupon; include response metadata. */
|
|
636
|
+
async createWithResponse(options) {
|
|
637
|
+
return this.#client._callWithResponse({
|
|
518
638
|
operationId: "coupons_create",
|
|
519
639
|
method: "POST",
|
|
520
|
-
path: "/coupons"
|
|
640
|
+
path: "/coupons",
|
|
641
|
+
idempotent: true
|
|
521
642
|
}, {
|
|
522
|
-
headers: {
|
|
643
|
+
headers: {
|
|
644
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
645
|
+
"Accept-Language": options.acceptLanguage
|
|
646
|
+
},
|
|
523
647
|
body: options.body,
|
|
524
648
|
...options.request === void 0 ? {} : { request: options.request }
|
|
525
649
|
});
|
|
526
650
|
}
|
|
527
651
|
/** Get a coupon */
|
|
528
652
|
async get(options) {
|
|
529
|
-
return this
|
|
653
|
+
return (await this.getWithResponse(options)).data;
|
|
654
|
+
}
|
|
655
|
+
/** Get a coupon; include response metadata. */
|
|
656
|
+
async getWithResponse(options) {
|
|
657
|
+
return this.#client._callWithResponse({
|
|
530
658
|
operationId: "coupons_retrieve",
|
|
531
659
|
method: "GET",
|
|
532
660
|
path: "/coupons/{id}"
|
|
@@ -538,45 +666,72 @@ var CouponsResource = class {
|
|
|
538
666
|
}
|
|
539
667
|
/** Replace a coupon */
|
|
540
668
|
async replace(options) {
|
|
541
|
-
return this
|
|
669
|
+
return (await this.replaceWithResponse(options)).data;
|
|
670
|
+
}
|
|
671
|
+
/** Replace a coupon; include response metadata. */
|
|
672
|
+
async replaceWithResponse(options) {
|
|
673
|
+
return this.#client._callWithResponse({
|
|
542
674
|
operationId: "coupons_update",
|
|
543
675
|
method: "PUT",
|
|
544
676
|
path: "/coupons/{id}"
|
|
545
677
|
}, {
|
|
546
678
|
path: { id: options.id },
|
|
547
|
-
headers: {
|
|
679
|
+
headers: {
|
|
680
|
+
"If-Match": options.ifMatch,
|
|
681
|
+
"Accept-Language": options.acceptLanguage
|
|
682
|
+
},
|
|
548
683
|
body: options.body,
|
|
549
684
|
...options.request === void 0 ? {} : { request: options.request }
|
|
550
685
|
});
|
|
551
686
|
}
|
|
552
687
|
/** Update a coupon */
|
|
553
688
|
async update(options) {
|
|
554
|
-
return this
|
|
689
|
+
return (await this.updateWithResponse(options)).data;
|
|
690
|
+
}
|
|
691
|
+
/** Update a coupon; include response metadata. */
|
|
692
|
+
async updateWithResponse(options) {
|
|
693
|
+
return this.#client._callWithResponse({
|
|
555
694
|
operationId: "coupons_partial_update",
|
|
556
695
|
method: "PATCH",
|
|
557
696
|
path: "/coupons/{id}"
|
|
558
697
|
}, {
|
|
559
698
|
path: { id: options.id },
|
|
560
|
-
headers: {
|
|
699
|
+
headers: {
|
|
700
|
+
"If-Match": options.ifMatch,
|
|
701
|
+
"Accept-Language": options.acceptLanguage
|
|
702
|
+
},
|
|
561
703
|
...options.body === void 0 ? {} : { body: options.body },
|
|
562
704
|
...options.request === void 0 ? {} : { request: options.request }
|
|
563
705
|
});
|
|
564
706
|
}
|
|
565
707
|
/** Delete a coupon */
|
|
566
708
|
async delete(options) {
|
|
567
|
-
return this
|
|
709
|
+
return (await this.deleteWithResponse(options)).data;
|
|
710
|
+
}
|
|
711
|
+
/** Delete a coupon; include response metadata. */
|
|
712
|
+
async deleteWithResponse(options) {
|
|
713
|
+
return this.#client._callWithResponse({
|
|
568
714
|
operationId: "coupons_destroy",
|
|
569
715
|
method: "DELETE",
|
|
570
|
-
path: "/coupons/{id}"
|
|
716
|
+
path: "/coupons/{id}",
|
|
717
|
+
idempotent: true
|
|
571
718
|
}, {
|
|
572
719
|
path: { id: options.id },
|
|
573
|
-
headers: {
|
|
720
|
+
headers: {
|
|
721
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
722
|
+
"If-Match": options.ifMatch,
|
|
723
|
+
"Accept-Language": options.acceptLanguage
|
|
724
|
+
},
|
|
574
725
|
...options.request === void 0 ? {} : { request: options.request }
|
|
575
726
|
});
|
|
576
727
|
}
|
|
577
728
|
/** List coupon redemptions */
|
|
578
729
|
async listRedeems(options) {
|
|
579
|
-
return this
|
|
730
|
+
return (await this.listRedeemsWithResponse(options)).data;
|
|
731
|
+
}
|
|
732
|
+
/** List coupon redemptions; include response metadata. */
|
|
733
|
+
async listRedeemsWithResponse(options) {
|
|
734
|
+
return this.#client._callWithResponse({
|
|
580
735
|
operationId: "coupons_redeems_list",
|
|
581
736
|
method: "GET",
|
|
582
737
|
path: "/coupons/{id}/redeems"
|
|
@@ -595,7 +750,11 @@ var CouponsResource = class {
|
|
|
595
750
|
}
|
|
596
751
|
/** Calculate a discounted price */
|
|
597
752
|
async calculatePrice(options) {
|
|
598
|
-
return this
|
|
753
|
+
return (await this.calculatePriceWithResponse(options)).data;
|
|
754
|
+
}
|
|
755
|
+
/** Calculate a discounted price; include response metadata. */
|
|
756
|
+
async calculatePriceWithResponse(options) {
|
|
757
|
+
return this.#client._callWithResponse({
|
|
599
758
|
operationId: "coupons_calculate_price_create",
|
|
600
759
|
method: "POST",
|
|
601
760
|
path: "/coupons/calculate-price"
|
|
@@ -613,7 +772,11 @@ var InvoicesResource = class {
|
|
|
613
772
|
}
|
|
614
773
|
/** List invoices */
|
|
615
774
|
async list(options = {}) {
|
|
616
|
-
return this
|
|
775
|
+
return (await this.listWithResponse(options)).data;
|
|
776
|
+
}
|
|
777
|
+
/** List invoices; include response metadata. */
|
|
778
|
+
async listWithResponse(options = {}) {
|
|
779
|
+
return this.#client._callWithResponse({
|
|
617
780
|
operationId: "invoices_list",
|
|
618
781
|
method: "GET",
|
|
619
782
|
path: "/invoices"
|
|
@@ -637,19 +800,31 @@ var InvoicesResource = class {
|
|
|
637
800
|
}
|
|
638
801
|
/** Create an invoice */
|
|
639
802
|
async create(options) {
|
|
640
|
-
return this
|
|
803
|
+
return (await this.createWithResponse(options)).data;
|
|
804
|
+
}
|
|
805
|
+
/** Create an invoice; include response metadata. */
|
|
806
|
+
async createWithResponse(options) {
|
|
807
|
+
return this.#client._callWithResponse({
|
|
641
808
|
operationId: "invoices_create",
|
|
642
809
|
method: "POST",
|
|
643
|
-
path: "/invoices"
|
|
810
|
+
path: "/invoices",
|
|
811
|
+
idempotent: true
|
|
644
812
|
}, {
|
|
645
|
-
headers: {
|
|
813
|
+
headers: {
|
|
814
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
815
|
+
"Accept-Language": options.acceptLanguage
|
|
816
|
+
},
|
|
646
817
|
body: options.body,
|
|
647
818
|
...options.request === void 0 ? {} : { request: options.request }
|
|
648
819
|
});
|
|
649
820
|
}
|
|
650
821
|
/** Get an invoice */
|
|
651
822
|
async get(options) {
|
|
652
|
-
return this
|
|
823
|
+
return (await this.getWithResponse(options)).data;
|
|
824
|
+
}
|
|
825
|
+
/** Get an invoice; include response metadata. */
|
|
826
|
+
async getWithResponse(options) {
|
|
827
|
+
return this.#client._callWithResponse({
|
|
653
828
|
operationId: "invoices_retrieve",
|
|
654
829
|
method: "GET",
|
|
655
830
|
path: "/invoices/{id}"
|
|
@@ -661,19 +836,32 @@ var InvoicesResource = class {
|
|
|
661
836
|
}
|
|
662
837
|
/** Delete an invoice */
|
|
663
838
|
async delete(options) {
|
|
664
|
-
return this
|
|
839
|
+
return (await this.deleteWithResponse(options)).data;
|
|
840
|
+
}
|
|
841
|
+
/** Delete an invoice; include response metadata. */
|
|
842
|
+
async deleteWithResponse(options) {
|
|
843
|
+
return this.#client._callWithResponse({
|
|
665
844
|
operationId: "invoices_destroy",
|
|
666
845
|
method: "DELETE",
|
|
667
|
-
path: "/invoices/{id}"
|
|
846
|
+
path: "/invoices/{id}",
|
|
847
|
+
idempotent: true
|
|
668
848
|
}, {
|
|
669
849
|
path: { id: options.id },
|
|
670
|
-
headers: {
|
|
850
|
+
headers: {
|
|
851
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
852
|
+
"If-Match": options.ifMatch,
|
|
853
|
+
"Accept-Language": options.acceptLanguage
|
|
854
|
+
},
|
|
671
855
|
...options.request === void 0 ? {} : { request: options.request }
|
|
672
856
|
});
|
|
673
857
|
}
|
|
674
858
|
/** Download an invoice PDF */
|
|
675
859
|
async downloadPdf(options) {
|
|
676
|
-
return this
|
|
860
|
+
return (await this.downloadPdfWithResponse(options)).data;
|
|
861
|
+
}
|
|
862
|
+
/** Download an invoice PDF; include response metadata. */
|
|
863
|
+
async downloadPdfWithResponse(options) {
|
|
864
|
+
return this.#client._callWithResponse({
|
|
677
865
|
operationId: "invoices_download_pdf_retrieve",
|
|
678
866
|
method: "GET",
|
|
679
867
|
path: "/invoices/{id}/download/pdf",
|
|
@@ -686,7 +874,11 @@ var InvoicesResource = class {
|
|
|
686
874
|
}
|
|
687
875
|
/** Get an invoice payment link */
|
|
688
876
|
async getPaymentLink(options) {
|
|
689
|
-
return this
|
|
877
|
+
return (await this.getPaymentLinkWithResponse(options)).data;
|
|
878
|
+
}
|
|
879
|
+
/** Get an invoice payment link; include response metadata. */
|
|
880
|
+
async getPaymentLinkWithResponse(options) {
|
|
881
|
+
return this.#client._callWithResponse({
|
|
690
882
|
operationId: "invoices_pay_retrieve",
|
|
691
883
|
method: "GET",
|
|
692
884
|
path: "/invoices/{id}/pay"
|
|
@@ -704,7 +896,11 @@ var LocationsResource = class {
|
|
|
704
896
|
}
|
|
705
897
|
/** List available autonomous systems */
|
|
706
898
|
async listAsns(options = {}) {
|
|
707
|
-
return this
|
|
899
|
+
return (await this.listAsnsWithResponse(options)).data;
|
|
900
|
+
}
|
|
901
|
+
/** List available autonomous systems; include response metadata. */
|
|
902
|
+
async listAsnsWithResponse(options = {}) {
|
|
903
|
+
return this.#client._callWithResponse({
|
|
708
904
|
operationId: "locations_asn_list",
|
|
709
905
|
method: "GET",
|
|
710
906
|
path: "/locations/asn"
|
|
@@ -726,7 +922,11 @@ var LocationsResource = class {
|
|
|
726
922
|
}
|
|
727
923
|
/** List available cities */
|
|
728
924
|
async listCities(options = {}) {
|
|
729
|
-
return this
|
|
925
|
+
return (await this.listCitiesWithResponse(options)).data;
|
|
926
|
+
}
|
|
927
|
+
/** List available cities; include response metadata. */
|
|
928
|
+
async listCitiesWithResponse(options = {}) {
|
|
929
|
+
return this.#client._callWithResponse({
|
|
730
930
|
operationId: "locations_cities_list",
|
|
731
931
|
method: "GET",
|
|
732
932
|
path: "/locations/cities"
|
|
@@ -748,7 +948,11 @@ var LocationsResource = class {
|
|
|
748
948
|
}
|
|
749
949
|
/** Get a city */
|
|
750
950
|
async getCity(options) {
|
|
751
|
-
return this
|
|
951
|
+
return (await this.getCityWithResponse(options)).data;
|
|
952
|
+
}
|
|
953
|
+
/** Get a city; include response metadata. */
|
|
954
|
+
async getCityWithResponse(options) {
|
|
955
|
+
return this.#client._callWithResponse({
|
|
752
956
|
operationId: "locations_cities_retrieve",
|
|
753
957
|
method: "GET",
|
|
754
958
|
path: "/locations/cities/{id}"
|
|
@@ -760,7 +964,11 @@ var LocationsResource = class {
|
|
|
760
964
|
}
|
|
761
965
|
/** List available continents */
|
|
762
966
|
async listContinents(options = {}) {
|
|
763
|
-
return this
|
|
967
|
+
return (await this.listContinentsWithResponse(options)).data;
|
|
968
|
+
}
|
|
969
|
+
/** List available continents; include response metadata. */
|
|
970
|
+
async listContinentsWithResponse(options = {}) {
|
|
971
|
+
return this.#client._callWithResponse({
|
|
764
972
|
operationId: "locations_continents_list",
|
|
765
973
|
method: "GET",
|
|
766
974
|
path: "/locations/continents"
|
|
@@ -780,7 +988,11 @@ var LocationsResource = class {
|
|
|
780
988
|
}
|
|
781
989
|
/** Get a continent */
|
|
782
990
|
async getContinent(options) {
|
|
783
|
-
return this
|
|
991
|
+
return (await this.getContinentWithResponse(options)).data;
|
|
992
|
+
}
|
|
993
|
+
/** Get a continent; include response metadata. */
|
|
994
|
+
async getContinentWithResponse(options) {
|
|
995
|
+
return this.#client._callWithResponse({
|
|
784
996
|
operationId: "locations_continents_retrieve",
|
|
785
997
|
method: "GET",
|
|
786
998
|
path: "/locations/continents/{id}"
|
|
@@ -792,7 +1004,11 @@ var LocationsResource = class {
|
|
|
792
1004
|
}
|
|
793
1005
|
/** List available countries */
|
|
794
1006
|
async listCountries(options = {}) {
|
|
795
|
-
return this
|
|
1007
|
+
return (await this.listCountriesWithResponse(options)).data;
|
|
1008
|
+
}
|
|
1009
|
+
/** List available countries; include response metadata. */
|
|
1010
|
+
async listCountriesWithResponse(options = {}) {
|
|
1011
|
+
return this.#client._callWithResponse({
|
|
796
1012
|
operationId: "locations_countries_list",
|
|
797
1013
|
method: "GET",
|
|
798
1014
|
path: "/locations/countries"
|
|
@@ -812,7 +1028,11 @@ var LocationsResource = class {
|
|
|
812
1028
|
}
|
|
813
1029
|
/** Get a country */
|
|
814
1030
|
async getCountry(options) {
|
|
815
|
-
return this
|
|
1031
|
+
return (await this.getCountryWithResponse(options)).data;
|
|
1032
|
+
}
|
|
1033
|
+
/** Get a country; include response metadata. */
|
|
1034
|
+
async getCountryWithResponse(options) {
|
|
1035
|
+
return this.#client._callWithResponse({
|
|
816
1036
|
operationId: "locations_countries_retrieve",
|
|
817
1037
|
method: "GET",
|
|
818
1038
|
path: "/locations/countries/{id}"
|
|
@@ -824,7 +1044,11 @@ var LocationsResource = class {
|
|
|
824
1044
|
}
|
|
825
1045
|
/** List available internet service providers */
|
|
826
1046
|
async listIsps(options = {}) {
|
|
827
|
-
return this
|
|
1047
|
+
return (await this.listIspsWithResponse(options)).data;
|
|
1048
|
+
}
|
|
1049
|
+
/** List available internet service providers; include response metadata. */
|
|
1050
|
+
async listIspsWithResponse(options = {}) {
|
|
1051
|
+
return this.#client._callWithResponse({
|
|
828
1052
|
operationId: "locations_isps_list",
|
|
829
1053
|
method: "GET",
|
|
830
1054
|
path: "/locations/isps"
|
|
@@ -845,7 +1069,11 @@ var LocationsResource = class {
|
|
|
845
1069
|
}
|
|
846
1070
|
/** List available regions */
|
|
847
1071
|
async listRegions(options = {}) {
|
|
848
|
-
return this
|
|
1072
|
+
return (await this.listRegionsWithResponse(options)).data;
|
|
1073
|
+
}
|
|
1074
|
+
/** List available regions; include response metadata. */
|
|
1075
|
+
async listRegionsWithResponse(options = {}) {
|
|
1076
|
+
return this.#client._callWithResponse({
|
|
849
1077
|
operationId: "locations_regions_list",
|
|
850
1078
|
method: "GET",
|
|
851
1079
|
path: "/locations/regions"
|
|
@@ -866,7 +1094,11 @@ var LocationsResource = class {
|
|
|
866
1094
|
}
|
|
867
1095
|
/** Get a region */
|
|
868
1096
|
async getRegion(options) {
|
|
869
|
-
return this
|
|
1097
|
+
return (await this.getRegionWithResponse(options)).data;
|
|
1098
|
+
}
|
|
1099
|
+
/** Get a region; include response metadata. */
|
|
1100
|
+
async getRegionWithResponse(options) {
|
|
1101
|
+
return this.#client._callWithResponse({
|
|
870
1102
|
operationId: "locations_regions_retrieve",
|
|
871
1103
|
method: "GET",
|
|
872
1104
|
path: "/locations/regions/{id}"
|
|
@@ -884,7 +1116,11 @@ var NewsResource = class {
|
|
|
884
1116
|
}
|
|
885
1117
|
/** List product announcements */
|
|
886
1118
|
async list(options = {}) {
|
|
887
|
-
return this
|
|
1119
|
+
return (await this.listWithResponse(options)).data;
|
|
1120
|
+
}
|
|
1121
|
+
/** List product announcements; include response metadata. */
|
|
1122
|
+
async listWithResponse(options = {}) {
|
|
1123
|
+
return this.#client._callWithResponse({
|
|
888
1124
|
operationId: "news_list",
|
|
889
1125
|
method: "GET",
|
|
890
1126
|
path: "/news"
|
|
@@ -907,7 +1143,11 @@ var OrdersResource = class {
|
|
|
907
1143
|
}
|
|
908
1144
|
/** List active orders */
|
|
909
1145
|
async list(options = {}) {
|
|
910
|
-
return this
|
|
1146
|
+
return (await this.listWithResponse(options)).data;
|
|
1147
|
+
}
|
|
1148
|
+
/** List active orders; include response metadata. */
|
|
1149
|
+
async listWithResponse(options = {}) {
|
|
1150
|
+
return this.#client._callWithResponse({
|
|
911
1151
|
operationId: "orders_list",
|
|
912
1152
|
method: "GET",
|
|
913
1153
|
path: "/orders"
|
|
@@ -929,7 +1169,11 @@ var OrdersResource = class {
|
|
|
929
1169
|
}
|
|
930
1170
|
/** Get an order */
|
|
931
1171
|
async get(options) {
|
|
932
|
-
return this
|
|
1172
|
+
return (await this.getWithResponse(options)).data;
|
|
1173
|
+
}
|
|
1174
|
+
/** Get an order; include response metadata. */
|
|
1175
|
+
async getWithResponse(options) {
|
|
1176
|
+
return this.#client._callWithResponse({
|
|
933
1177
|
operationId: "orders_retrieve",
|
|
934
1178
|
method: "GET",
|
|
935
1179
|
path: "/orders/{id}"
|
|
@@ -941,32 +1185,52 @@ var OrdersResource = class {
|
|
|
941
1185
|
}
|
|
942
1186
|
/** Update order auto-renewal */
|
|
943
1187
|
async updateAutoRenewal(options) {
|
|
944
|
-
return this
|
|
1188
|
+
return (await this.updateAutoRenewalWithResponse(options)).data;
|
|
1189
|
+
}
|
|
1190
|
+
/** Update order auto-renewal; include response metadata. */
|
|
1191
|
+
async updateAutoRenewalWithResponse(options) {
|
|
1192
|
+
return this.#client._callWithResponse({
|
|
945
1193
|
operationId: "orders_partial_update",
|
|
946
1194
|
method: "PATCH",
|
|
947
1195
|
path: "/orders/{id}"
|
|
948
1196
|
}, {
|
|
949
1197
|
path: { id: options.id },
|
|
950
|
-
headers: {
|
|
1198
|
+
headers: {
|
|
1199
|
+
"If-Match": options.ifMatch,
|
|
1200
|
+
"Accept-Language": options.acceptLanguage
|
|
1201
|
+
},
|
|
951
1202
|
...options.body === void 0 ? {} : { body: options.body },
|
|
952
1203
|
...options.request === void 0 ? {} : { request: options.request }
|
|
953
1204
|
});
|
|
954
1205
|
}
|
|
955
1206
|
/** Delete a sub-user order */
|
|
956
1207
|
async delete(options) {
|
|
957
|
-
return this
|
|
1208
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1209
|
+
}
|
|
1210
|
+
/** Delete a sub-user order; include response metadata. */
|
|
1211
|
+
async deleteWithResponse(options) {
|
|
1212
|
+
return this.#client._callWithResponse({
|
|
958
1213
|
operationId: "orders_destroy",
|
|
959
1214
|
method: "DELETE",
|
|
960
|
-
path: "/orders/{id}"
|
|
1215
|
+
path: "/orders/{id}",
|
|
1216
|
+
idempotent: true
|
|
961
1217
|
}, {
|
|
962
1218
|
path: { id: options.id },
|
|
963
|
-
headers: {
|
|
1219
|
+
headers: {
|
|
1220
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1221
|
+
"If-Match": options.ifMatch,
|
|
1222
|
+
"Accept-Language": options.acceptLanguage
|
|
1223
|
+
},
|
|
964
1224
|
...options.request === void 0 ? {} : { request: options.request }
|
|
965
1225
|
});
|
|
966
1226
|
}
|
|
967
1227
|
/** Reset an order's proxy password */
|
|
968
1228
|
async resetPassword(options) {
|
|
969
|
-
return this
|
|
1229
|
+
return (await this.resetPasswordWithResponse(options)).data;
|
|
1230
|
+
}
|
|
1231
|
+
/** Reset an order's proxy password; include response metadata. */
|
|
1232
|
+
async resetPasswordWithResponse(options) {
|
|
1233
|
+
return this.#client._callWithResponse({
|
|
970
1234
|
operationId: "reset_password_create",
|
|
971
1235
|
method: "POST",
|
|
972
1236
|
path: "/reset-password"
|
|
@@ -984,7 +1248,11 @@ var PackagesResource = class {
|
|
|
984
1248
|
}
|
|
985
1249
|
/** List available proxy packages */
|
|
986
1250
|
async list(options = {}) {
|
|
987
|
-
return this
|
|
1251
|
+
return (await this.listWithResponse(options)).data;
|
|
1252
|
+
}
|
|
1253
|
+
/** List available proxy packages; include response metadata. */
|
|
1254
|
+
async listWithResponse(options = {}) {
|
|
1255
|
+
return this.#client._callWithResponse({
|
|
988
1256
|
operationId: "packages_list",
|
|
989
1257
|
method: "GET",
|
|
990
1258
|
path: "/packages"
|
|
@@ -1004,7 +1272,11 @@ var PackagesResource = class {
|
|
|
1004
1272
|
}
|
|
1005
1273
|
/** List affiliate package commissions */
|
|
1006
1274
|
async listCommissions(options = {}) {
|
|
1007
|
-
return this
|
|
1275
|
+
return (await this.listCommissionsWithResponse(options)).data;
|
|
1276
|
+
}
|
|
1277
|
+
/** List affiliate package commissions; include response metadata. */
|
|
1278
|
+
async listCommissionsWithResponse(options = {}) {
|
|
1279
|
+
return this.#client._callWithResponse({
|
|
1008
1280
|
operationId: "packages_commissions_list",
|
|
1009
1281
|
method: "GET",
|
|
1010
1282
|
path: "/packages/commissions"
|
|
@@ -1029,7 +1301,11 @@ var ProfileResource = class {
|
|
|
1029
1301
|
}
|
|
1030
1302
|
/** Get the current profile */
|
|
1031
1303
|
async get(options = {}) {
|
|
1032
|
-
return this
|
|
1304
|
+
return (await this.getWithResponse(options)).data;
|
|
1305
|
+
}
|
|
1306
|
+
/** Get the current profile; include response metadata. */
|
|
1307
|
+
async getWithResponse(options = {}) {
|
|
1308
|
+
return this.#client._callWithResponse({
|
|
1033
1309
|
operationId: "profile_retrieve",
|
|
1034
1310
|
method: "GET",
|
|
1035
1311
|
path: "/profile"
|
|
@@ -1040,30 +1316,48 @@ var ProfileResource = class {
|
|
|
1040
1316
|
}
|
|
1041
1317
|
/** Update the current profile */
|
|
1042
1318
|
async update(options = {}) {
|
|
1043
|
-
return this
|
|
1319
|
+
return (await this.updateWithResponse(options)).data;
|
|
1320
|
+
}
|
|
1321
|
+
/** Update the current profile; include response metadata. */
|
|
1322
|
+
async updateWithResponse(options = {}) {
|
|
1323
|
+
return this.#client._callWithResponse({
|
|
1044
1324
|
operationId: "profile_partial_update",
|
|
1045
1325
|
method: "PATCH",
|
|
1046
1326
|
path: "/profile"
|
|
1047
1327
|
}, {
|
|
1048
|
-
headers: {
|
|
1328
|
+
headers: {
|
|
1329
|
+
"If-Match": options.ifMatch,
|
|
1330
|
+
"Accept-Language": options.acceptLanguage
|
|
1331
|
+
},
|
|
1049
1332
|
...options.body === void 0 ? {} : { body: options.body },
|
|
1050
1333
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1051
1334
|
});
|
|
1052
1335
|
}
|
|
1053
1336
|
/** Delete the current account */
|
|
1054
1337
|
async delete(options = {}) {
|
|
1055
|
-
return this
|
|
1338
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1339
|
+
}
|
|
1340
|
+
/** Delete the current account; include response metadata. */
|
|
1341
|
+
async deleteWithResponse(options = {}) {
|
|
1342
|
+
return this.#client._callWithResponse({
|
|
1056
1343
|
operationId: "profile_destroy",
|
|
1057
1344
|
method: "DELETE",
|
|
1058
1345
|
path: "/profile"
|
|
1059
1346
|
}, {
|
|
1060
|
-
headers: {
|
|
1347
|
+
headers: {
|
|
1348
|
+
"If-Match": options.ifMatch,
|
|
1349
|
+
"Accept-Language": options.acceptLanguage
|
|
1350
|
+
},
|
|
1061
1351
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1062
1352
|
});
|
|
1063
1353
|
}
|
|
1064
|
-
/** Confirm two-factor
|
|
1354
|
+
/** Confirm two-factor authentication */
|
|
1065
1355
|
async confirmTwoFactor(options) {
|
|
1066
|
-
return this
|
|
1356
|
+
return (await this.confirmTwoFactorWithResponse(options)).data;
|
|
1357
|
+
}
|
|
1358
|
+
/** Confirm two-factor authentication; include response metadata. */
|
|
1359
|
+
async confirmTwoFactorWithResponse(options) {
|
|
1360
|
+
return this.#client._callWithResponse({
|
|
1067
1361
|
operationId: "profile_2fa_confirm_create",
|
|
1068
1362
|
method: "POST",
|
|
1069
1363
|
path: "/profile/2fa/confirm"
|
|
@@ -1075,7 +1369,11 @@ var ProfileResource = class {
|
|
|
1075
1369
|
}
|
|
1076
1370
|
/** Disable two-factor authentication */
|
|
1077
1371
|
async disableTwoFactor(options) {
|
|
1078
|
-
return this
|
|
1372
|
+
return (await this.disableTwoFactorWithResponse(options)).data;
|
|
1373
|
+
}
|
|
1374
|
+
/** Disable two-factor authentication; include response metadata. */
|
|
1375
|
+
async disableTwoFactorWithResponse(options) {
|
|
1376
|
+
return this.#client._callWithResponse({
|
|
1079
1377
|
operationId: "profile_2fa_disable_create",
|
|
1080
1378
|
method: "POST",
|
|
1081
1379
|
path: "/profile/2fa/disable"
|
|
@@ -1085,20 +1383,29 @@ var ProfileResource = class {
|
|
|
1085
1383
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1086
1384
|
});
|
|
1087
1385
|
}
|
|
1088
|
-
/**
|
|
1386
|
+
/** Prepare two-factor authentication */
|
|
1089
1387
|
async setupTwoFactor(options = {}) {
|
|
1090
|
-
return this
|
|
1388
|
+
return (await this.setupTwoFactorWithResponse(options)).data;
|
|
1389
|
+
}
|
|
1390
|
+
/** Prepare two-factor authentication; include response metadata. */
|
|
1391
|
+
async setupTwoFactorWithResponse(options = {}) {
|
|
1392
|
+
return this.#client._callWithResponse({
|
|
1091
1393
|
operationId: "profile_2fa_setup_create",
|
|
1092
1394
|
method: "POST",
|
|
1093
1395
|
path: "/profile/2fa/setup"
|
|
1094
1396
|
}, {
|
|
1095
1397
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
1398
|
+
...options.body === void 0 ? {} : { body: options.body },
|
|
1096
1399
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1097
1400
|
});
|
|
1098
1401
|
}
|
|
1099
1402
|
/** Get two-factor status */
|
|
1100
1403
|
async getTwoFactorStatus(options = {}) {
|
|
1101
|
-
return this
|
|
1404
|
+
return (await this.getTwoFactorStatusWithResponse(options)).data;
|
|
1405
|
+
}
|
|
1406
|
+
/** Get two-factor status; include response metadata. */
|
|
1407
|
+
async getTwoFactorStatusWithResponse(options = {}) {
|
|
1408
|
+
return this.#client._callWithResponse({
|
|
1102
1409
|
operationId: "profile_2fa_status_retrieve",
|
|
1103
1410
|
method: "GET",
|
|
1104
1411
|
path: "/profile/2fa/status"
|
|
@@ -1109,7 +1416,11 @@ var ProfileResource = class {
|
|
|
1109
1416
|
}
|
|
1110
1417
|
/** Change the account password */
|
|
1111
1418
|
async changePassword(options) {
|
|
1112
|
-
return this
|
|
1419
|
+
return (await this.changePasswordWithResponse(options)).data;
|
|
1420
|
+
}
|
|
1421
|
+
/** Change the account password; include response metadata. */
|
|
1422
|
+
async changePasswordWithResponse(options) {
|
|
1423
|
+
return this.#client._callWithResponse({
|
|
1113
1424
|
operationId: "profile_change_password_create",
|
|
1114
1425
|
method: "POST",
|
|
1115
1426
|
path: "/profile/change-password"
|
|
@@ -1127,7 +1438,11 @@ var ProxiesResource = class {
|
|
|
1127
1438
|
}
|
|
1128
1439
|
/** Generate proxy credentials */
|
|
1129
1440
|
async generate(options) {
|
|
1130
|
-
return this
|
|
1441
|
+
return (await this.generateWithResponse(options)).data;
|
|
1442
|
+
}
|
|
1443
|
+
/** Generate proxy credentials; include response metadata. */
|
|
1444
|
+
async generateWithResponse(options) {
|
|
1445
|
+
return this.#client._callWithResponse({
|
|
1131
1446
|
operationId: "proxies_generate_create",
|
|
1132
1447
|
method: "POST",
|
|
1133
1448
|
path: "/proxies/generate"
|
|
@@ -1145,7 +1460,11 @@ var RewardsResource = class {
|
|
|
1145
1460
|
}
|
|
1146
1461
|
/** List account rewards */
|
|
1147
1462
|
async list(options = {}) {
|
|
1148
|
-
return this
|
|
1463
|
+
return (await this.listWithResponse(options)).data;
|
|
1464
|
+
}
|
|
1465
|
+
/** List account rewards; include response metadata. */
|
|
1466
|
+
async listWithResponse(options = {}) {
|
|
1467
|
+
return this.#client._callWithResponse({
|
|
1149
1468
|
operationId: "rewards_list",
|
|
1150
1469
|
method: "GET",
|
|
1151
1470
|
path: "/rewards"
|
|
@@ -1164,7 +1483,11 @@ var RewardsResource = class {
|
|
|
1164
1483
|
}
|
|
1165
1484
|
/** Claim available rewards */
|
|
1166
1485
|
async claim(options) {
|
|
1167
|
-
return this
|
|
1486
|
+
return (await this.claimWithResponse(options)).data;
|
|
1487
|
+
}
|
|
1488
|
+
/** Claim available rewards; include response metadata. */
|
|
1489
|
+
async claimWithResponse(options) {
|
|
1490
|
+
return this.#client._callWithResponse({
|
|
1168
1491
|
operationId: "rewards_claim_create",
|
|
1169
1492
|
method: "POST",
|
|
1170
1493
|
path: "/rewards/claim"
|
|
@@ -1175,35 +1498,6 @@ var RewardsResource = class {
|
|
|
1175
1498
|
});
|
|
1176
1499
|
}
|
|
1177
1500
|
};
|
|
1178
|
-
var SessionsResource = class {
|
|
1179
|
-
#client;
|
|
1180
|
-
constructor(client) {
|
|
1181
|
-
this.#client = client;
|
|
1182
|
-
}
|
|
1183
|
-
/** List active proxy sessions */
|
|
1184
|
-
async list(options = {}) {
|
|
1185
|
-
return this.#client._call({
|
|
1186
|
-
operationId: "sessions_list",
|
|
1187
|
-
method: "GET",
|
|
1188
|
-
path: "/sessions"
|
|
1189
|
-
}, {
|
|
1190
|
-
headers: { "Accept-Language": options.acceptLanguage },
|
|
1191
|
-
...options.request === void 0 ? {} : { request: options.request }
|
|
1192
|
-
});
|
|
1193
|
-
}
|
|
1194
|
-
/** Revoke a proxy session */
|
|
1195
|
-
async delete(options) {
|
|
1196
|
-
return this.#client._call({
|
|
1197
|
-
operationId: "sessions_destroy",
|
|
1198
|
-
method: "DELETE",
|
|
1199
|
-
path: "/sessions/{id}"
|
|
1200
|
-
}, {
|
|
1201
|
-
path: { id: options.id },
|
|
1202
|
-
headers: { "Accept-Language": options.acceptLanguage },
|
|
1203
|
-
...options.request === void 0 ? {} : { request: options.request }
|
|
1204
|
-
});
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
1501
|
var SettingsResource = class {
|
|
1208
1502
|
#client;
|
|
1209
1503
|
constructor(client) {
|
|
@@ -1211,7 +1505,11 @@ var SettingsResource = class {
|
|
|
1211
1505
|
}
|
|
1212
1506
|
/** Get account settings */
|
|
1213
1507
|
async get(options = {}) {
|
|
1214
|
-
return this
|
|
1508
|
+
return (await this.getWithResponse(options)).data;
|
|
1509
|
+
}
|
|
1510
|
+
/** Get account settings; include response metadata. */
|
|
1511
|
+
async getWithResponse(options = {}) {
|
|
1512
|
+
return this.#client._callWithResponse({
|
|
1215
1513
|
operationId: "settings_retrieve",
|
|
1216
1514
|
method: "GET",
|
|
1217
1515
|
path: "/settings"
|
|
@@ -1228,7 +1526,11 @@ var TelegramDashboardResource = class {
|
|
|
1228
1526
|
}
|
|
1229
1527
|
/** Get the Telegram dashboard connection */
|
|
1230
1528
|
async getConnection(options = {}) {
|
|
1231
|
-
return this
|
|
1529
|
+
return (await this.getConnectionWithResponse(options)).data;
|
|
1530
|
+
}
|
|
1531
|
+
/** Get the Telegram dashboard connection; include response metadata. */
|
|
1532
|
+
async getConnectionWithResponse(options = {}) {
|
|
1533
|
+
return this.#client._callWithResponse({
|
|
1232
1534
|
operationId: "integrations_telegram_connection_retrieve",
|
|
1233
1535
|
method: "GET",
|
|
1234
1536
|
path: "/integrations/telegram/connection"
|
|
@@ -1239,7 +1541,11 @@ var TelegramDashboardResource = class {
|
|
|
1239
1541
|
}
|
|
1240
1542
|
/** Update Telegram dashboard preferences */
|
|
1241
1543
|
async updateConnection(options = {}) {
|
|
1242
|
-
return this
|
|
1544
|
+
return (await this.updateConnectionWithResponse(options)).data;
|
|
1545
|
+
}
|
|
1546
|
+
/** Update Telegram dashboard preferences; include response metadata. */
|
|
1547
|
+
async updateConnectionWithResponse(options = {}) {
|
|
1548
|
+
return this.#client._callWithResponse({
|
|
1243
1549
|
operationId: "integrations_telegram_connection_partial_update",
|
|
1244
1550
|
method: "PATCH",
|
|
1245
1551
|
path: "/integrations/telegram/connection"
|
|
@@ -1251,7 +1557,11 @@ var TelegramDashboardResource = class {
|
|
|
1251
1557
|
}
|
|
1252
1558
|
/** Disconnect the Telegram dashboard */
|
|
1253
1559
|
async deleteConnection(options = {}) {
|
|
1254
|
-
return this
|
|
1560
|
+
return (await this.deleteConnectionWithResponse(options)).data;
|
|
1561
|
+
}
|
|
1562
|
+
/** Disconnect the Telegram dashboard; include response metadata. */
|
|
1563
|
+
async deleteConnectionWithResponse(options = {}) {
|
|
1564
|
+
return this.#client._callWithResponse({
|
|
1255
1565
|
operationId: "integrations_telegram_connection_destroy",
|
|
1256
1566
|
method: "DELETE",
|
|
1257
1567
|
path: "/integrations/telegram/connection"
|
|
@@ -1262,7 +1572,11 @@ var TelegramDashboardResource = class {
|
|
|
1262
1572
|
}
|
|
1263
1573
|
/** Create a Telegram account link */
|
|
1264
1574
|
async createLink(options = {}) {
|
|
1265
|
-
return this
|
|
1575
|
+
return (await this.createLinkWithResponse(options)).data;
|
|
1576
|
+
}
|
|
1577
|
+
/** Create a Telegram account link; include response metadata. */
|
|
1578
|
+
async createLinkWithResponse(options = {}) {
|
|
1579
|
+
return this.#client._callWithResponse({
|
|
1266
1580
|
operationId: "integrations_telegram_link_create",
|
|
1267
1581
|
method: "POST",
|
|
1268
1582
|
path: "/integrations/telegram/link"
|
|
@@ -1272,42 +1586,6 @@ var TelegramDashboardResource = class {
|
|
|
1272
1586
|
});
|
|
1273
1587
|
}
|
|
1274
1588
|
};
|
|
1275
|
-
var TelegramServiceResource = class {
|
|
1276
|
-
#client;
|
|
1277
|
-
constructor(client) {
|
|
1278
|
-
this.#client = client;
|
|
1279
|
-
}
|
|
1280
|
-
/** Consume a Telegram account link */
|
|
1281
|
-
async consumeLink(options) {
|
|
1282
|
-
return this.#client._call({
|
|
1283
|
-
operationId: "integrations_telegram_link_consume_create",
|
|
1284
|
-
method: "POST",
|
|
1285
|
-
path: "/integrations/telegram/link/consume"
|
|
1286
|
-
}, {
|
|
1287
|
-
headers: {
|
|
1288
|
-
"X-ProxyRequest-Telegram-Secret": options.serviceSecret,
|
|
1289
|
-
"Accept-Language": options.acceptLanguage
|
|
1290
|
-
},
|
|
1291
|
-
body: options.body,
|
|
1292
|
-
...options.request === void 0 ? {} : { request: options.request }
|
|
1293
|
-
});
|
|
1294
|
-
}
|
|
1295
|
-
/** Create a Telegram API session */
|
|
1296
|
-
async createSession(options) {
|
|
1297
|
-
return this.#client._call({
|
|
1298
|
-
operationId: "integrations_telegram_session_create",
|
|
1299
|
-
method: "POST",
|
|
1300
|
-
path: "/integrations/telegram/session"
|
|
1301
|
-
}, {
|
|
1302
|
-
headers: {
|
|
1303
|
-
"X-ProxyRequest-Telegram-Secret": options.serviceSecret,
|
|
1304
|
-
"Accept-Language": options.acceptLanguage
|
|
1305
|
-
},
|
|
1306
|
-
body: options.body,
|
|
1307
|
-
...options.request === void 0 ? {} : { request: options.request }
|
|
1308
|
-
});
|
|
1309
|
-
}
|
|
1310
|
-
};
|
|
1311
1589
|
var UsersResource = class {
|
|
1312
1590
|
#client;
|
|
1313
1591
|
constructor(client) {
|
|
@@ -1315,7 +1593,11 @@ var UsersResource = class {
|
|
|
1315
1593
|
}
|
|
1316
1594
|
/** List users in the current account */
|
|
1317
1595
|
async list(options = {}) {
|
|
1318
|
-
return this
|
|
1596
|
+
return (await this.listWithResponse(options)).data;
|
|
1597
|
+
}
|
|
1598
|
+
/** List users in the current account; include response metadata. */
|
|
1599
|
+
async listWithResponse(options = {}) {
|
|
1600
|
+
return this.#client._callWithResponse({
|
|
1319
1601
|
operationId: "users_list",
|
|
1320
1602
|
method: "GET",
|
|
1321
1603
|
path: "/users"
|
|
@@ -1336,19 +1618,31 @@ var UsersResource = class {
|
|
|
1336
1618
|
}
|
|
1337
1619
|
/** Create a sub-user */
|
|
1338
1620
|
async create(options) {
|
|
1339
|
-
return this
|
|
1621
|
+
return (await this.createWithResponse(options)).data;
|
|
1622
|
+
}
|
|
1623
|
+
/** Create a sub-user; include response metadata. */
|
|
1624
|
+
async createWithResponse(options) {
|
|
1625
|
+
return this.#client._callWithResponse({
|
|
1340
1626
|
operationId: "users_create",
|
|
1341
1627
|
method: "POST",
|
|
1342
|
-
path: "/users"
|
|
1628
|
+
path: "/users",
|
|
1629
|
+
idempotent: true
|
|
1343
1630
|
}, {
|
|
1344
|
-
headers: {
|
|
1631
|
+
headers: {
|
|
1632
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1633
|
+
"Accept-Language": options.acceptLanguage
|
|
1634
|
+
},
|
|
1345
1635
|
body: options.body,
|
|
1346
1636
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1347
1637
|
});
|
|
1348
1638
|
}
|
|
1349
1639
|
/** Get a user */
|
|
1350
1640
|
async get(options) {
|
|
1351
|
-
return this
|
|
1641
|
+
return (await this.getWithResponse(options)).data;
|
|
1642
|
+
}
|
|
1643
|
+
/** Get a user; include response metadata. */
|
|
1644
|
+
async getWithResponse(options) {
|
|
1645
|
+
return this.#client._callWithResponse({
|
|
1352
1646
|
operationId: "users_retrieve",
|
|
1353
1647
|
method: "GET",
|
|
1354
1648
|
path: "/users/{id}"
|
|
@@ -1360,58 +1654,94 @@ var UsersResource = class {
|
|
|
1360
1654
|
}
|
|
1361
1655
|
/** Update a user */
|
|
1362
1656
|
async update(options) {
|
|
1363
|
-
return this
|
|
1657
|
+
return (await this.updateWithResponse(options)).data;
|
|
1658
|
+
}
|
|
1659
|
+
/** Update a user; include response metadata. */
|
|
1660
|
+
async updateWithResponse(options) {
|
|
1661
|
+
return this.#client._callWithResponse({
|
|
1364
1662
|
operationId: "users_partial_update",
|
|
1365
1663
|
method: "PATCH",
|
|
1366
1664
|
path: "/users/{id}"
|
|
1367
1665
|
}, {
|
|
1368
1666
|
path: { id: options.id },
|
|
1369
|
-
headers: {
|
|
1667
|
+
headers: {
|
|
1668
|
+
"If-Match": options.ifMatch,
|
|
1669
|
+
"Accept-Language": options.acceptLanguage
|
|
1670
|
+
},
|
|
1370
1671
|
...options.body === void 0 ? {} : { body: options.body },
|
|
1371
1672
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1372
1673
|
});
|
|
1373
1674
|
}
|
|
1374
1675
|
/** Delete a user */
|
|
1375
1676
|
async delete(options) {
|
|
1376
|
-
return this
|
|
1677
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1678
|
+
}
|
|
1679
|
+
/** Delete a user; include response metadata. */
|
|
1680
|
+
async deleteWithResponse(options) {
|
|
1681
|
+
return this.#client._callWithResponse({
|
|
1377
1682
|
operationId: "users_destroy",
|
|
1378
1683
|
method: "DELETE",
|
|
1379
|
-
path: "/users/{id}"
|
|
1684
|
+
path: "/users/{id}",
|
|
1685
|
+
idempotent: true
|
|
1380
1686
|
}, {
|
|
1381
1687
|
path: { id: options.id },
|
|
1382
|
-
headers: {
|
|
1688
|
+
headers: {
|
|
1689
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1690
|
+
"If-Match": options.ifMatch,
|
|
1691
|
+
"Accept-Language": options.acceptLanguage
|
|
1692
|
+
},
|
|
1383
1693
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1384
1694
|
});
|
|
1385
1695
|
}
|
|
1386
1696
|
/** Add data to a sub-user order */
|
|
1387
1697
|
async addData(options) {
|
|
1388
|
-
return this
|
|
1698
|
+
return (await this.addDataWithResponse(options)).data;
|
|
1699
|
+
}
|
|
1700
|
+
/** Add data to a sub-user order; include response metadata. */
|
|
1701
|
+
async addDataWithResponse(options) {
|
|
1702
|
+
return this.#client._callWithResponse({
|
|
1389
1703
|
operationId: "users_data_add_create",
|
|
1390
1704
|
method: "POST",
|
|
1391
|
-
path: "/users/{id}/data/add"
|
|
1705
|
+
path: "/users/{id}/data/add",
|
|
1706
|
+
idempotent: true
|
|
1392
1707
|
}, {
|
|
1393
1708
|
path: { id: options.id },
|
|
1394
|
-
headers: {
|
|
1709
|
+
headers: {
|
|
1710
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1711
|
+
"Accept-Language": options.acceptLanguage
|
|
1712
|
+
},
|
|
1395
1713
|
body: options.body,
|
|
1396
1714
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1397
1715
|
});
|
|
1398
1716
|
}
|
|
1399
1717
|
/** Subtract data from a sub-user order */
|
|
1400
1718
|
async subtractData(options) {
|
|
1401
|
-
return this
|
|
1719
|
+
return (await this.subtractDataWithResponse(options)).data;
|
|
1720
|
+
}
|
|
1721
|
+
/** Subtract data from a sub-user order; include response metadata. */
|
|
1722
|
+
async subtractDataWithResponse(options) {
|
|
1723
|
+
return this.#client._callWithResponse({
|
|
1402
1724
|
operationId: "users_data_subtract_create",
|
|
1403
1725
|
method: "POST",
|
|
1404
|
-
path: "/users/{id}/data/subtract"
|
|
1726
|
+
path: "/users/{id}/data/subtract",
|
|
1727
|
+
idempotent: true
|
|
1405
1728
|
}, {
|
|
1406
1729
|
path: { id: options.id },
|
|
1407
|
-
headers: {
|
|
1730
|
+
headers: {
|
|
1731
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1732
|
+
"Accept-Language": options.acceptLanguage
|
|
1733
|
+
},
|
|
1408
1734
|
body: options.body,
|
|
1409
1735
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1410
1736
|
});
|
|
1411
1737
|
}
|
|
1412
1738
|
/** List a sub-user's orders */
|
|
1413
1739
|
async listOrders(options) {
|
|
1414
|
-
return this
|
|
1740
|
+
return (await this.listOrdersWithResponse(options)).data;
|
|
1741
|
+
}
|
|
1742
|
+
/** List a sub-user's orders; include response metadata. */
|
|
1743
|
+
async listOrdersWithResponse(options) {
|
|
1744
|
+
return this.#client._callWithResponse({
|
|
1415
1745
|
operationId: "users_orders_list",
|
|
1416
1746
|
method: "GET",
|
|
1417
1747
|
path: "/users/{id}/orders"
|
|
@@ -1431,7 +1761,11 @@ var UsersResource = class {
|
|
|
1431
1761
|
}
|
|
1432
1762
|
/** Rotate a sub-user proxy password */
|
|
1433
1763
|
async resetPassword(options) {
|
|
1434
|
-
return this
|
|
1764
|
+
return (await this.resetPasswordWithResponse(options)).data;
|
|
1765
|
+
}
|
|
1766
|
+
/** Rotate a sub-user proxy password; include response metadata. */
|
|
1767
|
+
async resetPasswordWithResponse(options) {
|
|
1768
|
+
return this.#client._callWithResponse({
|
|
1435
1769
|
operationId: "users_password_create",
|
|
1436
1770
|
method: "POST",
|
|
1437
1771
|
path: "/users/{id}/password"
|
|
@@ -1450,7 +1784,11 @@ var WebhooksResource = class {
|
|
|
1450
1784
|
}
|
|
1451
1785
|
/** List customer webhooks */
|
|
1452
1786
|
async list(options = {}) {
|
|
1453
|
-
return this
|
|
1787
|
+
return (await this.listWithResponse(options)).data;
|
|
1788
|
+
}
|
|
1789
|
+
/** List customer webhooks; include response metadata. */
|
|
1790
|
+
async listWithResponse(options = {}) {
|
|
1791
|
+
return this.#client._callWithResponse({
|
|
1454
1792
|
operationId: "webhooks_list",
|
|
1455
1793
|
method: "GET",
|
|
1456
1794
|
path: "/webhooks"
|
|
@@ -1465,19 +1803,31 @@ var WebhooksResource = class {
|
|
|
1465
1803
|
}
|
|
1466
1804
|
/** Create a customer webhook */
|
|
1467
1805
|
async create(options) {
|
|
1468
|
-
return this
|
|
1806
|
+
return (await this.createWithResponse(options)).data;
|
|
1807
|
+
}
|
|
1808
|
+
/** Create a customer webhook; include response metadata. */
|
|
1809
|
+
async createWithResponse(options) {
|
|
1810
|
+
return this.#client._callWithResponse({
|
|
1469
1811
|
operationId: "webhooks_create",
|
|
1470
1812
|
method: "POST",
|
|
1471
|
-
path: "/webhooks"
|
|
1813
|
+
path: "/webhooks",
|
|
1814
|
+
idempotent: true
|
|
1472
1815
|
}, {
|
|
1473
|
-
headers: {
|
|
1816
|
+
headers: {
|
|
1817
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1818
|
+
"Accept-Language": options.acceptLanguage
|
|
1819
|
+
},
|
|
1474
1820
|
body: options.body,
|
|
1475
1821
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1476
1822
|
});
|
|
1477
1823
|
}
|
|
1478
1824
|
/** Get a customer webhook */
|
|
1479
1825
|
async get(options) {
|
|
1480
|
-
return this
|
|
1826
|
+
return (await this.getWithResponse(options)).data;
|
|
1827
|
+
}
|
|
1828
|
+
/** Get a customer webhook; include response metadata. */
|
|
1829
|
+
async getWithResponse(options) {
|
|
1830
|
+
return this.#client._callWithResponse({
|
|
1481
1831
|
operationId: "webhooks_retrieve",
|
|
1482
1832
|
method: "GET",
|
|
1483
1833
|
path: "/webhooks/{id}"
|
|
@@ -1489,13 +1839,22 @@ var WebhooksResource = class {
|
|
|
1489
1839
|
}
|
|
1490
1840
|
/** Delete a customer webhook */
|
|
1491
1841
|
async delete(options) {
|
|
1492
|
-
return this
|
|
1842
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1843
|
+
}
|
|
1844
|
+
/** Delete a customer webhook; include response metadata. */
|
|
1845
|
+
async deleteWithResponse(options) {
|
|
1846
|
+
return this.#client._callWithResponse({
|
|
1493
1847
|
operationId: "webhooks_destroy",
|
|
1494
1848
|
method: "DELETE",
|
|
1495
|
-
path: "/webhooks/{id}"
|
|
1849
|
+
path: "/webhooks/{id}",
|
|
1850
|
+
idempotent: true
|
|
1496
1851
|
}, {
|
|
1497
1852
|
path: { id: options.id },
|
|
1498
|
-
headers: {
|
|
1853
|
+
headers: {
|
|
1854
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1855
|
+
"If-Match": options.ifMatch,
|
|
1856
|
+
"Accept-Language": options.acceptLanguage
|
|
1857
|
+
},
|
|
1499
1858
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1500
1859
|
});
|
|
1501
1860
|
}
|
|
@@ -1515,10 +1874,8 @@ function createResourceCollection(client) {
|
|
|
1515
1874
|
profile: new ProfileResource(client),
|
|
1516
1875
|
proxies: new ProxiesResource(client),
|
|
1517
1876
|
rewards: new RewardsResource(client),
|
|
1518
|
-
sessions: new SessionsResource(client),
|
|
1519
1877
|
settings: new SettingsResource(client),
|
|
1520
1878
|
telegram: new TelegramDashboardResource(client),
|
|
1521
|
-
telegramService: new TelegramServiceResource(client),
|
|
1522
1879
|
users: new UsersResource(client),
|
|
1523
1880
|
webhooks: new WebhooksResource(client)
|
|
1524
1881
|
};
|
|
@@ -1577,15 +1934,14 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1577
1934
|
profile;
|
|
1578
1935
|
proxies;
|
|
1579
1936
|
rewards;
|
|
1580
|
-
sessions;
|
|
1581
1937
|
settings;
|
|
1582
1938
|
telegram;
|
|
1583
|
-
telegramService;
|
|
1584
1939
|
users;
|
|
1585
1940
|
webhooks;
|
|
1586
1941
|
baseUrl;
|
|
1587
1942
|
language;
|
|
1588
1943
|
timeoutMs;
|
|
1944
|
+
idempotency;
|
|
1589
1945
|
#fetch;
|
|
1590
1946
|
#headers;
|
|
1591
1947
|
#openapi;
|
|
@@ -1593,6 +1949,7 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1593
1949
|
this.baseUrl = normalizeBaseUrl(options.baseUrl ?? "https://api.proxyrequest.com/api/v1");
|
|
1594
1950
|
this.language = options.language ?? "en";
|
|
1595
1951
|
this.timeoutMs = options.timeoutMs ?? 15e3;
|
|
1952
|
+
this.idempotency = options.idempotency ?? true;
|
|
1596
1953
|
if (!Number.isFinite(this.timeoutMs) || this.timeoutMs < 0) throw new RangeError("timeoutMs must be a non-negative finite number.");
|
|
1597
1954
|
this.#fetch = options.fetch ?? globalThis.fetch;
|
|
1598
1955
|
if (typeof this.#fetch !== "function") throw new TypeError("A Fetch API implementation is required.");
|
|
@@ -1627,10 +1984,8 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1627
1984
|
this.profile = resources.profile;
|
|
1628
1985
|
this.proxies = resources.proxies;
|
|
1629
1986
|
this.rewards = resources.rewards;
|
|
1630
|
-
this.sessions = resources.sessions;
|
|
1631
1987
|
this.settings = resources.settings;
|
|
1632
1988
|
this.telegram = resources.telegram;
|
|
1633
|
-
this.telegramService = resources.telegramService;
|
|
1634
1989
|
this.users = resources.users;
|
|
1635
1990
|
this.webhooks = resources.webhooks;
|
|
1636
1991
|
}
|
|
@@ -1650,34 +2005,55 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1650
2005
|
return new ProxyRequestClient(options);
|
|
1651
2006
|
}
|
|
1652
2007
|
async _call(spec, data = {}) {
|
|
2008
|
+
return (await this._callWithResponse(spec, data)).data;
|
|
2009
|
+
}
|
|
2010
|
+
async _callWithResponse(spec, data = {}) {
|
|
1653
2011
|
const controls = data.request ?? {};
|
|
1654
|
-
const
|
|
1655
|
-
const
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
...
|
|
1662
|
-
...controls.headers === void 0 ? {} : { headers: controls.headers },
|
|
1663
|
-
signal: timeout.signal,
|
|
1664
|
-
...spec.binary ? { parseAs: "arrayBuffer" } : {}
|
|
2012
|
+
const controlHeaders = new Headers(controls.headers);
|
|
2013
|
+
const parameterKey = stringHeader(data.headers?.["Idempotency-Key"]);
|
|
2014
|
+
const controlKey = controlHeaders.get("Idempotency-Key") ?? void 0;
|
|
2015
|
+
const idempotencyKey = spec.idempotent ? parameterKey ?? controlKey ?? (this.idempotency ? newIdempotencyKey() : void 0) : void 0;
|
|
2016
|
+
if (spec.idempotent) controlHeaders.delete("Idempotency-Key");
|
|
2017
|
+
const operationHeaders = {
|
|
2018
|
+
...data.headers,
|
|
2019
|
+
...idempotencyKey === void 0 ? {} : { "Idempotency-Key": idempotencyKey }
|
|
1665
2020
|
};
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
2021
|
+
const method = this.#openapi[spec.method];
|
|
2022
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
2023
|
+
const timeout = requestSignal(controls.signal, controls.timeoutMs ?? this.timeoutMs);
|
|
2024
|
+
try {
|
|
2025
|
+
const result = await method(spec.path, {
|
|
2026
|
+
params: {
|
|
2027
|
+
...data.path === void 0 ? {} : { path: data.path },
|
|
2028
|
+
...data.query === void 0 ? {} : { query: data.query },
|
|
2029
|
+
...Object.keys(operationHeaders).length === 0 ? {} : { header: operationHeaders }
|
|
2030
|
+
},
|
|
2031
|
+
...data.body === void 0 ? {} : { body: data.body },
|
|
2032
|
+
...[...controlHeaders].length === 0 ? {} : { headers: controlHeaders },
|
|
2033
|
+
signal: timeout.signal,
|
|
2034
|
+
...spec.binary ? { parseAs: "arrayBuffer" } : {}
|
|
2035
|
+
});
|
|
2036
|
+
if (result.error !== void 0) throw ApiError.unexpected(`ProxyRequest returned an undocumented error for ${spec.operationId}.`, result.error);
|
|
2037
|
+
const dataValue = spec.binary ? binaryResult(spec, result.data, result.response.headers) : result.data;
|
|
2038
|
+
const headers = headersToRecord(result.response.headers);
|
|
2039
|
+
const etag = headers.etag;
|
|
2040
|
+
return {
|
|
2041
|
+
data: dataValue,
|
|
2042
|
+
statusCode: result.response.status,
|
|
2043
|
+
headers,
|
|
2044
|
+
...etag === void 0 ? {} : { etag },
|
|
2045
|
+
idempotencyReplayed: headers["idempotency-replayed"]?.toLowerCase() === "true"
|
|
2046
|
+
};
|
|
2047
|
+
} catch (error) {
|
|
2048
|
+
const apiError = (error instanceof ApiError ? error : ApiError.unexpected(`Unable to process the ProxyRequest response for ${spec.operationId}.`, error)).withIdempotencyKey(idempotencyKey);
|
|
2049
|
+
const delay = retryDelay(apiError, attempt);
|
|
2050
|
+
if (attempt >= 2 || idempotencyKey === void 0 || controls.signal?.aborted || delay === void 0) throw apiError;
|
|
2051
|
+
await wait(delay, controls.signal);
|
|
2052
|
+
} finally {
|
|
2053
|
+
timeout.cleanup();
|
|
1673
2054
|
}
|
|
1674
|
-
return result.data;
|
|
1675
|
-
} catch (error) {
|
|
1676
|
-
if (error instanceof ApiError) throw error;
|
|
1677
|
-
throw ApiError.unexpected(`Unable to process the ProxyRequest response for ${spec.operationId}.`, error);
|
|
1678
|
-
} finally {
|
|
1679
|
-
timeout.cleanup();
|
|
1680
2055
|
}
|
|
2056
|
+
throw ApiError.unexpected(`Unable to complete ${spec.operationId}.`);
|
|
1681
2057
|
}
|
|
1682
2058
|
async request(method, path, options = {}) {
|
|
1683
2059
|
const url = new URL(path.replace(/^\//u, ""), `${this.baseUrl}/`);
|
|
@@ -1752,40 +2128,63 @@ function appendQuery(search, query) {
|
|
|
1752
2128
|
function isBodyInit(value) {
|
|
1753
2129
|
return typeof value === "string" || value instanceof Blob || value instanceof ArrayBuffer || ArrayBuffer.isView(value) || value instanceof FormData || value instanceof URLSearchParams || value instanceof ReadableStream;
|
|
1754
2130
|
}
|
|
2131
|
+
function stringHeader(value) {
|
|
2132
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
2133
|
+
}
|
|
2134
|
+
function newIdempotencyKey() {
|
|
2135
|
+
if (typeof globalThis.crypto?.randomUUID !== "function") throw new Error("crypto.randomUUID() is required for automatic idempotency keys.");
|
|
2136
|
+
return globalThis.crypto.randomUUID();
|
|
2137
|
+
}
|
|
2138
|
+
function binaryResult(spec, data, headers) {
|
|
2139
|
+
if (!(data instanceof ArrayBuffer)) throw ApiError.unexpected(`ProxyRequest returned an invalid file for ${spec.operationId}.`);
|
|
2140
|
+
return FileDownload.fromResponse(data, headers);
|
|
2141
|
+
}
|
|
2142
|
+
function headersToRecord(headers) {
|
|
2143
|
+
return Object.freeze(Object.fromEntries(headers.entries()));
|
|
2144
|
+
}
|
|
2145
|
+
function retryDelay(error, attempt) {
|
|
2146
|
+
if (error.kind === "network") return attempt === 0 ? 100 : 200;
|
|
2147
|
+
if (error.statusCode === 409 && error.retryAfter !== void 0 && error.retryAfter >= 0 && error.retryAfter <= 5) return error.retryAfter * 1e3;
|
|
2148
|
+
}
|
|
2149
|
+
function wait(milliseconds, signal) {
|
|
2150
|
+
if (signal?.aborted) return Promise.reject(ApiError.network(signal.reason));
|
|
2151
|
+
return new Promise((resolvePromise, reject) => {
|
|
2152
|
+
const timer = setTimeout(() => {
|
|
2153
|
+
signal?.removeEventListener("abort", abort);
|
|
2154
|
+
resolvePromise();
|
|
2155
|
+
}, milliseconds);
|
|
2156
|
+
const abort = () => {
|
|
2157
|
+
clearTimeout(timer);
|
|
2158
|
+
reject(ApiError.network(signal?.reason));
|
|
2159
|
+
};
|
|
2160
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
2161
|
+
});
|
|
2162
|
+
}
|
|
1755
2163
|
|
|
1756
2164
|
//#endregion
|
|
1757
2165
|
//#region src/webhooks.ts
|
|
1758
2166
|
const encoder = new TextEncoder();
|
|
1759
2167
|
var WebhookVerifier = class WebhookVerifier {
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
if (!signature || !secret
|
|
1763
|
-
const
|
|
1764
|
-
if (
|
|
1765
|
-
if (options.timestampHeader !== void 0) {
|
|
1766
|
-
const timestampHeader = options.timestampHeader.trim();
|
|
1767
|
-
if (!/^\d+$/u.test(timestampHeader) || Number(timestampHeader) !== parsed.timestamp) return false;
|
|
1768
|
-
}
|
|
1769
|
-
const now = options.now ?? Math.floor(Date.now() / 1e3);
|
|
1770
|
-
if (tolerance !== null && Math.abs(now - parsed.timestamp) > tolerance) return false;
|
|
1771
|
-
const body = bodyBytes(rawBody);
|
|
1772
|
-
const payload = concatBytes(encoder.encode(`${parsed.timestamp}.`), body);
|
|
2168
|
+
/** Verify X-Signature against the exact raw request body. */
|
|
2169
|
+
static async verify(rawBody, signature, secret) {
|
|
2170
|
+
if (!signature || !secret) return false;
|
|
2171
|
+
const candidate = parseBase64Signature(signature);
|
|
2172
|
+
if (candidate === void 0) return false;
|
|
1773
2173
|
try {
|
|
1774
2174
|
const key = await globalThis.crypto.subtle.importKey("raw", encoder.encode(secret), {
|
|
1775
2175
|
name: "HMAC",
|
|
1776
2176
|
hash: "SHA-256"
|
|
1777
|
-
}, false, ["
|
|
1778
|
-
|
|
1779
|
-
return parsed.signatures.some((candidate) => constantTimeHexEqual(expected, candidate));
|
|
2177
|
+
}, false, ["verify"]);
|
|
2178
|
+
return globalThis.crypto.subtle.verify("HMAC", key, candidate.slice().buffer, bodyBytes(rawBody).slice().buffer);
|
|
1780
2179
|
} catch {
|
|
1781
2180
|
return false;
|
|
1782
2181
|
}
|
|
1783
2182
|
}
|
|
1784
|
-
static async verifyOrThrow(rawBody, signature, secret
|
|
1785
|
-
if (!await WebhookVerifier.verify(rawBody, signature, secret
|
|
2183
|
+
static async verifyOrThrow(rawBody, signature, secret) {
|
|
2184
|
+
if (!await WebhookVerifier.verify(rawBody, signature, secret)) throw new InvalidSignatureError("The ProxyRequest webhook signature is invalid.");
|
|
1786
2185
|
}
|
|
1787
|
-
static async decodeVerifiedJson(rawBody, signature, secret
|
|
1788
|
-
await WebhookVerifier.verifyOrThrow(rawBody, signature, secret
|
|
2186
|
+
static async decodeVerifiedJson(rawBody, signature, secret) {
|
|
2187
|
+
await WebhookVerifier.verifyOrThrow(rawBody, signature, secret);
|
|
1789
2188
|
const text = typeof rawBody === "string" ? rawBody : new TextDecoder().decode(bodyBytes(rawBody));
|
|
1790
2189
|
try {
|
|
1791
2190
|
const payload = JSON.parse(text);
|
|
@@ -1797,40 +2196,17 @@ var WebhookVerifier = class WebhookVerifier {
|
|
|
1797
2196
|
}
|
|
1798
2197
|
}
|
|
1799
2198
|
};
|
|
1800
|
-
function parseSignature(signature) {
|
|
1801
|
-
let timestamp;
|
|
1802
|
-
const signatures = [];
|
|
1803
|
-
for (const part of signature.split(",")) {
|
|
1804
|
-
const [key, value] = part.trim().split("=", 2);
|
|
1805
|
-
if (key === "t" && value !== void 0 && /^\d+$/u.test(value)) timestamp = Number(value);
|
|
1806
|
-
if (key === "v1" && value !== void 0 && /^[a-f\d]{64}$/iu.test(value)) signatures.push(value.toLowerCase());
|
|
1807
|
-
}
|
|
1808
|
-
if (timestamp === void 0 || !Number.isSafeInteger(timestamp) || signatures.length === 0) return;
|
|
1809
|
-
return {
|
|
1810
|
-
timestamp,
|
|
1811
|
-
signatures
|
|
1812
|
-
};
|
|
1813
|
-
}
|
|
1814
2199
|
function bodyBytes(value) {
|
|
1815
2200
|
if (typeof value === "string") return encoder.encode(value);
|
|
1816
2201
|
return value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
1817
2202
|
}
|
|
1818
|
-
function
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
|
|
1822
|
-
return
|
|
1823
|
-
}
|
|
1824
|
-
function constantTimeHexEqual(expected, candidate) {
|
|
1825
|
-
if (!/^[a-f\d]+$/iu.test(candidate) || candidate.length !== expected.byteLength * 2) return false;
|
|
1826
|
-
let difference = 0;
|
|
1827
|
-
for (let index = 0; index < expected.byteLength; index += 1) {
|
|
1828
|
-
const byte = Number.parseInt(candidate.slice(index * 2, index * 2 + 2), 16);
|
|
1829
|
-
difference |= (expected[index] ?? 0) ^ byte;
|
|
1830
|
-
}
|
|
1831
|
-
return difference === 0;
|
|
2203
|
+
function parseBase64Signature(signature) {
|
|
2204
|
+
if (!/^[A-Za-z0-9+/]{43}=$/u.test(signature)) return void 0;
|
|
2205
|
+
const decoded = atob(signature);
|
|
2206
|
+
if (decoded.length !== 32 || btoa(decoded) !== signature) return void 0;
|
|
2207
|
+
return Uint8Array.from(decoded, (character) => character.charCodeAt(0));
|
|
1832
2208
|
}
|
|
1833
2209
|
|
|
1834
2210
|
//#endregion
|
|
1835
|
-
export { APIKeysResource, AffiliatesResource, AnalyticsResource, ApiError, AuthorizationResource, ProxyRequestClient as Client, ProxyRequestClient, CouponsResource, DEFAULT_BASE_URL, FileDownload, InvalidSignatureError, InvoicesResource, LocationsResource, NewsResource, OrdersResource, PackagesResource, PaginationError, ProfileResource, ProxiesResource, ProxyRequestError, RewardsResource, SDK_VERSION,
|
|
2211
|
+
export { APIKeysResource, AffiliatesResource, AnalyticsResource, ApiError, AuthorizationResource, ProxyRequestClient as Client, ProxyRequestClient, CouponsResource, DEFAULT_BASE_URL, FileDownload, InvalidSignatureError, InvoicesResource, LocationsResource, NewsResource, OrdersResource, PackagesResource, PaginationError, ProfileResource, ProxiesResource, ProxyRequestError, RewardsResource, SDK_VERSION, SettingsResource, TelegramDashboardResource, UsersResource, WebhookVerifier, WebhooksResource, createResourceCollection, paginate };
|
|
1836
2212
|
//# sourceMappingURL=index.js.map
|