@ofauth/onlyfans-sdk 2.2.3 → 2.3.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.d.mts +6151 -6009
- package/dist/index.d.ts +6151 -6009
- package/dist/index.js +1064 -948
- package/dist/index.mjs +1064 -948
- package/package.json +1 -1
- package/src/client.ts +6928 -6598
- package/src/runtime.ts +48 -19
- package/src/runtime.unit.test.ts +39 -0
package/dist/index.js
CHANGED
|
@@ -61,6 +61,11 @@ var OFAuthAPIError = class extends Error {
|
|
|
61
61
|
this.response = response;
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
+
function isJsonContentType(contentType) {
|
|
65
|
+
if (!contentType) return false;
|
|
66
|
+
const lower = contentType.toLowerCase();
|
|
67
|
+
return lower.includes("application/json") || lower.includes("+json");
|
|
68
|
+
}
|
|
64
69
|
function buildQueryString(params) {
|
|
65
70
|
const entries = [];
|
|
66
71
|
for (const [key, value] of Object.entries(params)) {
|
|
@@ -75,6 +80,26 @@ function buildQueryString(params) {
|
|
|
75
80
|
}
|
|
76
81
|
return entries.length > 0 ? `?${entries.join("&")}` : "";
|
|
77
82
|
}
|
|
83
|
+
async function readErrorBody(response) {
|
|
84
|
+
const contentType = response.headers.get("content-type");
|
|
85
|
+
if (isJsonContentType(contentType)) {
|
|
86
|
+
const json = await response.json();
|
|
87
|
+
const obj = typeof json === "object" && json !== null ? json : null;
|
|
88
|
+
return {
|
|
89
|
+
message: typeof obj?.message === "string" ? obj.message : void 0,
|
|
90
|
+
code: typeof obj?.code === "string" ? obj.code : void 0,
|
|
91
|
+
details: obj?.details
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return await response.text();
|
|
95
|
+
}
|
|
96
|
+
async function readSuccessBody(response) {
|
|
97
|
+
const contentType = response.headers.get("content-type");
|
|
98
|
+
if (isJsonContentType(contentType)) {
|
|
99
|
+
return await response.json();
|
|
100
|
+
}
|
|
101
|
+
return await response.text();
|
|
102
|
+
}
|
|
78
103
|
async function request(config, reqConfig) {
|
|
79
104
|
const fetchFn = config.fetchApi || fetch;
|
|
80
105
|
const basePath = config.basePath || BASE_PATH;
|
|
@@ -96,19 +121,16 @@ async function request(config, reqConfig) {
|
|
|
96
121
|
body: reqConfig.body instanceof FormData || reqConfig.body instanceof Blob ? reqConfig.body : reqConfig.body ? JSON.stringify(reqConfig.body) : void 0
|
|
97
122
|
});
|
|
98
123
|
if (!response.ok) {
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
const contentType = response.headers.get("content-type");
|
|
107
|
-
if (contentType?.includes("application/json")) {
|
|
108
|
-
return response.json();
|
|
124
|
+
const body = await readErrorBody(response);
|
|
125
|
+
const obj = typeof body === "object" && body !== null ? body : void 0;
|
|
126
|
+
throw new OFAuthAPIError(response, {
|
|
127
|
+
message: (typeof obj?.message === "string" ? obj.message : void 0) ?? (typeof body === "string" ? body : void 0),
|
|
128
|
+
code: typeof obj?.code === "string" ? obj.code : void 0,
|
|
129
|
+
details: obj?.details
|
|
130
|
+
});
|
|
109
131
|
}
|
|
110
132
|
if (response.status === 204) return {};
|
|
111
|
-
return response
|
|
133
|
+
return await readSuccessBody(response);
|
|
112
134
|
}
|
|
113
135
|
async function proxy(config, opts) {
|
|
114
136
|
const fetchFn = config.fetchApi || fetch;
|
|
@@ -142,62 +164,64 @@ async function proxy(config, opts) {
|
|
|
142
164
|
body: opts.body instanceof FormData || opts.body instanceof Blob ? opts.body : opts.body ? JSON.stringify(opts.body) : void 0
|
|
143
165
|
});
|
|
144
166
|
if (!response.ok) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
const contentType = response.headers.get("content-type");
|
|
153
|
-
if (contentType?.includes("application/json")) {
|
|
154
|
-
return response.json();
|
|
167
|
+
const body = await readErrorBody(response);
|
|
168
|
+
const obj = typeof body === "object" && body !== null ? body : void 0;
|
|
169
|
+
throw new OFAuthAPIError(response, {
|
|
170
|
+
message: (typeof obj?.message === "string" ? obj.message : void 0) ?? (typeof body === "string" ? body : void 0),
|
|
171
|
+
code: typeof obj?.code === "string" ? obj.code : void 0,
|
|
172
|
+
details: obj?.details
|
|
173
|
+
});
|
|
155
174
|
}
|
|
156
175
|
if (response.status === 204) return {};
|
|
157
|
-
return response
|
|
176
|
+
return await readSuccessBody(response);
|
|
158
177
|
}
|
|
159
178
|
|
|
160
179
|
// src/client.ts
|
|
161
|
-
var
|
|
180
|
+
var AccessAnalyticsCampaignsNamespace = class {
|
|
162
181
|
constructor(config) {
|
|
163
182
|
this._config = config;
|
|
164
183
|
}
|
|
165
184
|
/**
|
|
166
|
-
*
|
|
185
|
+
* Campaigns chart
|
|
167
186
|
*/
|
|
168
|
-
|
|
187
|
+
getChart(params) {
|
|
169
188
|
return request(this._config, {
|
|
170
|
-
path:
|
|
171
|
-
method: "
|
|
189
|
+
path: "/v2/access/analytics/campaigns/chart",
|
|
190
|
+
method: "GET",
|
|
191
|
+
query: {
|
|
192
|
+
"startDate": params.startDate,
|
|
193
|
+
"endDate": params.endDate,
|
|
194
|
+
"withTotal": params.withTotal
|
|
195
|
+
}
|
|
172
196
|
});
|
|
173
197
|
}
|
|
174
198
|
/**
|
|
175
|
-
*
|
|
199
|
+
* Top campaigns
|
|
176
200
|
*/
|
|
177
|
-
|
|
201
|
+
getTop(params) {
|
|
178
202
|
return request(this._config, {
|
|
179
|
-
path: "/v2/
|
|
203
|
+
path: "/v2/access/analytics/campaigns/top",
|
|
180
204
|
method: "GET",
|
|
181
205
|
query: {
|
|
182
|
-
"status": params.status,
|
|
183
|
-
"imported": params.imported,
|
|
184
206
|
"limit": params.limit,
|
|
185
|
-
"offset": params.offset
|
|
207
|
+
"offset": params.offset,
|
|
208
|
+
"startDate": params.startDate,
|
|
209
|
+
"endDate": params.endDate
|
|
186
210
|
}
|
|
187
211
|
});
|
|
188
212
|
}
|
|
189
213
|
/**
|
|
190
|
-
*
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
async *
|
|
214
|
+
* Top campaigns
|
|
215
|
+
*
|
|
216
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
217
|
+
*/
|
|
218
|
+
async *iterateTop(params) {
|
|
195
219
|
let offset = 0;
|
|
196
220
|
let fetched = 0;
|
|
197
221
|
const limit = params?.pageSize ?? 20;
|
|
198
222
|
const maxItems = params?.maxItems ?? Infinity;
|
|
199
223
|
while (fetched < maxItems) {
|
|
200
|
-
const response = await this.
|
|
224
|
+
const response = await this.getTop({
|
|
201
225
|
...params,
|
|
202
226
|
limit: Math.min(limit, maxItems - fetched),
|
|
203
227
|
offset
|
|
@@ -208,145 +232,42 @@ var AccountConnectionsNamespace = class {
|
|
|
208
232
|
fetched++;
|
|
209
233
|
}
|
|
210
234
|
if (!response.hasMore) return;
|
|
211
|
-
|
|
235
|
+
const nextOffset = response.nextOffset;
|
|
236
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
212
237
|
}
|
|
213
238
|
}
|
|
214
|
-
/**
|
|
215
|
-
* Invalidate connection
|
|
216
|
-
*/
|
|
217
|
-
invalidate(params) {
|
|
218
|
-
return request(this._config, {
|
|
219
|
-
path: `/v2/account/connections/${encodeURIComponent(String(params.connectionId))}/invalidate`,
|
|
220
|
-
method: "POST"
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Get connection settings
|
|
225
|
-
*/
|
|
226
|
-
getSettings(params) {
|
|
227
|
-
return request(this._config, {
|
|
228
|
-
path: `/v2/account/connections/${encodeURIComponent(String(params.connectionId))}/settings`,
|
|
229
|
-
method: "GET"
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Update connection settings
|
|
234
|
-
*/
|
|
235
|
-
updateSettings(params) {
|
|
236
|
-
return request(this._config, {
|
|
237
|
-
path: `/v2/account/connections/${encodeURIComponent(String(params.connectionId))}/settings`,
|
|
238
|
-
method: "PATCH",
|
|
239
|
-
body: params.body
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Import connection
|
|
244
|
-
*/
|
|
245
|
-
createImport(params) {
|
|
246
|
-
return request(this._config, {
|
|
247
|
-
path: "/v2/account/connections/import",
|
|
248
|
-
method: "POST",
|
|
249
|
-
body: params.body
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Update imported connection session
|
|
254
|
-
*/
|
|
255
|
-
updateImport(params) {
|
|
256
|
-
return request(this._config, {
|
|
257
|
-
path: `/v2/account/connections/import/${encodeURIComponent(String(params.connectionId))}`,
|
|
258
|
-
method: "PATCH",
|
|
259
|
-
body: params.body
|
|
260
|
-
});
|
|
261
|
-
}
|
|
262
|
-
};
|
|
263
|
-
var AccountNamespace = class {
|
|
264
|
-
constructor(config) {
|
|
265
|
-
this._config = config;
|
|
266
|
-
this.connections = new AccountConnectionsNamespace(config);
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Whoami
|
|
270
|
-
*/
|
|
271
|
-
whoami() {
|
|
272
|
-
return request(this._config, {
|
|
273
|
-
path: "/v2/account/whoami",
|
|
274
|
-
method: "GET"
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
/**
|
|
278
|
-
* Get organization settings
|
|
279
|
-
*/
|
|
280
|
-
getSettings() {
|
|
281
|
-
return request(this._config, {
|
|
282
|
-
path: "/v2/account/settings",
|
|
283
|
-
method: "GET"
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* Update organization settings
|
|
288
|
-
*/
|
|
289
|
-
updateSettings(params) {
|
|
290
|
-
return request(this._config, {
|
|
291
|
-
path: "/v2/account/settings",
|
|
292
|
-
method: "PATCH",
|
|
293
|
-
body: params.body
|
|
294
|
-
});
|
|
295
|
-
}
|
|
296
239
|
};
|
|
297
|
-
var
|
|
240
|
+
var AccessAnalyticsEarningsNamespace = class {
|
|
298
241
|
constructor(config) {
|
|
299
242
|
this._config = config;
|
|
300
243
|
}
|
|
301
244
|
/**
|
|
302
|
-
*
|
|
303
|
-
*/
|
|
304
|
-
get() {
|
|
305
|
-
return request(this._config, {
|
|
306
|
-
path: "/v2/access/self",
|
|
307
|
-
method: "GET"
|
|
308
|
-
});
|
|
309
|
-
}
|
|
310
|
-
/**
|
|
311
|
-
* Update current user profile
|
|
312
|
-
*/
|
|
313
|
-
update(params) {
|
|
314
|
-
return request(this._config, {
|
|
315
|
-
path: "/v2/access/self",
|
|
316
|
-
method: "PATCH",
|
|
317
|
-
body: params.body
|
|
318
|
-
});
|
|
319
|
-
}
|
|
320
|
-
/**
|
|
321
|
-
* List notifications
|
|
245
|
+
* Chargebacks
|
|
322
246
|
*/
|
|
323
|
-
|
|
247
|
+
listChargebacks(params) {
|
|
324
248
|
return request(this._config, {
|
|
325
|
-
path: "/v2/access/
|
|
249
|
+
path: "/v2/access/analytics/earnings/chargebacks",
|
|
326
250
|
method: "GET",
|
|
327
251
|
query: {
|
|
328
|
-
"
|
|
329
|
-
"
|
|
330
|
-
"
|
|
331
|
-
"relatedUsername": params.relatedUsername
|
|
252
|
+
"startDate": params.startDate,
|
|
253
|
+
"endDate": params.endDate,
|
|
254
|
+
"marker": params.marker
|
|
332
255
|
}
|
|
333
256
|
});
|
|
334
257
|
}
|
|
335
258
|
/**
|
|
336
|
-
*
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
async *
|
|
341
|
-
let
|
|
259
|
+
* Chargebacks
|
|
260
|
+
*
|
|
261
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
262
|
+
*/
|
|
263
|
+
async *iterateChargebacks(params) {
|
|
264
|
+
let marker;
|
|
342
265
|
let fetched = 0;
|
|
343
|
-
const limit = params?.pageSize ?? 20;
|
|
344
266
|
const maxItems = params?.maxItems ?? Infinity;
|
|
345
267
|
while (fetched < maxItems) {
|
|
346
|
-
const response = await this.
|
|
268
|
+
const response = await this.listChargebacks({
|
|
347
269
|
...params,
|
|
348
|
-
|
|
349
|
-
offset
|
|
270
|
+
marker
|
|
350
271
|
});
|
|
351
272
|
for (const item of response.list) {
|
|
352
273
|
if (fetched >= maxItems) return;
|
|
@@ -354,41 +275,53 @@ var AccessSelfNamespace = class {
|
|
|
354
275
|
fetched++;
|
|
355
276
|
}
|
|
356
277
|
if (!response.hasMore) return;
|
|
357
|
-
|
|
278
|
+
marker = response.nextMarker == null ? void 0 : String(response.nextMarker);
|
|
358
279
|
}
|
|
359
280
|
}
|
|
360
281
|
/**
|
|
361
|
-
*
|
|
282
|
+
* Earnings chart
|
|
362
283
|
*/
|
|
363
|
-
|
|
284
|
+
getChart(params) {
|
|
364
285
|
return request(this._config, {
|
|
365
|
-
path: "/v2/access/
|
|
286
|
+
path: "/v2/access/analytics/earnings/chart",
|
|
366
287
|
method: "GET",
|
|
367
288
|
query: {
|
|
368
|
-
"
|
|
369
|
-
"
|
|
370
|
-
"
|
|
371
|
-
"
|
|
372
|
-
"
|
|
373
|
-
"search": params.search
|
|
289
|
+
"startDate": params.startDate,
|
|
290
|
+
"endDate": params.endDate,
|
|
291
|
+
"by": params.by,
|
|
292
|
+
"withTotal": params.withTotal,
|
|
293
|
+
"monthlyTotal": params.monthlyTotal
|
|
374
294
|
}
|
|
375
295
|
});
|
|
376
296
|
}
|
|
377
297
|
/**
|
|
378
|
-
*
|
|
379
|
-
*
|
|
380
|
-
* Returns an async iterator that automatically paginates through all results.
|
|
298
|
+
* Transactions
|
|
381
299
|
*/
|
|
382
|
-
|
|
383
|
-
|
|
300
|
+
listTransactions(params) {
|
|
301
|
+
return request(this._config, {
|
|
302
|
+
path: "/v2/access/analytics/earnings/transactions",
|
|
303
|
+
method: "GET",
|
|
304
|
+
query: {
|
|
305
|
+
"startDate": params.startDate,
|
|
306
|
+
"marker": params.marker,
|
|
307
|
+
"type": params.type,
|
|
308
|
+
"tipsSource": params.tipsSource
|
|
309
|
+
}
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Transactions
|
|
314
|
+
*
|
|
315
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
316
|
+
*/
|
|
317
|
+
async *iterateTransactions(params) {
|
|
318
|
+
let marker;
|
|
384
319
|
let fetched = 0;
|
|
385
|
-
const limit = params?.pageSize ?? 20;
|
|
386
320
|
const maxItems = params?.maxItems ?? Infinity;
|
|
387
321
|
while (fetched < maxItems) {
|
|
388
|
-
const response = await this.
|
|
322
|
+
const response = await this.listTransactions({
|
|
389
323
|
...params,
|
|
390
|
-
|
|
391
|
-
offset
|
|
324
|
+
marker
|
|
392
325
|
});
|
|
393
326
|
for (const item of response.list) {
|
|
394
327
|
if (fetched >= maxItems) return;
|
|
@@ -396,41 +329,41 @@ var AccessSelfNamespace = class {
|
|
|
396
329
|
fetched++;
|
|
397
330
|
}
|
|
398
331
|
if (!response.hasMore) return;
|
|
399
|
-
|
|
332
|
+
marker = response.nextMarker == null ? void 0 : String(response.nextMarker);
|
|
400
333
|
}
|
|
401
334
|
}
|
|
335
|
+
};
|
|
336
|
+
var AccessAnalyticsMassMessagesNamespace = class {
|
|
337
|
+
constructor(config) {
|
|
338
|
+
this._config = config;
|
|
339
|
+
}
|
|
402
340
|
/**
|
|
403
|
-
*
|
|
341
|
+
* Mass message buyers
|
|
404
342
|
*/
|
|
405
|
-
|
|
343
|
+
listBuyers(params) {
|
|
406
344
|
return request(this._config, {
|
|
407
|
-
path:
|
|
345
|
+
path: `/v2/access/analytics/mass-messages/${encodeURIComponent(String(params.massMessageId))}/buyers`,
|
|
408
346
|
method: "GET",
|
|
409
347
|
query: {
|
|
410
348
|
"limit": params.limit,
|
|
411
349
|
"offset": params.offset,
|
|
412
|
-
"
|
|
413
|
-
"sortBy": params.sortBy,
|
|
414
|
-
"sortDirection": params.sortDirection,
|
|
415
|
-
"search": params.search
|
|
350
|
+
"marker": params.marker
|
|
416
351
|
}
|
|
417
352
|
});
|
|
418
353
|
}
|
|
419
354
|
/**
|
|
420
|
-
*
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
async *
|
|
425
|
-
let
|
|
355
|
+
* Mass message buyers
|
|
356
|
+
*
|
|
357
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
358
|
+
*/
|
|
359
|
+
async *iterateBuyers(params) {
|
|
360
|
+
let marker;
|
|
426
361
|
let fetched = 0;
|
|
427
|
-
const limit = params?.pageSize ?? 20;
|
|
428
362
|
const maxItems = params?.maxItems ?? Infinity;
|
|
429
363
|
while (fetched < maxItems) {
|
|
430
|
-
const response = await this.
|
|
364
|
+
const response = await this.listBuyers({
|
|
431
365
|
...params,
|
|
432
|
-
|
|
433
|
-
offset
|
|
366
|
+
marker
|
|
434
367
|
});
|
|
435
368
|
for (const item of response.list) {
|
|
436
369
|
if (fetched >= maxItems) return;
|
|
@@ -438,108 +371,36 @@ var AccessSelfNamespace = class {
|
|
|
438
371
|
fetched++;
|
|
439
372
|
}
|
|
440
373
|
if (!response.hasMore) return;
|
|
441
|
-
|
|
374
|
+
marker = response.nextMarker == null ? void 0 : String(response.nextMarker);
|
|
442
375
|
}
|
|
443
376
|
}
|
|
444
|
-
};
|
|
445
|
-
var AccessEarningsNamespace = class {
|
|
446
|
-
constructor(config) {
|
|
447
|
-
this._config = config;
|
|
448
|
-
}
|
|
449
377
|
/**
|
|
450
|
-
*
|
|
378
|
+
* Mass messages chart
|
|
451
379
|
*/
|
|
452
380
|
getChart(params) {
|
|
453
381
|
return request(this._config, {
|
|
454
|
-
path: "/v2/access/
|
|
382
|
+
path: "/v2/access/analytics/mass-messages/chart",
|
|
455
383
|
method: "GET",
|
|
456
384
|
query: {
|
|
457
385
|
"startDate": params.startDate,
|
|
458
386
|
"endDate": params.endDate,
|
|
459
|
-
"
|
|
460
|
-
"withTotal": params.withTotal,
|
|
461
|
-
"monthlyTotal": params.monthlyTotal
|
|
462
|
-
}
|
|
463
|
-
});
|
|
464
|
-
}
|
|
465
|
-
/**
|
|
466
|
-
* List transactions
|
|
467
|
-
*/
|
|
468
|
-
listTransactions(params) {
|
|
469
|
-
return request(this._config, {
|
|
470
|
-
path: "/v2/access/earnings/transactions",
|
|
471
|
-
method: "GET",
|
|
472
|
-
query: {
|
|
473
|
-
"startDate": params.startDate,
|
|
474
|
-
"marker": params.marker,
|
|
475
|
-
"type": params.type,
|
|
476
|
-
"tipsSource": params.tipsSource
|
|
387
|
+
"withTotal": params.withTotal
|
|
477
388
|
}
|
|
478
389
|
});
|
|
479
390
|
}
|
|
480
391
|
/**
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
* Returns an async iterator that automatically paginates through all results.
|
|
484
|
-
*/
|
|
485
|
-
async *iterateTransactions(params) {
|
|
486
|
-
let marker;
|
|
487
|
-
let fetched = 0;
|
|
488
|
-
const maxItems = params?.maxItems ?? Infinity;
|
|
489
|
-
while (fetched < maxItems) {
|
|
490
|
-
const response = await this.listTransactions({
|
|
491
|
-
...params,
|
|
492
|
-
marker
|
|
493
|
-
});
|
|
494
|
-
for (const item of response.list) {
|
|
495
|
-
if (fetched >= maxItems) return;
|
|
496
|
-
yield item;
|
|
497
|
-
fetched++;
|
|
498
|
-
}
|
|
499
|
-
if (!response.hasMore) return;
|
|
500
|
-
marker = response.marker;
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
|
-
/**
|
|
504
|
-
* List chargebacks
|
|
392
|
+
* Mass messages purchased
|
|
505
393
|
*/
|
|
506
|
-
|
|
394
|
+
getPurchased(params) {
|
|
507
395
|
return request(this._config, {
|
|
508
|
-
path: "/v2/access/
|
|
396
|
+
path: "/v2/access/analytics/mass-messages/purchased",
|
|
509
397
|
method: "GET",
|
|
510
398
|
query: {
|
|
511
399
|
"limit": params.limit,
|
|
512
|
-
"offset": params.offset
|
|
513
|
-
"startDate": params.startDate,
|
|
514
|
-
"endDate": params.endDate
|
|
400
|
+
"offset": params.offset
|
|
515
401
|
}
|
|
516
402
|
});
|
|
517
403
|
}
|
|
518
|
-
/**
|
|
519
|
-
* List chargebacks
|
|
520
|
-
*
|
|
521
|
-
* Returns an async iterator that automatically paginates through all results.
|
|
522
|
-
*/
|
|
523
|
-
async *iterateChargebacks(params) {
|
|
524
|
-
let offset = 0;
|
|
525
|
-
let fetched = 0;
|
|
526
|
-
const limit = params?.pageSize ?? 20;
|
|
527
|
-
const maxItems = params?.maxItems ?? Infinity;
|
|
528
|
-
while (fetched < maxItems) {
|
|
529
|
-
const response = await this.listChargebacks({
|
|
530
|
-
...params,
|
|
531
|
-
limit: Math.min(limit, maxItems - fetched),
|
|
532
|
-
offset
|
|
533
|
-
});
|
|
534
|
-
for (const item of response.list) {
|
|
535
|
-
if (fetched >= maxItems) return;
|
|
536
|
-
yield item;
|
|
537
|
-
fetched++;
|
|
538
|
-
}
|
|
539
|
-
if (!response.hasMore) return;
|
|
540
|
-
offset = response.nextOffset ?? offset + response.list.length;
|
|
541
|
-
}
|
|
542
|
-
}
|
|
543
404
|
};
|
|
544
405
|
var AccessAnalyticsPostsNamespace = class {
|
|
545
406
|
constructor(config) {
|
|
@@ -586,38 +447,36 @@ var AccessAnalyticsPostsNamespace = class {
|
|
|
586
447
|
});
|
|
587
448
|
}
|
|
588
449
|
};
|
|
589
|
-
var
|
|
450
|
+
var AccessAnalyticsPromotionsNamespace = class {
|
|
590
451
|
constructor(config) {
|
|
591
452
|
this._config = config;
|
|
592
453
|
}
|
|
593
454
|
/**
|
|
594
|
-
*
|
|
455
|
+
* Promotions chart
|
|
595
456
|
*/
|
|
596
457
|
getChart(params) {
|
|
597
458
|
return request(this._config, {
|
|
598
|
-
path: "/v2/access/analytics/
|
|
459
|
+
path: "/v2/access/analytics/promotions/chart",
|
|
599
460
|
method: "GET",
|
|
600
461
|
query: {
|
|
601
462
|
"startDate": params.startDate,
|
|
602
463
|
"endDate": params.endDate,
|
|
603
|
-
"withTotal": params.withTotal
|
|
604
|
-
"by": params.by
|
|
464
|
+
"withTotal": params.withTotal
|
|
605
465
|
}
|
|
606
466
|
});
|
|
607
467
|
}
|
|
608
468
|
/**
|
|
609
|
-
* Top
|
|
469
|
+
* Top promotions
|
|
610
470
|
*/
|
|
611
471
|
getTop(params) {
|
|
612
472
|
return request(this._config, {
|
|
613
|
-
path: "/v2/access/analytics/
|
|
473
|
+
path: "/v2/access/analytics/promotions/top",
|
|
614
474
|
method: "GET",
|
|
615
475
|
query: {
|
|
616
|
-
"by": params.by,
|
|
617
|
-
"startDate": params.startDate,
|
|
618
|
-
"endDate": params.endDate,
|
|
619
476
|
"limit": params.limit,
|
|
620
|
-
"offset": params.offset
|
|
477
|
+
"offset": params.offset,
|
|
478
|
+
"startDate": params.startDate,
|
|
479
|
+
"endDate": params.endDate
|
|
621
480
|
}
|
|
622
481
|
});
|
|
623
482
|
}
|
|
@@ -658,105 +517,38 @@ var AccessAnalyticsStoriesNamespace = class {
|
|
|
658
517
|
});
|
|
659
518
|
}
|
|
660
519
|
};
|
|
661
|
-
var
|
|
520
|
+
var AccessAnalyticsStreamsNamespace = class {
|
|
662
521
|
constructor(config) {
|
|
663
522
|
this._config = config;
|
|
664
523
|
}
|
|
665
524
|
/**
|
|
666
|
-
*
|
|
525
|
+
* Streams chart
|
|
667
526
|
*/
|
|
668
527
|
getChart(params) {
|
|
669
528
|
return request(this._config, {
|
|
670
|
-
path: "/v2/access/analytics/
|
|
529
|
+
path: "/v2/access/analytics/streams/chart",
|
|
671
530
|
method: "GET",
|
|
672
531
|
query: {
|
|
673
532
|
"startDate": params.startDate,
|
|
674
533
|
"endDate": params.endDate,
|
|
675
|
-
"withTotal": params.withTotal
|
|
676
|
-
|
|
677
|
-
});
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Mass messages purchased
|
|
681
|
-
*/
|
|
682
|
-
getPurchased(params) {
|
|
683
|
-
return request(this._config, {
|
|
684
|
-
path: "/v2/access/analytics/mass-messages/purchased",
|
|
685
|
-
method: "GET",
|
|
686
|
-
query: {
|
|
687
|
-
"limit": params.limit,
|
|
688
|
-
"offset": params.offset
|
|
689
|
-
}
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
/**
|
|
693
|
-
* Mass message buyers
|
|
694
|
-
*/
|
|
695
|
-
listBuyers(params) {
|
|
696
|
-
return request(this._config, {
|
|
697
|
-
path: `/v2/access/analytics/mass-messages/${encodeURIComponent(String(params.massMessageId))}/buyers`,
|
|
698
|
-
method: "GET",
|
|
699
|
-
query: {
|
|
700
|
-
"limit": params.limit,
|
|
701
|
-
"offset": params.offset,
|
|
702
|
-
"marker": params.marker
|
|
534
|
+
"withTotal": params.withTotal,
|
|
535
|
+
"by": params.by
|
|
703
536
|
}
|
|
704
537
|
});
|
|
705
538
|
}
|
|
706
539
|
/**
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
* Returns an async iterator that automatically paginates through all results.
|
|
710
|
-
*/
|
|
711
|
-
async *iterateBuyers(params) {
|
|
712
|
-
let marker;
|
|
713
|
-
let fetched = 0;
|
|
714
|
-
const maxItems = params?.maxItems ?? Infinity;
|
|
715
|
-
while (fetched < maxItems) {
|
|
716
|
-
const response = await this.listBuyers({
|
|
717
|
-
...params,
|
|
718
|
-
marker
|
|
719
|
-
});
|
|
720
|
-
for (const item of response.list) {
|
|
721
|
-
if (fetched >= maxItems) return;
|
|
722
|
-
yield item;
|
|
723
|
-
fetched++;
|
|
724
|
-
}
|
|
725
|
-
if (!response.hasMore) return;
|
|
726
|
-
marker = response.marker;
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
};
|
|
730
|
-
var AccessAnalyticsPromotionsNamespace = class {
|
|
731
|
-
constructor(config) {
|
|
732
|
-
this._config = config;
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Promotions chart
|
|
540
|
+
* Top streams
|
|
736
541
|
*/
|
|
737
|
-
|
|
542
|
+
getTop(params) {
|
|
738
543
|
return request(this._config, {
|
|
739
|
-
path: "/v2/access/analytics/
|
|
544
|
+
path: "/v2/access/analytics/streams/top",
|
|
740
545
|
method: "GET",
|
|
741
546
|
query: {
|
|
547
|
+
"by": params.by,
|
|
742
548
|
"startDate": params.startDate,
|
|
743
549
|
"endDate": params.endDate,
|
|
744
|
-
"withTotal": params.withTotal
|
|
745
|
-
}
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
/**
|
|
749
|
-
* Top promotions
|
|
750
|
-
*/
|
|
751
|
-
getTop(params) {
|
|
752
|
-
return request(this._config, {
|
|
753
|
-
path: "/v2/access/analytics/promotions/top",
|
|
754
|
-
method: "GET",
|
|
755
|
-
query: {
|
|
756
550
|
"limit": params.limit,
|
|
757
|
-
"offset": params.offset
|
|
758
|
-
"startDate": params.startDate,
|
|
759
|
-
"endDate": params.endDate
|
|
551
|
+
"offset": params.offset
|
|
760
552
|
}
|
|
761
553
|
});
|
|
762
554
|
}
|
|
@@ -795,65 +587,6 @@ var AccessAnalyticsTrialsNamespace = class {
|
|
|
795
587
|
});
|
|
796
588
|
}
|
|
797
589
|
};
|
|
798
|
-
var AccessAnalyticsCampaignsNamespace = class {
|
|
799
|
-
constructor(config) {
|
|
800
|
-
this._config = config;
|
|
801
|
-
}
|
|
802
|
-
/**
|
|
803
|
-
* Campaigns chart
|
|
804
|
-
*/
|
|
805
|
-
getChart(params) {
|
|
806
|
-
return request(this._config, {
|
|
807
|
-
path: "/v2/access/analytics/campaigns/chart",
|
|
808
|
-
method: "GET",
|
|
809
|
-
query: {
|
|
810
|
-
"startDate": params.startDate,
|
|
811
|
-
"endDate": params.endDate,
|
|
812
|
-
"withTotal": params.withTotal
|
|
813
|
-
}
|
|
814
|
-
});
|
|
815
|
-
}
|
|
816
|
-
/**
|
|
817
|
-
* Top campaigns
|
|
818
|
-
*/
|
|
819
|
-
getTop(params) {
|
|
820
|
-
return request(this._config, {
|
|
821
|
-
path: "/v2/access/analytics/campaigns/top",
|
|
822
|
-
method: "GET",
|
|
823
|
-
query: {
|
|
824
|
-
"limit": params.limit,
|
|
825
|
-
"offset": params.offset,
|
|
826
|
-
"startDate": params.startDate,
|
|
827
|
-
"endDate": params.endDate
|
|
828
|
-
}
|
|
829
|
-
});
|
|
830
|
-
}
|
|
831
|
-
/**
|
|
832
|
-
* Top campaigns
|
|
833
|
-
*
|
|
834
|
-
* Returns an async iterator that automatically paginates through all results.
|
|
835
|
-
*/
|
|
836
|
-
async *iterateTop(params) {
|
|
837
|
-
let offset = 0;
|
|
838
|
-
let fetched = 0;
|
|
839
|
-
const limit = params?.pageSize ?? 20;
|
|
840
|
-
const maxItems = params?.maxItems ?? Infinity;
|
|
841
|
-
while (fetched < maxItems) {
|
|
842
|
-
const response = await this.getTop({
|
|
843
|
-
...params,
|
|
844
|
-
limit: Math.min(limit, maxItems - fetched),
|
|
845
|
-
offset
|
|
846
|
-
});
|
|
847
|
-
for (const item of response.list) {
|
|
848
|
-
if (fetched >= maxItems) return;
|
|
849
|
-
yield item;
|
|
850
|
-
fetched++;
|
|
851
|
-
}
|
|
852
|
-
if (!response.hasMore) return;
|
|
853
|
-
offset = response.nextOffset ?? offset + response.list.length;
|
|
854
|
-
}
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
590
|
var AccessAnalyticsVisitorCountriesNamespace = class {
|
|
858
591
|
constructor(config) {
|
|
859
592
|
this._config = config;
|
|
@@ -890,39 +623,43 @@ var AccessAnalyticsVisitorCountriesNamespace = class {
|
|
|
890
623
|
var AccessAnalyticsNamespace = class {
|
|
891
624
|
constructor(config) {
|
|
892
625
|
this._config = config;
|
|
893
|
-
this.
|
|
894
|
-
this.
|
|
895
|
-
this.stories = new AccessAnalyticsStoriesNamespace(config);
|
|
626
|
+
this.campaigns = new AccessAnalyticsCampaignsNamespace(config);
|
|
627
|
+
this.earnings = new AccessAnalyticsEarningsNamespace(config);
|
|
896
628
|
this.massMessages = new AccessAnalyticsMassMessagesNamespace(config);
|
|
629
|
+
this.posts = new AccessAnalyticsPostsNamespace(config);
|
|
897
630
|
this.promotions = new AccessAnalyticsPromotionsNamespace(config);
|
|
631
|
+
this.stories = new AccessAnalyticsStoriesNamespace(config);
|
|
632
|
+
this.streams = new AccessAnalyticsStreamsNamespace(config);
|
|
898
633
|
this.trials = new AccessAnalyticsTrialsNamespace(config);
|
|
899
|
-
this.campaigns = new AccessAnalyticsCampaignsNamespace(config);
|
|
900
634
|
this.visitorCountries = new AccessAnalyticsVisitorCountriesNamespace(config);
|
|
901
635
|
}
|
|
902
636
|
};
|
|
903
|
-
var
|
|
637
|
+
var AccessChatsNamespace = class {
|
|
904
638
|
constructor(config) {
|
|
905
639
|
this._config = config;
|
|
906
640
|
}
|
|
907
641
|
/**
|
|
908
|
-
*
|
|
642
|
+
* Chats list
|
|
909
643
|
*/
|
|
910
644
|
list(params) {
|
|
911
645
|
return request(this._config, {
|
|
912
|
-
path: "/v2/access/
|
|
646
|
+
path: "/v2/access/chats",
|
|
913
647
|
method: "GET",
|
|
914
648
|
query: {
|
|
915
649
|
"limit": params.limit,
|
|
916
650
|
"offset": params.offset,
|
|
917
|
-
"
|
|
651
|
+
"order": params.order,
|
|
652
|
+
"filter": params.filter,
|
|
653
|
+
"query": params.query,
|
|
654
|
+
"userListId": params.userListId
|
|
918
655
|
}
|
|
919
656
|
});
|
|
920
657
|
}
|
|
921
658
|
/**
|
|
922
|
-
*
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
659
|
+
* Chats list
|
|
660
|
+
*
|
|
661
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
662
|
+
*/
|
|
926
663
|
async *iterate(params) {
|
|
927
664
|
let offset = 0;
|
|
928
665
|
let fetched = 0;
|
|
@@ -940,82 +677,39 @@ var AccessUsersListsNamespace = class {
|
|
|
940
677
|
fetched++;
|
|
941
678
|
}
|
|
942
679
|
if (!response.hasMore) return;
|
|
943
|
-
|
|
680
|
+
const nextOffset = response.nextOffset;
|
|
681
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
944
682
|
}
|
|
945
683
|
}
|
|
946
684
|
/**
|
|
947
|
-
*
|
|
685
|
+
* Get chat media
|
|
948
686
|
*/
|
|
949
|
-
|
|
687
|
+
listMedia(params) {
|
|
950
688
|
return request(this._config, {
|
|
951
|
-
path:
|
|
952
|
-
method: "POST",
|
|
953
|
-
body: params.body
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
/**
|
|
957
|
-
* Get user list
|
|
958
|
-
*/
|
|
959
|
-
get(params) {
|
|
960
|
-
return request(this._config, {
|
|
961
|
-
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}`,
|
|
962
|
-
method: "GET"
|
|
963
|
-
});
|
|
964
|
-
}
|
|
965
|
-
/**
|
|
966
|
-
* Update user list
|
|
967
|
-
*/
|
|
968
|
-
update(params) {
|
|
969
|
-
return request(this._config, {
|
|
970
|
-
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}`,
|
|
971
|
-
method: "PATCH",
|
|
972
|
-
body: params.body
|
|
973
|
-
});
|
|
974
|
-
}
|
|
975
|
-
/**
|
|
976
|
-
* Delete user list
|
|
977
|
-
*/
|
|
978
|
-
delete(params) {
|
|
979
|
-
return request(this._config, {
|
|
980
|
-
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}`,
|
|
981
|
-
method: "DELETE"
|
|
982
|
-
});
|
|
983
|
-
}
|
|
984
|
-
/**
|
|
985
|
-
* Add user to multiple lists
|
|
986
|
-
*/
|
|
987
|
-
create2(params) {
|
|
988
|
-
return request(this._config, {
|
|
989
|
-
path: `/v2/access/users/${encodeURIComponent(String(params.userId))}/lists`,
|
|
990
|
-
method: "POST",
|
|
991
|
-
body: params.body
|
|
992
|
-
});
|
|
993
|
-
}
|
|
994
|
-
/**
|
|
995
|
-
* List users in user list
|
|
996
|
-
*/
|
|
997
|
-
listUsers(params) {
|
|
998
|
-
return request(this._config, {
|
|
999
|
-
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}/users`,
|
|
689
|
+
path: `/v2/access/chats/${encodeURIComponent(String(params.userId))}/media`,
|
|
1000
690
|
method: "GET",
|
|
1001
691
|
query: {
|
|
1002
692
|
"limit": params.limit,
|
|
1003
|
-
"offset": params.offset
|
|
693
|
+
"offset": params.offset,
|
|
694
|
+
"skip_users": params.skipUsers,
|
|
695
|
+
"last_id": params.lastId,
|
|
696
|
+
"opened": params.opened,
|
|
697
|
+
"type": params.type
|
|
1004
698
|
}
|
|
1005
699
|
});
|
|
1006
700
|
}
|
|
1007
701
|
/**
|
|
1008
|
-
*
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
async *
|
|
702
|
+
* Get chat media
|
|
703
|
+
*
|
|
704
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
705
|
+
*/
|
|
706
|
+
async *iterateMedia(params) {
|
|
1013
707
|
let offset = 0;
|
|
1014
708
|
let fetched = 0;
|
|
1015
709
|
const limit = params?.pageSize ?? 20;
|
|
1016
710
|
const maxItems = params?.maxItems ?? Infinity;
|
|
1017
711
|
while (fetched < maxItems) {
|
|
1018
|
-
const response = await this.
|
|
712
|
+
const response = await this.listMedia({
|
|
1019
713
|
...params,
|
|
1020
714
|
limit: Math.min(limit, maxItems - fetched),
|
|
1021
715
|
offset
|
|
@@ -1026,84 +720,38 @@ var AccessUsersListsNamespace = class {
|
|
|
1026
720
|
fetched++;
|
|
1027
721
|
}
|
|
1028
722
|
if (!response.hasMore) return;
|
|
1029
|
-
|
|
723
|
+
const nextOffset = response.nextOffset;
|
|
724
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1030
725
|
}
|
|
1031
726
|
}
|
|
1032
727
|
/**
|
|
1033
|
-
*
|
|
1034
|
-
*/
|
|
1035
|
-
createUsers(params) {
|
|
1036
|
-
return request(this._config, {
|
|
1037
|
-
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}/users/${encodeURIComponent(String(params.userId))}`,
|
|
1038
|
-
method: "POST"
|
|
1039
|
-
});
|
|
1040
|
-
}
|
|
1041
|
-
/**
|
|
1042
|
-
* Remove user from user list
|
|
1043
|
-
*/
|
|
1044
|
-
deleteUsers(params) {
|
|
1045
|
-
return request(this._config, {
|
|
1046
|
-
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}/users/${encodeURIComponent(String(params.userId))}`,
|
|
1047
|
-
method: "DELETE"
|
|
1048
|
-
});
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
var AccessUsersNamespace = class {
|
|
1052
|
-
constructor(config) {
|
|
1053
|
-
this._config = config;
|
|
1054
|
-
this.lists = new AccessUsersListsNamespace(config);
|
|
1055
|
-
}
|
|
1056
|
-
/**
|
|
1057
|
-
* Get user
|
|
1058
|
-
*/
|
|
1059
|
-
get(params) {
|
|
1060
|
-
return request(this._config, {
|
|
1061
|
-
path: `/v2/access/users/${encodeURIComponent(String(params.userId))}`,
|
|
1062
|
-
method: "GET"
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
/**
|
|
1066
|
-
* List user posts
|
|
1067
|
-
*/
|
|
1068
|
-
listPosts(params) {
|
|
1069
|
-
return request(this._config, {
|
|
1070
|
-
path: `/v2/access/users/${encodeURIComponent(String(params.userId))}/posts`,
|
|
1071
|
-
method: "GET",
|
|
1072
|
-
query: {
|
|
1073
|
-
"limit": params.limit,
|
|
1074
|
-
"sortBy": params.sortBy,
|
|
1075
|
-
"sortDirection": params.sortDirection,
|
|
1076
|
-
"pinned": params.pinned,
|
|
1077
|
-
"includePostCounts": params.includePostCounts,
|
|
1078
|
-
"beforePublishTime": params.beforePublishTime
|
|
1079
|
-
}
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
/**
|
|
1083
|
-
* List restricted users
|
|
728
|
+
* Chat messages
|
|
1084
729
|
*/
|
|
1085
|
-
|
|
730
|
+
listMessages(params) {
|
|
1086
731
|
return request(this._config, {
|
|
1087
|
-
path:
|
|
732
|
+
path: `/v2/access/chats/${encodeURIComponent(String(params.userId))}/messages`,
|
|
1088
733
|
method: "GET",
|
|
1089
734
|
query: {
|
|
1090
735
|
"limit": params.limit,
|
|
1091
|
-
"offset": params.offset
|
|
736
|
+
"offset": params.offset,
|
|
737
|
+
"query": params.query,
|
|
738
|
+
"id": params.id,
|
|
739
|
+
"first_id": params.firstId
|
|
1092
740
|
}
|
|
1093
741
|
});
|
|
1094
742
|
}
|
|
1095
743
|
/**
|
|
1096
|
-
*
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
async *
|
|
744
|
+
* Chat messages
|
|
745
|
+
*
|
|
746
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
747
|
+
*/
|
|
748
|
+
async *iterateMessages(params) {
|
|
1101
749
|
let offset = 0;
|
|
1102
750
|
let fetched = 0;
|
|
1103
751
|
const limit = params?.pageSize ?? 20;
|
|
1104
752
|
const maxItems = params?.maxItems ?? Infinity;
|
|
1105
753
|
while (fetched < maxItems) {
|
|
1106
|
-
const response = await this.
|
|
754
|
+
const response = await this.listMessages({
|
|
1107
755
|
...params,
|
|
1108
756
|
limit: Math.min(limit, maxItems - fetched),
|
|
1109
757
|
offset
|
|
@@ -1114,55 +762,62 @@ var AccessUsersNamespace = class {
|
|
|
1114
762
|
fetched++;
|
|
1115
763
|
}
|
|
1116
764
|
if (!response.hasMore) return;
|
|
1117
|
-
|
|
765
|
+
const nextOffset = response.nextOffset;
|
|
766
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1118
767
|
}
|
|
1119
768
|
}
|
|
1120
769
|
/**
|
|
1121
|
-
*
|
|
770
|
+
* Send chat message
|
|
1122
771
|
*/
|
|
1123
|
-
|
|
772
|
+
createMessages(params) {
|
|
1124
773
|
return request(this._config, {
|
|
1125
|
-
path: `/v2/access/
|
|
1126
|
-
method: "POST"
|
|
774
|
+
path: `/v2/access/chats/${encodeURIComponent(String(params.userId))}/messages`,
|
|
775
|
+
method: "POST",
|
|
776
|
+
body: params.body
|
|
1127
777
|
});
|
|
1128
778
|
}
|
|
1129
779
|
/**
|
|
1130
|
-
*
|
|
780
|
+
* Unsend chat message
|
|
1131
781
|
*/
|
|
1132
|
-
|
|
782
|
+
deleteMessages(params) {
|
|
1133
783
|
return request(this._config, {
|
|
1134
|
-
path: `/v2/access/
|
|
1135
|
-
method: "DELETE"
|
|
784
|
+
path: `/v2/access/chats/${encodeURIComponent(String(params.userId))}/messages/${encodeURIComponent(String(params.messageId))}`,
|
|
785
|
+
method: "DELETE",
|
|
786
|
+
body: params.body
|
|
1136
787
|
});
|
|
1137
788
|
}
|
|
789
|
+
};
|
|
790
|
+
var AccessEarningsNamespace = class {
|
|
791
|
+
constructor(config) {
|
|
792
|
+
this._config = config;
|
|
793
|
+
}
|
|
1138
794
|
/**
|
|
1139
|
-
* List
|
|
795
|
+
* List chargebacks
|
|
1140
796
|
*/
|
|
1141
|
-
|
|
797
|
+
listChargebacks(params) {
|
|
1142
798
|
return request(this._config, {
|
|
1143
|
-
path: "/v2/access/
|
|
799
|
+
path: "/v2/access/earnings/chargebacks",
|
|
1144
800
|
method: "GET",
|
|
1145
801
|
query: {
|
|
1146
|
-
"
|
|
1147
|
-
"
|
|
802
|
+
"startDate": params.startDate,
|
|
803
|
+
"endDate": params.endDate,
|
|
804
|
+
"marker": params.marker
|
|
1148
805
|
}
|
|
1149
806
|
});
|
|
1150
807
|
}
|
|
1151
808
|
/**
|
|
1152
|
-
* List
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
async *
|
|
1157
|
-
let
|
|
809
|
+
* List chargebacks
|
|
810
|
+
*
|
|
811
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
812
|
+
*/
|
|
813
|
+
async *iterateChargebacks(params) {
|
|
814
|
+
let marker;
|
|
1158
815
|
let fetched = 0;
|
|
1159
|
-
const limit = params?.pageSize ?? 20;
|
|
1160
816
|
const maxItems = params?.maxItems ?? Infinity;
|
|
1161
817
|
while (fetched < maxItems) {
|
|
1162
|
-
const response = await this.
|
|
818
|
+
const response = await this.listChargebacks({
|
|
1163
819
|
...params,
|
|
1164
|
-
|
|
1165
|
-
offset
|
|
820
|
+
marker
|
|
1166
821
|
});
|
|
1167
822
|
for (const item of response.list) {
|
|
1168
823
|
if (fetched >= maxItems) return;
|
|
@@ -1170,62 +825,90 @@ var AccessUsersNamespace = class {
|
|
|
1170
825
|
fetched++;
|
|
1171
826
|
}
|
|
1172
827
|
if (!response.hasMore) return;
|
|
1173
|
-
|
|
828
|
+
marker = response.nextMarker == null ? void 0 : String(response.nextMarker);
|
|
1174
829
|
}
|
|
1175
830
|
}
|
|
1176
831
|
/**
|
|
1177
|
-
*
|
|
832
|
+
* Get earnings chart
|
|
1178
833
|
*/
|
|
1179
|
-
|
|
834
|
+
getChart(params) {
|
|
1180
835
|
return request(this._config, {
|
|
1181
|
-
path: "/v2/access/
|
|
836
|
+
path: "/v2/access/earnings/chart",
|
|
1182
837
|
method: "GET",
|
|
1183
838
|
query: {
|
|
1184
|
-
"
|
|
839
|
+
"startDate": params.startDate,
|
|
840
|
+
"endDate": params.endDate,
|
|
841
|
+
"by": params.by,
|
|
842
|
+
"withTotal": params.withTotal,
|
|
843
|
+
"monthlyTotal": params.monthlyTotal
|
|
1185
844
|
}
|
|
1186
845
|
});
|
|
1187
846
|
}
|
|
1188
847
|
/**
|
|
1189
|
-
*
|
|
848
|
+
* List transactions
|
|
1190
849
|
*/
|
|
1191
|
-
|
|
850
|
+
listTransactions(params) {
|
|
1192
851
|
return request(this._config, {
|
|
1193
|
-
path: "/v2/access/
|
|
852
|
+
path: "/v2/access/earnings/transactions",
|
|
1194
853
|
method: "GET",
|
|
1195
854
|
query: {
|
|
1196
|
-
"
|
|
1197
|
-
"
|
|
1198
|
-
"
|
|
855
|
+
"startDate": params.startDate,
|
|
856
|
+
"marker": params.marker,
|
|
857
|
+
"type": params.type,
|
|
858
|
+
"tipsSource": params.tipsSource
|
|
1199
859
|
}
|
|
1200
860
|
});
|
|
1201
861
|
}
|
|
862
|
+
/**
|
|
863
|
+
* List transactions
|
|
864
|
+
*
|
|
865
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
866
|
+
*/
|
|
867
|
+
async *iterateTransactions(params) {
|
|
868
|
+
let marker;
|
|
869
|
+
let fetched = 0;
|
|
870
|
+
const maxItems = params?.maxItems ?? Infinity;
|
|
871
|
+
while (fetched < maxItems) {
|
|
872
|
+
const response = await this.listTransactions({
|
|
873
|
+
...params,
|
|
874
|
+
marker
|
|
875
|
+
});
|
|
876
|
+
for (const item of response.list) {
|
|
877
|
+
if (fetched >= maxItems) return;
|
|
878
|
+
yield item;
|
|
879
|
+
fetched++;
|
|
880
|
+
}
|
|
881
|
+
if (!response.hasMore) return;
|
|
882
|
+
marker = response.nextMarker == null ? void 0 : String(response.nextMarker);
|
|
883
|
+
}
|
|
884
|
+
}
|
|
1202
885
|
};
|
|
1203
|
-
var
|
|
886
|
+
var AccessPromotionsTrackingLinksNamespace = class {
|
|
1204
887
|
constructor(config) {
|
|
1205
888
|
this._config = config;
|
|
1206
889
|
}
|
|
1207
890
|
/**
|
|
1208
|
-
*
|
|
891
|
+
* List tracking links
|
|
1209
892
|
*/
|
|
1210
893
|
list(params) {
|
|
1211
894
|
return request(this._config, {
|
|
1212
|
-
path: "/v2/access/
|
|
895
|
+
path: "/v2/access/promotions/tracking-links",
|
|
1213
896
|
method: "GET",
|
|
1214
897
|
query: {
|
|
1215
898
|
"limit": params.limit,
|
|
1216
899
|
"offset": params.offset,
|
|
1217
|
-
"
|
|
1218
|
-
"
|
|
1219
|
-
"
|
|
1220
|
-
"
|
|
900
|
+
"pagination": params.pagination,
|
|
901
|
+
"with_deleted": params.withDeleted,
|
|
902
|
+
"sorting_deleted": params.sortingDeleted,
|
|
903
|
+
"stats": params.stats
|
|
1221
904
|
}
|
|
1222
905
|
});
|
|
1223
906
|
}
|
|
1224
907
|
/**
|
|
1225
|
-
*
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
908
|
+
* List tracking links
|
|
909
|
+
*
|
|
910
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
911
|
+
*/
|
|
1229
912
|
async *iterate(params) {
|
|
1230
913
|
let offset = 0;
|
|
1231
914
|
let fetched = 0;
|
|
@@ -1243,35 +926,313 @@ var AccessChatsNamespace = class {
|
|
|
1243
926
|
fetched++;
|
|
1244
927
|
}
|
|
1245
928
|
if (!response.hasMore) return;
|
|
1246
|
-
|
|
929
|
+
const nextOffset = response.nextOffset;
|
|
930
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1247
931
|
}
|
|
1248
932
|
}
|
|
1249
933
|
/**
|
|
1250
|
-
*
|
|
934
|
+
* Create tracking link
|
|
1251
935
|
*/
|
|
1252
|
-
|
|
936
|
+
create(params) {
|
|
1253
937
|
return request(this._config, {
|
|
1254
|
-
path:
|
|
1255
|
-
method: "
|
|
1256
|
-
|
|
1257
|
-
"limit": params.limit,
|
|
1258
|
-
"offset": params.offset,
|
|
1259
|
-
"query": params.query
|
|
1260
|
-
}
|
|
938
|
+
path: "/v2/access/promotions/tracking-links",
|
|
939
|
+
method: "POST",
|
|
940
|
+
body: params.body
|
|
1261
941
|
});
|
|
1262
942
|
}
|
|
1263
943
|
/**
|
|
1264
|
-
*
|
|
1265
|
-
*
|
|
1266
|
-
* Returns an async iterator that automatically paginates through all results.
|
|
944
|
+
* Get tracking link
|
|
1267
945
|
*/
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
946
|
+
get(params) {
|
|
947
|
+
return request(this._config, {
|
|
948
|
+
path: `/v2/access/promotions/tracking-links/${encodeURIComponent(String(params.trackingLinkId))}`,
|
|
949
|
+
method: "GET"
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
/**
|
|
953
|
+
* Update tracking link
|
|
954
|
+
*/
|
|
955
|
+
replace(params) {
|
|
956
|
+
return request(this._config, {
|
|
957
|
+
path: `/v2/access/promotions/tracking-links/${encodeURIComponent(String(params.trackingLinkId))}`,
|
|
958
|
+
method: "PUT",
|
|
959
|
+
body: params.body
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
/**
|
|
963
|
+
* Delete tracking link
|
|
964
|
+
*/
|
|
965
|
+
delete(params) {
|
|
966
|
+
return request(this._config, {
|
|
967
|
+
path: `/v2/access/promotions/tracking-links/${encodeURIComponent(String(params.trackingLinkId))}`,
|
|
968
|
+
method: "DELETE"
|
|
969
|
+
});
|
|
970
|
+
}
|
|
971
|
+
/**
|
|
972
|
+
* Get tracking link claimers
|
|
973
|
+
*/
|
|
974
|
+
listClaimers(params) {
|
|
975
|
+
return request(this._config, {
|
|
976
|
+
path: `/v2/access/promotions/tracking-links/${encodeURIComponent(String(params.trackingLinkId))}/claimers`,
|
|
977
|
+
method: "GET"
|
|
978
|
+
});
|
|
979
|
+
}
|
|
980
|
+
/**
|
|
981
|
+
* Share tracking link access
|
|
982
|
+
*/
|
|
983
|
+
createShareAccess(params) {
|
|
984
|
+
return request(this._config, {
|
|
985
|
+
path: "/v2/access/promotions/tracking-links/share-access",
|
|
986
|
+
method: "POST",
|
|
987
|
+
body: params.body
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
/**
|
|
991
|
+
* Revoke tracking link access
|
|
992
|
+
*/
|
|
993
|
+
deleteShareAccess(params) {
|
|
994
|
+
return request(this._config, {
|
|
995
|
+
path: "/v2/access/promotions/tracking-links/share-access",
|
|
996
|
+
method: "DELETE",
|
|
997
|
+
body: params.body
|
|
998
|
+
});
|
|
999
|
+
}
|
|
1000
|
+
};
|
|
1001
|
+
var AccessPromotionsTrialLinksNamespace = class {
|
|
1002
|
+
constructor(config) {
|
|
1003
|
+
this._config = config;
|
|
1004
|
+
}
|
|
1005
|
+
/**
|
|
1006
|
+
* List trial links
|
|
1007
|
+
*/
|
|
1008
|
+
list(params) {
|
|
1009
|
+
return request(this._config, {
|
|
1010
|
+
path: "/v2/access/promotions/trial-links",
|
|
1011
|
+
method: "GET",
|
|
1012
|
+
query: {
|
|
1013
|
+
"limit": params.limit,
|
|
1014
|
+
"offset": params.offset
|
|
1015
|
+
}
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
/**
|
|
1019
|
+
* Create trial link
|
|
1020
|
+
*/
|
|
1021
|
+
create(params) {
|
|
1022
|
+
return request(this._config, {
|
|
1023
|
+
path: "/v2/access/promotions/trial-links",
|
|
1024
|
+
method: "POST",
|
|
1025
|
+
body: params.body
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1028
|
+
/**
|
|
1029
|
+
* Get trial link
|
|
1030
|
+
*/
|
|
1031
|
+
get(params) {
|
|
1032
|
+
return request(this._config, {
|
|
1033
|
+
path: `/v2/access/promotions/trial-links/${encodeURIComponent(String(params.trialLinkId))}`,
|
|
1034
|
+
method: "GET"
|
|
1035
|
+
});
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Update trial link
|
|
1039
|
+
*/
|
|
1040
|
+
replace(params) {
|
|
1041
|
+
return request(this._config, {
|
|
1042
|
+
path: `/v2/access/promotions/trial-links/${encodeURIComponent(String(params.trialLinkId))}`,
|
|
1043
|
+
method: "PUT",
|
|
1044
|
+
body: params.body
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* Delete trial link
|
|
1049
|
+
*/
|
|
1050
|
+
delete(params) {
|
|
1051
|
+
return request(this._config, {
|
|
1052
|
+
path: `/v2/access/promotions/trial-links/${encodeURIComponent(String(params.trialLinkId))}`,
|
|
1053
|
+
method: "DELETE"
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
/**
|
|
1057
|
+
* Share trial link access
|
|
1058
|
+
*/
|
|
1059
|
+
createShareAccess(params) {
|
|
1060
|
+
return request(this._config, {
|
|
1061
|
+
path: "/v2/access/promotions/trial-links/share-access",
|
|
1062
|
+
method: "POST",
|
|
1063
|
+
body: params.body
|
|
1064
|
+
});
|
|
1065
|
+
}
|
|
1066
|
+
/**
|
|
1067
|
+
* Revoke trial link access
|
|
1068
|
+
*/
|
|
1069
|
+
deleteShareAccess(params) {
|
|
1070
|
+
return request(this._config, {
|
|
1071
|
+
path: "/v2/access/promotions/trial-links/share-access",
|
|
1072
|
+
method: "DELETE",
|
|
1073
|
+
body: params.body
|
|
1074
|
+
});
|
|
1075
|
+
}
|
|
1076
|
+
};
|
|
1077
|
+
var AccessPromotionsNamespace = class {
|
|
1078
|
+
constructor(config) {
|
|
1079
|
+
this._config = config;
|
|
1080
|
+
this.trackingLinks = new AccessPromotionsTrackingLinksNamespace(config);
|
|
1081
|
+
this.trialLinks = new AccessPromotionsTrialLinksNamespace(config);
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* List promotions
|
|
1085
|
+
*/
|
|
1086
|
+
list(params) {
|
|
1087
|
+
return request(this._config, {
|
|
1088
|
+
path: "/v2/access/promotions",
|
|
1089
|
+
method: "GET",
|
|
1090
|
+
query: {
|
|
1091
|
+
"limit": params.limit,
|
|
1092
|
+
"offset": params.offset
|
|
1093
|
+
}
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
1096
|
+
/**
|
|
1097
|
+
* Create promotion
|
|
1098
|
+
*/
|
|
1099
|
+
create(params) {
|
|
1100
|
+
return request(this._config, {
|
|
1101
|
+
path: "/v2/access/promotions",
|
|
1102
|
+
method: "POST",
|
|
1103
|
+
body: params.body
|
|
1104
|
+
});
|
|
1105
|
+
}
|
|
1106
|
+
/**
|
|
1107
|
+
* Update promotion
|
|
1108
|
+
*/
|
|
1109
|
+
replace(params) {
|
|
1110
|
+
return request(this._config, {
|
|
1111
|
+
path: `/v2/access/promotions/${encodeURIComponent(String(params.promotionId))}`,
|
|
1112
|
+
method: "PUT",
|
|
1113
|
+
body: params.body
|
|
1114
|
+
});
|
|
1115
|
+
}
|
|
1116
|
+
/**
|
|
1117
|
+
* Delete promotion
|
|
1118
|
+
*/
|
|
1119
|
+
delete(params) {
|
|
1120
|
+
return request(this._config, {
|
|
1121
|
+
path: `/v2/access/promotions/${encodeURIComponent(String(params.promotionId))}`,
|
|
1122
|
+
method: "DELETE"
|
|
1123
|
+
});
|
|
1124
|
+
}
|
|
1125
|
+
/**
|
|
1126
|
+
* Stop promotion
|
|
1127
|
+
*/
|
|
1128
|
+
createStop(params) {
|
|
1129
|
+
return request(this._config, {
|
|
1130
|
+
path: `/v2/access/promotions/${encodeURIComponent(String(params.promotionId))}/stop`,
|
|
1131
|
+
method: "POST"
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1134
|
+
/**
|
|
1135
|
+
* List bundles
|
|
1136
|
+
*/
|
|
1137
|
+
listBundles(params) {
|
|
1138
|
+
return request(this._config, {
|
|
1139
|
+
path: "/v2/access/promotions/bundles",
|
|
1140
|
+
method: "GET",
|
|
1141
|
+
query: {
|
|
1142
|
+
"limit": params.limit,
|
|
1143
|
+
"offset": params.offset
|
|
1144
|
+
}
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
/**
|
|
1148
|
+
* Create bundle
|
|
1149
|
+
*/
|
|
1150
|
+
createBundles(params) {
|
|
1151
|
+
return request(this._config, {
|
|
1152
|
+
path: "/v2/access/promotions/bundles",
|
|
1153
|
+
method: "POST",
|
|
1154
|
+
body: params.body
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
/**
|
|
1158
|
+
* Get bundle
|
|
1159
|
+
*/
|
|
1160
|
+
getBundles(params) {
|
|
1161
|
+
return request(this._config, {
|
|
1162
|
+
path: `/v2/access/promotions/bundles/${encodeURIComponent(String(params.bundleId))}`,
|
|
1163
|
+
method: "GET"
|
|
1164
|
+
});
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Update bundle
|
|
1168
|
+
*/
|
|
1169
|
+
replaceBundles(params) {
|
|
1170
|
+
return request(this._config, {
|
|
1171
|
+
path: `/v2/access/promotions/bundles/${encodeURIComponent(String(params.bundleId))}`,
|
|
1172
|
+
method: "PUT",
|
|
1173
|
+
body: params.body
|
|
1174
|
+
});
|
|
1175
|
+
}
|
|
1176
|
+
/**
|
|
1177
|
+
* Delete bundle
|
|
1178
|
+
*/
|
|
1179
|
+
deleteBundles(params) {
|
|
1180
|
+
return request(this._config, {
|
|
1181
|
+
path: `/v2/access/promotions/bundles/${encodeURIComponent(String(params.bundleId))}`,
|
|
1182
|
+
method: "DELETE"
|
|
1183
|
+
});
|
|
1184
|
+
}
|
|
1185
|
+
};
|
|
1186
|
+
var AccessSelfNamespace = class {
|
|
1187
|
+
constructor(config) {
|
|
1188
|
+
this._config = config;
|
|
1189
|
+
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Get current user
|
|
1192
|
+
*/
|
|
1193
|
+
get() {
|
|
1194
|
+
return request(this._config, {
|
|
1195
|
+
path: "/v2/access/self",
|
|
1196
|
+
method: "GET"
|
|
1197
|
+
});
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Update current user profile
|
|
1201
|
+
*/
|
|
1202
|
+
update(params) {
|
|
1203
|
+
return request(this._config, {
|
|
1204
|
+
path: "/v2/access/self",
|
|
1205
|
+
method: "PATCH",
|
|
1206
|
+
body: params.body
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
/**
|
|
1210
|
+
* List notifications
|
|
1211
|
+
*/
|
|
1212
|
+
listNotifications(params) {
|
|
1213
|
+
return request(this._config, {
|
|
1214
|
+
path: "/v2/access/self/notifications",
|
|
1215
|
+
method: "GET",
|
|
1216
|
+
query: {
|
|
1217
|
+
"limit": params.limit,
|
|
1218
|
+
"offset": params.offset,
|
|
1219
|
+
"type": params.type,
|
|
1220
|
+
"relatedUsername": params.relatedUsername
|
|
1221
|
+
}
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
/**
|
|
1225
|
+
* List notifications
|
|
1226
|
+
*
|
|
1227
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1228
|
+
*/
|
|
1229
|
+
async *iterateNotifications(params) {
|
|
1230
|
+
let offset = 0;
|
|
1231
|
+
let fetched = 0;
|
|
1232
|
+
const limit = params?.pageSize ?? 20;
|
|
1233
|
+
const maxItems = params?.maxItems ?? Infinity;
|
|
1273
1234
|
while (fetched < maxItems) {
|
|
1274
|
-
const response = await this.
|
|
1235
|
+
const response = await this.listNotifications({
|
|
1275
1236
|
...params,
|
|
1276
1237
|
limit: Math.min(limit, maxItems - fetched),
|
|
1277
1238
|
offset
|
|
@@ -1282,58 +1243,82 @@ var AccessChatsNamespace = class {
|
|
|
1282
1243
|
fetched++;
|
|
1283
1244
|
}
|
|
1284
1245
|
if (!response.hasMore) return;
|
|
1285
|
-
|
|
1246
|
+
const nextOffset = response.nextOffset;
|
|
1247
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1286
1248
|
}
|
|
1287
1249
|
}
|
|
1288
1250
|
/**
|
|
1289
|
-
*
|
|
1251
|
+
* List release forms
|
|
1290
1252
|
*/
|
|
1291
|
-
|
|
1253
|
+
listReleaseForms(params) {
|
|
1292
1254
|
return request(this._config, {
|
|
1293
|
-
path:
|
|
1294
|
-
method: "
|
|
1295
|
-
|
|
1255
|
+
path: "/v2/access/self/release-forms",
|
|
1256
|
+
method: "GET",
|
|
1257
|
+
query: {
|
|
1258
|
+
"limit": params.limit,
|
|
1259
|
+
"offset": params.offset,
|
|
1260
|
+
"filter": params.filter,
|
|
1261
|
+
"sortBy": params.sortBy,
|
|
1262
|
+
"sortDirection": params.sortDirection,
|
|
1263
|
+
"search": params.search
|
|
1264
|
+
}
|
|
1296
1265
|
});
|
|
1297
1266
|
}
|
|
1298
1267
|
/**
|
|
1299
|
-
*
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1268
|
+
* List release forms
|
|
1269
|
+
*
|
|
1270
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1271
|
+
*/
|
|
1272
|
+
async *iterateReleaseForms(params) {
|
|
1273
|
+
let offset = 0;
|
|
1274
|
+
let fetched = 0;
|
|
1275
|
+
const limit = params?.pageSize ?? 20;
|
|
1276
|
+
const maxItems = params?.maxItems ?? Infinity;
|
|
1277
|
+
while (fetched < maxItems) {
|
|
1278
|
+
const response = await this.listReleaseForms({
|
|
1279
|
+
...params,
|
|
1280
|
+
limit: Math.min(limit, maxItems - fetched),
|
|
1281
|
+
offset
|
|
1282
|
+
});
|
|
1283
|
+
for (const item of response.list) {
|
|
1284
|
+
if (fetched >= maxItems) return;
|
|
1285
|
+
yield item;
|
|
1286
|
+
fetched++;
|
|
1287
|
+
}
|
|
1288
|
+
if (!response.hasMore) return;
|
|
1289
|
+
const nextOffset = response.nextOffset;
|
|
1290
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1291
|
+
}
|
|
1307
1292
|
}
|
|
1308
1293
|
/**
|
|
1309
|
-
*
|
|
1294
|
+
* List tagged friend users
|
|
1310
1295
|
*/
|
|
1311
|
-
|
|
1296
|
+
listTaggedFriendUsers(params) {
|
|
1312
1297
|
return request(this._config, {
|
|
1313
|
-
path:
|
|
1298
|
+
path: "/v2/access/self/tagged-friend-users",
|
|
1314
1299
|
method: "GET",
|
|
1315
1300
|
query: {
|
|
1316
1301
|
"limit": params.limit,
|
|
1317
1302
|
"offset": params.offset,
|
|
1318
|
-
"
|
|
1319
|
-
"
|
|
1320
|
-
"
|
|
1321
|
-
"
|
|
1303
|
+
"filter": params.filter,
|
|
1304
|
+
"sortBy": params.sortBy,
|
|
1305
|
+
"sortDirection": params.sortDirection,
|
|
1306
|
+
"search": params.search
|
|
1322
1307
|
}
|
|
1323
1308
|
});
|
|
1324
1309
|
}
|
|
1325
1310
|
/**
|
|
1326
|
-
*
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
async *
|
|
1311
|
+
* List tagged friend users
|
|
1312
|
+
*
|
|
1313
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1314
|
+
*/
|
|
1315
|
+
async *iterateTaggedFriendUsers(params) {
|
|
1331
1316
|
let offset = 0;
|
|
1332
1317
|
let fetched = 0;
|
|
1333
1318
|
const limit = params?.pageSize ?? 20;
|
|
1334
1319
|
const maxItems = params?.maxItems ?? Infinity;
|
|
1335
1320
|
while (fetched < maxItems) {
|
|
1336
|
-
const response = await this.
|
|
1321
|
+
const response = await this.listTaggedFriendUsers({
|
|
1337
1322
|
...params,
|
|
1338
1323
|
limit: Math.min(limit, maxItems - fetched),
|
|
1339
1324
|
offset
|
|
@@ -1344,7 +1329,8 @@ var AccessChatsNamespace = class {
|
|
|
1344
1329
|
fetched++;
|
|
1345
1330
|
}
|
|
1346
1331
|
if (!response.hasMore) return;
|
|
1347
|
-
|
|
1332
|
+
const nextOffset = response.nextOffset;
|
|
1333
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1348
1334
|
}
|
|
1349
1335
|
}
|
|
1350
1336
|
};
|
|
@@ -1373,9 +1359,9 @@ var AccessSubscribersNamespace = class {
|
|
|
1373
1359
|
}
|
|
1374
1360
|
/**
|
|
1375
1361
|
* List subscribers
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1362
|
+
*
|
|
1363
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1364
|
+
*/
|
|
1379
1365
|
async *iterate(params) {
|
|
1380
1366
|
let offset = 0;
|
|
1381
1367
|
let fetched = 0;
|
|
@@ -1393,15 +1379,16 @@ var AccessSubscribersNamespace = class {
|
|
|
1393
1379
|
fetched++;
|
|
1394
1380
|
}
|
|
1395
1381
|
if (!response.hasMore) return;
|
|
1396
|
-
|
|
1382
|
+
const nextOffset = response.nextOffset;
|
|
1383
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1397
1384
|
}
|
|
1398
1385
|
}
|
|
1399
1386
|
/**
|
|
1400
|
-
*
|
|
1387
|
+
* Set custom name for subscriber
|
|
1401
1388
|
*/
|
|
1402
|
-
|
|
1389
|
+
setCustomName(params) {
|
|
1403
1390
|
return request(this._config, {
|
|
1404
|
-
path: `/v2/access/subscribers/${encodeURIComponent(String(params.userId))}/
|
|
1391
|
+
path: `/v2/access/subscribers/${encodeURIComponent(String(params.userId))}/custom-name`,
|
|
1405
1392
|
method: "PUT",
|
|
1406
1393
|
body: params.body
|
|
1407
1394
|
});
|
|
@@ -1417,11 +1404,11 @@ var AccessSubscribersNamespace = class {
|
|
|
1417
1404
|
});
|
|
1418
1405
|
}
|
|
1419
1406
|
/**
|
|
1420
|
-
*
|
|
1407
|
+
* Update subscriber note
|
|
1421
1408
|
*/
|
|
1422
|
-
|
|
1409
|
+
setNote(params) {
|
|
1423
1410
|
return request(this._config, {
|
|
1424
|
-
path: `/v2/access/subscribers/${encodeURIComponent(String(params.userId))}/
|
|
1411
|
+
path: `/v2/access/subscribers/${encodeURIComponent(String(params.userId))}/note`,
|
|
1425
1412
|
method: "PUT",
|
|
1426
1413
|
body: params.body
|
|
1427
1414
|
});
|
|
@@ -1449,9 +1436,9 @@ var AccessSubscriptionsNamespace = class {
|
|
|
1449
1436
|
}
|
|
1450
1437
|
/**
|
|
1451
1438
|
* List subscriptions
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1439
|
+
*
|
|
1440
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1441
|
+
*/
|
|
1455
1442
|
async *iterate(params) {
|
|
1456
1443
|
let offset = 0;
|
|
1457
1444
|
let fetched = 0;
|
|
@@ -1469,27 +1456,10 @@ var AccessSubscriptionsNamespace = class {
|
|
|
1469
1456
|
fetched++;
|
|
1470
1457
|
}
|
|
1471
1458
|
if (!response.hasMore) return;
|
|
1472
|
-
|
|
1459
|
+
const nextOffset = response.nextOffset;
|
|
1460
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1473
1461
|
}
|
|
1474
1462
|
}
|
|
1475
|
-
/**
|
|
1476
|
-
* Get subscription
|
|
1477
|
-
*/
|
|
1478
|
-
get(params) {
|
|
1479
|
-
return request(this._config, {
|
|
1480
|
-
path: `/v2/access/subscriptions/${encodeURIComponent(String(params.subscriptionId))}`,
|
|
1481
|
-
method: "GET"
|
|
1482
|
-
});
|
|
1483
|
-
}
|
|
1484
|
-
/**
|
|
1485
|
-
* Get subscription counts
|
|
1486
|
-
*/
|
|
1487
|
-
getCount() {
|
|
1488
|
-
return request(this._config, {
|
|
1489
|
-
path: "/v2/access/subscriptions/count",
|
|
1490
|
-
method: "GET"
|
|
1491
|
-
});
|
|
1492
|
-
}
|
|
1493
1463
|
/**
|
|
1494
1464
|
* Get subscription history
|
|
1495
1465
|
*/
|
|
@@ -1502,260 +1472,274 @@ var AccessSubscriptionsNamespace = class {
|
|
|
1502
1472
|
}
|
|
1503
1473
|
});
|
|
1504
1474
|
}
|
|
1505
|
-
};
|
|
1506
|
-
var AccessPromotionsTrackingLinksNamespace = class {
|
|
1507
|
-
constructor(config) {
|
|
1508
|
-
this._config = config;
|
|
1509
|
-
}
|
|
1510
1475
|
/**
|
|
1511
|
-
*
|
|
1476
|
+
* Get subscription counts
|
|
1512
1477
|
*/
|
|
1513
|
-
|
|
1478
|
+
getCount() {
|
|
1514
1479
|
return request(this._config, {
|
|
1515
|
-
path: "/v2/access/
|
|
1516
|
-
method: "GET"
|
|
1517
|
-
query: {
|
|
1518
|
-
"limit": params.limit,
|
|
1519
|
-
"offset": params.offset,
|
|
1520
|
-
"pagination": params.pagination,
|
|
1521
|
-
"with_deleted": params.withDeleted,
|
|
1522
|
-
"sorting_deleted": params.sortingDeleted,
|
|
1523
|
-
"stats": params.stats
|
|
1524
|
-
}
|
|
1480
|
+
path: "/v2/access/subscriptions/count",
|
|
1481
|
+
method: "GET"
|
|
1525
1482
|
});
|
|
1526
1483
|
}
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
*/
|
|
1532
|
-
async *iterate(params) {
|
|
1533
|
-
let offset = 0;
|
|
1534
|
-
let fetched = 0;
|
|
1535
|
-
const limit = params?.pageSize ?? 20;
|
|
1536
|
-
const maxItems = params?.maxItems ?? Infinity;
|
|
1537
|
-
while (fetched < maxItems) {
|
|
1538
|
-
const response = await this.list({
|
|
1539
|
-
...params,
|
|
1540
|
-
limit: Math.min(limit, maxItems - fetched),
|
|
1541
|
-
offset
|
|
1542
|
-
});
|
|
1543
|
-
for (const item of response.list) {
|
|
1544
|
-
if (fetched >= maxItems) return;
|
|
1545
|
-
yield item;
|
|
1546
|
-
fetched++;
|
|
1547
|
-
}
|
|
1548
|
-
if (!response.hasMore) return;
|
|
1549
|
-
offset = response.nextOffset ?? offset + response.list.length;
|
|
1550
|
-
}
|
|
1484
|
+
};
|
|
1485
|
+
var AccessUploadsNamespace = class {
|
|
1486
|
+
constructor(config) {
|
|
1487
|
+
this._config = config;
|
|
1551
1488
|
}
|
|
1552
1489
|
/**
|
|
1553
|
-
*
|
|
1490
|
+
* Upload single-part media and finalize (No need to call /complete after upload if using this endpoint)
|
|
1554
1491
|
*/
|
|
1555
|
-
|
|
1492
|
+
replace(params) {
|
|
1556
1493
|
return request(this._config, {
|
|
1557
|
-
path:
|
|
1558
|
-
method: "
|
|
1559
|
-
body: params.body
|
|
1494
|
+
path: `/v2/access/uploads/${encodeURIComponent(String(params.mediaUploadId))}`,
|
|
1495
|
+
method: "PUT"
|
|
1560
1496
|
});
|
|
1561
1497
|
}
|
|
1562
1498
|
/**
|
|
1563
|
-
*
|
|
1499
|
+
* Upload chunk to managed media upload
|
|
1564
1500
|
*/
|
|
1565
|
-
|
|
1501
|
+
replaceParts(params) {
|
|
1566
1502
|
return request(this._config, {
|
|
1567
|
-
path: `/v2/access/
|
|
1568
|
-
method: "
|
|
1503
|
+
path: `/v2/access/uploads/${encodeURIComponent(String(params.mediaUploadId))}/parts/${encodeURIComponent(String(params.partNumber))}`,
|
|
1504
|
+
method: "PUT"
|
|
1569
1505
|
});
|
|
1570
1506
|
}
|
|
1571
1507
|
/**
|
|
1572
|
-
*
|
|
1508
|
+
* Check if media already exists in vault
|
|
1573
1509
|
*/
|
|
1574
|
-
|
|
1510
|
+
check(params) {
|
|
1575
1511
|
return request(this._config, {
|
|
1576
|
-
path:
|
|
1577
|
-
method: "
|
|
1512
|
+
path: "/v2/access/uploads/check",
|
|
1513
|
+
method: "POST",
|
|
1578
1514
|
body: params.body
|
|
1579
1515
|
});
|
|
1580
1516
|
}
|
|
1581
1517
|
/**
|
|
1582
|
-
*
|
|
1583
|
-
*/
|
|
1584
|
-
delete(params) {
|
|
1585
|
-
return request(this._config, {
|
|
1586
|
-
path: `/v2/access/promotions/tracking-links/${encodeURIComponent(String(params.trackingLinkId))}`,
|
|
1587
|
-
method: "DELETE"
|
|
1588
|
-
});
|
|
1589
|
-
}
|
|
1590
|
-
/**
|
|
1591
|
-
* Share tracking link access
|
|
1518
|
+
* Finalize media upload
|
|
1592
1519
|
*/
|
|
1593
|
-
|
|
1520
|
+
complete(params) {
|
|
1594
1521
|
return request(this._config, {
|
|
1595
|
-
path: "/v2/access/
|
|
1522
|
+
path: "/v2/access/uploads/complete",
|
|
1596
1523
|
method: "POST",
|
|
1597
1524
|
body: params.body
|
|
1598
1525
|
});
|
|
1599
1526
|
}
|
|
1600
1527
|
/**
|
|
1601
|
-
*
|
|
1528
|
+
* Initialize media upload
|
|
1602
1529
|
*/
|
|
1603
|
-
|
|
1530
|
+
init(params) {
|
|
1604
1531
|
return request(this._config, {
|
|
1605
|
-
path: "/v2/access/
|
|
1606
|
-
method: "
|
|
1532
|
+
path: "/v2/access/uploads/init",
|
|
1533
|
+
method: "POST",
|
|
1607
1534
|
body: params.body
|
|
1608
1535
|
});
|
|
1609
1536
|
}
|
|
1537
|
+
};
|
|
1538
|
+
var AccessUsersListsNamespace = class {
|
|
1539
|
+
constructor(config) {
|
|
1540
|
+
this._config = config;
|
|
1541
|
+
}
|
|
1610
1542
|
/**
|
|
1611
|
-
*
|
|
1543
|
+
* Add user to multiple lists
|
|
1612
1544
|
*/
|
|
1613
|
-
|
|
1614
|
-
return request(this._config, {
|
|
1615
|
-
path: `/v2/access/
|
|
1616
|
-
method: "
|
|
1545
|
+
create(params) {
|
|
1546
|
+
return request(this._config, {
|
|
1547
|
+
path: `/v2/access/users/${encodeURIComponent(String(params.userId))}/lists`,
|
|
1548
|
+
method: "POST",
|
|
1549
|
+
body: params.body
|
|
1617
1550
|
});
|
|
1618
1551
|
}
|
|
1619
|
-
};
|
|
1620
|
-
var AccessPromotionsTrialLinksNamespace = class {
|
|
1621
|
-
constructor(config) {
|
|
1622
|
-
this._config = config;
|
|
1623
|
-
}
|
|
1624
1552
|
/**
|
|
1625
|
-
* List
|
|
1553
|
+
* List user lists
|
|
1626
1554
|
*/
|
|
1627
1555
|
list(params) {
|
|
1628
1556
|
return request(this._config, {
|
|
1629
|
-
path: "/v2/access/
|
|
1557
|
+
path: "/v2/access/users/lists",
|
|
1630
1558
|
method: "GET",
|
|
1631
1559
|
query: {
|
|
1632
1560
|
"limit": params.limit,
|
|
1633
|
-
"offset": params.offset
|
|
1561
|
+
"offset": params.offset,
|
|
1562
|
+
"query": params.query
|
|
1634
1563
|
}
|
|
1635
1564
|
});
|
|
1636
1565
|
}
|
|
1637
1566
|
/**
|
|
1638
|
-
*
|
|
1567
|
+
* List user lists
|
|
1568
|
+
*
|
|
1569
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1570
|
+
*/
|
|
1571
|
+
async *iterate(params) {
|
|
1572
|
+
let offset = 0;
|
|
1573
|
+
let fetched = 0;
|
|
1574
|
+
const limit = params?.pageSize ?? 20;
|
|
1575
|
+
const maxItems = params?.maxItems ?? Infinity;
|
|
1576
|
+
while (fetched < maxItems) {
|
|
1577
|
+
const response = await this.list({
|
|
1578
|
+
...params,
|
|
1579
|
+
limit: Math.min(limit, maxItems - fetched),
|
|
1580
|
+
offset
|
|
1581
|
+
});
|
|
1582
|
+
for (const item of response.list) {
|
|
1583
|
+
if (fetched >= maxItems) return;
|
|
1584
|
+
yield item;
|
|
1585
|
+
fetched++;
|
|
1586
|
+
}
|
|
1587
|
+
if (!response.hasMore) return;
|
|
1588
|
+
const nextOffset = response.nextOffset;
|
|
1589
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
/**
|
|
1593
|
+
* Create user list
|
|
1639
1594
|
*/
|
|
1640
|
-
|
|
1595
|
+
create2(params) {
|
|
1641
1596
|
return request(this._config, {
|
|
1642
|
-
path: "/v2/access/
|
|
1597
|
+
path: "/v2/access/users/lists",
|
|
1643
1598
|
method: "POST",
|
|
1644
1599
|
body: params.body
|
|
1645
1600
|
});
|
|
1646
1601
|
}
|
|
1647
1602
|
/**
|
|
1648
|
-
* Get
|
|
1603
|
+
* Get user list
|
|
1649
1604
|
*/
|
|
1650
1605
|
get(params) {
|
|
1651
1606
|
return request(this._config, {
|
|
1652
|
-
path: `/v2/access/
|
|
1607
|
+
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}`,
|
|
1653
1608
|
method: "GET"
|
|
1654
1609
|
});
|
|
1655
1610
|
}
|
|
1656
1611
|
/**
|
|
1657
|
-
* Update
|
|
1612
|
+
* Update user list
|
|
1658
1613
|
*/
|
|
1659
|
-
|
|
1614
|
+
update(params) {
|
|
1660
1615
|
return request(this._config, {
|
|
1661
|
-
path: `/v2/access/
|
|
1662
|
-
method: "
|
|
1616
|
+
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}`,
|
|
1617
|
+
method: "PATCH",
|
|
1663
1618
|
body: params.body
|
|
1664
1619
|
});
|
|
1665
1620
|
}
|
|
1666
1621
|
/**
|
|
1667
|
-
* Delete
|
|
1622
|
+
* Delete user list
|
|
1668
1623
|
*/
|
|
1669
1624
|
delete(params) {
|
|
1670
1625
|
return request(this._config, {
|
|
1671
|
-
path: `/v2/access/
|
|
1626
|
+
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}`,
|
|
1672
1627
|
method: "DELETE"
|
|
1673
1628
|
});
|
|
1674
1629
|
}
|
|
1675
1630
|
/**
|
|
1676
|
-
*
|
|
1631
|
+
* List users in user list
|
|
1677
1632
|
*/
|
|
1678
|
-
|
|
1633
|
+
listUsers(params) {
|
|
1679
1634
|
return request(this._config, {
|
|
1680
|
-
path:
|
|
1681
|
-
method: "
|
|
1682
|
-
|
|
1635
|
+
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}/users`,
|
|
1636
|
+
method: "GET",
|
|
1637
|
+
query: {
|
|
1638
|
+
"limit": params.limit,
|
|
1639
|
+
"offset": params.offset
|
|
1640
|
+
}
|
|
1683
1641
|
});
|
|
1684
1642
|
}
|
|
1685
1643
|
/**
|
|
1686
|
-
*
|
|
1644
|
+
* List users in user list
|
|
1645
|
+
*
|
|
1646
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1647
|
+
*/
|
|
1648
|
+
async *iterateUsers(params) {
|
|
1649
|
+
let offset = 0;
|
|
1650
|
+
let fetched = 0;
|
|
1651
|
+
const limit = params?.pageSize ?? 20;
|
|
1652
|
+
const maxItems = params?.maxItems ?? Infinity;
|
|
1653
|
+
while (fetched < maxItems) {
|
|
1654
|
+
const response = await this.listUsers({
|
|
1655
|
+
...params,
|
|
1656
|
+
limit: Math.min(limit, maxItems - fetched),
|
|
1657
|
+
offset
|
|
1658
|
+
});
|
|
1659
|
+
for (const item of response.list) {
|
|
1660
|
+
if (fetched >= maxItems) return;
|
|
1661
|
+
yield item;
|
|
1662
|
+
fetched++;
|
|
1663
|
+
}
|
|
1664
|
+
if (!response.hasMore) return;
|
|
1665
|
+
const nextOffset = response.nextOffset;
|
|
1666
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1667
|
+
}
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* Add user to list
|
|
1687
1671
|
*/
|
|
1688
|
-
|
|
1672
|
+
createUsers(params) {
|
|
1689
1673
|
return request(this._config, {
|
|
1690
|
-
path:
|
|
1691
|
-
method: "
|
|
1692
|
-
body: params.body
|
|
1674
|
+
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}/users/${encodeURIComponent(String(params.userId))}`,
|
|
1675
|
+
method: "POST"
|
|
1693
1676
|
});
|
|
1694
1677
|
}
|
|
1695
|
-
};
|
|
1696
|
-
var AccessPromotionsNamespace = class {
|
|
1697
|
-
constructor(config) {
|
|
1698
|
-
this._config = config;
|
|
1699
|
-
this.trackingLinks = new AccessPromotionsTrackingLinksNamespace(config);
|
|
1700
|
-
this.trialLinks = new AccessPromotionsTrialLinksNamespace(config);
|
|
1701
|
-
}
|
|
1702
1678
|
/**
|
|
1703
|
-
*
|
|
1679
|
+
* Remove user from user list
|
|
1704
1680
|
*/
|
|
1705
|
-
|
|
1681
|
+
deleteUsers(params) {
|
|
1706
1682
|
return request(this._config, {
|
|
1707
|
-
path:
|
|
1708
|
-
method: "
|
|
1709
|
-
query: {
|
|
1710
|
-
"limit": params.limit,
|
|
1711
|
-
"offset": params.offset
|
|
1712
|
-
}
|
|
1683
|
+
path: `/v2/access/users/lists/${encodeURIComponent(String(params.listId))}/users/${encodeURIComponent(String(params.userId))}`,
|
|
1684
|
+
method: "DELETE"
|
|
1713
1685
|
});
|
|
1714
1686
|
}
|
|
1687
|
+
};
|
|
1688
|
+
var AccessUsersNamespace = class {
|
|
1689
|
+
constructor(config) {
|
|
1690
|
+
this._config = config;
|
|
1691
|
+
this.lists = new AccessUsersListsNamespace(config);
|
|
1692
|
+
}
|
|
1715
1693
|
/**
|
|
1716
|
-
*
|
|
1694
|
+
* Get user
|
|
1717
1695
|
*/
|
|
1718
|
-
|
|
1696
|
+
get(params) {
|
|
1719
1697
|
return request(this._config, {
|
|
1720
|
-
path:
|
|
1721
|
-
method: "
|
|
1722
|
-
body: params.body
|
|
1698
|
+
path: `/v2/access/users/${encodeURIComponent(String(params.userId))}`,
|
|
1699
|
+
method: "GET"
|
|
1723
1700
|
});
|
|
1724
1701
|
}
|
|
1725
1702
|
/**
|
|
1726
|
-
*
|
|
1703
|
+
* List user posts
|
|
1727
1704
|
*/
|
|
1728
|
-
|
|
1705
|
+
listPosts(params) {
|
|
1729
1706
|
return request(this._config, {
|
|
1730
|
-
path: `/v2/access/
|
|
1731
|
-
method: "GET"
|
|
1707
|
+
path: `/v2/access/users/${encodeURIComponent(String(params.userId))}/posts`,
|
|
1708
|
+
method: "GET",
|
|
1709
|
+
query: {
|
|
1710
|
+
"limit": params.limit,
|
|
1711
|
+
"sortBy": params.sortBy,
|
|
1712
|
+
"sortDirection": params.sortDirection,
|
|
1713
|
+
"pinned": params.pinned,
|
|
1714
|
+
"includePostCounts": params.includePostCounts,
|
|
1715
|
+
"beforePublishTime": params.beforePublishTime
|
|
1716
|
+
}
|
|
1732
1717
|
});
|
|
1733
1718
|
}
|
|
1734
1719
|
/**
|
|
1735
|
-
*
|
|
1720
|
+
* Restrict user
|
|
1736
1721
|
*/
|
|
1737
|
-
|
|
1722
|
+
restrict(params) {
|
|
1738
1723
|
return request(this._config, {
|
|
1739
|
-
path: `/v2/access/
|
|
1740
|
-
method: "
|
|
1741
|
-
body: params.body
|
|
1724
|
+
path: `/v2/access/users/${encodeURIComponent(String(params.userId))}/restrict`,
|
|
1725
|
+
method: "POST"
|
|
1742
1726
|
});
|
|
1743
1727
|
}
|
|
1744
1728
|
/**
|
|
1745
|
-
*
|
|
1729
|
+
* Unrestrict user
|
|
1746
1730
|
*/
|
|
1747
|
-
|
|
1731
|
+
restrict2(params) {
|
|
1748
1732
|
return request(this._config, {
|
|
1749
|
-
path: `/v2/access/
|
|
1733
|
+
path: `/v2/access/users/${encodeURIComponent(String(params.userId))}/restrict`,
|
|
1750
1734
|
method: "DELETE"
|
|
1751
1735
|
});
|
|
1752
1736
|
}
|
|
1753
1737
|
/**
|
|
1754
|
-
* List
|
|
1738
|
+
* List restricted users
|
|
1755
1739
|
*/
|
|
1756
|
-
|
|
1740
|
+
getRestrict(params) {
|
|
1757
1741
|
return request(this._config, {
|
|
1758
|
-
path: "/v2/access/
|
|
1742
|
+
path: "/v2/access/users/restrict",
|
|
1759
1743
|
method: "GET",
|
|
1760
1744
|
query: {
|
|
1761
1745
|
"limit": params.limit,
|
|
@@ -1764,50 +1748,94 @@ var AccessPromotionsNamespace = class {
|
|
|
1764
1748
|
});
|
|
1765
1749
|
}
|
|
1766
1750
|
/**
|
|
1767
|
-
*
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1751
|
+
* List restricted users
|
|
1752
|
+
*
|
|
1753
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1754
|
+
*/
|
|
1755
|
+
async *iterateRestrict(params) {
|
|
1756
|
+
let offset = 0;
|
|
1757
|
+
let fetched = 0;
|
|
1758
|
+
const limit = params?.pageSize ?? 20;
|
|
1759
|
+
const maxItems = params?.maxItems ?? Infinity;
|
|
1760
|
+
while (fetched < maxItems) {
|
|
1761
|
+
const response = await this.getRestrict({
|
|
1762
|
+
...params,
|
|
1763
|
+
limit: Math.min(limit, maxItems - fetched),
|
|
1764
|
+
offset
|
|
1765
|
+
});
|
|
1766
|
+
for (const item of response.list) {
|
|
1767
|
+
if (fetched >= maxItems) return;
|
|
1768
|
+
yield item;
|
|
1769
|
+
fetched++;
|
|
1770
|
+
}
|
|
1771
|
+
if (!response.hasMore) return;
|
|
1772
|
+
const nextOffset = response.nextOffset;
|
|
1773
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1774
|
+
}
|
|
1775
1775
|
}
|
|
1776
1776
|
/**
|
|
1777
|
-
*
|
|
1777
|
+
* List blocked users
|
|
1778
1778
|
*/
|
|
1779
|
-
|
|
1779
|
+
getBlocked(params) {
|
|
1780
1780
|
return request(this._config, {
|
|
1781
|
-
path:
|
|
1782
|
-
method: "GET"
|
|
1781
|
+
path: "/v2/access/users/blocked",
|
|
1782
|
+
method: "GET",
|
|
1783
|
+
query: {
|
|
1784
|
+
"limit": params.limit,
|
|
1785
|
+
"offset": params.offset
|
|
1786
|
+
}
|
|
1783
1787
|
});
|
|
1784
1788
|
}
|
|
1785
1789
|
/**
|
|
1786
|
-
*
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1790
|
+
* List blocked users
|
|
1791
|
+
*
|
|
1792
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1793
|
+
*/
|
|
1794
|
+
async *iterateBlocked(params) {
|
|
1795
|
+
let offset = 0;
|
|
1796
|
+
let fetched = 0;
|
|
1797
|
+
const limit = params?.pageSize ?? 20;
|
|
1798
|
+
const maxItems = params?.maxItems ?? Infinity;
|
|
1799
|
+
while (fetched < maxItems) {
|
|
1800
|
+
const response = await this.getBlocked({
|
|
1801
|
+
...params,
|
|
1802
|
+
limit: Math.min(limit, maxItems - fetched),
|
|
1803
|
+
offset
|
|
1804
|
+
});
|
|
1805
|
+
for (const item of response.list) {
|
|
1806
|
+
if (fetched >= maxItems) return;
|
|
1807
|
+
yield item;
|
|
1808
|
+
fetched++;
|
|
1809
|
+
}
|
|
1810
|
+
if (!response.hasMore) return;
|
|
1811
|
+
const nextOffset = response.nextOffset;
|
|
1812
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1813
|
+
}
|
|
1794
1814
|
}
|
|
1795
1815
|
/**
|
|
1796
|
-
*
|
|
1816
|
+
* List users by IDs
|
|
1797
1817
|
*/
|
|
1798
|
-
|
|
1818
|
+
getList(params) {
|
|
1799
1819
|
return request(this._config, {
|
|
1800
|
-
path:
|
|
1801
|
-
method: "
|
|
1820
|
+
path: "/v2/access/users/list",
|
|
1821
|
+
method: "GET",
|
|
1822
|
+
query: {
|
|
1823
|
+
"userIds": params.userIds
|
|
1824
|
+
}
|
|
1802
1825
|
});
|
|
1803
1826
|
}
|
|
1804
1827
|
/**
|
|
1805
|
-
*
|
|
1828
|
+
* Search performers
|
|
1806
1829
|
*/
|
|
1807
|
-
|
|
1830
|
+
search(params) {
|
|
1808
1831
|
return request(this._config, {
|
|
1809
|
-
path:
|
|
1810
|
-
method: "
|
|
1832
|
+
path: "/v2/access/users/search",
|
|
1833
|
+
method: "GET",
|
|
1834
|
+
query: {
|
|
1835
|
+
"limit": params.limit,
|
|
1836
|
+
"offset": params.offset,
|
|
1837
|
+
"query": params.query
|
|
1838
|
+
}
|
|
1811
1839
|
});
|
|
1812
1840
|
}
|
|
1813
1841
|
};
|
|
@@ -1831,9 +1859,9 @@ var AccessVaultListsNamespace = class {
|
|
|
1831
1859
|
}
|
|
1832
1860
|
/**
|
|
1833
1861
|
* List vault folders
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1862
|
+
*
|
|
1863
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1864
|
+
*/
|
|
1837
1865
|
async *iterate(params) {
|
|
1838
1866
|
let offset = 0;
|
|
1839
1867
|
let fetched = 0;
|
|
@@ -1851,7 +1879,8 @@ var AccessVaultListsNamespace = class {
|
|
|
1851
1879
|
fetched++;
|
|
1852
1880
|
}
|
|
1853
1881
|
if (!response.hasMore) return;
|
|
1854
|
-
|
|
1882
|
+
const nextOffset = response.nextOffset;
|
|
1883
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1855
1884
|
}
|
|
1856
1885
|
}
|
|
1857
1886
|
/**
|
|
@@ -1902,9 +1931,9 @@ var AccessVaultListsNamespace = class {
|
|
|
1902
1931
|
}
|
|
1903
1932
|
/**
|
|
1904
1933
|
* List media in vault list
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1934
|
+
*
|
|
1935
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1936
|
+
*/
|
|
1908
1937
|
async *iterateMedia(params) {
|
|
1909
1938
|
let offset = 0;
|
|
1910
1939
|
let fetched = 0;
|
|
@@ -1922,7 +1951,8 @@ var AccessVaultListsNamespace = class {
|
|
|
1922
1951
|
fetched++;
|
|
1923
1952
|
}
|
|
1924
1953
|
if (!response.hasMore) return;
|
|
1925
|
-
|
|
1954
|
+
const nextOffset = response.nextOffset;
|
|
1955
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1926
1956
|
}
|
|
1927
1957
|
}
|
|
1928
1958
|
/**
|
|
@@ -1961,9 +1991,9 @@ var AccessVaultNamespace = class {
|
|
|
1961
1991
|
}
|
|
1962
1992
|
/**
|
|
1963
1993
|
* List vault media
|
|
1964
|
-
|
|
1965
|
-
|
|
1966
|
-
|
|
1994
|
+
*
|
|
1995
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
1996
|
+
*/
|
|
1967
1997
|
async *iterateMedia(params) {
|
|
1968
1998
|
let offset = 0;
|
|
1969
1999
|
let fetched = 0;
|
|
@@ -1981,77 +2011,103 @@ var AccessVaultNamespace = class {
|
|
|
1981
2011
|
fetched++;
|
|
1982
2012
|
}
|
|
1983
2013
|
if (!response.hasMore) return;
|
|
1984
|
-
|
|
2014
|
+
const nextOffset = response.nextOffset;
|
|
2015
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
1985
2016
|
}
|
|
1986
2017
|
}
|
|
1987
2018
|
};
|
|
1988
|
-
var
|
|
2019
|
+
var AccessNamespace = class {
|
|
1989
2020
|
constructor(config) {
|
|
1990
2021
|
this._config = config;
|
|
2022
|
+
this.analytics = new AccessAnalyticsNamespace(config);
|
|
2023
|
+
this.chats = new AccessChatsNamespace(config);
|
|
2024
|
+
this.earnings = new AccessEarningsNamespace(config);
|
|
2025
|
+
this.promotions = new AccessPromotionsNamespace(config);
|
|
2026
|
+
this.self = new AccessSelfNamespace(config);
|
|
2027
|
+
this.subscribers = new AccessSubscribersNamespace(config);
|
|
2028
|
+
this.subscriptions = new AccessSubscriptionsNamespace(config);
|
|
2029
|
+
this.uploads = new AccessUploadsNamespace(config);
|
|
2030
|
+
this.users = new AccessUsersNamespace(config);
|
|
2031
|
+
this.vault = new AccessVaultNamespace(config);
|
|
1991
2032
|
}
|
|
1992
2033
|
/**
|
|
1993
|
-
*
|
|
2034
|
+
* List mass messages
|
|
1994
2035
|
*/
|
|
1995
|
-
|
|
2036
|
+
listMassMessages(params) {
|
|
1996
2037
|
return request(this._config, {
|
|
1997
|
-
path:
|
|
1998
|
-
method: "
|
|
2038
|
+
path: "/v2/access/mass-messages",
|
|
2039
|
+
method: "GET",
|
|
2040
|
+
query: {
|
|
2041
|
+
"limit": params.limit,
|
|
2042
|
+
"offset": params.offset,
|
|
2043
|
+
"type": params.type
|
|
2044
|
+
}
|
|
1999
2045
|
});
|
|
2000
2046
|
}
|
|
2001
2047
|
/**
|
|
2002
|
-
*
|
|
2048
|
+
* List mass messages
|
|
2049
|
+
*
|
|
2050
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
2051
|
+
*/
|
|
2052
|
+
async *iterateMassMessages(params) {
|
|
2053
|
+
let offset = 0;
|
|
2054
|
+
let fetched = 0;
|
|
2055
|
+
const limit = params?.pageSize ?? 20;
|
|
2056
|
+
const maxItems = params?.maxItems ?? Infinity;
|
|
2057
|
+
while (fetched < maxItems) {
|
|
2058
|
+
const response = await this.listMassMessages({
|
|
2059
|
+
...params,
|
|
2060
|
+
limit: Math.min(limit, maxItems - fetched),
|
|
2061
|
+
offset
|
|
2062
|
+
});
|
|
2063
|
+
for (const item of response.list) {
|
|
2064
|
+
if (fetched >= maxItems) return;
|
|
2065
|
+
yield item;
|
|
2066
|
+
fetched++;
|
|
2067
|
+
}
|
|
2068
|
+
if (!response.hasMore) return;
|
|
2069
|
+
const nextOffset = response.nextOffset;
|
|
2070
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
2071
|
+
}
|
|
2072
|
+
}
|
|
2073
|
+
/**
|
|
2074
|
+
* Create mass message
|
|
2003
2075
|
*/
|
|
2004
|
-
|
|
2076
|
+
createMassMessages(params) {
|
|
2005
2077
|
return request(this._config, {
|
|
2006
|
-
path: "/v2/access/
|
|
2078
|
+
path: "/v2/access/mass-messages",
|
|
2007
2079
|
method: "POST",
|
|
2008
2080
|
body: params.body
|
|
2009
2081
|
});
|
|
2010
2082
|
}
|
|
2011
2083
|
/**
|
|
2012
|
-
*
|
|
2084
|
+
* Get mass message
|
|
2013
2085
|
*/
|
|
2014
|
-
|
|
2086
|
+
getMassMessages(params) {
|
|
2015
2087
|
return request(this._config, {
|
|
2016
|
-
path:
|
|
2017
|
-
method: "
|
|
2018
|
-
body: params.body
|
|
2088
|
+
path: `/v2/access/mass-messages/${encodeURIComponent(String(params.massMessageId))}`,
|
|
2089
|
+
method: "GET"
|
|
2019
2090
|
});
|
|
2020
2091
|
}
|
|
2021
2092
|
/**
|
|
2022
|
-
*
|
|
2093
|
+
* Update mass message
|
|
2023
2094
|
*/
|
|
2024
|
-
|
|
2095
|
+
replaceMassMessages(params) {
|
|
2025
2096
|
return request(this._config, {
|
|
2026
|
-
path: `/v2/access/
|
|
2027
|
-
method: "PUT"
|
|
2097
|
+
path: `/v2/access/mass-messages/${encodeURIComponent(String(params.massMessageId))}`,
|
|
2098
|
+
method: "PUT",
|
|
2099
|
+
body: params.body
|
|
2028
2100
|
});
|
|
2029
2101
|
}
|
|
2030
2102
|
/**
|
|
2031
|
-
*
|
|
2103
|
+
* Delete mass message
|
|
2032
2104
|
*/
|
|
2033
|
-
|
|
2105
|
+
deleteMassMessages(params) {
|
|
2034
2106
|
return request(this._config, {
|
|
2035
|
-
path:
|
|
2036
|
-
method: "
|
|
2037
|
-
body: params.body
|
|
2107
|
+
path: `/v2/access/mass-messages/${encodeURIComponent(String(params.massMessageId))}`,
|
|
2108
|
+
method: "DELETE"
|
|
2038
2109
|
});
|
|
2039
2110
|
}
|
|
2040
|
-
};
|
|
2041
|
-
var AccessNamespace = class {
|
|
2042
|
-
constructor(config) {
|
|
2043
|
-
this._config = config;
|
|
2044
|
-
this.self = new AccessSelfNamespace(config);
|
|
2045
|
-
this.earnings = new AccessEarningsNamespace(config);
|
|
2046
|
-
this.analytics = new AccessAnalyticsNamespace(config);
|
|
2047
|
-
this.users = new AccessUsersNamespace(config);
|
|
2048
|
-
this.chats = new AccessChatsNamespace(config);
|
|
2049
|
-
this.subscribers = new AccessSubscribersNamespace(config);
|
|
2050
|
-
this.subscriptions = new AccessSubscriptionsNamespace(config);
|
|
2051
|
-
this.promotions = new AccessPromotionsNamespace(config);
|
|
2052
|
-
this.vault = new AccessVaultNamespace(config);
|
|
2053
|
-
this.uploads = new AccessUploadsNamespace(config);
|
|
2054
|
-
}
|
|
2055
2111
|
/**
|
|
2056
2112
|
* List own posts
|
|
2057
2113
|
*/
|
|
@@ -2107,32 +2163,38 @@ var AccessNamespace = class {
|
|
|
2107
2163
|
method: "DELETE"
|
|
2108
2164
|
});
|
|
2109
2165
|
}
|
|
2166
|
+
};
|
|
2167
|
+
var AccountConnectionsNamespace = class {
|
|
2168
|
+
constructor(config) {
|
|
2169
|
+
this._config = config;
|
|
2170
|
+
}
|
|
2110
2171
|
/**
|
|
2111
|
-
* List
|
|
2172
|
+
* List connections
|
|
2112
2173
|
*/
|
|
2113
|
-
|
|
2174
|
+
list(params) {
|
|
2114
2175
|
return request(this._config, {
|
|
2115
|
-
path: "/v2/
|
|
2176
|
+
path: "/v2/account/connections",
|
|
2116
2177
|
method: "GET",
|
|
2117
2178
|
query: {
|
|
2179
|
+
"status": params.status,
|
|
2180
|
+
"imported": params.imported,
|
|
2118
2181
|
"limit": params.limit,
|
|
2119
|
-
"offset": params.offset
|
|
2120
|
-
"type": params.type
|
|
2182
|
+
"offset": params.offset
|
|
2121
2183
|
}
|
|
2122
2184
|
});
|
|
2123
2185
|
}
|
|
2124
2186
|
/**
|
|
2125
|
-
* List
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
async *
|
|
2187
|
+
* List connections
|
|
2188
|
+
*
|
|
2189
|
+
* Returns an async iterator that automatically paginates through all results.
|
|
2190
|
+
*/
|
|
2191
|
+
async *iterate(params) {
|
|
2130
2192
|
let offset = 0;
|
|
2131
2193
|
let fetched = 0;
|
|
2132
2194
|
const limit = params?.pageSize ?? 20;
|
|
2133
2195
|
const maxItems = params?.maxItems ?? Infinity;
|
|
2134
2196
|
while (fetched < maxItems) {
|
|
2135
|
-
const response = await this.
|
|
2197
|
+
const response = await this.list({
|
|
2136
2198
|
...params,
|
|
2137
2199
|
limit: Math.min(limit, maxItems - fetched),
|
|
2138
2200
|
offset
|
|
@@ -2143,78 +2205,99 @@ var AccessNamespace = class {
|
|
|
2143
2205
|
fetched++;
|
|
2144
2206
|
}
|
|
2145
2207
|
if (!response.hasMore) return;
|
|
2146
|
-
|
|
2208
|
+
const nextOffset = response.nextOffset;
|
|
2209
|
+
offset = typeof nextOffset === "number" ? nextOffset : typeof nextOffset === "string" && nextOffset.trim() !== "" && Number.isFinite(Number(nextOffset)) ? Number(nextOffset) : offset + response.list.length;
|
|
2147
2210
|
}
|
|
2148
2211
|
}
|
|
2149
2212
|
/**
|
|
2150
|
-
*
|
|
2213
|
+
* Disconnect connection
|
|
2151
2214
|
*/
|
|
2152
|
-
|
|
2215
|
+
delete(params) {
|
|
2153
2216
|
return request(this._config, {
|
|
2154
|
-
path:
|
|
2217
|
+
path: `/v2/account/connections/${encodeURIComponent(String(params.connectionId))}`,
|
|
2218
|
+
method: "DELETE"
|
|
2219
|
+
});
|
|
2220
|
+
}
|
|
2221
|
+
/**
|
|
2222
|
+
* Import connection
|
|
2223
|
+
*/
|
|
2224
|
+
createImport(params) {
|
|
2225
|
+
return request(this._config, {
|
|
2226
|
+
path: "/v2/account/connections/import",
|
|
2155
2227
|
method: "POST",
|
|
2156
2228
|
body: params.body
|
|
2157
2229
|
});
|
|
2158
2230
|
}
|
|
2159
2231
|
/**
|
|
2160
|
-
*
|
|
2232
|
+
* Update imported connection session
|
|
2161
2233
|
*/
|
|
2162
|
-
|
|
2234
|
+
updateImport(params) {
|
|
2163
2235
|
return request(this._config, {
|
|
2164
|
-
path: `/v2/
|
|
2165
|
-
method: "
|
|
2236
|
+
path: `/v2/account/connections/import/${encodeURIComponent(String(params.connectionId))}`,
|
|
2237
|
+
method: "PATCH",
|
|
2238
|
+
body: params.body
|
|
2166
2239
|
});
|
|
2167
2240
|
}
|
|
2168
2241
|
/**
|
|
2169
|
-
*
|
|
2242
|
+
* Invalidate connection
|
|
2170
2243
|
*/
|
|
2171
|
-
|
|
2244
|
+
invalidate(params) {
|
|
2172
2245
|
return request(this._config, {
|
|
2173
|
-
path: `/v2/
|
|
2174
|
-
method: "
|
|
2175
|
-
body: params.body
|
|
2246
|
+
path: `/v2/account/connections/${encodeURIComponent(String(params.connectionId))}/invalidate`,
|
|
2247
|
+
method: "POST"
|
|
2176
2248
|
});
|
|
2177
2249
|
}
|
|
2178
2250
|
/**
|
|
2179
|
-
*
|
|
2251
|
+
* Get connection settings
|
|
2180
2252
|
*/
|
|
2181
|
-
|
|
2253
|
+
getSettings(params) {
|
|
2182
2254
|
return request(this._config, {
|
|
2183
|
-
path: `/v2/
|
|
2184
|
-
method: "
|
|
2255
|
+
path: `/v2/account/connections/${encodeURIComponent(String(params.connectionId))}/settings`,
|
|
2256
|
+
method: "GET"
|
|
2257
|
+
});
|
|
2258
|
+
}
|
|
2259
|
+
/**
|
|
2260
|
+
* Update connection settings
|
|
2261
|
+
*/
|
|
2262
|
+
updateSettings(params) {
|
|
2263
|
+
return request(this._config, {
|
|
2264
|
+
path: `/v2/account/connections/${encodeURIComponent(String(params.connectionId))}/settings`,
|
|
2265
|
+
method: "PATCH",
|
|
2266
|
+
body: params.body
|
|
2185
2267
|
});
|
|
2186
2268
|
}
|
|
2187
2269
|
};
|
|
2188
|
-
var
|
|
2270
|
+
var AccountNamespace = class {
|
|
2189
2271
|
constructor(config) {
|
|
2190
2272
|
this._config = config;
|
|
2273
|
+
this.connections = new AccountConnectionsNamespace(config);
|
|
2191
2274
|
}
|
|
2192
2275
|
/**
|
|
2193
|
-
* Get
|
|
2276
|
+
* Get organization settings
|
|
2194
2277
|
*/
|
|
2195
|
-
|
|
2278
|
+
getSettings() {
|
|
2196
2279
|
return request(this._config, {
|
|
2197
|
-
path:
|
|
2280
|
+
path: "/v2/account/settings",
|
|
2198
2281
|
method: "GET"
|
|
2199
2282
|
});
|
|
2200
2283
|
}
|
|
2201
2284
|
/**
|
|
2202
|
-
*
|
|
2285
|
+
* Update organization settings
|
|
2203
2286
|
*/
|
|
2204
|
-
|
|
2287
|
+
updateSettings(params) {
|
|
2205
2288
|
return request(this._config, {
|
|
2206
|
-
path:
|
|
2207
|
-
method: "
|
|
2289
|
+
path: "/v2/account/settings",
|
|
2290
|
+
method: "PATCH",
|
|
2291
|
+
body: params.body
|
|
2208
2292
|
});
|
|
2209
2293
|
}
|
|
2210
2294
|
/**
|
|
2211
|
-
*
|
|
2295
|
+
* Whoami
|
|
2212
2296
|
*/
|
|
2213
|
-
|
|
2297
|
+
whoami() {
|
|
2214
2298
|
return request(this._config, {
|
|
2215
|
-
path: "/v2/
|
|
2216
|
-
method: "
|
|
2217
|
-
body: params.body
|
|
2299
|
+
path: "/v2/account/whoami",
|
|
2300
|
+
method: "GET"
|
|
2218
2301
|
});
|
|
2219
2302
|
}
|
|
2220
2303
|
};
|
|
@@ -2251,27 +2334,50 @@ var DynamicRulesNamespace = class {
|
|
|
2251
2334
|
});
|
|
2252
2335
|
}
|
|
2253
2336
|
};
|
|
2254
|
-
var
|
|
2337
|
+
var LinkNamespace = class {
|
|
2255
2338
|
constructor(config) {
|
|
2256
2339
|
this._config = config;
|
|
2257
2340
|
}
|
|
2258
2341
|
/**
|
|
2259
|
-
*
|
|
2342
|
+
* Get login status
|
|
2260
2343
|
*/
|
|
2261
|
-
|
|
2344
|
+
get(params) {
|
|
2262
2345
|
return request(this._config, {
|
|
2263
|
-
path: `/v2/
|
|
2346
|
+
path: `/v2/link/${encodeURIComponent(String(params.clientSecret))}`,
|
|
2347
|
+
method: "GET"
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2350
|
+
/**
|
|
2351
|
+
* Delete login session
|
|
2352
|
+
*/
|
|
2353
|
+
delete(params) {
|
|
2354
|
+
return request(this._config, {
|
|
2355
|
+
path: `/v2/link/${encodeURIComponent(String(params.clientSecret))}`,
|
|
2356
|
+
method: "DELETE"
|
|
2357
|
+
});
|
|
2358
|
+
}
|
|
2359
|
+
/**
|
|
2360
|
+
* Initialize a Link session
|
|
2361
|
+
*/
|
|
2362
|
+
init(params) {
|
|
2363
|
+
return request(this._config, {
|
|
2364
|
+
path: "/v2/link/init",
|
|
2264
2365
|
method: "POST",
|
|
2265
|
-
|
|
2366
|
+
body: params.body
|
|
2266
2367
|
});
|
|
2267
2368
|
}
|
|
2369
|
+
};
|
|
2370
|
+
var VaultPlusStoreNamespace = class {
|
|
2371
|
+
constructor(config) {
|
|
2372
|
+
this._config = config;
|
|
2373
|
+
}
|
|
2268
2374
|
/**
|
|
2269
|
-
*
|
|
2375
|
+
* Store all media from a vault list
|
|
2270
2376
|
*/
|
|
2271
|
-
|
|
2377
|
+
createList(params) {
|
|
2272
2378
|
return request(this._config, {
|
|
2273
|
-
path:
|
|
2274
|
-
method: "
|
|
2379
|
+
path: `/v2/vault-plus/store/list/${encodeURIComponent(String(params.listId))}`,
|
|
2380
|
+
method: "POST",
|
|
2275
2381
|
connectionId: params.connectionId
|
|
2276
2382
|
});
|
|
2277
2383
|
}
|
|
@@ -2284,6 +2390,16 @@ var VaultPlusStoreNamespace = class {
|
|
|
2284
2390
|
method: "GET"
|
|
2285
2391
|
});
|
|
2286
2392
|
}
|
|
2393
|
+
/**
|
|
2394
|
+
* Get storage status for a connection
|
|
2395
|
+
*/
|
|
2396
|
+
getStatus(params) {
|
|
2397
|
+
return request(this._config, {
|
|
2398
|
+
path: "/v2/vault-plus/store/status",
|
|
2399
|
+
method: "GET",
|
|
2400
|
+
connectionId: params.connectionId
|
|
2401
|
+
});
|
|
2402
|
+
}
|
|
2287
2403
|
};
|
|
2288
2404
|
var VaultPlusNamespace = class {
|
|
2289
2405
|
constructor(config) {
|
|
@@ -2352,10 +2468,10 @@ var VaultPlusNamespace = class {
|
|
|
2352
2468
|
var OFAuthClient = class {
|
|
2353
2469
|
constructor(config) {
|
|
2354
2470
|
this._config = config;
|
|
2355
|
-
this.account = new AccountNamespace(config);
|
|
2356
2471
|
this.access = new AccessNamespace(config);
|
|
2357
|
-
this.
|
|
2472
|
+
this.account = new AccountNamespace(config);
|
|
2358
2473
|
this.dynamicRules = new DynamicRulesNamespace(config);
|
|
2474
|
+
this.link = new LinkNamespace(config);
|
|
2359
2475
|
this.vaultPlus = new VaultPlusNamespace(config);
|
|
2360
2476
|
}
|
|
2361
2477
|
/**
|