@ofauth/onlyfans-sdk 2.2.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -10,6 +10,11 @@ var OFAuthAPIError = class extends Error {
10
10
  this.response = response;
11
11
  }
12
12
  };
13
+ function isJsonContentType(contentType) {
14
+ if (!contentType) return false;
15
+ const lower = contentType.toLowerCase();
16
+ return lower.includes("application/json") || lower.includes("+json");
17
+ }
13
18
  function buildQueryString(params) {
14
19
  const entries = [];
15
20
  for (const [key, value] of Object.entries(params)) {
@@ -24,6 +29,26 @@ function buildQueryString(params) {
24
29
  }
25
30
  return entries.length > 0 ? `?${entries.join("&")}` : "";
26
31
  }
32
+ async function readErrorBody(response) {
33
+ const contentType = response.headers.get("content-type");
34
+ if (isJsonContentType(contentType)) {
35
+ const json = await response.json();
36
+ const obj = typeof json === "object" && json !== null ? json : null;
37
+ return {
38
+ message: typeof obj?.message === "string" ? obj.message : void 0,
39
+ code: typeof obj?.code === "string" ? obj.code : void 0,
40
+ details: obj?.details
41
+ };
42
+ }
43
+ return await response.text();
44
+ }
45
+ async function readSuccessBody(response) {
46
+ const contentType = response.headers.get("content-type");
47
+ if (isJsonContentType(contentType)) {
48
+ return await response.json();
49
+ }
50
+ return await response.text();
51
+ }
27
52
  async function request(config, reqConfig) {
28
53
  const fetchFn = config.fetchApi || fetch;
29
54
  const basePath = config.basePath || BASE_PATH;
@@ -45,19 +70,16 @@ async function request(config, reqConfig) {
45
70
  body: reqConfig.body instanceof FormData || reqConfig.body instanceof Blob ? reqConfig.body : reqConfig.body ? JSON.stringify(reqConfig.body) : void 0
46
71
  });
47
72
  if (!response.ok) {
48
- let errorBody;
49
- try {
50
- errorBody = await response.json();
51
- } catch {
52
- }
53
- throw new OFAuthAPIError(response, errorBody);
54
- }
55
- const contentType = response.headers.get("content-type");
56
- if (contentType?.includes("application/json")) {
57
- return response.json();
73
+ const body = await readErrorBody(response);
74
+ const obj = typeof body === "object" && body !== null ? body : void 0;
75
+ throw new OFAuthAPIError(response, {
76
+ message: (typeof obj?.message === "string" ? obj.message : void 0) ?? (typeof body === "string" ? body : void 0),
77
+ code: typeof obj?.code === "string" ? obj.code : void 0,
78
+ details: obj?.details
79
+ });
58
80
  }
59
81
  if (response.status === 204) return {};
60
- return response.text();
82
+ return await readSuccessBody(response);
61
83
  }
62
84
  async function proxy(config, opts) {
63
85
  const fetchFn = config.fetchApi || fetch;
@@ -91,19 +113,16 @@ async function proxy(config, opts) {
91
113
  body: opts.body instanceof FormData || opts.body instanceof Blob ? opts.body : opts.body ? JSON.stringify(opts.body) : void 0
92
114
  });
93
115
  if (!response.ok) {
94
- let errorBody;
95
- try {
96
- errorBody = await response.json();
97
- } catch {
98
- }
99
- throw new OFAuthAPIError(response, errorBody);
100
- }
101
- const contentType = response.headers.get("content-type");
102
- if (contentType?.includes("application/json")) {
103
- return response.json();
116
+ const body = await readErrorBody(response);
117
+ const obj = typeof body === "object" && body !== null ? body : void 0;
118
+ throw new OFAuthAPIError(response, {
119
+ message: (typeof obj?.message === "string" ? obj.message : void 0) ?? (typeof body === "string" ? body : void 0),
120
+ code: typeof obj?.code === "string" ? obj.code : void 0,
121
+ details: obj?.details
122
+ });
104
123
  }
105
124
  if (response.status === 204) return {};
106
- return response.text();
125
+ return await readSuccessBody(response);
107
126
  }
108
127
 
109
128
  // src/client.ts
@@ -137,9 +156,9 @@ var AccountConnectionsNamespace = class {
137
156
  }
