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