@proxyrequest/sdk 1.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +33 -0
- package/README.md +58 -8
- package/SECURITY.md +1 -1
- package/dist/index.cjs +665 -266
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +249 -74
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +249 -74
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +666 -265
- package/dist/index.js.map +1 -1
- package/dist/{models-VMmyyuf_.d.cts → models-Ci7ojtEW.d.cts} +13 -9
- package/dist/models-Ci7ojtEW.d.cts.map +1 -0
- package/dist/{models-ECy_bhdn.d.ts → models-rpFTQLRE.d.ts} +13 -9
- package/dist/models-rpFTQLRE.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-B2orTIrr.d.cts} +970 -453
- package/dist/schema-B2orTIrr.d.cts.map +1 -0
- package/dist/{schema-CvCxeox5.d.ts → schema-B2orTIrr.d.ts} +970 -453
- package/dist/schema-B2orTIrr.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"
|
|
@@ -703,8 +895,12 @@ var LocationsResource = class {
|
|
|
703
895
|
this.#client = client;
|
|
704
896
|
}
|
|
705
897
|
/** List available autonomous systems */
|
|
706
|
-
async listAsns(options
|
|
707
|
-
return this
|
|
898
|
+
async listAsns(options) {
|
|
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"
|
|
@@ -725,8 +921,12 @@ var LocationsResource = class {
|
|
|
725
921
|
});
|
|
726
922
|
}
|
|
727
923
|
/** List available cities */
|
|
728
|
-
async listCities(options
|
|
729
|
-
return this
|
|
924
|
+
async listCities(options) {
|
|
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,19 +948,28 @@ 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}"
|
|
755
959
|
}, {
|
|
756
960
|
path: { id: options.id },
|
|
961
|
+
query: { package_id: options.packageId },
|
|
757
962
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
758
963
|
...options.request === void 0 ? {} : { request: options.request }
|
|
759
964
|
});
|
|
760
965
|
}
|
|
761
966
|
/** List available continents */
|
|
762
|
-
async listContinents(options
|
|
763
|
-
return this
|
|
967
|
+
async listContinents(options) {
|
|
968
|
+
return (await this.listContinentsWithResponse(options)).data;
|
|
969
|
+
}
|
|
970
|
+
/** List available continents; include response metadata. */
|
|
971
|
+
async listContinentsWithResponse(options) {
|
|
972
|
+
return this.#client._callWithResponse({
|
|
764
973
|
operationId: "locations_continents_list",
|
|
765
974
|
method: "GET",
|
|
766
975
|
path: "/locations/continents"
|
|
@@ -780,19 +989,28 @@ var LocationsResource = class {
|
|
|
780
989
|
}
|
|
781
990
|
/** Get a continent */
|
|
782
991
|
async getContinent(options) {
|
|
783
|
-
return this
|
|
992
|
+
return (await this.getContinentWithResponse(options)).data;
|
|
993
|
+
}
|
|
994
|
+
/** Get a continent; include response metadata. */
|
|
995
|
+
async getContinentWithResponse(options) {
|
|
996
|
+
return this.#client._callWithResponse({
|
|
784
997
|
operationId: "locations_continents_retrieve",
|
|
785
998
|
method: "GET",
|
|
786
999
|
path: "/locations/continents/{id}"
|
|
787
1000
|
}, {
|
|
788
1001
|
path: { id: options.id },
|
|
1002
|
+
query: { package_id: options.packageId },
|
|
789
1003
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
790
1004
|
...options.request === void 0 ? {} : { request: options.request }
|
|
791
1005
|
});
|
|
792
1006
|
}
|
|
793
1007
|
/** List available countries */
|
|
794
|
-
async listCountries(options
|
|
795
|
-
return this
|
|
1008
|
+
async listCountries(options) {
|
|
1009
|
+
return (await this.listCountriesWithResponse(options)).data;
|
|
1010
|
+
}
|
|
1011
|
+
/** List available countries; include response metadata. */
|
|
1012
|
+
async listCountriesWithResponse(options) {
|
|
1013
|
+
return this.#client._callWithResponse({
|
|
796
1014
|
operationId: "locations_countries_list",
|
|
797
1015
|
method: "GET",
|
|
798
1016
|
path: "/locations/countries"
|
|
@@ -812,19 +1030,28 @@ var LocationsResource = class {
|
|
|
812
1030
|
}
|
|
813
1031
|
/** Get a country */
|
|
814
1032
|
async getCountry(options) {
|
|
815
|
-
return this
|
|
1033
|
+
return (await this.getCountryWithResponse(options)).data;
|
|
1034
|
+
}
|
|
1035
|
+
/** Get a country; include response metadata. */
|
|
1036
|
+
async getCountryWithResponse(options) {
|
|
1037
|
+
return this.#client._callWithResponse({
|
|
816
1038
|
operationId: "locations_countries_retrieve",
|
|
817
1039
|
method: "GET",
|
|
818
1040
|
path: "/locations/countries/{id}"
|
|
819
1041
|
}, {
|
|
820
1042
|
path: { id: options.id },
|
|
1043
|
+
query: { package_id: options.packageId },
|
|
821
1044
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
822
1045
|
...options.request === void 0 ? {} : { request: options.request }
|
|
823
1046
|
});
|
|
824
1047
|
}
|
|
825
1048
|
/** List available internet service providers */
|
|
826
|
-
async listIsps(options
|
|
827
|
-
return this
|
|
1049
|
+
async listIsps(options) {
|
|
1050
|
+
return (await this.listIspsWithResponse(options)).data;
|
|
1051
|
+
}
|
|
1052
|
+
/** List available internet service providers; include response metadata. */
|
|
1053
|
+
async listIspsWithResponse(options) {
|
|
1054
|
+
return this.#client._callWithResponse({
|
|
828
1055
|
operationId: "locations_isps_list",
|
|
829
1056
|
method: "GET",
|
|
830
1057
|
path: "/locations/isps"
|
|
@@ -844,8 +1071,12 @@ var LocationsResource = class {
|
|
|
844
1071
|
});
|
|
845
1072
|
}
|
|
846
1073
|
/** List available regions */
|
|
847
|
-
async listRegions(options
|
|
848
|
-
return this
|
|
1074
|
+
async listRegions(options) {
|
|
1075
|
+
return (await this.listRegionsWithResponse(options)).data;
|
|
1076
|
+
}
|
|
1077
|
+
/** List available regions; include response metadata. */
|
|
1078
|
+
async listRegionsWithResponse(options) {
|
|
1079
|
+
return this.#client._callWithResponse({
|
|
849
1080
|
operationId: "locations_regions_list",
|
|
850
1081
|
method: "GET",
|
|
851
1082
|
path: "/locations/regions"
|
|
@@ -866,12 +1097,17 @@ var LocationsResource = class {
|
|
|
866
1097
|
}
|
|
867
1098
|
/** Get a region */
|
|
868
1099
|
async getRegion(options) {
|
|
869
|
-
return this
|
|
1100
|
+
return (await this.getRegionWithResponse(options)).data;
|
|
1101
|
+
}
|
|
1102
|
+
/** Get a region; include response metadata. */
|
|
1103
|
+
async getRegionWithResponse(options) {
|
|
1104
|
+
return this.#client._callWithResponse({
|
|
870
1105
|
operationId: "locations_regions_retrieve",
|
|
871
1106
|
method: "GET",
|
|
872
1107
|
path: "/locations/regions/{id}"
|
|
873
1108
|
}, {
|
|
874
1109
|
path: { id: options.id },
|
|
1110
|
+
query: { package_id: options.packageId },
|
|
875
1111
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
876
1112
|
...options.request === void 0 ? {} : { request: options.request }
|
|
877
1113
|
});
|
|
@@ -884,7 +1120,11 @@ var NewsResource = class {
|
|
|
884
1120
|
}
|
|
885
1121
|
/** List product announcements */
|
|
886
1122
|
async list(options = {}) {
|
|
887
|
-
return this
|
|
1123
|
+
return (await this.listWithResponse(options)).data;
|
|
1124
|
+
}
|
|
1125
|
+
/** List product announcements; include response metadata. */
|
|
1126
|
+
async listWithResponse(options = {}) {
|
|
1127
|
+
return this.#client._callWithResponse({
|
|
888
1128
|
operationId: "news_list",
|
|
889
1129
|
method: "GET",
|
|
890
1130
|
path: "/news"
|
|
@@ -907,7 +1147,11 @@ var OrdersResource = class {
|
|
|
907
1147
|
}
|
|
908
1148
|
/** List active orders */
|
|
909
1149
|
async list(options = {}) {
|
|
910
|
-
return this
|
|
1150
|
+
return (await this.listWithResponse(options)).data;
|
|
1151
|
+
}
|
|
1152
|
+
/** List active orders; include response metadata. */
|
|
1153
|
+
async listWithResponse(options = {}) {
|
|
1154
|
+
return this.#client._callWithResponse({
|
|
911
1155
|
operationId: "orders_list",
|
|
912
1156
|
method: "GET",
|
|
913
1157
|
path: "/orders"
|
|
@@ -929,7 +1173,11 @@ var OrdersResource = class {
|
|
|
929
1173
|
}
|
|
930
1174
|
/** Get an order */
|
|
931
1175
|
async get(options) {
|
|
932
|
-
return this
|
|
1176
|
+
return (await this.getWithResponse(options)).data;
|
|
1177
|
+
}
|
|
1178
|
+
/** Get an order; include response metadata. */
|
|
1179
|
+
async getWithResponse(options) {
|
|
1180
|
+
return this.#client._callWithResponse({
|
|
933
1181
|
operationId: "orders_retrieve",
|
|
934
1182
|
method: "GET",
|
|
935
1183
|
path: "/orders/{id}"
|
|
@@ -941,32 +1189,52 @@ var OrdersResource = class {
|
|
|
941
1189
|
}
|
|
942
1190
|
/** Update order auto-renewal */
|
|
943
1191
|
async updateAutoRenewal(options) {
|
|
944
|
-
return this
|
|
1192
|
+
return (await this.updateAutoRenewalWithResponse(options)).data;
|
|
1193
|
+
}
|
|
1194
|
+
/** Update order auto-renewal; include response metadata. */
|
|
1195
|
+
async updateAutoRenewalWithResponse(options) {
|
|
1196
|
+
return this.#client._callWithResponse({
|
|
945
1197
|
operationId: "orders_partial_update",
|
|
946
1198
|
method: "PATCH",
|
|
947
1199
|
path: "/orders/{id}"
|
|
948
1200
|
}, {
|
|
949
1201
|
path: { id: options.id },
|
|
950
|
-
headers: {
|
|
1202
|
+
headers: {
|
|
1203
|
+
"If-Match": options.ifMatch,
|
|
1204
|
+
"Accept-Language": options.acceptLanguage
|
|
1205
|
+
},
|
|
951
1206
|
...options.body === void 0 ? {} : { body: options.body },
|
|
952
1207
|
...options.request === void 0 ? {} : { request: options.request }
|
|
953
1208
|
});
|
|
954
1209
|
}
|
|
955
1210
|
/** Delete a sub-user order */
|
|
956
1211
|
async delete(options) {
|
|
957
|
-
return this
|
|
1212
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1213
|
+
}
|
|
1214
|
+
/** Delete a sub-user order; include response metadata. */
|
|
1215
|
+
async deleteWithResponse(options) {
|
|
1216
|
+
return this.#client._callWithResponse({
|
|
958
1217
|
operationId: "orders_destroy",
|
|
959
1218
|
method: "DELETE",
|
|
960
|
-
path: "/orders/{id}"
|
|
1219
|
+
path: "/orders/{id}",
|
|
1220
|
+
idempotent: true
|
|
961
1221
|
}, {
|
|
962
1222
|
path: { id: options.id },
|
|
963
|
-
headers: {
|
|
1223
|
+
headers: {
|
|
1224
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1225
|
+
"If-Match": options.ifMatch,
|
|
1226
|
+
"Accept-Language": options.acceptLanguage
|
|
1227
|
+
},
|
|
964
1228
|
...options.request === void 0 ? {} : { request: options.request }
|
|
965
1229
|
});
|
|
966
1230
|
}
|
|
967
1231
|
/** Reset an order's proxy password */
|
|
968
1232
|
async resetPassword(options) {
|
|
969
|
-
return this
|
|
1233
|
+
return (await this.resetPasswordWithResponse(options)).data;
|
|
1234
|
+
}
|
|
1235
|
+
/** Reset an order's proxy password; include response metadata. */
|
|
1236
|
+
async resetPasswordWithResponse(options) {
|
|
1237
|
+
return this.#client._callWithResponse({
|
|
970
1238
|
operationId: "reset_password_create",
|
|
971
1239
|
method: "POST",
|
|
972
1240
|
path: "/reset-password"
|
|
@@ -984,7 +1252,11 @@ var PackagesResource = class {
|
|
|
984
1252
|
}
|
|
985
1253
|
/** List available proxy packages */
|
|
986
1254
|
async list(options = {}) {
|
|
987
|
-
return this
|
|
1255
|
+
return (await this.listWithResponse(options)).data;
|
|
1256
|
+
}
|
|
1257
|
+
/** List available proxy packages; include response metadata. */
|
|
1258
|
+
async listWithResponse(options = {}) {
|
|
1259
|
+
return this.#client._callWithResponse({
|
|
988
1260
|
operationId: "packages_list",
|
|
989
1261
|
method: "GET",
|
|
990
1262
|
path: "/packages"
|
|
@@ -1004,7 +1276,11 @@ var PackagesResource = class {
|
|
|
1004
1276
|
}
|
|
1005
1277
|
/** List affiliate package commissions */
|
|
1006
1278
|
async listCommissions(options = {}) {
|
|
1007
|
-
return this
|
|
1279
|
+
return (await this.listCommissionsWithResponse(options)).data;
|
|
1280
|
+
}
|
|
1281
|
+
/** List affiliate package commissions; include response metadata. */
|
|
1282
|
+
async listCommissionsWithResponse(options = {}) {
|
|
1283
|
+
return this.#client._callWithResponse({
|
|
1008
1284
|
operationId: "packages_commissions_list",
|
|
1009
1285
|
method: "GET",
|
|
1010
1286
|
path: "/packages/commissions"
|
|
@@ -1029,7 +1305,11 @@ var ProfileResource = class {
|
|
|
1029
1305
|
}
|
|
1030
1306
|
/** Get the current profile */
|
|
1031
1307
|
async get(options = {}) {
|
|
1032
|
-
return this
|
|
1308
|
+
return (await this.getWithResponse(options)).data;
|
|
1309
|
+
}
|
|
1310
|
+
/** Get the current profile; include response metadata. */
|
|
1311
|
+
async getWithResponse(options = {}) {
|
|
1312
|
+
return this.#client._callWithResponse({
|
|
1033
1313
|
operationId: "profile_retrieve",
|
|
1034
1314
|
method: "GET",
|
|
1035
1315
|
path: "/profile"
|
|
@@ -1040,30 +1320,48 @@ var ProfileResource = class {
|
|
|
1040
1320
|
}
|
|
1041
1321
|
/** Update the current profile */
|
|
1042
1322
|
async update(options = {}) {
|
|
1043
|
-
return this
|
|
1323
|
+
return (await this.updateWithResponse(options)).data;
|
|
1324
|
+
}
|
|
1325
|
+
/** Update the current profile; include response metadata. */
|
|
1326
|
+
async updateWithResponse(options = {}) {
|
|
1327
|
+
return this.#client._callWithResponse({
|
|
1044
1328
|
operationId: "profile_partial_update",
|
|
1045
1329
|
method: "PATCH",
|
|
1046
1330
|
path: "/profile"
|
|
1047
1331
|
}, {
|
|
1048
|
-
headers: {
|
|
1332
|
+
headers: {
|
|
1333
|
+
"If-Match": options.ifMatch,
|
|
1334
|
+
"Accept-Language": options.acceptLanguage
|
|
1335
|
+
},
|
|
1049
1336
|
...options.body === void 0 ? {} : { body: options.body },
|
|
1050
1337
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1051
1338
|
});
|
|
1052
1339
|
}
|
|
1053
1340
|
/** Delete the current account */
|
|
1054
1341
|
async delete(options = {}) {
|
|
1055
|
-
return this
|
|
1342
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1343
|
+
}
|
|
1344
|
+
/** Delete the current account; include response metadata. */
|
|
1345
|
+
async deleteWithResponse(options = {}) {
|
|
1346
|
+
return this.#client._callWithResponse({
|
|
1056
1347
|
operationId: "profile_destroy",
|
|
1057
1348
|
method: "DELETE",
|
|
1058
1349
|
path: "/profile"
|
|
1059
1350
|
}, {
|
|
1060
|
-
headers: {
|
|
1351
|
+
headers: {
|
|
1352
|
+
"If-Match": options.ifMatch,
|
|
1353
|
+
"Accept-Language": options.acceptLanguage
|
|
1354
|
+
},
|
|
1061
1355
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1062
1356
|
});
|
|
1063
1357
|
}
|
|
1064
|
-
/** Confirm two-factor
|
|
1358
|
+
/** Confirm two-factor authentication */
|
|
1065
1359
|
async confirmTwoFactor(options) {
|
|
1066
|
-
return this
|
|
1360
|
+
return (await this.confirmTwoFactorWithResponse(options)).data;
|
|
1361
|
+
}
|
|
1362
|
+
/** Confirm two-factor authentication; include response metadata. */
|
|
1363
|
+
async confirmTwoFactorWithResponse(options) {
|
|
1364
|
+
return this.#client._callWithResponse({
|
|
1067
1365
|
operationId: "profile_2fa_confirm_create",
|
|
1068
1366
|
method: "POST",
|
|
1069
1367
|
path: "/profile/2fa/confirm"
|
|
@@ -1075,7 +1373,11 @@ var ProfileResource = class {
|
|
|
1075
1373
|
}
|
|
1076
1374
|
/** Disable two-factor authentication */
|
|
1077
1375
|
async disableTwoFactor(options) {
|
|
1078
|
-
return this
|
|
1376
|
+
return (await this.disableTwoFactorWithResponse(options)).data;
|
|
1377
|
+
}
|
|
1378
|
+
/** Disable two-factor authentication; include response metadata. */
|
|
1379
|
+
async disableTwoFactorWithResponse(options) {
|
|
1380
|
+
return this.#client._callWithResponse({
|
|
1079
1381
|
operationId: "profile_2fa_disable_create",
|
|
1080
1382
|
method: "POST",
|
|
1081
1383
|
path: "/profile/2fa/disable"
|
|
@@ -1085,20 +1387,29 @@ var ProfileResource = class {
|
|
|
1085
1387
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1086
1388
|
});
|
|
1087
1389
|
}
|
|
1088
|
-
/**
|
|
1390
|
+
/** Prepare two-factor authentication */
|
|
1089
1391
|
async setupTwoFactor(options = {}) {
|
|
1090
|
-
return this
|
|
1392
|
+
return (await this.setupTwoFactorWithResponse(options)).data;
|
|
1393
|
+
}
|
|
1394
|
+
/** Prepare two-factor authentication; include response metadata. */
|
|
1395
|
+
async setupTwoFactorWithResponse(options = {}) {
|
|
1396
|
+
return this.#client._callWithResponse({
|
|
1091
1397
|
operationId: "profile_2fa_setup_create",
|
|
1092
1398
|
method: "POST",
|
|
1093
1399
|
path: "/profile/2fa/setup"
|
|
1094
1400
|
}, {
|
|
1095
1401
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
1402
|
+
...options.body === void 0 ? {} : { body: options.body },
|
|
1096
1403
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1097
1404
|
});
|
|
1098
1405
|
}
|
|
1099
1406
|
/** Get two-factor status */
|
|
1100
1407
|
async getTwoFactorStatus(options = {}) {
|
|
1101
|
-
return this
|
|
1408
|
+
return (await this.getTwoFactorStatusWithResponse(options)).data;
|
|
1409
|
+
}
|
|
1410
|
+
/** Get two-factor status; include response metadata. */
|
|
1411
|
+
async getTwoFactorStatusWithResponse(options = {}) {
|
|
1412
|
+
return this.#client._callWithResponse({
|
|
1102
1413
|
operationId: "profile_2fa_status_retrieve",
|
|
1103
1414
|
method: "GET",
|
|
1104
1415
|
path: "/profile/2fa/status"
|
|
@@ -1109,7 +1420,11 @@ var ProfileResource = class {
|
|
|
1109
1420
|
}
|
|
1110
1421
|
/** Change the account password */
|
|
1111
1422
|
async changePassword(options) {
|
|
1112
|
-
return this
|
|
1423
|
+
return (await this.changePasswordWithResponse(options)).data;
|
|
1424
|
+
}
|
|
1425
|
+
/** Change the account password; include response metadata. */
|
|
1426
|
+
async changePasswordWithResponse(options) {
|
|
1427
|
+
return this.#client._callWithResponse({
|
|
1113
1428
|
operationId: "profile_change_password_create",
|
|
1114
1429
|
method: "POST",
|
|
1115
1430
|
path: "/profile/change-password"
|
|
@@ -1127,7 +1442,11 @@ var ProxiesResource = class {
|
|
|
1127
1442
|
}
|
|
1128
1443
|
/** Generate proxy credentials */
|
|
1129
1444
|
async generate(options) {
|
|
1130
|
-
return this
|
|
1445
|
+
return (await this.generateWithResponse(options)).data;
|
|
1446
|
+
}
|
|
1447
|
+
/** Generate proxy credentials; include response metadata. */
|
|
1448
|
+
async generateWithResponse(options) {
|
|
1449
|
+
return this.#client._callWithResponse({
|
|
1131
1450
|
operationId: "proxies_generate_create",
|
|
1132
1451
|
method: "POST",
|
|
1133
1452
|
path: "/proxies/generate"
|
|
@@ -1145,7 +1464,11 @@ var RewardsResource = class {
|
|
|
1145
1464
|
}
|
|
1146
1465
|
/** List account rewards */
|
|
1147
1466
|
async list(options = {}) {
|
|
1148
|
-
return this
|
|
1467
|
+
return (await this.listWithResponse(options)).data;
|
|
1468
|
+
}
|
|
1469
|
+
/** List account rewards; include response metadata. */
|
|
1470
|
+
async listWithResponse(options = {}) {
|
|
1471
|
+
return this.#client._callWithResponse({
|
|
1149
1472
|
operationId: "rewards_list",
|
|
1150
1473
|
method: "GET",
|
|
1151
1474
|
path: "/rewards"
|
|
@@ -1164,7 +1487,11 @@ var RewardsResource = class {
|
|
|
1164
1487
|
}
|
|
1165
1488
|
/** Claim available rewards */
|
|
1166
1489
|
async claim(options) {
|
|
1167
|
-
return this
|
|
1490
|
+
return (await this.claimWithResponse(options)).data;
|
|
1491
|
+
}
|
|
1492
|
+
/** Claim available rewards; include response metadata. */
|
|
1493
|
+
async claimWithResponse(options) {
|
|
1494
|
+
return this.#client._callWithResponse({
|
|
1168
1495
|
operationId: "rewards_claim_create",
|
|
1169
1496
|
method: "POST",
|
|
1170
1497
|
path: "/rewards/claim"
|
|
@@ -1175,35 +1502,6 @@ var RewardsResource = class {
|
|
|
1175
1502
|
});
|
|
1176
1503
|
}
|
|
1177
1504
|
};
|
|
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
1505
|
var SettingsResource = class {
|
|
1208
1506
|
#client;
|
|
1209
1507
|
constructor(client) {
|
|
@@ -1211,7 +1509,11 @@ var SettingsResource = class {
|
|
|
1211
1509
|
}
|
|
1212
1510
|
/** Get account settings */
|
|
1213
1511
|
async get(options = {}) {
|
|
1214
|
-
return this
|
|
1512
|
+
return (await this.getWithResponse(options)).data;
|
|
1513
|
+
}
|
|
1514
|
+
/** Get account settings; include response metadata. */
|
|
1515
|
+
async getWithResponse(options = {}) {
|
|
1516
|
+
return this.#client._callWithResponse({
|
|
1215
1517
|
operationId: "settings_retrieve",
|
|
1216
1518
|
method: "GET",
|
|
1217
1519
|
path: "/settings"
|
|
@@ -1228,7 +1530,11 @@ var TelegramDashboardResource = class {
|
|
|
1228
1530
|
}
|
|
1229
1531
|
/** Get the Telegram dashboard connection */
|
|
1230
1532
|
async getConnection(options = {}) {
|
|
1231
|
-
return this
|
|
1533
|
+
return (await this.getConnectionWithResponse(options)).data;
|
|
1534
|
+
}
|
|
1535
|
+
/** Get the Telegram dashboard connection; include response metadata. */
|
|
1536
|
+
async getConnectionWithResponse(options = {}) {
|
|
1537
|
+
return this.#client._callWithResponse({
|
|
1232
1538
|
operationId: "integrations_telegram_connection_retrieve",
|
|
1233
1539
|
method: "GET",
|
|
1234
1540
|
path: "/integrations/telegram/connection"
|
|
@@ -1239,7 +1545,11 @@ var TelegramDashboardResource = class {
|
|
|
1239
1545
|
}
|
|
1240
1546
|
/** Update Telegram dashboard preferences */
|
|
1241
1547
|
async updateConnection(options = {}) {
|
|
1242
|
-
return this
|
|
1548
|
+
return (await this.updateConnectionWithResponse(options)).data;
|
|
1549
|
+
}
|
|
1550
|
+
/** Update Telegram dashboard preferences; include response metadata. */
|
|
1551
|
+
async updateConnectionWithResponse(options = {}) {
|
|
1552
|
+
return this.#client._callWithResponse({
|
|
1243
1553
|
operationId: "integrations_telegram_connection_partial_update",
|
|
1244
1554
|
method: "PATCH",
|
|
1245
1555
|
path: "/integrations/telegram/connection"
|
|
@@ -1251,7 +1561,11 @@ var TelegramDashboardResource = class {
|
|
|
1251
1561
|
}
|
|
1252
1562
|
/** Disconnect the Telegram dashboard */
|
|
1253
1563
|
async deleteConnection(options = {}) {
|
|
1254
|
-
return this
|
|
1564
|
+
return (await this.deleteConnectionWithResponse(options)).data;
|
|
1565
|
+
}
|
|
1566
|
+
/** Disconnect the Telegram dashboard; include response metadata. */
|
|
1567
|
+
async deleteConnectionWithResponse(options = {}) {
|
|
1568
|
+
return this.#client._callWithResponse({
|
|
1255
1569
|
operationId: "integrations_telegram_connection_destroy",
|
|
1256
1570
|
method: "DELETE",
|
|
1257
1571
|
path: "/integrations/telegram/connection"
|
|
@@ -1262,7 +1576,11 @@ var TelegramDashboardResource = class {
|
|
|
1262
1576
|
}
|
|
1263
1577
|
/** Create a Telegram account link */
|
|
1264
1578
|
async createLink(options = {}) {
|
|
1265
|
-
return this
|
|
1579
|
+
return (await this.createLinkWithResponse(options)).data;
|
|
1580
|
+
}
|
|
1581
|
+
/** Create a Telegram account link; include response metadata. */
|
|
1582
|
+
async createLinkWithResponse(options = {}) {
|
|
1583
|
+
return this.#client._callWithResponse({
|
|
1266
1584
|
operationId: "integrations_telegram_link_create",
|
|
1267
1585
|
method: "POST",
|
|
1268
1586
|
path: "/integrations/telegram/link"
|
|
@@ -1272,42 +1590,6 @@ var TelegramDashboardResource = class {
|
|
|
1272
1590
|
});
|
|
1273
1591
|
}
|
|
1274
1592
|
};
|
|
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
1593
|
var UsersResource = class {
|
|
1312
1594
|
#client;
|
|
1313
1595
|
constructor(client) {
|
|
@@ -1315,7 +1597,11 @@ var UsersResource = class {
|
|
|
1315
1597
|
}
|
|
1316
1598
|
/** List users in the current account */
|
|
1317
1599
|
async list(options = {}) {
|
|
1318
|
-
return this
|
|
1600
|
+
return (await this.listWithResponse(options)).data;
|
|
1601
|
+
}
|
|
1602
|
+
/** List users in the current account; include response metadata. */
|
|
1603
|
+
async listWithResponse(options = {}) {
|
|
1604
|
+
return this.#client._callWithResponse({
|
|
1319
1605
|
operationId: "users_list",
|
|
1320
1606
|
method: "GET",
|
|
1321
1607
|
path: "/users"
|
|
@@ -1334,21 +1620,33 @@ var UsersResource = class {
|
|
|
1334
1620
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1335
1621
|
});
|
|
1336
1622
|
}
|
|
1337
|
-
/** Create a
|
|
1623
|
+
/** Create a customer account */
|
|
1338
1624
|
async create(options) {
|
|
1339
|
-
return this
|
|
1625
|
+
return (await this.createWithResponse(options)).data;
|
|
1626
|
+
}
|
|
1627
|
+
/** Create a customer account; include response metadata. */
|
|
1628
|
+
async createWithResponse(options) {
|
|
1629
|
+
return this.#client._callWithResponse({
|
|
1340
1630
|
operationId: "users_create",
|
|
1341
1631
|
method: "POST",
|
|
1342
|
-
path: "/users"
|
|
1632
|
+
path: "/users",
|
|
1633
|
+
idempotent: true
|
|
1343
1634
|
}, {
|
|
1344
|
-
headers: {
|
|
1635
|
+
headers: {
|
|
1636
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1637
|
+
"Accept-Language": options.acceptLanguage
|
|
1638
|
+
},
|
|
1345
1639
|
body: options.body,
|
|
1346
1640
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1347
1641
|
});
|
|
1348
1642
|
}
|
|
1349
1643
|
/** Get a user */
|
|
1350
1644
|
async get(options) {
|
|
1351
|
-
return this
|
|
1645
|
+
return (await this.getWithResponse(options)).data;
|
|
1646
|
+
}
|
|
1647
|
+
/** Get a user; include response metadata. */
|
|
1648
|
+
async getWithResponse(options) {
|
|
1649
|
+
return this.#client._callWithResponse({
|
|
1352
1650
|
operationId: "users_retrieve",
|
|
1353
1651
|
method: "GET",
|
|
1354
1652
|
path: "/users/{id}"
|
|
@@ -1360,58 +1658,115 @@ var UsersResource = class {
|
|
|
1360
1658
|
}
|
|
1361
1659
|
/** Update a user */
|
|
1362
1660
|
async update(options) {
|
|
1363
|
-
return this
|
|
1661
|
+
return (await this.updateWithResponse(options)).data;
|
|
1662
|
+
}
|
|
1663
|
+
/** Update a user; include response metadata. */
|
|
1664
|
+
async updateWithResponse(options) {
|
|
1665
|
+
return this.#client._callWithResponse({
|
|
1364
1666
|
operationId: "users_partial_update",
|
|
1365
1667
|
method: "PATCH",
|
|
1366
1668
|
path: "/users/{id}"
|
|
1367
1669
|
}, {
|
|
1368
1670
|
path: { id: options.id },
|
|
1369
|
-
headers: {
|
|
1671
|
+
headers: {
|
|
1672
|
+
"If-Match": options.ifMatch,
|
|
1673
|
+
"Accept-Language": options.acceptLanguage
|
|
1674
|
+
},
|
|
1370
1675
|
...options.body === void 0 ? {} : { body: options.body },
|
|
1371
1676
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1372
1677
|
});
|
|
1373
1678
|
}
|
|
1374
1679
|
/** Delete a user */
|
|
1375
1680
|
async delete(options) {
|
|
1376
|
-
return this
|
|
1681
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1682
|
+
}
|
|
1683
|
+
/** Delete a user; include response metadata. */
|
|
1684
|
+
async deleteWithResponse(options) {
|
|
1685
|
+
return this.#client._callWithResponse({
|
|
1377
1686
|
operationId: "users_destroy",
|
|
1378
1687
|
method: "DELETE",
|
|
1379
|
-
path: "/users/{id}"
|
|
1688
|
+
path: "/users/{id}",
|
|
1689
|
+
idempotent: true
|
|
1380
1690
|
}, {
|
|
1381
1691
|
path: { id: options.id },
|
|
1382
|
-
headers: {
|
|
1692
|
+
headers: {
|
|
1693
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1694
|
+
"If-Match": options.ifMatch,
|
|
1695
|
+
"Accept-Language": options.acceptLanguage
|
|
1696
|
+
},
|
|
1383
1697
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1384
1698
|
});
|
|
1385
1699
|
}
|
|
1386
1700
|
/** Add data to a sub-user order */
|
|
1387
1701
|
async addData(options) {
|
|
1388
|
-
return this
|
|
1702
|
+
return (await this.addDataWithResponse(options)).data;
|
|
1703
|
+
}
|
|
1704
|
+
/** Add data to a sub-user order; include response metadata. */
|
|
1705
|
+
async addDataWithResponse(options) {
|
|
1706
|
+
return this.#client._callWithResponse({
|
|
1389
1707
|
operationId: "users_data_add_create",
|
|
1390
1708
|
method: "POST",
|
|
1391
|
-
path: "/users/{id}/data/add"
|
|
1709
|
+
path: "/users/{id}/data/add",
|
|
1710
|
+
idempotent: true
|
|
1392
1711
|
}, {
|
|
1393
1712
|
path: { id: options.id },
|
|
1394
|
-
headers: {
|
|
1713
|
+
headers: {
|
|
1714
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1715
|
+
"Accept-Language": options.acceptLanguage
|
|
1716
|
+
},
|
|
1395
1717
|
body: options.body,
|
|
1396
1718
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1397
1719
|
});
|
|
1398
1720
|
}
|
|
1399
1721
|
/** Subtract data from a sub-user order */
|
|
1400
1722
|
async subtractData(options) {
|
|
1401
|
-
return this
|
|
1723
|
+
return (await this.subtractDataWithResponse(options)).data;
|
|
1724
|
+
}
|
|
1725
|
+
/** Subtract data from a sub-user order; include response metadata. */
|
|
1726
|
+
async subtractDataWithResponse(options) {
|
|
1727
|
+
return this.#client._callWithResponse({
|
|
1402
1728
|
operationId: "users_data_subtract_create",
|
|
1403
1729
|
method: "POST",
|
|
1404
|
-
path: "/users/{id}/data/subtract"
|
|
1730
|
+
path: "/users/{id}/data/subtract",
|
|
1731
|
+
idempotent: true
|
|
1405
1732
|
}, {
|
|
1406
1733
|
path: { id: options.id },
|
|
1407
|
-
headers: {
|
|
1734
|
+
headers: {
|
|
1735
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1736
|
+
"Accept-Language": options.acceptLanguage
|
|
1737
|
+
},
|
|
1738
|
+
body: options.body,
|
|
1739
|
+
...options.request === void 0 ? {} : { request: options.request }
|
|
1740
|
+
});
|
|
1741
|
+
}
|
|
1742
|
+
/** Reset a user's remaining data */
|
|
1743
|
+
async resetData(options) {
|
|
1744
|
+
return (await this.resetDataWithResponse(options)).data;
|
|
1745
|
+
}
|
|
1746
|
+
/** Reset a user's remaining data; include response metadata. */
|
|
1747
|
+
async resetDataWithResponse(options) {
|
|
1748
|
+
return this.#client._callWithResponse({
|
|
1749
|
+
operationId: "users_data_reset_create",
|
|
1750
|
+
method: "POST",
|
|
1751
|
+
path: "/users/{id}/data/reset",
|
|
1752
|
+
idempotent: true
|
|
1753
|
+
}, {
|
|
1754
|
+
path: { id: options.id },
|
|
1755
|
+
headers: {
|
|
1756
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1757
|
+
"Accept-Language": options.acceptLanguage
|
|
1758
|
+
},
|
|
1408
1759
|
body: options.body,
|
|
1409
1760
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1410
1761
|
});
|
|
1411
1762
|
}
|
|
1412
1763
|
/** List a sub-user's orders */
|
|
1413
1764
|
async listOrders(options) {
|
|
1414
|
-
return this
|
|
1765
|
+
return (await this.listOrdersWithResponse(options)).data;
|
|
1766
|
+
}
|
|
1767
|
+
/** List a sub-user's orders; include response metadata. */
|
|
1768
|
+
async listOrdersWithResponse(options) {
|
|
1769
|
+
return this.#client._callWithResponse({
|
|
1415
1770
|
operationId: "users_orders_list",
|
|
1416
1771
|
method: "GET",
|
|
1417
1772
|
path: "/users/{id}/orders"
|
|
@@ -1431,14 +1786,18 @@ var UsersResource = class {
|
|
|
1431
1786
|
}
|
|
1432
1787
|
/** Rotate a sub-user proxy password */
|
|
1433
1788
|
async resetPassword(options) {
|
|
1434
|
-
return this
|
|
1789
|
+
return (await this.resetPasswordWithResponse(options)).data;
|
|
1790
|
+
}
|
|
1791
|
+
/** Rotate a sub-user proxy password; include response metadata. */
|
|
1792
|
+
async resetPasswordWithResponse(options) {
|
|
1793
|
+
return this.#client._callWithResponse({
|
|
1435
1794
|
operationId: "users_password_create",
|
|
1436
1795
|
method: "POST",
|
|
1437
1796
|
path: "/users/{id}/password"
|
|
1438
1797
|
}, {
|
|
1439
1798
|
path: { id: options.id },
|
|
1440
1799
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
1441
|
-
|
|
1800
|
+
body: options.body,
|
|
1442
1801
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1443
1802
|
});
|
|
1444
1803
|
}
|
|
@@ -1450,7 +1809,11 @@ var WebhooksResource = class {
|
|
|
1450
1809
|
}
|
|
1451
1810
|
/** List customer webhooks */
|
|
1452
1811
|
async list(options = {}) {
|
|
1453
|
-
return this
|
|
1812
|
+
return (await this.listWithResponse(options)).data;
|
|
1813
|
+
}
|
|
1814
|
+
/** List customer webhooks; include response metadata. */
|
|
1815
|
+
async listWithResponse(options = {}) {
|
|
1816
|
+
return this.#client._callWithResponse({
|
|
1454
1817
|
operationId: "webhooks_list",
|
|
1455
1818
|
method: "GET",
|
|
1456
1819
|
path: "/webhooks"
|
|
@@ -1465,19 +1828,31 @@ var WebhooksResource = class {
|
|
|
1465
1828
|
}
|
|
1466
1829
|
/** Create a customer webhook */
|
|
1467
1830
|
async create(options) {
|
|
1468
|
-
return this
|
|
1831
|
+
return (await this.createWithResponse(options)).data;
|
|
1832
|
+
}
|
|
1833
|
+
/** Create a customer webhook; include response metadata. */
|
|
1834
|
+
async createWithResponse(options) {
|
|
1835
|
+
return this.#client._callWithResponse({
|
|
1469
1836
|
operationId: "webhooks_create",
|
|
1470
1837
|
method: "POST",
|
|
1471
|
-
path: "/webhooks"
|
|
1838
|
+
path: "/webhooks",
|
|
1839
|
+
idempotent: true
|
|
1472
1840
|
}, {
|
|
1473
|
-
headers: {
|
|
1841
|
+
headers: {
|
|
1842
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1843
|
+
"Accept-Language": options.acceptLanguage
|
|
1844
|
+
},
|
|
1474
1845
|
body: options.body,
|
|
1475
1846
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1476
1847
|
});
|
|
1477
1848
|
}
|
|
1478
1849
|
/** Get a customer webhook */
|
|
1479
1850
|
async get(options) {
|
|
1480
|
-
return this
|
|
1851
|
+
return (await this.getWithResponse(options)).data;
|
|
1852
|
+
}
|
|
1853
|
+
/** Get a customer webhook; include response metadata. */
|
|
1854
|
+
async getWithResponse(options) {
|
|
1855
|
+
return this.#client._callWithResponse({
|
|
1481
1856
|
operationId: "webhooks_retrieve",
|
|
1482
1857
|
method: "GET",
|
|
1483
1858
|
path: "/webhooks/{id}"
|
|
@@ -1489,13 +1864,22 @@ var WebhooksResource = class {
|
|
|
1489
1864
|
}
|
|
1490
1865
|
/** Delete a customer webhook */
|
|
1491
1866
|
async delete(options) {
|
|
1492
|
-
return this
|
|
1867
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1868
|
+
}
|
|
1869
|
+
/** Delete a customer webhook; include response metadata. */
|
|
1870
|
+
async deleteWithResponse(options) {
|
|
1871
|
+
return this.#client._callWithResponse({
|
|
1493
1872
|
operationId: "webhooks_destroy",
|
|
1494
1873
|
method: "DELETE",
|
|
1495
|
-
path: "/webhooks/{id}"
|
|
1874
|
+
path: "/webhooks/{id}",
|
|
1875
|
+
idempotent: true
|
|
1496
1876
|
}, {
|
|
1497
1877
|
path: { id: options.id },
|
|
1498
|
-
headers: {
|
|
1878
|
+
headers: {
|
|
1879
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1880
|
+
"If-Match": options.ifMatch,
|
|
1881
|
+
"Accept-Language": options.acceptLanguage
|
|
1882
|
+
},
|
|
1499
1883
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1500
1884
|
});
|
|
1501
1885
|
}
|
|
@@ -1515,10 +1899,8 @@ function createResourceCollection(client) {
|
|
|
1515
1899
|
profile: new ProfileResource(client),
|
|
1516
1900
|
proxies: new ProxiesResource(client),
|
|
1517
1901
|
rewards: new RewardsResource(client),
|
|
1518
|
-
sessions: new SessionsResource(client),
|
|
1519
1902
|
settings: new SettingsResource(client),
|
|
1520
1903
|
telegram: new TelegramDashboardResource(client),
|
|
1521
|
-
telegramService: new TelegramServiceResource(client),
|
|
1522
1904
|
users: new UsersResource(client),
|
|
1523
1905
|
webhooks: new WebhooksResource(client)
|
|
1524
1906
|
};
|
|
@@ -1562,7 +1944,7 @@ function offsetFromUrl(url) {
|
|
|
1562
1944
|
//#endregion
|
|
1563
1945
|
//#region src/client.ts
|
|
1564
1946
|
const DEFAULT_BASE_URL = "https://api.proxyrequest.com/api/v1";
|
|
1565
|
-
const SDK_VERSION = "1.0
|
|
1947
|
+
const SDK_VERSION = "2.1.0";
|
|
1566
1948
|
var ProxyRequestClient = class ProxyRequestClient {
|
|
1567
1949
|
apiKeys;
|
|
1568
1950
|
affiliates;
|
|
@@ -1577,15 +1959,14 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1577
1959
|
profile;
|
|
1578
1960
|
proxies;
|
|
1579
1961
|
rewards;
|
|
1580
|
-
sessions;
|
|
1581
1962
|
settings;
|
|
1582
1963
|
telegram;
|
|
1583
|
-
telegramService;
|
|
1584
1964
|
users;
|
|
1585
1965
|
webhooks;
|
|
1586
1966
|
baseUrl;
|
|
1587
1967
|
language;
|
|
1588
1968
|
timeoutMs;
|
|
1969
|
+
idempotency;
|
|
1589
1970
|
#fetch;
|
|
1590
1971
|
#headers;
|
|
1591
1972
|
#openapi;
|
|
@@ -1593,6 +1974,7 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1593
1974
|
this.baseUrl = normalizeBaseUrl(options.baseUrl ?? "https://api.proxyrequest.com/api/v1");
|
|
1594
1975
|
this.language = options.language ?? "en";
|
|
1595
1976
|
this.timeoutMs = options.timeoutMs ?? 15e3;
|
|
1977
|
+
this.idempotency = options.idempotency ?? true;
|
|
1596
1978
|
if (!Number.isFinite(this.timeoutMs) || this.timeoutMs < 0) throw new RangeError("timeoutMs must be a non-negative finite number.");
|
|
1597
1979
|
this.#fetch = options.fetch ?? globalThis.fetch;
|
|
1598
1980
|
if (typeof this.#fetch !== "function") throw new TypeError("A Fetch API implementation is required.");
|
|
@@ -1627,10 +2009,8 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1627
2009
|
this.profile = resources.profile;
|
|
1628
2010
|
this.proxies = resources.proxies;
|
|
1629
2011
|
this.rewards = resources.rewards;
|
|
1630
|
-
this.sessions = resources.sessions;
|
|
1631
2012
|
this.settings = resources.settings;
|
|
1632
2013
|
this.telegram = resources.telegram;
|
|
1633
|
-
this.telegramService = resources.telegramService;
|
|
1634
2014
|
this.users = resources.users;
|
|
1635
2015
|
this.webhooks = resources.webhooks;
|
|
1636
2016
|
}
|
|
@@ -1650,34 +2030,55 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1650
2030
|
return new ProxyRequestClient(options);
|
|
1651
2031
|
}
|
|
1652
2032
|
async _call(spec, data = {}) {
|
|
2033
|
+
return (await this._callWithResponse(spec, data)).data;
|
|
2034
|
+
}
|
|
2035
|
+
async _callWithResponse(spec, data = {}) {
|
|
1653
2036
|
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" } : {}
|
|
2037
|
+
const controlHeaders = new Headers(controls.headers);
|
|
2038
|
+
const parameterKey = stringHeader(data.headers?.["Idempotency-Key"]);
|
|
2039
|
+
const controlKey = controlHeaders.get("Idempotency-Key") ?? void 0;
|
|
2040
|
+
const idempotencyKey = spec.idempotent ? parameterKey ?? controlKey ?? (this.idempotency ? newIdempotencyKey() : void 0) : void 0;
|
|
2041
|
+
if (spec.idempotent) controlHeaders.delete("Idempotency-Key");
|
|
2042
|
+
const operationHeaders = {
|
|
2043
|
+
...data.headers,
|
|
2044
|
+
...idempotencyKey === void 0 ? {} : { "Idempotency-Key": idempotencyKey }
|
|
1665
2045
|
};
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
const
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
2046
|
+
const method = this.#openapi[spec.method];
|
|
2047
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
2048
|
+
const timeout = requestSignal(controls.signal, controls.timeoutMs ?? this.timeoutMs);
|
|
2049
|
+
try {
|
|
2050
|
+
const result = await method(spec.path, {
|
|
2051
|
+
params: {
|
|
2052
|
+
...data.path === void 0 ? {} : { path: data.path },
|
|
2053
|
+
...data.query === void 0 ? {} : { query: data.query },
|
|
2054
|
+
...Object.keys(operationHeaders).length === 0 ? {} : { header: operationHeaders }
|
|
2055
|
+
},
|
|
2056
|
+
...data.body === void 0 ? {} : { body: data.body },
|
|
2057
|
+
...[...controlHeaders].length === 0 ? {} : { headers: controlHeaders },
|
|
2058
|
+
signal: timeout.signal,
|
|
2059
|
+
...spec.binary ? { parseAs: "arrayBuffer" } : {}
|
|
2060
|
+
});
|
|
2061
|
+
if (result.error !== void 0) throw ApiError.unexpected(`ProxyRequest returned an undocumented error for ${spec.operationId}.`, result.error);
|
|
2062
|
+
const dataValue = spec.binary ? binaryResult(spec, result.data, result.response.headers) : result.data;
|
|
2063
|
+
const headers = headersToRecord(result.response.headers);
|
|
2064
|
+
const etag = headers.etag;
|
|
2065
|
+
return {
|
|
2066
|
+
data: dataValue,
|
|
2067
|
+
statusCode: result.response.status,
|
|
2068
|
+
headers,
|
|
2069
|
+
...etag === void 0 ? {} : { etag },
|
|
2070
|
+
idempotencyReplayed: headers["idempotency-replayed"]?.toLowerCase() === "true"
|
|
2071
|
+
};
|
|
2072
|
+
} catch (error) {
|
|
2073
|
+
const apiError = (error instanceof ApiError ? error : ApiError.unexpected(`Unable to process the ProxyRequest response for ${spec.operationId}.`, error)).withIdempotencyKey(idempotencyKey);
|
|
2074
|
+
const delay = retryDelay(apiError, attempt);
|
|
2075
|
+
if (attempt >= 2 || idempotencyKey === void 0 || controls.signal?.aborted || delay === void 0) throw apiError;
|
|
2076
|
+
await wait(delay, controls.signal);
|
|
2077
|
+
} finally {
|
|
2078
|
+
timeout.cleanup();
|
|
1673
2079
|
}
|
|
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
2080
|
}
|
|
2081
|
+
throw ApiError.unexpected(`Unable to complete ${spec.operationId}.`);
|
|
1681
2082
|
}
|
|
1682
2083
|
async request(method, path, options = {}) {
|
|
1683
2084
|
const url = new URL(path.replace(/^\//u, ""), `${this.baseUrl}/`);
|
|
@@ -1752,40 +2153,63 @@ function appendQuery(search, query) {
|
|
|
1752
2153
|
function isBodyInit(value) {
|
|
1753
2154
|
return typeof value === "string" || value instanceof Blob || value instanceof ArrayBuffer || ArrayBuffer.isView(value) || value instanceof FormData || value instanceof URLSearchParams || value instanceof ReadableStream;
|
|
1754
2155
|
}
|
|
2156
|
+
function stringHeader(value) {
|
|
2157
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
2158
|
+
}
|
|
2159
|
+
function newIdempotencyKey() {
|
|
2160
|
+
if (typeof globalThis.crypto?.randomUUID !== "function") throw new Error("crypto.randomUUID() is required for automatic idempotency keys.");
|
|
2161
|
+
return globalThis.crypto.randomUUID();
|
|
2162
|
+
}
|
|
2163
|
+
function binaryResult(spec, data, headers) {
|
|
2164
|
+
if (!(data instanceof ArrayBuffer)) throw ApiError.unexpected(`ProxyRequest returned an invalid file for ${spec.operationId}.`);
|
|
2165
|
+
return FileDownload.fromResponse(data, headers);
|
|
2166
|
+
}
|
|
2167
|
+
function headersToRecord(headers) {
|
|
2168
|
+
return Object.freeze(Object.fromEntries(headers.entries()));
|
|
2169
|
+
}
|
|
2170
|
+
function retryDelay(error, attempt) {
|
|
2171
|
+
if (error.kind === "network") return attempt === 0 ? 100 : 200;
|
|
2172
|
+
if (error.statusCode === 409 && error.retryAfter !== void 0 && error.retryAfter >= 0 && error.retryAfter <= 5) return error.retryAfter * 1e3;
|
|
2173
|
+
}
|
|
2174
|
+
function wait(milliseconds, signal) {
|
|
2175
|
+
if (signal?.aborted) return Promise.reject(ApiError.network(signal.reason));
|
|
2176
|
+
return new Promise((resolvePromise, reject) => {
|
|
2177
|
+
const timer = setTimeout(() => {
|
|
2178
|
+
signal?.removeEventListener("abort", abort);
|
|
2179
|
+
resolvePromise();
|
|
2180
|
+
}, milliseconds);
|
|
2181
|
+
const abort = () => {
|
|
2182
|
+
clearTimeout(timer);
|
|
2183
|
+
reject(ApiError.network(signal?.reason));
|
|
2184
|
+
};
|
|
2185
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
2186
|
+
});
|
|
2187
|
+
}
|
|
1755
2188
|
|
|
1756
2189
|
//#endregion
|
|
1757
2190
|
//#region src/webhooks.ts
|
|
1758
2191
|
const encoder = new TextEncoder();
|
|
1759
2192
|
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);
|
|
2193
|
+
/** Verify X-Signature against the exact raw request body. */
|
|
2194
|
+
static async verify(rawBody, signature, secret) {
|
|
2195
|
+
if (!signature || !secret) return false;
|
|
2196
|
+
const candidate = parseBase64Signature(signature);
|
|
2197
|
+
if (candidate === void 0) return false;
|
|
1773
2198
|
try {
|
|
1774
2199
|
const key = await globalThis.crypto.subtle.importKey("raw", encoder.encode(secret), {
|
|
1775
2200
|
name: "HMAC",
|
|
1776
2201
|
hash: "SHA-256"
|
|
1777
|
-
}, false, ["
|
|
1778
|
-
|
|
1779
|
-
return parsed.signatures.some((candidate) => constantTimeHexEqual(expected, candidate));
|
|
2202
|
+
}, false, ["verify"]);
|
|
2203
|
+
return globalThis.crypto.subtle.verify("HMAC", key, candidate.slice().buffer, bodyBytes(rawBody).slice().buffer);
|
|
1780
2204
|
} catch {
|
|
1781
2205
|
return false;
|
|
1782
2206
|
}
|
|
1783
2207
|
}
|
|
1784
|
-
static async verifyOrThrow(rawBody, signature, secret
|
|
1785
|
-
if (!await WebhookVerifier.verify(rawBody, signature, secret
|
|
2208
|
+
static async verifyOrThrow(rawBody, signature, secret) {
|
|
2209
|
+
if (!await WebhookVerifier.verify(rawBody, signature, secret)) throw new InvalidSignatureError("The ProxyRequest webhook signature is invalid.");
|
|
1786
2210
|
}
|
|
1787
|
-
static async decodeVerifiedJson(rawBody, signature, secret
|
|
1788
|
-
await WebhookVerifier.verifyOrThrow(rawBody, signature, secret
|
|
2211
|
+
static async decodeVerifiedJson(rawBody, signature, secret) {
|
|
2212
|
+
await WebhookVerifier.verifyOrThrow(rawBody, signature, secret);
|
|
1789
2213
|
const text = typeof rawBody === "string" ? rawBody : new TextDecoder().decode(bodyBytes(rawBody));
|
|
1790
2214
|
try {
|
|
1791
2215
|
const payload = JSON.parse(text);
|
|
@@ -1797,40 +2221,17 @@ var WebhookVerifier = class WebhookVerifier {
|
|
|
1797
2221
|
}
|
|
1798
2222
|
}
|
|
1799
2223
|
};
|
|
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
2224
|
function bodyBytes(value) {
|
|
1815
2225
|
if (typeof value === "string") return encoder.encode(value);
|
|
1816
2226
|
return value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
1817
2227
|
}
|
|
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;
|
|
2228
|
+
function parseBase64Signature(signature) {
|
|
2229
|
+
if (!/^[A-Za-z0-9+/]{43}=$/u.test(signature)) return void 0;
|
|
2230
|
+
const decoded = atob(signature);
|
|
2231
|
+
if (decoded.length !== 32 || btoa(decoded) !== signature) return void 0;
|
|
2232
|
+
return Uint8Array.from(decoded, (character) => character.charCodeAt(0));
|
|
1832
2233
|
}
|
|
1833
2234
|
|
|
1834
2235
|
//#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,
|
|
2236
|
+
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
2237
|
//# sourceMappingURL=index.js.map
|