138
157
  /**
139
158
  * List connections
140
- *
141
- * Returns an async iterator that automatically paginates through all results.
142
- */
159
+ *
160
+ * Returns an async iterator that automatically paginates through all results.
161
+ */
143
162
  async *iterate(params) {
144
163
  let offset = 0;
145
164
  let fetched = 0;
@@ -157,7 +176,8 @@ var AccountConnectionsNamespace = class {
157
176
  fetched++;
158
177
  }
159
178
  if (!response.hasMore) return;
160
- offset = response.nextOffset ?? offset + response.list.length;
179
+ const nextOffset = response.nextOffset;
180
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
161
181
  }
162
182
  }
163
183
  /**
@@ -283,9 +303,9 @@ var AccessSelfNamespace = class {
283
303
  }
284
304
  /**
285
305
  * List notifications
286
- *
287
- * Returns an async iterator that automatically paginates through all results.
288
- */
306
+ *
307
+ * Returns an async iterator that automatically paginates through all results.
308
+ */
289
309
  async *iterateNotifications(params) {
290
310
  let offset = 0;
291
311
  let fetched = 0;
@@ -303,7 +323,8 @@ var AccessSelfNamespace = class {
303
323
  fetched++;
304
324
  }
305
325
  if (!response.hasMore) return;
306
- offset = response.nextOffset ?? offset + response.list.length;
326
+ const nextOffset = response.nextOffset;
327
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
307
328
  }
308
329
  }
309
330
  /**
@@ -325,9 +346,9 @@ var AccessSelfNamespace = class {
325
346
  }
326
347
  /**
327
348
  * List release forms
328
- *
329
- * Returns an async iterator that automatically paginates through all results.
330
- */
349
+ *
350
+ * Returns an async iterator that automatically paginates through all results.
351
+ */
331
352
  async *iterateReleaseForms(params) {
332
353
  let offset = 0;
333
354
  let fetched = 0;
@@ -345,7 +366,8 @@ var AccessSelfNamespace = class {
345
366
  fetched++;
346
367
  }
347
368
  if (!response.hasMore) return;
348
- offset = response.nextOffset ?? offset + response.list.length;
369
+ const nextOffset = response.nextOffset;
370
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
349
371
  }
350
372
  }
351
373
  /**
@@ -367,9 +389,9 @@ var AccessSelfNamespace = class {
367
389
  }
368
390
  /**
369
391
  * List tagged friend users
370
- *
371
- * Returns an async iterator that automatically paginates through all results.
372
- */
392
+ *
393
+ * Returns an async iterator that automatically paginates through all results.
394
+ */
373
395
  async *iterateTaggedFriendUsers(params) {
374
396
  let offset = 0;
375
397
  let fetched = 0;
@@ -387,7 +409,8 @@ var AccessSelfNamespace = class {
387
409
  fetched++;
388
410
  }
389
411
  if (!response.hasMore) return;
390
- offset = response.nextOffset ?? offset + response.list.length;
412
+ const nextOffset = response.nextOffset;
413
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
391
414
  }
392
415
  }
393
416
  };
@@ -428,9 +451,9 @@ var AccessEarningsNamespace = class {
428
451
  }
429
452
  /**
430
453
  * List transactions
431
- *
432
- * Returns an async iterator that automatically paginates through all results.
433
- */
454
+ *
455
+ * Returns an async iterator that automatically paginates through all results.
456
+ */
434
457
  async *iterateTransactions(params) {
435
458
  let marker;
436
459
  let fetched = 0;
@@ -446,7 +469,7 @@ var AccessEarningsNamespace = class {
446
469
  fetched++;
447
470
  }
448
471
  if (!response.hasMore) return;
449
- marker = response.marker;
472
+ marker = response.nextMarker == null ? void 0 : String(response.nextMarker);
450
473
  }
451
474
  }
