@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.cjs
CHANGED
|
@@ -43,6 +43,8 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
43
43
|
requestId;
|
|
44
44
|
retryAfter;
|
|
45
45
|
contentLanguage;
|
|
46
|
+
currentEtag;
|
|
47
|
+
idempotencyKey;
|
|
46
48
|
headers;
|
|
47
49
|
rawBody;
|
|
48
50
|
cause;
|
|
@@ -55,12 +57,14 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
55
57
|
this.requestId = options.requestId;
|
|
56
58
|
this.retryAfter = options.retryAfter;
|
|
57
59
|
this.contentLanguage = options.contentLanguage;
|
|
60
|
+
this.currentEtag = options.currentEtag;
|
|
61
|
+
this.idempotencyKey = options.idempotencyKey;
|
|
58
62
|
this.headers = options.headers ?? {};
|
|
59
63
|
this.rawBody = options.rawBody ?? /* @__PURE__ */ new Uint8Array();
|
|
60
64
|
this.cause = options.cause;
|
|
61
65
|
}
|
|
62
66
|
static async fromResponse(response) {
|
|
63
|
-
const headers = headersToRecord(response.headers);
|
|
67
|
+
const headers = headersToRecord$1(response.headers);
|
|
64
68
|
let rawBody = /* @__PURE__ */ new Uint8Array();
|
|
65
69
|
try {
|
|
66
70
|
rawBody = new Uint8Array(await response.clone().arrayBuffer());
|
|
@@ -74,6 +78,7 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
74
78
|
const requestId = header(headers, "x-request-id", "x-correlation-id");
|
|
75
79
|
const retryAfter = numberHeader(headers, "retry-after");
|
|
76
80
|
const contentLanguage = header(headers, "content-language");
|
|
81
|
+
const currentEtag = header(headers, "etag");
|
|
77
82
|
return new ApiError(detail ?? `ProxyRequest API returned HTTP ${statusCode}.`, {
|
|
78
83
|
kind,
|
|
79
84
|
statusCode,
|
|
@@ -82,6 +87,7 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
82
87
|
...requestId === void 0 ? {} : { requestId },
|
|
83
88
|
...retryAfter === void 0 ? {} : { retryAfter },
|
|
84
89
|
...contentLanguage === void 0 ? {} : { contentLanguage },
|
|
90
|
+
...currentEtag === void 0 ? {} : { currentEtag },
|
|
85
91
|
headers,
|
|
86
92
|
rawBody
|
|
87
93
|
});
|
|
@@ -99,6 +105,23 @@ var ApiError = class ApiError extends ProxyRequestError {
|
|
|
99
105
|
...cause === void 0 ? {} : { cause }
|
|
100
106
|
});
|
|
101
107
|
}
|
|
108
|
+
withIdempotencyKey(idempotencyKey) {
|
|
109
|
+
if (idempotencyKey === void 0 || this.idempotencyKey === idempotencyKey) return this;
|
|
110
|
+
return new ApiError(this.message, {
|
|
111
|
+
kind: this.kind,
|
|
112
|
+
...this.statusCode === void 0 ? {} : { statusCode: this.statusCode },
|
|
113
|
+
...this.detail === void 0 ? {} : { detail: this.detail },
|
|
114
|
+
fieldErrors: { ...this.fieldErrors },
|
|
115
|
+
...this.requestId === void 0 ? {} : { requestId: this.requestId },
|
|
116
|
+
...this.retryAfter === void 0 ? {} : { retryAfter: this.retryAfter },
|
|
117
|
+
...this.contentLanguage === void 0 ? {} : { contentLanguage: this.contentLanguage },
|
|
118
|
+
...this.currentEtag === void 0 ? {} : { currentEtag: this.currentEtag },
|
|
119
|
+
idempotencyKey,
|
|
120
|
+
headers: { ...this.headers },
|
|
121
|
+
rawBody: this.rawBody,
|
|
122
|
+
...this.cause === void 0 ? {} : { cause: this.cause }
|
|
123
|
+
});
|
|
124
|
+
}
|
|
102
125
|
};
|
|
103
126
|
var PaginationError = class extends ProxyRequestError {
|
|
104
127
|
name = "PaginationError";
|
|
@@ -112,11 +135,12 @@ function kindForStatus(statusCode) {
|
|
|
112
135
|
if (statusCode === 403) return "permission";
|
|
113
136
|
if (statusCode === 404) return "not_found";
|
|
114
137
|
if (statusCode === 409) return "conflict";
|
|
138
|
+
if (statusCode === 412) return "precondition";
|
|
115
139
|
if (statusCode === 429) return "rate_limit";
|
|
116
140
|
if (statusCode >= 500) return "server";
|
|
117
141
|
return "unexpected";
|
|
118
142
|
}
|
|
119
|
-
function headersToRecord(headers) {
|
|
143
|
+
function headersToRecord$1(headers) {
|
|
120
144
|
return Object.fromEntries([...headers.entries()].map(([key, value]) => [key.toLowerCase(), value]));
|
|
121
145
|
}
|
|
122
146
|
function header(headers, ...names) {
|
|
@@ -221,7 +245,11 @@ var APIKeysResource = class {
|
|
|
221
245
|
}
|
|
222
246
|
/** List API keys */
|
|
223
247
|
async list(options = {}) {
|
|
224
|
-
return this
|
|
248
|
+
return (await this.listWithResponse(options)).data;
|
|
249
|
+
}
|
|
250
|
+
/** List API keys; include response metadata. */
|
|
251
|
+
async listWithResponse(options = {}) {
|
|
252
|
+
return this.#client._callWithResponse({
|
|
225
253
|
operationId: "api_keys_list",
|
|
226
254
|
method: "GET",
|
|
227
255
|
path: "/api-keys"
|
|
@@ -236,7 +264,11 @@ var APIKeysResource = class {
|
|
|
236
264
|
}
|
|
237
265
|
/** Create an API key */
|
|
238
266
|
async create(options = {}) {
|
|
239
|
-
return this
|
|
267
|
+
return (await this.createWithResponse(options)).data;
|
|
268
|
+
}
|
|
269
|
+
/** Create an API key; include response metadata. */
|
|
270
|
+
async createWithResponse(options = {}) {
|
|
271
|
+
return this.#client._callWithResponse({
|
|
240
272
|
operationId: "api_keys_create",
|
|
241
273
|
method: "POST",
|
|
242
274
|
path: "/api-keys"
|
|
@@ -248,13 +280,21 @@ var APIKeysResource = class {
|
|
|
248
280
|
}
|
|
249
281
|
/** Revoke an API key */
|
|
250
282
|
async delete(options) {
|
|
251
|
-
return this
|
|
283
|
+
return (await this.deleteWithResponse(options)).data;
|
|
284
|
+
}
|
|
285
|
+
/** Revoke an API key; include response metadata. */
|
|
286
|
+
async deleteWithResponse(options) {
|
|
287
|
+
return this.#client._callWithResponse({
|
|
252
288
|
operationId: "api_keys_destroy",
|
|
253
289
|
method: "DELETE",
|
|
254
|
-
path: "/api-keys/{id}"
|
|
290
|
+
path: "/api-keys/{id}",
|
|
291
|
+
idempotent: true
|
|
255
292
|
}, {
|
|
256
293
|
path: { id: options.id },
|
|
257
|
-
headers: {
|
|
294
|
+
headers: {
|
|
295
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
296
|
+
"Accept-Language": options.acceptLanguage
|
|
297
|
+
},
|
|
258
298
|
...options.request === void 0 ? {} : { request: options.request }
|
|
259
299
|
});
|
|
260
300
|
}
|
|
@@ -266,7 +306,11 @@ var AffiliatesResource = class {
|
|
|
266
306
|
}
|
|
267
307
|
/** List referred customers */
|
|
268
308
|
async list(options = {}) {
|
|
269
|
-
return this
|
|
309
|
+
return (await this.listWithResponse(options)).data;
|
|
310
|
+
}
|
|
311
|
+
/** List referred customers; include response metadata. */
|
|
312
|
+
async listWithResponse(options = {}) {
|
|
313
|
+
return this.#client._callWithResponse({
|
|
270
314
|
operationId: "affiliates_list",
|
|
271
315
|
method: "GET",
|
|
272
316
|
path: "/affiliates"
|
|
@@ -281,7 +325,11 @@ var AffiliatesResource = class {
|
|
|
281
325
|
}
|
|
282
326
|
/** List affiliate reward entries */
|
|
283
327
|
async listRewards(options = {}) {
|
|
284
|
-
return this
|
|
328
|
+
return (await this.listRewardsWithResponse(options)).data;
|
|
329
|
+
}
|
|
330
|
+
/** List affiliate reward entries; include response metadata. */
|
|
331
|
+
async listRewardsWithResponse(options = {}) {
|
|
332
|
+
return this.#client._callWithResponse({
|
|
285
333
|
operationId: "affiliates_rewards_list",
|
|
286
334
|
method: "GET",
|
|
287
335
|
path: "/affiliates/rewards"
|
|
@@ -296,7 +344,11 @@ var AffiliatesResource = class {
|
|
|
296
344
|
}
|
|
297
345
|
/** Get affiliate earnings over time */
|
|
298
346
|
async getRewardsOverall(options = {}) {
|
|
299
|
-
return this
|
|
347
|
+
return (await this.getRewardsOverallWithResponse(options)).data;
|
|
348
|
+
}
|
|
349
|
+
/** Get affiliate earnings over time; include response metadata. */
|
|
350
|
+
async getRewardsOverallWithResponse(options = {}) {
|
|
351
|
+
return this.#client._callWithResponse({
|
|
300
352
|
operationId: "affiliates_rewards_overall_retrieve",
|
|
301
353
|
method: "GET",
|
|
302
354
|
path: "/affiliates/rewards/overall"
|
|
@@ -313,7 +365,11 @@ var AnalyticsResource = class {
|
|
|
313
365
|
}
|
|
314
366
|
/** List data transactions */
|
|
315
367
|
async getTransactions(options) {
|
|
316
|
-
return this
|
|
368
|
+
return (await this.getTransactionsWithResponse(options)).data;
|
|
369
|
+
}
|
|
370
|
+
/** List data transactions; include response metadata. */
|
|
371
|
+
async getTransactionsWithResponse(options) {
|
|
372
|
+
return this.#client._callWithResponse({
|
|
317
373
|
operationId: "analytics_transactions_retrieve",
|
|
318
374
|
method: "GET",
|
|
319
375
|
path: "/analytics/{id}/transactions"
|
|
@@ -335,7 +391,11 @@ var AnalyticsResource = class {
|
|
|
335
391
|
}
|
|
336
392
|
/** List active proxy connections */
|
|
337
393
|
async getConnections(options = {}) {
|
|
338
|
-
return this
|
|
394
|
+
return (await this.getConnectionsWithResponse(options)).data;
|
|
395
|
+
}
|
|
396
|
+
/** List active proxy connections; include response metadata. */
|
|
397
|
+
async getConnectionsWithResponse(options = {}) {
|
|
398
|
+
return this.#client._callWithResponse({
|
|
339
399
|
operationId: "analytics_connections_retrieve",
|
|
340
400
|
method: "GET",
|
|
341
401
|
path: "/analytics/connections"
|
|
@@ -352,7 +412,11 @@ var AnalyticsResource = class {
|
|
|
352
412
|
}
|
|
353
413
|
/** List top destination domains */
|
|
354
414
|
async listDomains(options = {}) {
|
|
355
|
-
return this
|
|
415
|
+
return (await this.listDomainsWithResponse(options)).data;
|
|
416
|
+
}
|
|
417
|
+
/** List top destination domains; include response metadata. */
|
|
418
|
+
async listDomainsWithResponse(options = {}) {
|
|
419
|
+
return this.#client._callWithResponse({
|
|
356
420
|
operationId: "analytics_domains_retrieve",
|
|
357
421
|
method: "GET",
|
|
358
422
|
path: "/analytics/domains"
|
|
@@ -377,7 +441,11 @@ var AnalyticsResource = class {
|
|
|
377
441
|
}
|
|
378
442
|
/** List proxy request activity */
|
|
379
443
|
async listFeed(options = {}) {
|
|
380
|
-
return this
|
|
444
|
+
return (await this.listFeedWithResponse(options)).data;
|
|
445
|
+
}
|
|
446
|
+
/** List proxy request activity; include response metadata. */
|
|
447
|
+
async listFeedWithResponse(options = {}) {
|
|
448
|
+
return this.#client._callWithResponse({
|
|
381
449
|
operationId: "analytics_feed_retrieve",
|
|
382
450
|
method: "GET",
|
|
383
451
|
path: "/analytics/feed"
|
|
@@ -404,7 +472,11 @@ var AnalyticsResource = class {
|
|
|
404
472
|
}
|
|
405
473
|
/** List proxy error logs */
|
|
406
474
|
async listLogs(options = {}) {
|
|
407
|
-
return this
|
|
475
|
+
return (await this.listLogsWithResponse(options)).data;
|
|
476
|
+
}
|
|
477
|
+
/** List proxy error logs; include response metadata. */
|
|
478
|
+
async listLogsWithResponse(options = {}) {
|
|
479
|
+
return this.#client._callWithResponse({
|
|
408
480
|
operationId: "analytics_logs_retrieve",
|
|
409
481
|
method: "GET",
|
|
410
482
|
path: "/analytics/logs"
|
|
@@ -431,7 +503,11 @@ var AnalyticsResource = class {
|
|
|
431
503
|
}
|
|
432
504
|
/** Get traffic totals over time */
|
|
433
505
|
async getOverall(options = {}) {
|
|
434
|
-
return this
|
|
506
|
+
return (await this.getOverallWithResponse(options)).data;
|
|
507
|
+
}
|
|
508
|
+
/** Get traffic totals over time; include response metadata. */
|
|
509
|
+
async getOverallWithResponse(options = {}) {
|
|
510
|
+
return this.#client._callWithResponse({
|
|
435
511
|
operationId: "analytics_overall_retrieve",
|
|
436
512
|
method: "GET",
|
|
437
513
|
path: "/analytics/overall"
|
|
@@ -458,7 +534,11 @@ var AuthorizationResource = class {
|
|
|
458
534
|
}
|
|
459
535
|
/** Sign in with email or username */
|
|
460
536
|
async login(options) {
|
|
461
|
-
return this
|
|
537
|
+
return (await this.loginWithResponse(options)).data;
|
|
538
|
+
}
|
|
539
|
+
/** Sign in with email or username; include response metadata. */
|
|
540
|
+
async loginWithResponse(options) {
|
|
541
|
+
return this.#client._callWithResponse({
|
|
462
542
|
operationId: "login_create",
|
|
463
543
|
method: "POST",
|
|
464
544
|
path: "/login"
|
|
@@ -470,7 +550,11 @@ var AuthorizationResource = class {
|
|
|
470
550
|
}
|
|
471
551
|
/** Sign in with Google */
|
|
472
552
|
async loginWithGoogle(options) {
|
|
473
|
-
return this
|
|
553
|
+
return (await this.loginWithGoogleWithResponse(options)).data;
|
|
554
|
+
}
|
|
555
|
+
/** Sign in with Google; include response metadata. */
|
|
556
|
+
async loginWithGoogleWithResponse(options) {
|
|
557
|
+
return this.#client._callWithResponse({
|
|
474
558
|
operationId: "login_google_create",
|
|
475
559
|
method: "POST",
|
|
476
560
|
path: "/login/google"
|
|
@@ -480,9 +564,29 @@ var AuthorizationResource = class {
|
|
|
480
564
|
...options.request === void 0 ? {} : { request: options.request }
|
|
481
565
|
});
|
|
482
566
|
}
|
|
567
|
+
/** Complete two-factor sign-in */
|
|
568
|
+
async verifyOtp(options) {
|
|
569
|
+
return (await this.verifyOtpWithResponse(options)).data;
|
|
570
|
+
}
|
|
571
|
+
/** Complete two-factor sign-in; include response metadata. */
|
|
572
|
+
async verifyOtpWithResponse(options) {
|
|
573
|
+
return this.#client._callWithResponse({
|
|
574
|
+
operationId: "login_otp_create",
|
|
575
|
+
method: "POST",
|
|
576
|
+
path: "/login/otp"
|
|
577
|
+
}, {
|
|
578
|
+
headers: { "Accept-Language": options.acceptLanguage },
|
|
579
|
+
body: options.body,
|
|
580
|
+
...options.request === void 0 ? {} : { request: options.request }
|
|
581
|
+
});
|
|
582
|
+
}
|
|
483
583
|
/** Send a password recovery email */
|
|
484
584
|
async recoverPassword(options) {
|
|
485
|
-
return this
|
|
585
|
+
return (await this.recoverPasswordWithResponse(options)).data;
|
|
586
|
+
}
|
|
587
|
+
/** Send a password recovery email; include response metadata. */
|
|
588
|
+
async recoverPasswordWithResponse(options) {
|
|
589
|
+
return this.#client._callWithResponse({
|
|
486
590
|
operationId: "recover_password_create",
|
|
487
591
|
method: "POST",
|
|
488
592
|
path: "/recover-password"
|
|
@@ -494,7 +598,11 @@ var AuthorizationResource = class {
|
|
|
494
598
|
}
|
|
495
599
|
/** Refresh an access token */
|
|
496
600
|
async refresh(options) {
|
|
497
|
-
return this
|
|
601
|
+
return (await this.refreshWithResponse(options)).data;
|
|
602
|
+
}
|
|
603
|
+
/** Refresh an access token; include response metadata. */
|
|
604
|
+
async refreshWithResponse(options) {
|
|
605
|
+
return this.#client._callWithResponse({
|
|
498
606
|
operationId: "refresh_create",
|
|
499
607
|
method: "POST",
|
|
500
608
|
path: "/refresh"
|
|
@@ -506,7 +614,11 @@ var AuthorizationResource = class {
|
|
|
506
614
|
}
|
|
507
615
|
/** Create a customer account */
|
|
508
616
|
async signup(options) {
|
|
509
|
-
return this
|
|
617
|
+
return (await this.signupWithResponse(options)).data;
|
|
618
|
+
}
|
|
619
|
+
/** Create a customer account; include response metadata. */
|
|
620
|
+
async signupWithResponse(options) {
|
|
621
|
+
return this.#client._callWithResponse({
|
|
510
622
|
operationId: "signup_create",
|
|
511
623
|
method: "POST",
|
|
512
624
|
path: "/signup"
|
|
@@ -524,7 +636,11 @@ var CouponsResource = class {
|
|
|
524
636
|
}
|
|
525
637
|
/** List available coupons */
|
|
526
638
|
async list(options = {}) {
|
|
527
|
-
return this
|
|
639
|
+
return (await this.listWithResponse(options)).data;
|
|
640
|
+
}
|
|
641
|
+
/** List available coupons; include response metadata. */
|
|
642
|
+
async listWithResponse(options = {}) {
|
|
643
|
+
return this.#client._callWithResponse({
|
|
528
644
|
operationId: "coupons_list",
|
|
529
645
|
method: "GET",
|
|
530
646
|
path: "/coupons"
|
|
@@ -543,19 +659,31 @@ var CouponsResource = class {
|
|
|
543
659
|
}
|
|
544
660
|
/** Create a coupon */
|
|
545
661
|
async create(options) {
|
|
546
|
-
return this
|
|
662
|
+
return (await this.createWithResponse(options)).data;
|
|
663
|
+
}
|
|
664
|
+
/** Create a coupon; include response metadata. */
|
|
665
|
+
async createWithResponse(options) {
|
|
666
|
+
return this.#client._callWithResponse({
|
|
547
667
|
operationId: "coupons_create",
|
|
548
668
|
method: "POST",
|
|
549
|
-
path: "/coupons"
|
|
669
|
+
path: "/coupons",
|
|
670
|
+
idempotent: true
|
|
550
671
|
}, {
|
|
551
|
-
headers: {
|
|
672
|
+
headers: {
|
|
673
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
674
|
+
"Accept-Language": options.acceptLanguage
|
|
675
|
+
},
|
|
552
676
|
body: options.body,
|
|
553
677
|
...options.request === void 0 ? {} : { request: options.request }
|
|
554
678
|
});
|
|
555
679
|
}
|
|
556
680
|
/** Get a coupon */
|
|
557
681
|
async get(options) {
|
|
558
|
-
return this
|
|
682
|
+
return (await this.getWithResponse(options)).data;
|
|
683
|
+
}
|
|
684
|
+
/** Get a coupon; include response metadata. */
|
|
685
|
+
async getWithResponse(options) {
|
|
686
|
+
return this.#client._callWithResponse({
|
|
559
687
|
operationId: "coupons_retrieve",
|
|
560
688
|
method: "GET",
|
|
561
689
|
path: "/coupons/{id}"
|
|
@@ -567,45 +695,72 @@ var CouponsResource = class {
|
|
|
567
695
|
}
|
|
568
696
|
/** Replace a coupon */
|
|
569
697
|
async replace(options) {
|
|
570
|
-
return this
|
|
698
|
+
return (await this.replaceWithResponse(options)).data;
|
|
699
|
+
}
|
|
700
|
+
/** Replace a coupon; include response metadata. */
|
|
701
|
+
async replaceWithResponse(options) {
|
|
702
|
+
return this.#client._callWithResponse({
|
|
571
703
|
operationId: "coupons_update",
|
|
572
704
|
method: "PUT",
|
|
573
705
|
path: "/coupons/{id}"
|
|
574
706
|
}, {
|
|
575
707
|
path: { id: options.id },
|
|
576
|
-
headers: {
|
|
708
|
+
headers: {
|
|
709
|
+
"If-Match": options.ifMatch,
|
|
710
|
+
"Accept-Language": options.acceptLanguage
|
|
711
|
+
},
|
|
577
712
|
body: options.body,
|
|
578
713
|
...options.request === void 0 ? {} : { request: options.request }
|
|
579
714
|
});
|
|
580
715
|
}
|
|
581
716
|
/** Update a coupon */
|
|
582
717
|
async update(options) {
|
|
583
|
-
return this
|
|
718
|
+
return (await this.updateWithResponse(options)).data;
|
|
719
|
+
}
|
|
720
|
+
/** Update a coupon; include response metadata. */
|
|
721
|
+
async updateWithResponse(options) {
|
|
722
|
+
return this.#client._callWithResponse({
|
|
584
723
|
operationId: "coupons_partial_update",
|
|
585
724
|
method: "PATCH",
|
|
586
725
|
path: "/coupons/{id}"
|
|
587
726
|
}, {
|
|
588
727
|
path: { id: options.id },
|
|
589
|
-
headers: {
|
|
728
|
+
headers: {
|
|
729
|
+
"If-Match": options.ifMatch,
|
|
730
|
+
"Accept-Language": options.acceptLanguage
|
|
731
|
+
},
|
|
590
732
|
...options.body === void 0 ? {} : { body: options.body },
|
|
591
733
|
...options.request === void 0 ? {} : { request: options.request }
|
|
592
734
|
});
|
|
593
735
|
}
|
|
594
736
|
/** Delete a coupon */
|
|
595
737
|
async delete(options) {
|
|
596
|
-
return this
|
|
738
|
+
return (await this.deleteWithResponse(options)).data;
|
|
739
|
+
}
|
|
740
|
+
/** Delete a coupon; include response metadata. */
|
|
741
|
+
async deleteWithResponse(options) {
|
|
742
|
+
return this.#client._callWithResponse({
|
|
597
743
|
operationId: "coupons_destroy",
|
|
598
744
|
method: "DELETE",
|
|
599
|
-
path: "/coupons/{id}"
|
|
745
|
+
path: "/coupons/{id}",
|
|
746
|
+
idempotent: true
|
|
600
747
|
}, {
|
|
601
748
|
path: { id: options.id },
|
|
602
|
-
headers: {
|
|
749
|
+
headers: {
|
|
750
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
751
|
+
"If-Match": options.ifMatch,
|
|
752
|
+
"Accept-Language": options.acceptLanguage
|
|
753
|
+
},
|
|
603
754
|
...options.request === void 0 ? {} : { request: options.request }
|
|
604
755
|
});
|
|
605
756
|
}
|
|
606
757
|
/** List coupon redemptions */
|
|
607
758
|
async listRedeems(options) {
|
|
608
|
-
return this
|
|
759
|
+
return (await this.listRedeemsWithResponse(options)).data;
|
|
760
|
+
}
|
|
761
|
+
/** List coupon redemptions; include response metadata. */
|
|
762
|
+
async listRedeemsWithResponse(options) {
|
|
763
|
+
return this.#client._callWithResponse({
|
|
609
764
|
operationId: "coupons_redeems_list",
|
|
610
765
|
method: "GET",
|
|
611
766
|
path: "/coupons/{id}/redeems"
|
|
@@ -624,7 +779,11 @@ var CouponsResource = class {
|
|
|
624
779
|
}
|
|
625
780
|
/** Calculate a discounted price */
|
|
626
781
|
async calculatePrice(options) {
|
|
627
|
-
return this
|
|
782
|
+
return (await this.calculatePriceWithResponse(options)).data;
|
|
783
|
+
}
|
|
784
|
+
/** Calculate a discounted price; include response metadata. */
|
|
785
|
+
async calculatePriceWithResponse(options) {
|
|
786
|
+
return this.#client._callWithResponse({
|
|
628
787
|
operationId: "coupons_calculate_price_create",
|
|
629
788
|
method: "POST",
|
|
630
789
|
path: "/coupons/calculate-price"
|
|
@@ -642,7 +801,11 @@ var InvoicesResource = class {
|
|
|
642
801
|
}
|
|
643
802
|
/** List invoices */
|
|
644
803
|
async list(options = {}) {
|
|
645
|
-
return this
|
|
804
|
+
return (await this.listWithResponse(options)).data;
|
|
805
|
+
}
|
|
806
|
+
/** List invoices; include response metadata. */
|
|
807
|
+
async listWithResponse(options = {}) {
|
|
808
|
+
return this.#client._callWithResponse({
|
|
646
809
|
operationId: "invoices_list",
|
|
647
810
|
method: "GET",
|
|
648
811
|
path: "/invoices"
|
|
@@ -666,19 +829,31 @@ var InvoicesResource = class {
|
|
|
666
829
|
}
|
|
667
830
|
/** Create an invoice */
|
|
668
831
|
async create(options) {
|
|
669
|
-
return this
|
|
832
|
+
return (await this.createWithResponse(options)).data;
|
|
833
|
+
}
|
|
834
|
+
/** Create an invoice; include response metadata. */
|
|
835
|
+
async createWithResponse(options) {
|
|
836
|
+
return this.#client._callWithResponse({
|
|
670
837
|
operationId: "invoices_create",
|
|
671
838
|
method: "POST",
|
|
672
|
-
path: "/invoices"
|
|
839
|
+
path: "/invoices",
|
|
840
|
+
idempotent: true
|
|
673
841
|
}, {
|
|
674
|
-
headers: {
|
|
842
|
+
headers: {
|
|
843
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
844
|
+
"Accept-Language": options.acceptLanguage
|
|
845
|
+
},
|
|
675
846
|
body: options.body,
|
|
676
847
|
...options.request === void 0 ? {} : { request: options.request }
|
|
677
848
|
});
|
|
678
849
|
}
|
|
679
850
|
/** Get an invoice */
|
|
680
851
|
async get(options) {
|
|
681
|
-
return this
|
|
852
|
+
return (await this.getWithResponse(options)).data;
|
|
853
|
+
}
|
|
854
|
+
/** Get an invoice; include response metadata. */
|
|
855
|
+
async getWithResponse(options) {
|
|
856
|
+
return this.#client._callWithResponse({
|
|
682
857
|
operationId: "invoices_retrieve",
|
|
683
858
|
method: "GET",
|
|
684
859
|
path: "/invoices/{id}"
|
|
@@ -690,19 +865,32 @@ var InvoicesResource = class {
|
|
|
690
865
|
}
|
|
691
866
|
/** Delete an invoice */
|
|
692
867
|
async delete(options) {
|
|
693
|
-
return this
|
|
868
|
+
return (await this.deleteWithResponse(options)).data;
|
|
869
|
+
}
|
|
870
|
+
/** Delete an invoice; include response metadata. */
|
|
871
|
+
async deleteWithResponse(options) {
|
|
872
|
+
return this.#client._callWithResponse({
|
|
694
873
|
operationId: "invoices_destroy",
|
|
695
874
|
method: "DELETE",
|
|
696
|
-
path: "/invoices/{id}"
|
|
875
|
+
path: "/invoices/{id}",
|
|
876
|
+
idempotent: true
|
|
697
877
|
}, {
|
|
698
878
|
path: { id: options.id },
|
|
699
|
-
headers: {
|
|
879
|
+
headers: {
|
|
880
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
881
|
+
"If-Match": options.ifMatch,
|
|
882
|
+
"Accept-Language": options.acceptLanguage
|
|
883
|
+
},
|
|
700
884
|
...options.request === void 0 ? {} : { request: options.request }
|
|
701
885
|
});
|
|
702
886
|
}
|
|
703
887
|
/** Download an invoice PDF */
|
|
704
888
|
async downloadPdf(options) {
|
|
705
|
-
return this
|
|
889
|
+
return (await this.downloadPdfWithResponse(options)).data;
|
|
890
|
+
}
|
|
891
|
+
/** Download an invoice PDF; include response metadata. */
|
|
892
|
+
async downloadPdfWithResponse(options) {
|
|
893
|
+
return this.#client._callWithResponse({
|
|
706
894
|
operationId: "invoices_download_pdf_retrieve",
|
|
707
895
|
method: "GET",
|
|
708
896
|
path: "/invoices/{id}/download/pdf",
|
|
@@ -715,7 +903,11 @@ var InvoicesResource = class {
|
|
|
715
903
|
}
|
|
716
904
|
/** Get an invoice payment link */
|
|
717
905
|
async getPaymentLink(options) {
|
|
718
|
-
return this
|
|
906
|
+
return (await this.getPaymentLinkWithResponse(options)).data;
|
|
907
|
+
}
|
|
908
|
+
/** Get an invoice payment link; include response metadata. */
|
|
909
|
+
async getPaymentLinkWithResponse(options) {
|
|
910
|
+
return this.#client._callWithResponse({
|
|
719
911
|
operationId: "invoices_pay_retrieve",
|
|
720
912
|
method: "GET",
|
|
721
913
|
path: "/invoices/{id}/pay"
|
|
@@ -732,8 +924,12 @@ var LocationsResource = class {
|
|
|
732
924
|
this.#client = client;
|
|
733
925
|
}
|
|
734
926
|
/** List available autonomous systems */
|
|
735
|
-
async listAsns(options
|
|
736
|
-
return this
|
|
927
|
+
async listAsns(options) {
|
|
928
|
+
return (await this.listAsnsWithResponse(options)).data;
|
|
929
|
+
}
|
|
930
|
+
/** List available autonomous systems; include response metadata. */
|
|
931
|
+
async listAsnsWithResponse(options) {
|
|
932
|
+
return this.#client._callWithResponse({
|
|
737
933
|
operationId: "locations_asn_list",
|
|
738
934
|
method: "GET",
|
|
739
935
|
path: "/locations/asn"
|
|
@@ -754,8 +950,12 @@ var LocationsResource = class {
|
|
|
754
950
|
});
|
|
755
951
|
}
|
|
756
952
|
/** List available cities */
|
|
757
|
-
async listCities(options
|
|
758
|
-
return this
|
|
953
|
+
async listCities(options) {
|
|
954
|
+
return (await this.listCitiesWithResponse(options)).data;
|
|
955
|
+
}
|
|
956
|
+
/** List available cities; include response metadata. */
|
|
957
|
+
async listCitiesWithResponse(options) {
|
|
958
|
+
return this.#client._callWithResponse({
|
|
759
959
|
operationId: "locations_cities_list",
|
|
760
960
|
method: "GET",
|
|
761
961
|
path: "/locations/cities"
|
|
@@ -777,19 +977,28 @@ var LocationsResource = class {
|
|
|
777
977
|
}
|
|
778
978
|
/** Get a city */
|
|
779
979
|
async getCity(options) {
|
|
780
|
-
return this
|
|
980
|
+
return (await this.getCityWithResponse(options)).data;
|
|
981
|
+
}
|
|
982
|
+
/** Get a city; include response metadata. */
|
|
983
|
+
async getCityWithResponse(options) {
|
|
984
|
+
return this.#client._callWithResponse({
|
|
781
985
|
operationId: "locations_cities_retrieve",
|
|
782
986
|
method: "GET",
|
|
783
987
|
path: "/locations/cities/{id}"
|
|
784
988
|
}, {
|
|
785
989
|
path: { id: options.id },
|
|
990
|
+
query: { package_id: options.packageId },
|
|
786
991
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
787
992
|
...options.request === void 0 ? {} : { request: options.request }
|
|
788
993
|
});
|
|
789
994
|
}
|
|
790
995
|
/** List available continents */
|
|
791
|
-
async listContinents(options
|
|
792
|
-
return this
|
|
996
|
+
async listContinents(options) {
|
|
997
|
+
return (await this.listContinentsWithResponse(options)).data;
|
|
998
|
+
}
|
|
999
|
+
/** List available continents; include response metadata. */
|
|
1000
|
+
async listContinentsWithResponse(options) {
|
|
1001
|
+
return this.#client._callWithResponse({
|
|
793
1002
|
operationId: "locations_continents_list",
|
|
794
1003
|
method: "GET",
|
|
795
1004
|
path: "/locations/continents"
|
|
@@ -809,19 +1018,28 @@ var LocationsResource = class {
|
|
|
809
1018
|
}
|
|
810
1019
|
/** Get a continent */
|
|
811
1020
|
async getContinent(options) {
|
|
812
|
-
return this
|
|
1021
|
+
return (await this.getContinentWithResponse(options)).data;
|
|
1022
|
+
}
|
|
1023
|
+
/** Get a continent; include response metadata. */
|
|
1024
|
+
async getContinentWithResponse(options) {
|
|
1025
|
+
return this.#client._callWithResponse({
|
|
813
1026
|
operationId: "locations_continents_retrieve",
|
|
814
1027
|
method: "GET",
|
|
815
1028
|
path: "/locations/continents/{id}"
|
|
816
1029
|
}, {
|
|
817
1030
|
path: { id: options.id },
|
|
1031
|
+
query: { package_id: options.packageId },
|
|
818
1032
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
819
1033
|
...options.request === void 0 ? {} : { request: options.request }
|
|
820
1034
|
});
|
|
821
1035
|
}
|
|
822
1036
|
/** List available countries */
|
|
823
|
-
async listCountries(options
|
|
824
|
-
return this
|
|
1037
|
+
async listCountries(options) {
|
|
1038
|
+
return (await this.listCountriesWithResponse(options)).data;
|
|
1039
|
+
}
|
|
1040
|
+
/** List available countries; include response metadata. */
|
|
1041
|
+
async listCountriesWithResponse(options) {
|
|
1042
|
+
return this.#client._callWithResponse({
|
|
825
1043
|
operationId: "locations_countries_list",
|
|
826
1044
|
method: "GET",
|
|
827
1045
|
path: "/locations/countries"
|
|
@@ -841,19 +1059,28 @@ var LocationsResource = class {
|
|
|
841
1059
|
}
|
|
842
1060
|
/** Get a country */
|
|
843
1061
|
async getCountry(options) {
|
|
844
|
-
return this
|
|
1062
|
+
return (await this.getCountryWithResponse(options)).data;
|
|
1063
|
+
}
|
|
1064
|
+
/** Get a country; include response metadata. */
|
|
1065
|
+
async getCountryWithResponse(options) {
|
|
1066
|
+
return this.#client._callWithResponse({
|
|
845
1067
|
operationId: "locations_countries_retrieve",
|
|
846
1068
|
method: "GET",
|
|
847
1069
|
path: "/locations/countries/{id}"
|
|
848
1070
|
}, {
|
|
849
1071
|
path: { id: options.id },
|
|
1072
|
+
query: { package_id: options.packageId },
|
|
850
1073
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
851
1074
|
...options.request === void 0 ? {} : { request: options.request }
|
|
852
1075
|
});
|
|
853
1076
|
}
|
|
854
1077
|
/** List available internet service providers */
|
|
855
|
-
async listIsps(options
|
|
856
|
-
return this
|
|
1078
|
+
async listIsps(options) {
|
|
1079
|
+
return (await this.listIspsWithResponse(options)).data;
|
|
1080
|
+
}
|
|
1081
|
+
/** List available internet service providers; include response metadata. */
|
|
1082
|
+
async listIspsWithResponse(options) {
|
|
1083
|
+
return this.#client._callWithResponse({
|
|
857
1084
|
operationId: "locations_isps_list",
|
|
858
1085
|
method: "GET",
|
|
859
1086
|
path: "/locations/isps"
|
|
@@ -873,8 +1100,12 @@ var LocationsResource = class {
|
|
|
873
1100
|
});
|
|
874
1101
|
}
|
|
875
1102
|
/** List available regions */
|
|
876
|
-
async listRegions(options
|
|
877
|
-
return this
|
|
1103
|
+
async listRegions(options) {
|
|
1104
|
+
return (await this.listRegionsWithResponse(options)).data;
|
|
1105
|
+
}
|
|
1106
|
+
/** List available regions; include response metadata. */
|
|
1107
|
+
async listRegionsWithResponse(options) {
|
|
1108
|
+
return this.#client._callWithResponse({
|
|
878
1109
|
operationId: "locations_regions_list",
|
|
879
1110
|
method: "GET",
|
|
880
1111
|
path: "/locations/regions"
|
|
@@ -895,12 +1126,17 @@ var LocationsResource = class {
|
|
|
895
1126
|
}
|
|
896
1127
|
/** Get a region */
|
|
897
1128
|
async getRegion(options) {
|
|
898
|
-
return this
|
|
1129
|
+
return (await this.getRegionWithResponse(options)).data;
|
|
1130
|
+
}
|
|
1131
|
+
/** Get a region; include response metadata. */
|
|
1132
|
+
async getRegionWithResponse(options) {
|
|
1133
|
+
return this.#client._callWithResponse({
|
|
899
1134
|
operationId: "locations_regions_retrieve",
|
|
900
1135
|
method: "GET",
|
|
901
1136
|
path: "/locations/regions/{id}"
|
|
902
1137
|
}, {
|
|
903
1138
|
path: { id: options.id },
|
|
1139
|
+
query: { package_id: options.packageId },
|
|
904
1140
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
905
1141
|
...options.request === void 0 ? {} : { request: options.request }
|
|
906
1142
|
});
|
|
@@ -913,7 +1149,11 @@ var NewsResource = class {
|
|
|
913
1149
|
}
|
|
914
1150
|
/** List product announcements */
|
|
915
1151
|
async list(options = {}) {
|
|
916
|
-
return this
|
|
1152
|
+
return (await this.listWithResponse(options)).data;
|
|
1153
|
+
}
|
|
1154
|
+
/** List product announcements; include response metadata. */
|
|
1155
|
+
async listWithResponse(options = {}) {
|
|
1156
|
+
return this.#client._callWithResponse({
|
|
917
1157
|
operationId: "news_list",
|
|
918
1158
|
method: "GET",
|
|
919
1159
|
path: "/news"
|
|
@@ -936,7 +1176,11 @@ var OrdersResource = class {
|
|
|
936
1176
|
}
|
|
937
1177
|
/** List active orders */
|
|
938
1178
|
async list(options = {}) {
|
|
939
|
-
return this
|
|
1179
|
+
return (await this.listWithResponse(options)).data;
|
|
1180
|
+
}
|
|
1181
|
+
/** List active orders; include response metadata. */
|
|
1182
|
+
async listWithResponse(options = {}) {
|
|
1183
|
+
return this.#client._callWithResponse({
|
|
940
1184
|
operationId: "orders_list",
|
|
941
1185
|
method: "GET",
|
|
942
1186
|
path: "/orders"
|
|
@@ -958,7 +1202,11 @@ var OrdersResource = class {
|
|
|
958
1202
|
}
|
|
959
1203
|
/** Get an order */
|
|
960
1204
|
async get(options) {
|
|
961
|
-
return this
|
|
1205
|
+
return (await this.getWithResponse(options)).data;
|
|
1206
|
+
}
|
|
1207
|
+
/** Get an order; include response metadata. */
|
|
1208
|
+
async getWithResponse(options) {
|
|
1209
|
+
return this.#client._callWithResponse({
|
|
962
1210
|
operationId: "orders_retrieve",
|
|
963
1211
|
method: "GET",
|
|
964
1212
|
path: "/orders/{id}"
|
|
@@ -970,32 +1218,52 @@ var OrdersResource = class {
|
|
|
970
1218
|
}
|
|
971
1219
|
/** Update order auto-renewal */
|
|
972
1220
|
async updateAutoRenewal(options) {
|
|
973
|
-
return this
|
|
1221
|
+
return (await this.updateAutoRenewalWithResponse(options)).data;
|
|
1222
|
+
}
|
|
1223
|
+
/** Update order auto-renewal; include response metadata. */
|
|
1224
|
+
async updateAutoRenewalWithResponse(options) {
|
|
1225
|
+
return this.#client._callWithResponse({
|
|
974
1226
|
operationId: "orders_partial_update",
|
|
975
1227
|
method: "PATCH",
|
|
976
1228
|
path: "/orders/{id}"
|
|
977
1229
|
}, {
|
|
978
1230
|
path: { id: options.id },
|
|
979
|
-
headers: {
|
|
1231
|
+
headers: {
|
|
1232
|
+
"If-Match": options.ifMatch,
|
|
1233
|
+
"Accept-Language": options.acceptLanguage
|
|
1234
|
+
},
|
|
980
1235
|
...options.body === void 0 ? {} : { body: options.body },
|
|
981
1236
|
...options.request === void 0 ? {} : { request: options.request }
|
|
982
1237
|
});
|
|
983
1238
|
}
|
|
984
1239
|
/** Delete a sub-user order */
|
|
985
1240
|
async delete(options) {
|
|
986
|
-
return this
|
|
1241
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1242
|
+
}
|
|
1243
|
+
/** Delete a sub-user order; include response metadata. */
|
|
1244
|
+
async deleteWithResponse(options) {
|
|
1245
|
+
return this.#client._callWithResponse({
|
|
987
1246
|
operationId: "orders_destroy",
|
|
988
1247
|
method: "DELETE",
|
|
989
|
-
path: "/orders/{id}"
|
|
1248
|
+
path: "/orders/{id}",
|
|
1249
|
+
idempotent: true
|
|
990
1250
|
}, {
|
|
991
1251
|
path: { id: options.id },
|
|
992
|
-
headers: {
|
|
1252
|
+
headers: {
|
|
1253
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1254
|
+
"If-Match": options.ifMatch,
|
|
1255
|
+
"Accept-Language": options.acceptLanguage
|
|
1256
|
+
},
|
|
993
1257
|
...options.request === void 0 ? {} : { request: options.request }
|
|
994
1258
|
});
|
|
995
1259
|
}
|
|
996
1260
|
/** Reset an order's proxy password */
|
|
997
1261
|
async resetPassword(options) {
|
|
998
|
-
return this
|
|
1262
|
+
return (await this.resetPasswordWithResponse(options)).data;
|
|
1263
|
+
}
|
|
1264
|
+
/** Reset an order's proxy password; include response metadata. */
|
|
1265
|
+
async resetPasswordWithResponse(options) {
|
|
1266
|
+
return this.#client._callWithResponse({
|
|
999
1267
|
operationId: "reset_password_create",
|
|
1000
1268
|
method: "POST",
|
|
1001
1269
|
path: "/reset-password"
|
|
@@ -1013,7 +1281,11 @@ var PackagesResource = class {
|
|
|
1013
1281
|
}
|
|
1014
1282
|
/** List available proxy packages */
|
|
1015
1283
|
async list(options = {}) {
|
|
1016
|
-
return this
|
|
1284
|
+
return (await this.listWithResponse(options)).data;
|
|
1285
|
+
}
|
|
1286
|
+
/** List available proxy packages; include response metadata. */
|
|
1287
|
+
async listWithResponse(options = {}) {
|
|
1288
|
+
return this.#client._callWithResponse({
|
|
1017
1289
|
operationId: "packages_list",
|
|
1018
1290
|
method: "GET",
|
|
1019
1291
|
path: "/packages"
|
|
@@ -1033,7 +1305,11 @@ var PackagesResource = class {
|
|
|
1033
1305
|
}
|
|
1034
1306
|
/** List affiliate package commissions */
|
|
1035
1307
|
async listCommissions(options = {}) {
|
|
1036
|
-
return this
|
|
1308
|
+
return (await this.listCommissionsWithResponse(options)).data;
|
|
1309
|
+
}
|
|
1310
|
+
/** List affiliate package commissions; include response metadata. */
|
|
1311
|
+
async listCommissionsWithResponse(options = {}) {
|
|
1312
|
+
return this.#client._callWithResponse({
|
|
1037
1313
|
operationId: "packages_commissions_list",
|
|
1038
1314
|
method: "GET",
|
|
1039
1315
|
path: "/packages/commissions"
|
|
@@ -1058,7 +1334,11 @@ var ProfileResource = class {
|
|
|
1058
1334
|
}
|
|
1059
1335
|
/** Get the current profile */
|
|
1060
1336
|
async get(options = {}) {
|
|
1061
|
-
return this
|
|
1337
|
+
return (await this.getWithResponse(options)).data;
|
|
1338
|
+
}
|
|
1339
|
+
/** Get the current profile; include response metadata. */
|
|
1340
|
+
async getWithResponse(options = {}) {
|
|
1341
|
+
return this.#client._callWithResponse({
|
|
1062
1342
|
operationId: "profile_retrieve",
|
|
1063
1343
|
method: "GET",
|
|
1064
1344
|
path: "/profile"
|
|
@@ -1069,30 +1349,48 @@ var ProfileResource = class {
|
|
|
1069
1349
|
}
|
|
1070
1350
|
/** Update the current profile */
|
|
1071
1351
|
async update(options = {}) {
|
|
1072
|
-
return this
|
|
1352
|
+
return (await this.updateWithResponse(options)).data;
|
|
1353
|
+
}
|
|
1354
|
+
/** Update the current profile; include response metadata. */
|
|
1355
|
+
async updateWithResponse(options = {}) {
|
|
1356
|
+
return this.#client._callWithResponse({
|
|
1073
1357
|
operationId: "profile_partial_update",
|
|
1074
1358
|
method: "PATCH",
|
|
1075
1359
|
path: "/profile"
|
|
1076
1360
|
}, {
|
|
1077
|
-
headers: {
|
|
1361
|
+
headers: {
|
|
1362
|
+
"If-Match": options.ifMatch,
|
|
1363
|
+
"Accept-Language": options.acceptLanguage
|
|
1364
|
+
},
|
|
1078
1365
|
...options.body === void 0 ? {} : { body: options.body },
|
|
1079
1366
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1080
1367
|
});
|
|
1081
1368
|
}
|
|
1082
1369
|
/** Delete the current account */
|
|
1083
1370
|
async delete(options = {}) {
|
|
1084
|
-
return this
|
|
1371
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1372
|
+
}
|
|
1373
|
+
/** Delete the current account; include response metadata. */
|
|
1374
|
+
async deleteWithResponse(options = {}) {
|
|
1375
|
+
return this.#client._callWithResponse({
|
|
1085
1376
|
operationId: "profile_destroy",
|
|
1086
1377
|
method: "DELETE",
|
|
1087
1378
|
path: "/profile"
|
|
1088
1379
|
}, {
|
|
1089
|
-
headers: {
|
|
1380
|
+
headers: {
|
|
1381
|
+
"If-Match": options.ifMatch,
|
|
1382
|
+
"Accept-Language": options.acceptLanguage
|
|
1383
|
+
},
|
|
1090
1384
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1091
1385
|
});
|
|
1092
1386
|
}
|
|
1093
|
-
/** Confirm two-factor
|
|
1387
|
+
/** Confirm two-factor authentication */
|
|
1094
1388
|
async confirmTwoFactor(options) {
|
|
1095
|
-
return this
|
|
1389
|
+
return (await this.confirmTwoFactorWithResponse(options)).data;
|
|
1390
|
+
}
|
|
1391
|
+
/** Confirm two-factor authentication; include response metadata. */
|
|
1392
|
+
async confirmTwoFactorWithResponse(options) {
|
|
1393
|
+
return this.#client._callWithResponse({
|
|
1096
1394
|
operationId: "profile_2fa_confirm_create",
|
|
1097
1395
|
method: "POST",
|
|
1098
1396
|
path: "/profile/2fa/confirm"
|
|
@@ -1104,7 +1402,11 @@ var ProfileResource = class {
|
|
|
1104
1402
|
}
|
|
1105
1403
|
/** Disable two-factor authentication */
|
|
1106
1404
|
async disableTwoFactor(options) {
|
|
1107
|
-
return this
|
|
1405
|
+
return (await this.disableTwoFactorWithResponse(options)).data;
|
|
1406
|
+
}
|
|
1407
|
+
/** Disable two-factor authentication; include response metadata. */
|
|
1408
|
+
async disableTwoFactorWithResponse(options) {
|
|
1409
|
+
return this.#client._callWithResponse({
|
|
1108
1410
|
operationId: "profile_2fa_disable_create",
|
|
1109
1411
|
method: "POST",
|
|
1110
1412
|
path: "/profile/2fa/disable"
|
|
@@ -1114,20 +1416,29 @@ var ProfileResource = class {
|
|
|
1114
1416
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1115
1417
|
});
|
|
1116
1418
|
}
|
|
1117
|
-
/**
|
|
1419
|
+
/** Prepare two-factor authentication */
|
|
1118
1420
|
async setupTwoFactor(options = {}) {
|
|
1119
|
-
return this
|
|
1421
|
+
return (await this.setupTwoFactorWithResponse(options)).data;
|
|
1422
|
+
}
|
|
1423
|
+
/** Prepare two-factor authentication; include response metadata. */
|
|
1424
|
+
async setupTwoFactorWithResponse(options = {}) {
|
|
1425
|
+
return this.#client._callWithResponse({
|
|
1120
1426
|
operationId: "profile_2fa_setup_create",
|
|
1121
1427
|
method: "POST",
|
|
1122
1428
|
path: "/profile/2fa/setup"
|
|
1123
1429
|
}, {
|
|
1124
1430
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
1431
|
+
...options.body === void 0 ? {} : { body: options.body },
|
|
1125
1432
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1126
1433
|
});
|
|
1127
1434
|
}
|
|
1128
1435
|
/** Get two-factor status */
|
|
1129
1436
|
async getTwoFactorStatus(options = {}) {
|
|
1130
|
-
return this
|
|
1437
|
+
return (await this.getTwoFactorStatusWithResponse(options)).data;
|
|
1438
|
+
}
|
|
1439
|
+
/** Get two-factor status; include response metadata. */
|
|
1440
|
+
async getTwoFactorStatusWithResponse(options = {}) {
|
|
1441
|
+
return this.#client._callWithResponse({
|
|
1131
1442
|
operationId: "profile_2fa_status_retrieve",
|
|
1132
1443
|
method: "GET",
|
|
1133
1444
|
path: "/profile/2fa/status"
|
|
@@ -1138,7 +1449,11 @@ var ProfileResource = class {
|
|
|
1138
1449
|
}
|
|
1139
1450
|
/** Change the account password */
|
|
1140
1451
|
async changePassword(options) {
|
|
1141
|
-
return this
|
|
1452
|
+
return (await this.changePasswordWithResponse(options)).data;
|
|
1453
|
+
}
|
|
1454
|
+
/** Change the account password; include response metadata. */
|
|
1455
|
+
async changePasswordWithResponse(options) {
|
|
1456
|
+
return this.#client._callWithResponse({
|
|
1142
1457
|
operationId: "profile_change_password_create",
|
|
1143
1458
|
method: "POST",
|
|
1144
1459
|
path: "/profile/change-password"
|
|
@@ -1156,7 +1471,11 @@ var ProxiesResource = class {
|
|
|
1156
1471
|
}
|
|
1157
1472
|
/** Generate proxy credentials */
|
|
1158
1473
|
async generate(options) {
|
|
1159
|
-
return this
|
|
1474
|
+
return (await this.generateWithResponse(options)).data;
|
|
1475
|
+
}
|
|
1476
|
+
/** Generate proxy credentials; include response metadata. */
|
|
1477
|
+
async generateWithResponse(options) {
|
|
1478
|
+
return this.#client._callWithResponse({
|
|
1160
1479
|
operationId: "proxies_generate_create",
|
|
1161
1480
|
method: "POST",
|
|
1162
1481
|
path: "/proxies/generate"
|
|
@@ -1174,7 +1493,11 @@ var RewardsResource = class {
|
|
|
1174
1493
|
}
|
|
1175
1494
|
/** List account rewards */
|
|
1176
1495
|
async list(options = {}) {
|
|
1177
|
-
return this
|
|
1496
|
+
return (await this.listWithResponse(options)).data;
|
|
1497
|
+
}
|
|
1498
|
+
/** List account rewards; include response metadata. */
|
|
1499
|
+
async listWithResponse(options = {}) {
|
|
1500
|
+
return this.#client._callWithResponse({
|
|
1178
1501
|
operationId: "rewards_list",
|
|
1179
1502
|
method: "GET",
|
|
1180
1503
|
path: "/rewards"
|
|
@@ -1193,7 +1516,11 @@ var RewardsResource = class {
|
|
|
1193
1516
|
}
|
|
1194
1517
|
/** Claim available rewards */
|
|
1195
1518
|
async claim(options) {
|
|
1196
|
-
return this
|
|
1519
|
+
return (await this.claimWithResponse(options)).data;
|
|
1520
|
+
}
|
|
1521
|
+
/** Claim available rewards; include response metadata. */
|
|
1522
|
+
async claimWithResponse(options) {
|
|
1523
|
+
return this.#client._callWithResponse({
|
|
1197
1524
|
operationId: "rewards_claim_create",
|
|
1198
1525
|
method: "POST",
|
|
1199
1526
|
path: "/rewards/claim"
|
|
@@ -1204,35 +1531,6 @@ var RewardsResource = class {
|
|
|
1204
1531
|
});
|
|
1205
1532
|
}
|
|
1206
1533
|
};
|
|
1207
|
-
var SessionsResource = class {
|
|
1208
|
-
#client;
|
|
1209
|
-
constructor(client) {
|
|
1210
|
-
this.#client = client;
|
|
1211
|
-
}
|
|
1212
|
-
/** List active proxy sessions */
|
|
1213
|
-
async list(options = {}) {
|
|
1214
|
-
return this.#client._call({
|
|
1215
|
-
operationId: "sessions_list",
|
|
1216
|
-
method: "GET",
|
|
1217
|
-
path: "/sessions"
|
|
1218
|
-
}, {
|
|
1219
|
-
headers: { "Accept-Language": options.acceptLanguage },
|
|
1220
|
-
...options.request === void 0 ? {} : { request: options.request }
|
|
1221
|
-
});
|
|
1222
|
-
}
|
|
1223
|
-
/** Revoke a proxy session */
|
|
1224
|
-
async delete(options) {
|
|
1225
|
-
return this.#client._call({
|
|
1226
|
-
operationId: "sessions_destroy",
|
|
1227
|
-
method: "DELETE",
|
|
1228
|
-
path: "/sessions/{id}"
|
|
1229
|
-
}, {
|
|
1230
|
-
path: { id: options.id },
|
|
1231
|
-
headers: { "Accept-Language": options.acceptLanguage },
|
|
1232
|
-
...options.request === void 0 ? {} : { request: options.request }
|
|
1233
|
-
});
|
|
1234
|
-
}
|
|
1235
|
-
};
|
|
1236
1534
|
var SettingsResource = class {
|
|
1237
1535
|
#client;
|
|
1238
1536
|
constructor(client) {
|
|
@@ -1240,7 +1538,11 @@ var SettingsResource = class {
|
|
|
1240
1538
|
}
|
|
1241
1539
|
/** Get account settings */
|
|
1242
1540
|
async get(options = {}) {
|
|
1243
|
-
return this
|
|
1541
|
+
return (await this.getWithResponse(options)).data;
|
|
1542
|
+
}
|
|
1543
|
+
/** Get account settings; include response metadata. */
|
|
1544
|
+
async getWithResponse(options = {}) {
|
|
1545
|
+
return this.#client._callWithResponse({
|
|
1244
1546
|
operationId: "settings_retrieve",
|
|
1245
1547
|
method: "GET",
|
|
1246
1548
|
path: "/settings"
|
|
@@ -1257,7 +1559,11 @@ var TelegramDashboardResource = class {
|
|
|
1257
1559
|
}
|
|
1258
1560
|
/** Get the Telegram dashboard connection */
|
|
1259
1561
|
async getConnection(options = {}) {
|
|
1260
|
-
return this
|
|
1562
|
+
return (await this.getConnectionWithResponse(options)).data;
|
|
1563
|
+
}
|
|
1564
|
+
/** Get the Telegram dashboard connection; include response metadata. */
|
|
1565
|
+
async getConnectionWithResponse(options = {}) {
|
|
1566
|
+
return this.#client._callWithResponse({
|
|
1261
1567
|
operationId: "integrations_telegram_connection_retrieve",
|
|
1262
1568
|
method: "GET",
|
|
1263
1569
|
path: "/integrations/telegram/connection"
|
|
@@ -1268,7 +1574,11 @@ var TelegramDashboardResource = class {
|
|
|
1268
1574
|
}
|
|
1269
1575
|
/** Update Telegram dashboard preferences */
|
|
1270
1576
|
async updateConnection(options = {}) {
|
|
1271
|
-
return this
|
|
1577
|
+
return (await this.updateConnectionWithResponse(options)).data;
|
|
1578
|
+
}
|
|
1579
|
+
/** Update Telegram dashboard preferences; include response metadata. */
|
|
1580
|
+
async updateConnectionWithResponse(options = {}) {
|
|
1581
|
+
return this.#client._callWithResponse({
|
|
1272
1582
|
operationId: "integrations_telegram_connection_partial_update",
|
|
1273
1583
|
method: "PATCH",
|
|
1274
1584
|
path: "/integrations/telegram/connection"
|
|
@@ -1280,7 +1590,11 @@ var TelegramDashboardResource = class {
|
|
|
1280
1590
|
}
|
|
1281
1591
|
/** Disconnect the Telegram dashboard */
|
|
1282
1592
|
async deleteConnection(options = {}) {
|
|
1283
|
-
return this
|
|
1593
|
+
return (await this.deleteConnectionWithResponse(options)).data;
|
|
1594
|
+
}
|
|
1595
|
+
/** Disconnect the Telegram dashboard; include response metadata. */
|
|
1596
|
+
async deleteConnectionWithResponse(options = {}) {
|
|
1597
|
+
return this.#client._callWithResponse({
|
|
1284
1598
|
operationId: "integrations_telegram_connection_destroy",
|
|
1285
1599
|
method: "DELETE",
|
|
1286
1600
|
path: "/integrations/telegram/connection"
|
|
@@ -1291,7 +1605,11 @@ var TelegramDashboardResource = class {
|
|
|
1291
1605
|
}
|
|
1292
1606
|
/** Create a Telegram account link */
|
|
1293
1607
|
async createLink(options = {}) {
|
|
1294
|
-
return this
|
|
1608
|
+
return (await this.createLinkWithResponse(options)).data;
|
|
1609
|
+
}
|
|
1610
|
+
/** Create a Telegram account link; include response metadata. */
|
|
1611
|
+
async createLinkWithResponse(options = {}) {
|
|
1612
|
+
return this.#client._callWithResponse({
|
|
1295
1613
|
operationId: "integrations_telegram_link_create",
|
|
1296
1614
|
method: "POST",
|
|
1297
1615
|
path: "/integrations/telegram/link"
|
|
@@ -1301,42 +1619,6 @@ var TelegramDashboardResource = class {
|
|
|
1301
1619
|
});
|
|
1302
1620
|
}
|
|
1303
1621
|
};
|
|
1304
|
-
var TelegramServiceResource = class {
|
|
1305
|
-
#client;
|
|
1306
|
-
constructor(client) {
|
|
1307
|
-
this.#client = client;
|
|
1308
|
-
}
|
|
1309
|
-
/** Consume a Telegram account link */
|
|
1310
|
-
async consumeLink(options) {
|
|
1311
|
-
return this.#client._call({
|
|
1312
|
-
operationId: "integrations_telegram_link_consume_create",
|
|
1313
|
-
method: "POST",
|
|
1314
|
-
path: "/integrations/telegram/link/consume"
|
|
1315
|
-
}, {
|
|
1316
|
-
headers: {
|
|
1317
|
-
"X-ProxyRequest-Telegram-Secret": options.serviceSecret,
|
|
1318
|
-
"Accept-Language": options.acceptLanguage
|
|
1319
|
-
},
|
|
1320
|
-
body: options.body,
|
|
1321
|
-
...options.request === void 0 ? {} : { request: options.request }
|
|
1322
|
-
});
|
|
1323
|
-
}
|
|
1324
|
-
/** Create a Telegram API session */
|
|
1325
|
-
async createSession(options) {
|
|
1326
|
-
return this.#client._call({
|
|
1327
|
-
operationId: "integrations_telegram_session_create",
|
|
1328
|
-
method: "POST",
|
|
1329
|
-
path: "/integrations/telegram/session"
|
|
1330
|
-
}, {
|
|
1331
|
-
headers: {
|
|
1332
|
-
"X-ProxyRequest-Telegram-Secret": options.serviceSecret,
|
|
1333
|
-
"Accept-Language": options.acceptLanguage
|
|
1334
|
-
},
|
|
1335
|
-
body: options.body,
|
|
1336
|
-
...options.request === void 0 ? {} : { request: options.request }
|
|
1337
|
-
});
|
|
1338
|
-
}
|
|
1339
|
-
};
|
|
1340
1622
|
var UsersResource = class {
|
|
1341
1623
|
#client;
|
|
1342
1624
|
constructor(client) {
|
|
@@ -1344,7 +1626,11 @@ var UsersResource = class {
|
|
|
1344
1626
|
}
|
|
1345
1627
|
/** List users in the current account */
|
|
1346
1628
|
async list(options = {}) {
|
|
1347
|
-
return this
|
|
1629
|
+
return (await this.listWithResponse(options)).data;
|
|
1630
|
+
}
|
|
1631
|
+
/** List users in the current account; include response metadata. */
|
|
1632
|
+
async listWithResponse(options = {}) {
|
|
1633
|
+
return this.#client._callWithResponse({
|
|
1348
1634
|
operationId: "users_list",
|
|
1349
1635
|
method: "GET",
|
|
1350
1636
|
path: "/users"
|
|
@@ -1363,21 +1649,33 @@ var UsersResource = class {
|
|
|
1363
1649
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1364
1650
|
});
|
|
1365
1651
|
}
|
|
1366
|
-
/** Create a
|
|
1652
|
+
/** Create a customer account */
|
|
1367
1653
|
async create(options) {
|
|
1368
|
-
return this
|
|
1654
|
+
return (await this.createWithResponse(options)).data;
|
|
1655
|
+
}
|
|
1656
|
+
/** Create a customer account; include response metadata. */
|
|
1657
|
+
async createWithResponse(options) {
|
|
1658
|
+
return this.#client._callWithResponse({
|
|
1369
1659
|
operationId: "users_create",
|
|
1370
1660
|
method: "POST",
|
|
1371
|
-
path: "/users"
|
|
1661
|
+
path: "/users",
|
|
1662
|
+
idempotent: true
|
|
1372
1663
|
}, {
|
|
1373
|
-
headers: {
|
|
1664
|
+
headers: {
|
|
1665
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1666
|
+
"Accept-Language": options.acceptLanguage
|
|
1667
|
+
},
|
|
1374
1668
|
body: options.body,
|
|
1375
1669
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1376
1670
|
});
|
|
1377
1671
|
}
|
|
1378
1672
|
/** Get a user */
|
|
1379
1673
|
async get(options) {
|
|
1380
|
-
return this
|
|
1674
|
+
return (await this.getWithResponse(options)).data;
|
|
1675
|
+
}
|
|
1676
|
+
/** Get a user; include response metadata. */
|
|
1677
|
+
async getWithResponse(options) {
|
|
1678
|
+
return this.#client._callWithResponse({
|
|
1381
1679
|
operationId: "users_retrieve",
|
|
1382
1680
|
method: "GET",
|
|
1383
1681
|
path: "/users/{id}"
|
|
@@ -1389,58 +1687,115 @@ var UsersResource = class {
|
|
|
1389
1687
|
}
|
|
1390
1688
|
/** Update a user */
|
|
1391
1689
|
async update(options) {
|
|
1392
|
-
return this
|
|
1690
|
+
return (await this.updateWithResponse(options)).data;
|
|
1691
|
+
}
|
|
1692
|
+
/** Update a user; include response metadata. */
|
|
1693
|
+
async updateWithResponse(options) {
|
|
1694
|
+
return this.#client._callWithResponse({
|
|
1393
1695
|
operationId: "users_partial_update",
|
|
1394
1696
|
method: "PATCH",
|
|
1395
1697
|
path: "/users/{id}"
|
|
1396
1698
|
}, {
|
|
1397
1699
|
path: { id: options.id },
|
|
1398
|
-
headers: {
|
|
1700
|
+
headers: {
|
|
1701
|
+
"If-Match": options.ifMatch,
|
|
1702
|
+
"Accept-Language": options.acceptLanguage
|
|
1703
|
+
},
|
|
1399
1704
|
...options.body === void 0 ? {} : { body: options.body },
|
|
1400
1705
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1401
1706
|
});
|
|
1402
1707
|
}
|
|
1403
1708
|
/** Delete a user */
|
|
1404
1709
|
async delete(options) {
|
|
1405
|
-
return this
|
|
1710
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1711
|
+
}
|
|
1712
|
+
/** Delete a user; include response metadata. */
|
|
1713
|
+
async deleteWithResponse(options) {
|
|
1714
|
+
return this.#client._callWithResponse({
|
|
1406
1715
|
operationId: "users_destroy",
|
|
1407
1716
|
method: "DELETE",
|
|
1408
|
-
path: "/users/{id}"
|
|
1717
|
+
path: "/users/{id}",
|
|
1718
|
+
idempotent: true
|
|
1409
1719
|
}, {
|
|
1410
1720
|
path: { id: options.id },
|
|
1411
|
-
headers: {
|
|
1721
|
+
headers: {
|
|
1722
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1723
|
+
"If-Match": options.ifMatch,
|
|
1724
|
+
"Accept-Language": options.acceptLanguage
|
|
1725
|
+
},
|
|
1412
1726
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1413
1727
|
});
|
|
1414
1728
|
}
|
|
1415
1729
|
/** Add data to a sub-user order */
|
|
1416
1730
|
async addData(options) {
|
|
1417
|
-
return this
|
|
1731
|
+
return (await this.addDataWithResponse(options)).data;
|
|
1732
|
+
}
|
|
1733
|
+
/** Add data to a sub-user order; include response metadata. */
|
|
1734
|
+
async addDataWithResponse(options) {
|
|
1735
|
+
return this.#client._callWithResponse({
|
|
1418
1736
|
operationId: "users_data_add_create",
|
|
1419
1737
|
method: "POST",
|
|
1420
|
-
path: "/users/{id}/data/add"
|
|
1738
|
+
path: "/users/{id}/data/add",
|
|
1739
|
+
idempotent: true
|
|
1421
1740
|
}, {
|
|
1422
1741
|
path: { id: options.id },
|
|
1423
|
-
headers: {
|
|
1742
|
+
headers: {
|
|
1743
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1744
|
+
"Accept-Language": options.acceptLanguage
|
|
1745
|
+
},
|
|
1424
1746
|
body: options.body,
|
|
1425
1747
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1426
1748
|
});
|
|
1427
1749
|
}
|
|
1428
1750
|
/** Subtract data from a sub-user order */
|
|
1429
1751
|
async subtractData(options) {
|
|
1430
|
-
return this
|
|
1752
|
+
return (await this.subtractDataWithResponse(options)).data;
|
|
1753
|
+
}
|
|
1754
|
+
/** Subtract data from a sub-user order; include response metadata. */
|
|
1755
|
+
async subtractDataWithResponse(options) {
|
|
1756
|
+
return this.#client._callWithResponse({
|
|
1431
1757
|
operationId: "users_data_subtract_create",
|
|
1432
1758
|
method: "POST",
|
|
1433
|
-
path: "/users/{id}/data/subtract"
|
|
1759
|
+
path: "/users/{id}/data/subtract",
|
|
1760
|
+
idempotent: true
|
|
1434
1761
|
}, {
|
|
1435
1762
|
path: { id: options.id },
|
|
1436
|
-
headers: {
|
|
1763
|
+
headers: {
|
|
1764
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1765
|
+
"Accept-Language": options.acceptLanguage
|
|
1766
|
+
},
|
|
1767
|
+
body: options.body,
|
|
1768
|
+
...options.request === void 0 ? {} : { request: options.request }
|
|
1769
|
+
});
|
|
1770
|
+
}
|
|
1771
|
+
/** Reset a user's remaining data */
|
|
1772
|
+
async resetData(options) {
|
|
1773
|
+
return (await this.resetDataWithResponse(options)).data;
|
|
1774
|
+
}
|
|
1775
|
+
/** Reset a user's remaining data; include response metadata. */
|
|
1776
|
+
async resetDataWithResponse(options) {
|
|
1777
|
+
return this.#client._callWithResponse({
|
|
1778
|
+
operationId: "users_data_reset_create",
|
|
1779
|
+
method: "POST",
|
|
1780
|
+
path: "/users/{id}/data/reset",
|
|
1781
|
+
idempotent: true
|
|
1782
|
+
}, {
|
|
1783
|
+
path: { id: options.id },
|
|
1784
|
+
headers: {
|
|
1785
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1786
|
+
"Accept-Language": options.acceptLanguage
|
|
1787
|
+
},
|
|
1437
1788
|
body: options.body,
|
|
1438
1789
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1439
1790
|
});
|
|
1440
1791
|
}
|
|
1441
1792
|
/** List a sub-user's orders */
|
|
1442
1793
|
async listOrders(options) {
|
|
1443
|
-
return this
|
|
1794
|
+
return (await this.listOrdersWithResponse(options)).data;
|
|
1795
|
+
}
|
|
1796
|
+
/** List a sub-user's orders; include response metadata. */
|
|
1797
|
+
async listOrdersWithResponse(options) {
|
|
1798
|
+
return this.#client._callWithResponse({
|
|
1444
1799
|
operationId: "users_orders_list",
|
|
1445
1800
|
method: "GET",
|
|
1446
1801
|
path: "/users/{id}/orders"
|
|
@@ -1460,14 +1815,18 @@ var UsersResource = class {
|
|
|
1460
1815
|
}
|
|
1461
1816
|
/** Rotate a sub-user proxy password */
|
|
1462
1817
|
async resetPassword(options) {
|
|
1463
|
-
return this
|
|
1818
|
+
return (await this.resetPasswordWithResponse(options)).data;
|
|
1819
|
+
}
|
|
1820
|
+
/** Rotate a sub-user proxy password; include response metadata. */
|
|
1821
|
+
async resetPasswordWithResponse(options) {
|
|
1822
|
+
return this.#client._callWithResponse({
|
|
1464
1823
|
operationId: "users_password_create",
|
|
1465
1824
|
method: "POST",
|
|
1466
1825
|
path: "/users/{id}/password"
|
|
1467
1826
|
}, {
|
|
1468
1827
|
path: { id: options.id },
|
|
1469
1828
|
headers: { "Accept-Language": options.acceptLanguage },
|
|
1470
|
-
|
|
1829
|
+
body: options.body,
|
|
1471
1830
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1472
1831
|
});
|
|
1473
1832
|
}
|
|
@@ -1479,7 +1838,11 @@ var WebhooksResource = class {
|
|
|
1479
1838
|
}
|
|
1480
1839
|
/** List customer webhooks */
|
|
1481
1840
|
async list(options = {}) {
|
|
1482
|
-
return this
|
|
1841
|
+
return (await this.listWithResponse(options)).data;
|
|
1842
|
+
}
|
|
1843
|
+
/** List customer webhooks; include response metadata. */
|
|
1844
|
+
async listWithResponse(options = {}) {
|
|
1845
|
+
return this.#client._callWithResponse({
|
|
1483
1846
|
operationId: "webhooks_list",
|
|
1484
1847
|
method: "GET",
|
|
1485
1848
|
path: "/webhooks"
|
|
@@ -1494,19 +1857,31 @@ var WebhooksResource = class {
|
|
|
1494
1857
|
}
|
|
1495
1858
|
/** Create a customer webhook */
|
|
1496
1859
|
async create(options) {
|
|
1497
|
-
return this
|
|
1860
|
+
return (await this.createWithResponse(options)).data;
|
|
1861
|
+
}
|
|
1862
|
+
/** Create a customer webhook; include response metadata. */
|
|
1863
|
+
async createWithResponse(options) {
|
|
1864
|
+
return this.#client._callWithResponse({
|
|
1498
1865
|
operationId: "webhooks_create",
|
|
1499
1866
|
method: "POST",
|
|
1500
|
-
path: "/webhooks"
|
|
1867
|
+
path: "/webhooks",
|
|
1868
|
+
idempotent: true
|
|
1501
1869
|
}, {
|
|
1502
|
-
headers: {
|
|
1870
|
+
headers: {
|
|
1871
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1872
|
+
"Accept-Language": options.acceptLanguage
|
|
1873
|
+
},
|
|
1503
1874
|
body: options.body,
|
|
1504
1875
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1505
1876
|
});
|
|
1506
1877
|
}
|
|
1507
1878
|
/** Get a customer webhook */
|
|
1508
1879
|
async get(options) {
|
|
1509
|
-
return this
|
|
1880
|
+
return (await this.getWithResponse(options)).data;
|
|
1881
|
+
}
|
|
1882
|
+
/** Get a customer webhook; include response metadata. */
|
|
1883
|
+
async getWithResponse(options) {
|
|
1884
|
+
return this.#client._callWithResponse({
|
|
1510
1885
|
operationId: "webhooks_retrieve",
|
|
1511
1886
|
method: "GET",
|
|
1512
1887
|
path: "/webhooks/{id}"
|
|
@@ -1518,13 +1893,22 @@ var WebhooksResource = class {
|
|
|
1518
1893
|
}
|
|
1519
1894
|
/** Delete a customer webhook */
|
|
1520
1895
|
async delete(options) {
|
|
1521
|
-
return this
|
|
1896
|
+
return (await this.deleteWithResponse(options)).data;
|
|
1897
|
+
}
|
|
1898
|
+
/** Delete a customer webhook; include response metadata. */
|
|
1899
|
+
async deleteWithResponse(options) {
|
|
1900
|
+
return this.#client._callWithResponse({
|
|
1522
1901
|
operationId: "webhooks_destroy",
|
|
1523
1902
|
method: "DELETE",
|
|
1524
|
-
path: "/webhooks/{id}"
|
|
1903
|
+
path: "/webhooks/{id}",
|
|
1904
|
+
idempotent: true
|
|
1525
1905
|
}, {
|
|
1526
1906
|
path: { id: options.id },
|
|
1527
|
-
headers: {
|
|
1907
|
+
headers: {
|
|
1908
|
+
"Idempotency-Key": options.idempotencyKey,
|
|
1909
|
+
"If-Match": options.ifMatch,
|
|
1910
|
+
"Accept-Language": options.acceptLanguage
|
|
1911
|
+
},
|
|
1528
1912
|
...options.request === void 0 ? {} : { request: options.request }
|
|
1529
1913
|
});
|
|
1530
1914
|
}
|
|
@@ -1544,10 +1928,8 @@ function createResourceCollection(client) {
|
|
|
1544
1928
|
profile: new ProfileResource(client),
|
|
1545
1929
|
proxies: new ProxiesResource(client),
|
|
1546
1930
|
rewards: new RewardsResource(client),
|
|
1547
|
-
sessions: new SessionsResource(client),
|
|
1548
1931
|
settings: new SettingsResource(client),
|
|
1549
1932
|
telegram: new TelegramDashboardResource(client),
|
|
1550
|
-
telegramService: new TelegramServiceResource(client),
|
|
1551
1933
|
users: new UsersResource(client),
|
|
1552
1934
|
webhooks: new WebhooksResource(client)
|
|
1553
1935
|
};
|
|
@@ -1591,7 +1973,7 @@ function offsetFromUrl(url) {
|
|
|
1591
1973
|
//#endregion
|
|
1592
1974
|
//#region src/client.ts
|
|
1593
1975
|
const DEFAULT_BASE_URL = "https://api.proxyrequest.com/api/v1";
|
|
1594
|
-
const SDK_VERSION = "1.0
|
|
1976
|
+
const SDK_VERSION = "2.1.0";
|
|
1595
1977
|
var ProxyRequestClient = class ProxyRequestClient {
|
|
1596
1978
|
apiKeys;
|
|
1597
1979
|
affiliates;
|
|
@@ -1606,15 +1988,14 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1606
1988
|
profile;
|
|
1607
1989
|
proxies;
|
|
1608
1990
|
rewards;
|
|
1609
|
-
sessions;
|
|
1610
1991
|
settings;
|
|
1611
1992
|
telegram;
|
|
1612
|
-
telegramService;
|
|
1613
1993
|
users;
|
|
1614
1994
|
webhooks;
|
|
1615
1995
|
baseUrl;
|
|
1616
1996
|
language;
|
|
1617
1997
|
timeoutMs;
|
|
1998
|
+
idempotency;
|
|
1618
1999
|
#fetch;
|
|
1619
2000
|
#headers;
|
|
1620
2001
|
#openapi;
|
|
@@ -1622,6 +2003,7 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1622
2003
|
this.baseUrl = normalizeBaseUrl(options.baseUrl ?? "https://api.proxyrequest.com/api/v1");
|
|
1623
2004
|
this.language = options.language ?? "en";
|
|
1624
2005
|
this.timeoutMs = options.timeoutMs ?? 15e3;
|
|
2006
|
+
this.idempotency = options.idempotency ?? true;
|
|
1625
2007
|
if (!Number.isFinite(this.timeoutMs) || this.timeoutMs < 0) throw new RangeError("timeoutMs must be a non-negative finite number.");
|
|
1626
2008
|
this.#fetch = options.fetch ?? globalThis.fetch;
|
|
1627
2009
|
if (typeof this.#fetch !== "function") throw new TypeError("A Fetch API implementation is required.");
|
|
@@ -1656,10 +2038,8 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1656
2038
|
this.profile = resources.profile;
|
|
1657
2039
|
this.proxies = resources.proxies;
|
|
1658
2040
|
this.rewards = resources.rewards;
|
|
1659
|
-
this.sessions = resources.sessions;
|
|
1660
2041
|
this.settings = resources.settings;
|
|
1661
2042
|
this.telegram = resources.telegram;
|
|
1662
|
-
this.telegramService = resources.telegramService;
|
|
1663
2043
|
this.users = resources.users;
|
|
1664
2044
|
this.webhooks = resources.webhooks;
|
|
1665
2045
|
}
|
|
@@ -1679,34 +2059,55 @@ var ProxyRequestClient = class ProxyRequestClient {
|
|
|
1679
2059
|
return new ProxyRequestClient(options);
|
|
1680
2060
|
}
|
|
1681
2061
|
async _call(spec, data = {}) {
|
|
2062
|
+
return (await this._callWithResponse(spec, data)).data;
|
|
2063
|
+
}
|
|
2064
|
+
async _callWithResponse(spec, data = {}) {
|
|
1682
2065
|
const controls = data.request ?? {};
|
|
1683
|
-
const
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
...
|
|
1691
|
-
...controls.headers === void 0 ? {} : { headers: controls.headers },
|
|
1692
|
-
signal: timeout.signal,
|
|
1693
|
-
...spec.binary ? { parseAs: "arrayBuffer" } : {}
|
|
2066
|
+
const controlHeaders = new Headers(controls.headers);
|
|
2067
|
+
const parameterKey = stringHeader(data.headers?.["Idempotency-Key"]);
|
|
2068
|
+
const controlKey = controlHeaders.get("Idempotency-Key") ?? void 0;
|
|
2069
|
+
const idempotencyKey = spec.idempotent ? parameterKey ?? controlKey ?? (this.idempotency ? newIdempotencyKey() : void 0) : void 0;
|
|
2070
|
+
if (spec.idempotent) controlHeaders.delete("Idempotency-Key");
|
|
2071
|
+
const operationHeaders = {
|
|
2072
|
+
...data.headers,
|
|
2073
|
+
...idempotencyKey === void 0 ? {} : { "Idempotency-Key": idempotencyKey }
|
|
1694
2074
|
};
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
const
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
2075
|
+
const method = this.#openapi[spec.method];
|
|
2076
|
+
for (let attempt = 0; attempt < 3; attempt += 1) {
|
|
2077
|
+
const timeout = requestSignal(controls.signal, controls.timeoutMs ?? this.timeoutMs);
|
|
2078
|
+
try {
|
|
2079
|
+
const result = await method(spec.path, {
|
|
2080
|
+
params: {
|
|
2081
|
+
...data.path === void 0 ? {} : { path: data.path },
|
|
2082
|
+
...data.query === void 0 ? {} : { query: data.query },
|
|
2083
|
+
...Object.keys(operationHeaders).length === 0 ? {} : { header: operationHeaders }
|
|
2084
|
+
},
|
|
2085
|
+
...data.body === void 0 ? {} : { body: data.body },
|
|
2086
|
+
...[...controlHeaders].length === 0 ? {} : { headers: controlHeaders },
|
|
2087
|
+
signal: timeout.signal,
|
|
2088
|
+
...spec.binary ? { parseAs: "arrayBuffer" } : {}
|
|
2089
|
+
});
|
|
2090
|
+
if (result.error !== void 0) throw ApiError.unexpected(`ProxyRequest returned an undocumented error for ${spec.operationId}.`, result.error);
|
|
2091
|
+
const dataValue = spec.binary ? binaryResult(spec, result.data, result.response.headers) : result.data;
|
|
2092
|
+
const headers = headersToRecord(result.response.headers);
|
|
2093
|
+
const etag = headers.etag;
|
|
2094
|
+
return {
|
|
2095
|
+
data: dataValue,
|
|
2096
|
+
statusCode: result.response.status,
|
|
2097
|
+
headers,
|
|
2098
|
+
...etag === void 0 ? {} : { etag },
|
|
2099
|
+
idempotencyReplayed: headers["idempotency-replayed"]?.toLowerCase() === "true"
|
|
2100
|
+
};
|
|
2101
|
+
} catch (error) {
|
|
2102
|
+
const apiError = (error instanceof ApiError ? error : ApiError.unexpected(`Unable to process the ProxyRequest response for ${spec.operationId}.`, error)).withIdempotencyKey(idempotencyKey);
|
|
2103
|
+
const delay = retryDelay(apiError, attempt);
|
|
2104
|
+
if (attempt >= 2 || idempotencyKey === void 0 || controls.signal?.aborted || delay === void 0) throw apiError;
|
|
2105
|
+
await wait(delay, controls.signal);
|
|
2106
|
+
} finally {
|
|
2107
|
+
timeout.cleanup();
|
|
1702
2108
|
}
|
|
1703
|
-
return result.data;
|
|
1704
|
-
} catch (error) {
|
|
1705
|
-
if (error instanceof ApiError) throw error;
|
|
1706
|
-
throw ApiError.unexpected(`Unable to process the ProxyRequest response for ${spec.operationId}.`, error);
|
|
1707
|
-
} finally {
|
|
1708
|
-
timeout.cleanup();
|
|
1709
2109
|
}
|
|
2110
|
+
throw ApiError.unexpected(`Unable to complete ${spec.operationId}.`);
|
|
1710
2111
|
}
|
|
1711
2112
|
async request(method, path, options = {}) {
|
|
1712
2113
|
const url = new URL(path.replace(/^\//u, ""), `${this.baseUrl}/`);
|
|
@@ -1781,40 +2182,63 @@ function appendQuery(search, query) {
|
|
|
1781
2182
|
function isBodyInit(value) {
|
|
1782
2183
|
return typeof value === "string" || value instanceof Blob || value instanceof ArrayBuffer || ArrayBuffer.isView(value) || value instanceof FormData || value instanceof URLSearchParams || value instanceof ReadableStream;
|
|
1783
2184
|
}
|
|
2185
|
+
function stringHeader(value) {
|
|
2186
|
+
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
2187
|
+
}
|
|
2188
|
+
function newIdempotencyKey() {
|
|
2189
|
+
if (typeof globalThis.crypto?.randomUUID !== "function") throw new Error("crypto.randomUUID() is required for automatic idempotency keys.");
|
|
2190
|
+
return globalThis.crypto.randomUUID();
|
|
2191
|
+
}
|
|
2192
|
+
function binaryResult(spec, data, headers) {
|
|
2193
|
+
if (!(data instanceof ArrayBuffer)) throw ApiError.unexpected(`ProxyRequest returned an invalid file for ${spec.operationId}.`);
|
|
2194
|
+
return FileDownload.fromResponse(data, headers);
|
|
2195
|
+
}
|
|
2196
|
+
function headersToRecord(headers) {
|
|
2197
|
+
return Object.freeze(Object.fromEntries(headers.entries()));
|
|
2198
|
+
}
|
|
2199
|
+
function retryDelay(error, attempt) {
|
|
2200
|
+
if (error.kind === "network") return attempt === 0 ? 100 : 200;
|
|
2201
|
+
if (error.statusCode === 409 && error.retryAfter !== void 0 && error.retryAfter >= 0 && error.retryAfter <= 5) return error.retryAfter * 1e3;
|
|
2202
|
+
}
|
|
2203
|
+
function wait(milliseconds, signal) {
|
|
2204
|
+
if (signal?.aborted) return Promise.reject(ApiError.network(signal.reason));
|
|
2205
|
+
return new Promise((resolvePromise, reject) => {
|
|
2206
|
+
const timer = setTimeout(() => {
|
|
2207
|
+
signal?.removeEventListener("abort", abort);
|
|
2208
|
+
resolvePromise();
|
|
2209
|
+
}, milliseconds);
|
|
2210
|
+
const abort = () => {
|
|
2211
|
+
clearTimeout(timer);
|
|
2212
|
+
reject(ApiError.network(signal?.reason));
|
|
2213
|
+
};
|
|
2214
|
+
signal?.addEventListener("abort", abort, { once: true });
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
1784
2217
|
|
|
1785
2218
|
//#endregion
|
|
1786
2219
|
//#region src/webhooks.ts
|
|
1787
2220
|
const encoder = new TextEncoder();
|
|
1788
2221
|
var WebhookVerifier = class WebhookVerifier {
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
if (!signature || !secret
|
|
1792
|
-
const
|
|
1793
|
-
if (
|
|
1794
|
-
if (options.timestampHeader !== void 0) {
|
|
1795
|
-
const timestampHeader = options.timestampHeader.trim();
|
|
1796
|
-
if (!/^\d+$/u.test(timestampHeader) || Number(timestampHeader) !== parsed.timestamp) return false;
|
|
1797
|
-
}
|
|
1798
|
-
const now = options.now ?? Math.floor(Date.now() / 1e3);
|
|
1799
|
-
if (tolerance !== null && Math.abs(now - parsed.timestamp) > tolerance) return false;
|
|
1800
|
-
const body = bodyBytes(rawBody);
|
|
1801
|
-
const payload = concatBytes(encoder.encode(`${parsed.timestamp}.`), body);
|
|
2222
|
+
/** Verify X-Signature against the exact raw request body. */
|
|
2223
|
+
static async verify(rawBody, signature, secret) {
|
|
2224
|
+
if (!signature || !secret) return false;
|
|
2225
|
+
const candidate = parseBase64Signature(signature);
|
|
2226
|
+
if (candidate === void 0) return false;
|
|
1802
2227
|
try {
|
|
1803
2228
|
const key = await globalThis.crypto.subtle.importKey("raw", encoder.encode(secret), {
|
|
1804
2229
|
name: "HMAC",
|
|
1805
2230
|
hash: "SHA-256"
|
|
1806
|
-
}, false, ["
|
|
1807
|
-
|
|
1808
|
-
return parsed.signatures.some((candidate) => constantTimeHexEqual(expected, candidate));
|
|
2231
|
+
}, false, ["verify"]);
|
|
2232
|
+
return globalThis.crypto.subtle.verify("HMAC", key, candidate.slice().buffer, bodyBytes(rawBody).slice().buffer);
|
|
1809
2233
|
} catch {
|
|
1810
2234
|
return false;
|
|
1811
2235
|
}
|
|
1812
2236
|
}
|
|
1813
|
-
static async verifyOrThrow(rawBody, signature, secret
|
|
1814
|
-
if (!await WebhookVerifier.verify(rawBody, signature, secret
|
|
2237
|
+
static async verifyOrThrow(rawBody, signature, secret) {
|
|
2238
|
+
if (!await WebhookVerifier.verify(rawBody, signature, secret)) throw new InvalidSignatureError("The ProxyRequest webhook signature is invalid.");
|
|
1815
2239
|
}
|
|
1816
|
-
static async decodeVerifiedJson(rawBody, signature, secret
|
|
1817
|
-
await WebhookVerifier.verifyOrThrow(rawBody, signature, secret
|
|
2240
|
+
static async decodeVerifiedJson(rawBody, signature, secret) {
|
|
2241
|
+
await WebhookVerifier.verifyOrThrow(rawBody, signature, secret);
|
|
1818
2242
|
const text = typeof rawBody === "string" ? rawBody : new TextDecoder().decode(bodyBytes(rawBody));
|
|
1819
2243
|
try {
|
|
1820
2244
|
const payload = JSON.parse(text);
|
|
@@ -1826,38 +2250,15 @@ var WebhookVerifier = class WebhookVerifier {
|
|
|
1826
2250
|
}
|
|
1827
2251
|
}
|
|
1828
2252
|
};
|
|
1829
|
-
function parseSignature(signature) {
|
|
1830
|
-
let timestamp;
|
|
1831
|
-
const signatures = [];
|
|
1832
|
-
for (const part of signature.split(",")) {
|
|
1833
|
-
const [key, value] = part.trim().split("=", 2);
|
|
1834
|
-
if (key === "t" && value !== void 0 && /^\d+$/u.test(value)) timestamp = Number(value);
|
|
1835
|
-
if (key === "v1" && value !== void 0 && /^[a-f\d]{64}$/iu.test(value)) signatures.push(value.toLowerCase());
|
|
1836
|
-
}
|
|
1837
|
-
if (timestamp === void 0 || !Number.isSafeInteger(timestamp) || signatures.length === 0) return;
|
|
1838
|
-
return {
|
|
1839
|
-
timestamp,
|
|
1840
|
-
signatures
|
|
1841
|
-
};
|
|
1842
|
-
}
|
|
1843
2253
|
function bodyBytes(value) {
|
|
1844
2254
|
if (typeof value === "string") return encoder.encode(value);
|
|
1845
2255
|
return value instanceof Uint8Array ? value : new Uint8Array(value);
|
|
1846
2256
|
}
|
|
1847
|
-
function
|
|
1848
|
-
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
return
|
|
1852
|
-
}
|
|
1853
|
-
function constantTimeHexEqual(expected, candidate) {
|
|
1854
|
-
if (!/^[a-f\d]+$/iu.test(candidate) || candidate.length !== expected.byteLength * 2) return false;
|
|
1855
|
-
let difference = 0;
|
|
1856
|
-
for (let index = 0; index < expected.byteLength; index += 1) {
|
|
1857
|
-
const byte = Number.parseInt(candidate.slice(index * 2, index * 2 + 2), 16);
|
|
1858
|
-
difference |= (expected[index] ?? 0) ^ byte;
|
|
1859
|
-
}
|
|
1860
|
-
return difference === 0;
|
|
2257
|
+
function parseBase64Signature(signature) {
|
|
2258
|
+
if (!/^[A-Za-z0-9+/]{43}=$/u.test(signature)) return void 0;
|
|
2259
|
+
const decoded = atob(signature);
|
|
2260
|
+
if (decoded.length !== 32 || btoa(decoded) !== signature) return void 0;
|
|
2261
|
+
return Uint8Array.from(decoded, (character) => character.charCodeAt(0));
|
|
1861
2262
|
}
|
|
1862
2263
|
|
|
1863
2264
|
//#endregion
|
|
@@ -1883,10 +2284,8 @@ exports.ProxyRequestClient = ProxyRequestClient;
|
|
|
1883
2284
|
exports.ProxyRequestError = ProxyRequestError;
|
|
1884
2285
|
exports.RewardsResource = RewardsResource;
|
|
1885
2286
|
exports.SDK_VERSION = SDK_VERSION;
|
|
1886
|
-
exports.SessionsResource = SessionsResource;
|
|
1887
2287
|
exports.SettingsResource = SettingsResource;
|
|
1888
2288
|
exports.TelegramDashboardResource = TelegramDashboardResource;
|
|
1889
|
-
exports.TelegramServiceResource = TelegramServiceResource;
|
|
1890
2289
|
exports.UsersResource = UsersResource;
|
|
1891
2290
|
exports.WebhookVerifier = WebhookVerifier;
|
|
1892
2291
|
exports.WebhooksResource = WebhooksResource;
|