452
475
  /**
@@ -457,28 +480,25 @@ var AccessEarningsNamespace = class {
457
480
  path: "/v2/access/earnings/chargebacks",
458
481
  method: "GET",
459
482
  query: {
460
- "limit": params.limit,
461
- "offset": params.offset,
462
483
  "startDate": params.startDate,
463
- "endDate": params.endDate
484
+ "endDate": params.endDate,
485
+ "marker": params.marker
464
486
  }
465
487
  });
466
488
  }
467
489
  /**
468
490
  * List chargebacks
469
- *
470
- * Returns an async iterator that automatically paginates through all results.
471
- */
491
+ *
492
+ * Returns an async iterator that automatically paginates through all results.
493
+ */
472
494
  async *iterateChargebacks(params) {
473
- let offset = 0;
495
+ let marker;
474
496
  let fetched = 0;
475
- const limit = params?.pageSize ?? 20;
476
497
  const maxItems = params?.maxItems ?? Infinity;
477
498
  while (fetched < maxItems) {
478
499
  const response = await this.listChargebacks({
479
500
  ...params,
480
- limit: Math.min(limit, maxItems - fetched),
481
- offset
501
+ marker
482
502
  });
483
503
  for (const item of response.list) {
484
504
  if (fetched >= maxItems) return;
@@ -486,7 +506,7 @@ var AccessEarningsNamespace = class {
486
506
  fetched++;
487
507
  }
488
508
  if (!response.hasMore) return;
489
- offset = response.nextOffset ?? offset + response.list.length;
509
+ marker = response.nextMarker == null ? void 0 : String(response.nextMarker);
490
510
  }
491
511
  }
492
512
  };
@@ -625,6 +645,20 @@ var AccessAnalyticsMassMessagesNamespace = class {
625
645
  }
626
646
  });
627
647
  }
648
+ /**
649
+ * Sent mass messages
650
+ */
651
+ getSent(params) {
652
+ return request(this._config, {
653
+ path: "/v2/access/analytics/mass-messages/sent",
654
+ method: "GET",
655
+ query: {
656
+ "startDate": params.startDate,
657
+ "endDate": params.endDate,
658
+ "limit": params.limit
659
+ }
660
+ });
661
+ }
628
662
  /**
629
663
  * Mass messages purchased
630
664
  */
@@ -654,9 +688,9 @@ var AccessAnalyticsMassMessagesNamespace = class {
654
688
  }
655
689
  /**
656
690
  * Mass message buyers
657
- *
658
- * Returns an async iterator that automatically paginates through all results.
659
- */
691
+ *
692
+ * Returns an async iterator that automatically paginates through all results.
693
+ */
660
694
  async *iterateBuyers(params) {
661
695
  let marker;
662
696
  let fetched = 0;
@@ -672,7 +706,7 @@ var AccessAnalyticsMassMessagesNamespace = class {
672
706
  fetched++;
673
707
  }
674
708
  if (!response.hasMore) return;
675
- marker = response.marker;
709
+ marker = response.nextMarker == null ? void 0 : String(response.nextMarker);
676
710
  }
677
711
  }
678
712
  };
@@ -779,9 +813,9 @@ var AccessAnalyticsCampaignsNamespace = class {
779
813
  }
780
814
  /**
781
815
  * Top campaigns
782
- *
783
- * Returns an async iterator that automatically paginates through all results.
784
- */
816
+ *
817
+ * Returns an async iterator that automatically paginates through all results.
818
+ */
785
819
  async *iterateTop(params) {
786
820
  let offset = 0;
787
821
  let fetched = 0;
@@ -799,7 +833,8 @@ var AccessAnalyticsCampaignsNamespace = class {
799
833
  fetched++;
800
834
  }
801
835
  if (!response.hasMore) return;
802
- offset = response.nextOffset ?? offset + response.list.length;
836
+ const nextOffset = response.nextOffset;
837
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
803
838
  }
804
839
  }
805
840
  };
@@ -869,9 +904,9 @@ var AccessUsersListsNamespace = class {
869
904
  }
870
905
  /**
871
906
  * List user lists
872
- *
873
- * Returns an async iterator that automatically paginates through all results.
874
- */
907
+ *
908
+ * Returns an async iterator that automatically paginates through all results.
909
+ */
875
910
  async *iterate(params) {
876
911
  let offset = 0;
877
912
  let fetched = 0;
@@ -889,7 +924,8 @@ var AccessUsersListsNamespace = class {
889
924
  fetched++;
890
925
  }
891
926
  if (!response.hasMore) return;
892
- offset = response.nextOffset ?? offset + response.list.length;
927
+ const nextOffset = response.nextOffset;
928
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
893
929
  }
894
930
  }
895
931
  /**
@@ -955,9 +991,9 @@ var AccessUsersListsNamespace = class {
955
991
  }
956
992
  /**
957
993
  * List users in user list
958
- *
959
- * Returns an async iterator that automatically paginates through all results.
960
- */
994
+ *
995
+ * Returns an async iterator that automatically paginates through all results.
996
+ */
961
997
  async *iterateUsers(params) {
962
998
  let offset = 0;
963
999
  let fetched = 0;
@@ -975,7 +1011,8 @@ var AccessUsersListsNamespace = class {
975
1011
  fetched++;
976
1012
  }
977
1013
  if (!response.hasMore) return;
978
- offset = response.nextOffset ?? offset + response.list.length;
1014
+ const nextOffset = response.nextOffset;
1015
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
979
1016
  }
980
1017
  }
981
1018
  /**
@@ -1043,9 +1080,9 @@ var AccessUsersNamespace = class {
1043
1080
  }
1044
1081
  /**
1045
1082
  * List restricted users
1046
- *
1047
- * Returns an async iterator that automatically paginates through all results.
1048
- */
1083
+ *
1084
+ * Returns an async iterator that automatically paginates through all results.
1085
+ */
1049
1086
  async *iterateRestrict(params) {
1050
1087
  let offset = 0;
1051
1088
  let fetched = 0;
@@ -1063,7 +1100,8 @@ var AccessUsersNamespace = class {
1063
1100
  fetched++;
1064
1101
  }
1065
1102
  if (!response.hasMore) return;
1066
- offset = response.nextOffset ?? offset + response.list.length;
1103
+ const nextOffset = response.nextOffset;
1104
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1067
1105
  }
1068
1106
  }
1069
1107
  /**
@@ -1099,9 +1137,9 @@ var AccessUsersNamespace = class {
1099
1137
  }
1100
1138
  /**
1101
1139
  * List blocked users
1102
- *
1103
- * Returns an async iterator that automatically paginates through all results.
1104
- */
1140
+ *
1141
+ * Returns an async iterator that automatically paginates through all results.
1142
+ */
1105
1143
  async *iterateBlocked(params) {
1106
1144
  let offset = 0;
1107
1145
  let fetched = 0;
@@ -1119,7 +1157,8 @@ var AccessUsersNamespace = class {
1119
1157
  fetched++;
1120
1158
  }
1121
1159
  if (!response.hasMore) return;
1122
- offset = response.nextOffset ?? offset + response.list.length;
1160
+ const nextOffset = response.nextOffset;
1161
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1123
1162
  }
1124
1163
  }
1125
1164
  /**
@@ -1172,9 +1211,9 @@ var AccessChatsNamespace = class {
1172
1211
  }
1173
1212
  /**
1174
1213
  * Chats list
1175
- *
1176
- * Returns an async iterator that automatically paginates through all results.
1177
- */
1214
+ *
1215
+ * Returns an async iterator that automatically paginates through all results.
1216
+ */
1178
1217
  async *iterate(params) {
1179
1218
  let offset = 0;
1180
1219
  let fetched = 0;
@@ -1192,7 +1231,8 @@ var AccessChatsNamespace = class {
1192
1231
  fetched++;
1193
1232
  }
1194
1233
  if (!response.hasMore) return;
1195
- offset = response.nextOffset ?? offset + response.list.length;
1234
+ const nextOffset = response.nextOffset;
1235
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1196
1236
  }
1197
1237
  }
1198
1238
  /**
@@ -1205,15 +1245,18 @@ var AccessChatsNamespace = class {
1205
1245
  query: {
1206
1246
  "limit": params.limit,
1207
1247
  "offset": params.offset,
1208
- "query": params.query
1248
+ "query": params.query,
1249
+ "last_id": params.lastId,
1250
+ "first_id": params.firstId,
1251
+ "include_users": params.includeUsers
1209
1252
  }
1210
1253
  });
1211
1254
  }
1212
1255
  /**
1213
1256
  * Chat messages
1214
- *
1215
- * Returns an async iterator that automatically paginates through all results.
1216
- */
1257
+ *
1258
+ * Returns an async iterator that automatically paginates through all results.
1259
+ */
1217
1260
  async *iterateMessages(params) {
1218
1261
  let offset = 0;
1219
1262
  let fetched = 0;
@@ -1231,7 +1274,8 @@ var AccessChatsNamespace = class {
1231
1274
  fetched++;
1232
1275
  }
1233
1276
  if (!response.hasMore) return;
1234
- offset = response.nextOffset ?? offset + response.list.length;
1277
+ const nextOffset = response.nextOffset;
1278
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1235
1279
  }
1236
1280
  }
1237
1281
  /**
@@ -1273,9 +1317,9 @@ var AccessChatsNamespace = class {
1273
1317
  }
1274
1318
  /**
1275
1319
  * Get chat media
1276
- *
1277
- * Returns an async iterator that automatically paginates through all results.
1278
- */
1320
+ *
1321
+ * Returns an async iterator that automatically paginates through all results.
1322
+ */
1279
1323
  async *iterateMedia(params) {
1280
1324
  let offset = 0;
1281
1325
  let fetched = 0;
@@ -1293,7 +1337,8 @@ var AccessChatsNamespace = class {
1293
1337
  fetched++;
1294
1338
  }
1295
1339
  if (!response.hasMore) return;
1296
- offset = response.nextOffset ?? offset + response.list.length;
1340
+ const nextOffset = response.nextOffset;
1341
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1297
1342
  }
1298
1343
  }
1299
1344
  };
@@ -1322,9 +1367,9 @@ var AccessSubscribersNamespace = class {
1322
1367
  }
1323
1368
  /**
1324
1369
  * List subscribers
1325
- *
1326
- * Returns an async iterator that automatically paginates through all results.
1327
- */
1370
+ *
1371
+ * Returns an async iterator that automatically paginates through all results.
1372
+ */
1328
1373
  async *iterate(params) {
1329
1374
  let offset = 0;
1330
1375
  let fetched = 0;
@@ -1342,7 +1387,8 @@ var AccessSubscribersNamespace = class {
1342
1387
  fetched++;
1343
1388
  }
1344
1389
  if (!response.hasMore) return;
1345
- offset = response.nextOffset ?? offset + response.list.length;
1390
+ const nextOffset = response.nextOffset;
1391
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1346
1392
  }
1347
1393
  }
1348
1394
  /**
@@ -1398,9 +1444,9 @@ var AccessSubscriptionsNamespace = class {
1398
1444
  }
1399
1445
  /**
1400
1446
  * List subscriptions
1401
- *
1402
- * Returns an async iterator that automatically paginates through all results.
1403
- */
1447
+ *
1448
+ * Returns an async iterator that automatically paginates through all results.
1449
+ */
1404
1450
  async *iterate(params) {
1405
1451
  let offset = 0;
1406
1452
  let fetched = 0;
@@ -1418,18 +1464,10 @@ var AccessSubscriptionsNamespace = class {
1418
1464
  fetched++;
1419
1465
  }
1420
1466
  if (!response.hasMore) return;
1421
- offset = response.nextOffset ?? offset + response.list.length;
1467
+ const nextOffset = response.nextOffset;
1468
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1422
1469
  }
1423
1470
  }
1424
- /**
1425
- * Get subscription
1426
- */
1427
- get(params) {
1428
- return request(this._config, {
1429
- path: `/v2/access/subscriptions/${encodeURIComponent(String(params.subscriptionId))}`,
1430
- method: "GET"
1431
- });
1432
- }
1433
1471
  /**
1434
1472
  * Get subscription counts
1435
1473
  */
@@ -1475,9 +1513,9 @@ var AccessPromotionsTrackingLinksNamespace = class {
1475
1513
  }
1476
1514
  /**
1477
1515
  * List tracking links
1478
- *
1479
- * Returns an async iterator that automatically paginates through all results.
1480
- */
1516
+ *
1517
+ * Returns an async iterator that automatically paginates through all results.
1518
+ */
1481
1519
  async *iterate(params) {
1482
1520
  let offset = 0;
1483
1521
  let fetched = 0;
@@ -1495,7 +1533,8 @@ var AccessPromotionsTrackingLinksNamespace = class {
1495
1533
  fetched++;
1496
1534
  }
1497
1535
  if (!response.hasMore) return;
1498
- offset = response.nextOffset ?? offset + response.list.length;
1536
+ const nextOffset = response.nextOffset;
1537
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1499
1538
  }
1500
1539
  }
1501
1540
  /**
@@ -1671,15 +1710,6 @@ var AccessPromotionsNamespace = class {
1671
1710
  body: params.body
1672
1711
  });
1673
1712
  }
1674
- /**
1675
- * Get promotion
1676
- */
1677
- get(params) {
1678
- return request(this._config, {
1679
- path: `/v2/access/promotions/${encodeURIComponent(String(params.promotionId))}`,
1680
- method: "GET"
1681
- });
1682
- }
1683
1713
  /**
1684
1714
  * Update promotion
1685
1715
  */
@@ -1751,11 +1781,11 @@ var AccessPromotionsNamespace = class {
1751
1781
  });
1752
1782
  }
1753
1783
  /**
1754
- * Finish promotion
1784
+ * Stop promotion
1755
1785
  */
1756
- finish(params) {
1786
+ createStop(params) {
1757
1787
  return request(this._config, {
1758
- path: `/v2/access/promotions/${encodeURIComponent(String(params.promotionId))}/finish`,
1788
+ path: `/v2/access/promotions/${encodeURIComponent(String(params.promotionId))}/stop`,
1759
1789
  method: "POST"
1760
1790
  });
1761
1791
  }
@@ -1780,9 +1810,9 @@ var AccessVaultListsNamespace = class {
1780
1810
  }
1781
1811
  /**
1782
1812
  * List vault folders
1783
- *
1784
- * Returns an async iterator that automatically paginates through all results.
1785
- */
1813
+ *
1814
+ * Returns an async iterator that automatically paginates through all results.
1815
+ */
1786
1816
  async *iterate(params) {
1787
1817
  let offset = 0;
1788
1818
  let fetched = 0;
@@ -1800,7 +1830,8 @@ var AccessVaultListsNamespace = class {
1800
1830
  fetched++;
1801
1831
  }
1802
1832
  if (!response.hasMore) return;
1803
- offset = response.nextOffset ?? offset + response.list.length;
1833
+ const nextOffset = response.nextOffset;
1834
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1804
1835
  }
1805
1836
  }
1806
1837
  /**
@@ -1851,9 +1882,9 @@ var AccessVaultListsNamespace = class {
1851
1882
  }
1852
1883
  /**
1853
1884
  * List media in vault list
1854
- *
1855
- * Returns an async iterator that automatically paginates through all results.
1856
- */
1885
+ *
1886
+ * Returns an async iterator that automatically paginates through all results.
1887
+ */
1857
1888
  async *iterateMedia(params) {
1858
1889
  let offset = 0;
1859
1890
  let fetched = 0;
@@ -1871,7 +1902,8 @@ var AccessVaultListsNamespace = class {
1871
1902
  fetched++;
1872
1903
  }
1873
1904
  if (!response.hasMore) return;
1874
- offset = response.nextOffset ?? offset + response.list.length;
1905
+ const nextOffset = response.nextOffset;
1906
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1875
1907
  }
1876
1908
  }
1877
1909
  /**
@@ -1910,9 +1942,9 @@ var AccessVaultNamespace = class {
1910
1942
  }
1911
1943
  /**
1912
1944
  * List vault media
1913
- *
1914
- * Returns an async iterator that automatically paginates through all results.
1915
- */
1945
+ *
1946
+ * Returns an async iterator that automatically paginates through all results.
1947
+ */
1916
1948
  async *iterateMedia(params) {
1917
1949
  let offset = 0;
1918
1950
  let fetched = 0;
@@ -1930,7 +1962,8 @@ var AccessVaultNamespace = class {
1930
1962
  fetched++;
1931
1963
  }
1932
1964
  if (!response.hasMore) return;
1933
- offset = response.nextOffset ?? offset + response.list.length;
1965
+ const nextOffset = response.nextOffset;
1966
+ offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
1934
1967
  }
1935
1968
  }
1936
1969
  };
@@ -2056,45 +2089,6 @@ var AccessNamespace = class {
2056
2089
  method: "DELETE"
2057
2090
  });
2058
2091
  }
2059
- /**
2060
- * List mass messages
2061
- */
2062
- listMassMessages(params) {
2063
- return request(this._config, {
2064
- path: "/v2/access/mass-messages",
2065
- method: "GET",
2066
- query: {
2067
- "limit": params.limit,
2068
- "offset": params.offset,
2069
- "type": params.type
2070
- }
2071
- });
2072
- }
2073
- /**
2074
- * List mass messages
2075
- *
2076
- * Returns an async iterator that automatically paginates through all results.
2077
- */
2078
- async *iterateMassMessages(params) {
2079
- let offset = 0;
2080
- let fetched = 0;
2081
- const limit = params?.pageSize ?? 20;
2082
- const maxItems = params?.maxItems ?? Infinity;
2083
- while (fetched < maxItems) {
2084
- const response = await this.listMassMessages({
2085
- ...params,
2086
- limit: Math.min(limit, maxItems - fetched),
2087
- offset
2088
- });
2089
- for (const item of response.list) {
2090
- if (fetched >= maxItems) return;
2091
- yield item;
2092
- fetched++;
2093
- }
2094
- if (!response.hasMore) return;
2095
- offset = response.nextOffset ?? offset + response.list.length;
2096
- }
2097
- }
2098
2092
  /**
2099
2093
  * Create mass message
2100
2094
  */