postboost 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/.openapi-generator/FILES +72 -0
  2. package/.openapi-generator/VERSION +1 -0
  3. package/.openapi-generator-ignore +23 -0
  4. package/LICENSE +21 -0
  5. package/README.md +0 -0
  6. package/api/accountsApi.ts +247 -0
  7. package/api/apis.ts +28 -0
  8. package/api/mediaApi.ts +1007 -0
  9. package/api/postsApi.ts +827 -0
  10. package/api/receiptsApi.ts +541 -0
  11. package/api/subscriptionsApi.ts +856 -0
  12. package/api/tagsApi.ts +492 -0
  13. package/api/usersApi.ts +537 -0
  14. package/api/workspacesApi.ts +784 -0
  15. package/api.ts +3 -0
  16. package/git_push.sh +57 -0
  17. package/model/account.ts +94 -0
  18. package/model/addGenericSubscriptionRequest.ts +43 -0
  19. package/model/changeSubscriptionPlanRequest.ts +55 -0
  20. package/model/checkoutSubscription200Response.ts +31 -0
  21. package/model/checkoutSubscriptionRequest.ts +49 -0
  22. package/model/deleteMediaBulkRequest.ts +34 -0
  23. package/model/deleteMode.ts +22 -0
  24. package/model/deletePostRequest.ts +40 -0
  25. package/model/deletePostsBulkRequest.ts +52 -0
  26. package/model/deleteReceiptsBulkRequest.ts +31 -0
  27. package/model/deleteResult.ts +43 -0
  28. package/model/deleteUser400Response.ts +37 -0
  29. package/model/deleteUsersBulkRequest.ts +31 -0
  30. package/model/deleteWorkspacesBulkRequest.ts +31 -0
  31. package/model/getRemoteUploadStatus200Response.ts +49 -0
  32. package/model/initiateChunkedUpload200Response.ts +43 -0
  33. package/model/initiateChunkedUploadRequest.ts +46 -0
  34. package/model/initiateRemoteUpload200Response.ts +94 -0
  35. package/model/initiateRemoteUpload200ResponseOneOf.ts +31 -0
  36. package/model/initiateRemoteUploadRequest.ts +40 -0
  37. package/model/listAccounts200Response.ts +32 -0
  38. package/model/listMedia200Response.ts +46 -0
  39. package/model/listPosts200Response.ts +46 -0
  40. package/model/listReceipts200Response.ts +46 -0
  41. package/model/listTags200Response.ts +32 -0
  42. package/model/listUsers200Response.ts +46 -0
  43. package/model/listWorkspaces200Response.ts +46 -0
  44. package/model/media.ts +86 -0
  45. package/model/models.ts +443 -0
  46. package/model/paginationMeta.ts +39 -0
  47. package/model/paginationMetaLinks.ts +49 -0
  48. package/model/paginationMetaMeta.ts +61 -0
  49. package/model/post.ts +91 -0
  50. package/model/postContent.ts +55 -0
  51. package/model/postInput.ts +98 -0
  52. package/model/postStatus.ts +19 -0
  53. package/model/postVersion.ts +59 -0
  54. package/model/receipt.ts +85 -0
  55. package/model/receiptInput.ts +79 -0
  56. package/model/receiptUpdateInput.ts +73 -0
  57. package/model/removeUserFromWorkspaceRequest.ts +31 -0
  58. package/model/schedulePostRequest.ts +31 -0
  59. package/model/scheduleResult.ts +37 -0
  60. package/model/subscription.ts +76 -0
  61. package/model/subscriptionInput.ts +55 -0
  62. package/model/subscriptionStatus.ts +22 -0
  63. package/model/subscriptionUpdateInput.ts +58 -0
  64. package/model/tag.ts +49 -0
  65. package/model/tagInput.ts +37 -0
  66. package/model/updateMediaRequest.ts +34 -0
  67. package/model/uploadChunk200Response.ts +34 -0
  68. package/model/user.ts +61 -0
  69. package/model/userInput.ts +55 -0
  70. package/model/userUpdateInput.ts +58 -0
  71. package/model/workspace.ts +69 -0
  72. package/model/workspaceInput.ts +56 -0
  73. package/model/workspaceUserInput.ts +56 -0
  74. package/package.json +28 -0
  75. package/tsconfig.json +24 -0
@@ -0,0 +1,784 @@
1
+ /**
2
+ * PostBoost API
3
+ * The PostBoost REST API lets you publish, schedule, and analyze social media posts across 8+ platforms from a single integration. No OAuth apps to maintain — PostBoost handles platform authorization for you. ## Base URL All workspace-scoped endpoints are prefixed with `/{workspaceUuid}`. Panel/admin endpoints are prefixed with `/panel`. ## Authentication All requests require a Bearer token in the `Authorization` header. Generate tokens in your PostBoost dashboard under **Settings → Access Tokens**. ``` Authorization: Bearer YOUR_API_TOKEN ```
4
+ *
5
+ * The version of the OpenAPI document: 1.0.0
6
+ * Contact: hi@postboost.co
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+
14
+ import localVarRequest from 'request';
15
+ import http from 'http';
16
+
17
+ /* tslint:disable:no-unused-locals */
18
+ import { DeleteWorkspacesBulkRequest } from '../model/deleteWorkspacesBulkRequest';
19
+ import { ListWorkspaces200Response } from '../model/listWorkspaces200Response';
20
+ import { RemoveUserFromWorkspaceRequest } from '../model/removeUserFromWorkspaceRequest';
21
+ import { Workspace } from '../model/workspace';
22
+ import { WorkspaceInput } from '../model/workspaceInput';
23
+ import { WorkspaceUserInput } from '../model/workspaceUserInput';
24
+
25
+ import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
26
+ import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
27
+
28
+ import { HttpError, RequestFile } from './apis';
29
+
30
+ let defaultBasePath = 'https://postboost.co/app/api';
31
+
32
+ // ===============================================
33
+ // This file is autogenerated - Please do not edit
34
+ // ===============================================
35
+
36
+ export enum WorkspacesApiApiKeys {
37
+ }
38
+
39
+ export class WorkspacesApi {
40
+ protected _basePath = defaultBasePath;
41
+ protected _defaultHeaders : any = {};
42
+ protected _useQuerystring : boolean = false;
43
+
44
+ protected authentications = {
45
+ 'default': <Authentication>new VoidAuth(),
46
+ 'bearerAuth': new HttpBearerAuth(),
47
+ }
48
+
49
+ protected interceptors: Interceptor[] = [];
50
+
51
+ constructor(basePath?: string);
52
+ constructor(basePathOrUsername: string, password?: string, basePath?: string) {
53
+ if (password) {
54
+ if (basePath) {
55
+ this.basePath = basePath;
56
+ }
57
+ } else {
58
+ if (basePathOrUsername) {
59
+ this.basePath = basePathOrUsername
60
+ }
61
+ }
62
+ }
63
+
64
+ set useQuerystring(value: boolean) {
65
+ this._useQuerystring = value;
66
+ }
67
+
68
+ set basePath(basePath: string) {
69
+ this._basePath = basePath;
70
+ }
71
+
72
+ set defaultHeaders(defaultHeaders: any) {
73
+ this._defaultHeaders = defaultHeaders;
74
+ }
75
+
76
+ get defaultHeaders() {
77
+ return this._defaultHeaders;
78
+ }
79
+
80
+ get basePath() {
81
+ return this._basePath;
82
+ }
83
+
84
+ public setDefaultAuthentication(auth: Authentication) {
85
+ this.authentications.default = auth;
86
+ }
87
+
88
+ public setApiKey(key: WorkspacesApiApiKeys, value: string) {
89
+ (this.authentications as any)[WorkspacesApiApiKeys[key]].apiKey = value;
90
+ }
91
+
92
+ set accessToken(accessToken: string | (() => string)) {
93
+ this.authentications.bearerAuth.accessToken = accessToken;
94
+ }
95
+
96
+ public addInterceptor(interceptor: Interceptor) {
97
+ this.interceptors.push(interceptor);
98
+ }
99
+
100
+ /**
101
+ *
102
+ * @summary Add user to workspace
103
+ * @param workspaceUuid UUID of the workspace.
104
+ * @param workspaceUserInput
105
+ */
106
+ public async addUserToWorkspace (workspaceUuid: string, workspaceUserInput: WorkspaceUserInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
107
+ const localVarPath = this.basePath + '/panel/workspaces/{workspaceUuid}/users'
108
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
109
+ let localVarQueryParameters: any = {};
110
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
111
+ const produces = ['application/json'];
112
+ // give precedence to 'application/json'
113
+ if (produces.indexOf('application/json') >= 0) {
114
+ localVarHeaderParams.Accept = 'application/json';
115
+ } else {
116
+ localVarHeaderParams.Accept = produces.join(',');
117
+ }
118
+ let localVarFormParams: any = {};
119
+
120
+ // verify required parameter 'workspaceUuid' is not null or undefined
121
+ if (workspaceUuid === null || workspaceUuid === undefined) {
122
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling addUserToWorkspace.');
123
+ }
124
+
125
+ // verify required parameter 'workspaceUserInput' is not null or undefined
126
+ if (workspaceUserInput === null || workspaceUserInput === undefined) {
127
+ throw new Error('Required parameter workspaceUserInput was null or undefined when calling addUserToWorkspace.');
128
+ }
129
+
130
+ (<any>Object).assign(localVarHeaderParams, options.headers);
131
+
132
+ let localVarUseFormData = false;
133
+
134
+ let localVarRequestOptions: localVarRequest.Options = {
135
+ method: 'POST',
136
+ qs: localVarQueryParameters,
137
+ headers: localVarHeaderParams,
138
+ uri: localVarPath,
139
+ useQuerystring: this._useQuerystring,
140
+ json: true,
141
+ body: ObjectSerializer.serialize(workspaceUserInput, "WorkspaceUserInput")
142
+ };
143
+
144
+ let authenticationPromise = Promise.resolve();
145
+ if (this.authentications.bearerAuth.accessToken) {
146
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
147
+ }
148
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
149
+
150
+ let interceptorPromise = authenticationPromise;
151
+ for (const interceptor of this.interceptors) {
152
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
153
+ }
154
+
155
+ return interceptorPromise.then(() => {
156
+ if (Object.keys(localVarFormParams).length) {
157
+ if (localVarUseFormData) {
158
+ (<any>localVarRequestOptions).formData = localVarFormParams;
159
+ } else {
160
+ localVarRequestOptions.form = localVarFormParams;
161
+ }
162
+ }
163
+ return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
164
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
165
+ if (error) {
166
+ reject(error);
167
+ } else {
168
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
169
+ body = ObjectSerializer.deserialize(body, "object");
170
+ resolve({ response: response, body: body });
171
+ } else {
172
+ reject(new HttpError(response, body, response.statusCode));
173
+ }
174
+ }
175
+ });
176
+ });
177
+ });
178
+ }
179
+ /**
180
+ * Create a new workspace. Admin only.
181
+ * @summary Create workspace
182
+ * @param workspaceInput
183
+ */
184
+ public async createWorkspace (workspaceInput: WorkspaceInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Workspace; }> {
185
+ const localVarPath = this.basePath + '/panel/workspaces';
186
+ let localVarQueryParameters: any = {};
187
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
188
+ const produces = ['application/json'];
189
+ // give precedence to 'application/json'
190
+ if (produces.indexOf('application/json') >= 0) {
191
+ localVarHeaderParams.Accept = 'application/json';
192
+ } else {
193
+ localVarHeaderParams.Accept = produces.join(',');
194
+ }
195
+ let localVarFormParams: any = {};
196
+
197
+ // verify required parameter 'workspaceInput' is not null or undefined
198
+ if (workspaceInput === null || workspaceInput === undefined) {
199
+ throw new Error('Required parameter workspaceInput was null or undefined when calling createWorkspace.');
200
+ }
201
+
202
+ (<any>Object).assign(localVarHeaderParams, options.headers);
203
+
204
+ let localVarUseFormData = false;
205
+
206
+ let localVarRequestOptions: localVarRequest.Options = {
207
+ method: 'POST',
208
+ qs: localVarQueryParameters,
209
+ headers: localVarHeaderParams,
210
+ uri: localVarPath,
211
+ useQuerystring: this._useQuerystring,
212
+ json: true,
213
+ body: ObjectSerializer.serialize(workspaceInput, "WorkspaceInput")
214
+ };
215
+
216
+ let authenticationPromise = Promise.resolve();
217
+ if (this.authentications.bearerAuth.accessToken) {
218
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
219
+ }
220
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
221
+
222
+ let interceptorPromise = authenticationPromise;
223
+ for (const interceptor of this.interceptors) {
224
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
225
+ }
226
+
227
+ return interceptorPromise.then(() => {
228
+ if (Object.keys(localVarFormParams).length) {
229
+ if (localVarUseFormData) {
230
+ (<any>localVarRequestOptions).formData = localVarFormParams;
231
+ } else {
232
+ localVarRequestOptions.form = localVarFormParams;
233
+ }
234
+ }
235
+ return new Promise<{ response: http.IncomingMessage; body: Workspace; }>((resolve, reject) => {
236
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
237
+ if (error) {
238
+ reject(error);
239
+ } else {
240
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
241
+ body = ObjectSerializer.deserialize(body, "Workspace");
242
+ resolve({ response: response, body: body });
243
+ } else {
244
+ reject(new HttpError(response, body, response.statusCode));
245
+ }
246
+ }
247
+ });
248
+ });
249
+ });
250
+ }
251
+ /**
252
+ *
253
+ * @summary Delete workspace
254
+ * @param workspaceUuid UUID of the workspace.
255
+ */
256
+ public async deleteWorkspace (workspaceUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
257
+ const localVarPath = this.basePath + '/panel/workspaces/{workspaceUuid}'
258
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
259
+ let localVarQueryParameters: any = {};
260
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
261
+ const produces = ['application/json'];
262
+ // give precedence to 'application/json'
263
+ if (produces.indexOf('application/json') >= 0) {
264
+ localVarHeaderParams.Accept = 'application/json';
265
+ } else {
266
+ localVarHeaderParams.Accept = produces.join(',');
267
+ }
268
+ let localVarFormParams: any = {};
269
+
270
+ // verify required parameter 'workspaceUuid' is not null or undefined
271
+ if (workspaceUuid === null || workspaceUuid === undefined) {
272
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling deleteWorkspace.');
273
+ }
274
+
275
+ (<any>Object).assign(localVarHeaderParams, options.headers);
276
+
277
+ let localVarUseFormData = false;
278
+
279
+ let localVarRequestOptions: localVarRequest.Options = {
280
+ method: 'DELETE',
281
+ qs: localVarQueryParameters,
282
+ headers: localVarHeaderParams,
283
+ uri: localVarPath,
284
+ useQuerystring: this._useQuerystring,
285
+ json: true,
286
+ };
287
+
288
+ let authenticationPromise = Promise.resolve();
289
+ if (this.authentications.bearerAuth.accessToken) {
290
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
291
+ }
292
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
293
+
294
+ let interceptorPromise = authenticationPromise;
295
+ for (const interceptor of this.interceptors) {
296
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
297
+ }
298
+
299
+ return interceptorPromise.then(() => {
300
+ if (Object.keys(localVarFormParams).length) {
301
+ if (localVarUseFormData) {
302
+ (<any>localVarRequestOptions).formData = localVarFormParams;
303
+ } else {
304
+ localVarRequestOptions.form = localVarFormParams;
305
+ }
306
+ }
307
+ return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
308
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
309
+ if (error) {
310
+ reject(error);
311
+ } else {
312
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
313
+ body = ObjectSerializer.deserialize(body, "object");
314
+ resolve({ response: response, body: body });
315
+ } else {
316
+ reject(new HttpError(response, body, response.statusCode));
317
+ }
318
+ }
319
+ });
320
+ });
321
+ });
322
+ }
323
+ /**
324
+ *
325
+ * @summary Delete workspaces (bulk)
326
+ * @param deleteWorkspacesBulkRequest
327
+ */
328
+ public async deleteWorkspacesBulk (deleteWorkspacesBulkRequest: DeleteWorkspacesBulkRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
329
+ const localVarPath = this.basePath + '/panel/workspaces';
330
+ let localVarQueryParameters: any = {};
331
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
332
+ const produces = ['application/json'];
333
+ // give precedence to 'application/json'
334
+ if (produces.indexOf('application/json') >= 0) {
335
+ localVarHeaderParams.Accept = 'application/json';
336
+ } else {
337
+ localVarHeaderParams.Accept = produces.join(',');
338
+ }
339
+ let localVarFormParams: any = {};
340
+
341
+ // verify required parameter 'deleteWorkspacesBulkRequest' is not null or undefined
342
+ if (deleteWorkspacesBulkRequest === null || deleteWorkspacesBulkRequest === undefined) {
343
+ throw new Error('Required parameter deleteWorkspacesBulkRequest was null or undefined when calling deleteWorkspacesBulk.');
344
+ }
345
+
346
+ (<any>Object).assign(localVarHeaderParams, options.headers);
347
+
348
+ let localVarUseFormData = false;
349
+
350
+ let localVarRequestOptions: localVarRequest.Options = {
351
+ method: 'DELETE',
352
+ qs: localVarQueryParameters,
353
+ headers: localVarHeaderParams,
354
+ uri: localVarPath,
355
+ useQuerystring: this._useQuerystring,
356
+ json: true,
357
+ body: ObjectSerializer.serialize(deleteWorkspacesBulkRequest, "DeleteWorkspacesBulkRequest")
358
+ };
359
+
360
+ let authenticationPromise = Promise.resolve();
361
+ if (this.authentications.bearerAuth.accessToken) {
362
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
363
+ }
364
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
365
+
366
+ let interceptorPromise = authenticationPromise;
367
+ for (const interceptor of this.interceptors) {
368
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
369
+ }
370
+
371
+ return interceptorPromise.then(() => {
372
+ if (Object.keys(localVarFormParams).length) {
373
+ if (localVarUseFormData) {
374
+ (<any>localVarRequestOptions).formData = localVarFormParams;
375
+ } else {
376
+ localVarRequestOptions.form = localVarFormParams;
377
+ }
378
+ }
379
+ return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
380
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
381
+ if (error) {
382
+ reject(error);
383
+ } else {
384
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
385
+ body = ObjectSerializer.deserialize(body, "object");
386
+ resolve({ response: response, body: body });
387
+ } else {
388
+ reject(new HttpError(response, body, response.statusCode));
389
+ }
390
+ }
391
+ });
392
+ });
393
+ });
394
+ }
395
+ /**
396
+ *
397
+ * @summary Get workspace
398
+ * @param workspaceUuid UUID of the workspace.
399
+ */
400
+ public async getWorkspace (workspaceUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Workspace; }> {
401
+ const localVarPath = this.basePath + '/panel/workspaces/{workspaceUuid}'
402
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
403
+ let localVarQueryParameters: any = {};
404
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
405
+ const produces = ['application/json'];
406
+ // give precedence to 'application/json'
407
+ if (produces.indexOf('application/json') >= 0) {
408
+ localVarHeaderParams.Accept = 'application/json';
409
+ } else {
410
+ localVarHeaderParams.Accept = produces.join(',');
411
+ }
412
+ let localVarFormParams: any = {};
413
+
414
+ // verify required parameter 'workspaceUuid' is not null or undefined
415
+ if (workspaceUuid === null || workspaceUuid === undefined) {
416
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getWorkspace.');
417
+ }
418
+
419
+ (<any>Object).assign(localVarHeaderParams, options.headers);
420
+
421
+ let localVarUseFormData = false;
422
+
423
+ let localVarRequestOptions: localVarRequest.Options = {
424
+ method: 'GET',
425
+ qs: localVarQueryParameters,
426
+ headers: localVarHeaderParams,
427
+ uri: localVarPath,
428
+ useQuerystring: this._useQuerystring,
429
+ json: true,
430
+ };
431
+
432
+ let authenticationPromise = Promise.resolve();
433
+ if (this.authentications.bearerAuth.accessToken) {
434
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
435
+ }
436
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
437
+
438
+ let interceptorPromise = authenticationPromise;
439
+ for (const interceptor of this.interceptors) {
440
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
441
+ }
442
+
443
+ return interceptorPromise.then(() => {
444
+ if (Object.keys(localVarFormParams).length) {
445
+ if (localVarUseFormData) {
446
+ (<any>localVarRequestOptions).formData = localVarFormParams;
447
+ } else {
448
+ localVarRequestOptions.form = localVarFormParams;
449
+ }
450
+ }
451
+ return new Promise<{ response: http.IncomingMessage; body: Workspace; }>((resolve, reject) => {
452
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
453
+ if (error) {
454
+ reject(error);
455
+ } else {
456
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
457
+ body = ObjectSerializer.deserialize(body, "Workspace");
458
+ resolve({ response: response, body: body });
459
+ } else {
460
+ reject(new HttpError(response, body, response.statusCode));
461
+ }
462
+ }
463
+ });
464
+ });
465
+ });
466
+ }
467
+ /**
468
+ * Returns a paginated list of all workspaces. Admin only.
469
+ * @summary List workspaces
470
+ * @param keyword
471
+ * @param subscriptionStatus
472
+ * @param accessStatus
473
+ */
474
+ public async listWorkspaces (keyword?: string, subscriptionStatus?: 'active' | 'trialing' | 'past_due' | 'paused' | 'canceled' | 'incomplete', accessStatus?: 'subscription' | 'unlimited' | 'locked', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ListWorkspaces200Response; }> {
475
+ const localVarPath = this.basePath + '/panel/workspaces';
476
+ let localVarQueryParameters: any = {};
477
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
478
+ const produces = ['application/json'];
479
+ // give precedence to 'application/json'
480
+ if (produces.indexOf('application/json') >= 0) {
481
+ localVarHeaderParams.Accept = 'application/json';
482
+ } else {
483
+ localVarHeaderParams.Accept = produces.join(',');
484
+ }
485
+ let localVarFormParams: any = {};
486
+
487
+ if (keyword !== undefined) {
488
+ localVarQueryParameters['keyword'] = ObjectSerializer.serialize(keyword, "string");
489
+ }
490
+
491
+ if (subscriptionStatus !== undefined) {
492
+ localVarQueryParameters['subscription_status'] = ObjectSerializer.serialize(subscriptionStatus, "'active' | 'trialing' | 'past_due' | 'paused' | 'canceled' | 'incomplete'");
493
+ }
494
+
495
+ if (accessStatus !== undefined) {
496
+ localVarQueryParameters['access_status'] = ObjectSerializer.serialize(accessStatus, "'subscription' | 'unlimited' | 'locked'");
497
+ }
498
+
499
+ (<any>Object).assign(localVarHeaderParams, options.headers);
500
+
501
+ let localVarUseFormData = false;
502
+
503
+ let localVarRequestOptions: localVarRequest.Options = {
504
+ method: 'GET',
505
+ qs: localVarQueryParameters,
506
+ headers: localVarHeaderParams,
507
+ uri: localVarPath,
508
+ useQuerystring: this._useQuerystring,
509
+ json: true,
510
+ };
511
+
512
+ let authenticationPromise = Promise.resolve();
513
+ if (this.authentications.bearerAuth.accessToken) {
514
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
515
+ }
516
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
517
+
518
+ let interceptorPromise = authenticationPromise;
519
+ for (const interceptor of this.interceptors) {
520
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
521
+ }
522
+
523
+ return interceptorPromise.then(() => {
524
+ if (Object.keys(localVarFormParams).length) {
525
+ if (localVarUseFormData) {
526
+ (<any>localVarRequestOptions).formData = localVarFormParams;
527
+ } else {
528
+ localVarRequestOptions.form = localVarFormParams;
529
+ }
530
+ }
531
+ return new Promise<{ response: http.IncomingMessage; body: ListWorkspaces200Response; }>((resolve, reject) => {
532
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
533
+ if (error) {
534
+ reject(error);
535
+ } else {
536
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
537
+ body = ObjectSerializer.deserialize(body, "ListWorkspaces200Response");
538
+ resolve({ response: response, body: body });
539
+ } else {
540
+ reject(new HttpError(response, body, response.statusCode));
541
+ }
542
+ }
543
+ });
544
+ });
545
+ });
546
+ }
547
+ /**
548
+ *
549
+ * @summary Remove user from workspace
550
+ * @param workspaceUuid UUID of the workspace.
551
+ * @param removeUserFromWorkspaceRequest
552
+ */
553
+ public async removeUserFromWorkspace (workspaceUuid: string, removeUserFromWorkspaceRequest: RemoveUserFromWorkspaceRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
554
+ const localVarPath = this.basePath + '/panel/workspaces/{workspaceUuid}/users'
555
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
556
+ let localVarQueryParameters: any = {};
557
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
558
+ const produces = ['application/json'];
559
+ // give precedence to 'application/json'
560
+ if (produces.indexOf('application/json') >= 0) {
561
+ localVarHeaderParams.Accept = 'application/json';
562
+ } else {
563
+ localVarHeaderParams.Accept = produces.join(',');
564
+ }
565
+ let localVarFormParams: any = {};
566
+
567
+ // verify required parameter 'workspaceUuid' is not null or undefined
568
+ if (workspaceUuid === null || workspaceUuid === undefined) {
569
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling removeUserFromWorkspace.');
570
+ }
571
+
572
+ // verify required parameter 'removeUserFromWorkspaceRequest' is not null or undefined
573
+ if (removeUserFromWorkspaceRequest === null || removeUserFromWorkspaceRequest === undefined) {
574
+ throw new Error('Required parameter removeUserFromWorkspaceRequest was null or undefined when calling removeUserFromWorkspace.');
575
+ }
576
+
577
+ (<any>Object).assign(localVarHeaderParams, options.headers);
578
+
579
+ let localVarUseFormData = false;
580
+
581
+ let localVarRequestOptions: localVarRequest.Options = {
582
+ method: 'DELETE',
583
+ qs: localVarQueryParameters,
584
+ headers: localVarHeaderParams,
585
+ uri: localVarPath,
586
+ useQuerystring: this._useQuerystring,
587
+ json: true,
588
+ body: ObjectSerializer.serialize(removeUserFromWorkspaceRequest, "RemoveUserFromWorkspaceRequest")
589
+ };
590
+
591
+ let authenticationPromise = Promise.resolve();
592
+ if (this.authentications.bearerAuth.accessToken) {
593
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
594
+ }
595
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
596
+
597
+ let interceptorPromise = authenticationPromise;
598
+ for (const interceptor of this.interceptors) {
599
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
600
+ }
601
+
602
+ return interceptorPromise.then(() => {
603
+ if (Object.keys(localVarFormParams).length) {
604
+ if (localVarUseFormData) {
605
+ (<any>localVarRequestOptions).formData = localVarFormParams;
606
+ } else {
607
+ localVarRequestOptions.form = localVarFormParams;
608
+ }
609
+ }
610
+ return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
611
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
612
+ if (error) {
613
+ reject(error);
614
+ } else {
615
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
616
+ body = ObjectSerializer.deserialize(body, "object");
617
+ resolve({ response: response, body: body });
618
+ } else {
619
+ reject(new HttpError(response, body, response.statusCode));
620
+ }
621
+ }
622
+ });
623
+ });
624
+ });
625
+ }
626
+ /**
627
+ *
628
+ * @summary Update workspace
629
+ * @param workspaceUuid UUID of the workspace.
630
+ * @param workspaceInput
631
+ */
632
+ public async updateWorkspace (workspaceUuid: string, workspaceInput: WorkspaceInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
633
+ const localVarPath = this.basePath + '/panel/workspaces/{workspaceUuid}'
634
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
635
+ let localVarQueryParameters: any = {};
636
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
637
+ const produces = ['application/json'];
638
+ // give precedence to 'application/json'
639
+ if (produces.indexOf('application/json') >= 0) {
640
+ localVarHeaderParams.Accept = 'application/json';
641
+ } else {
642
+ localVarHeaderParams.Accept = produces.join(',');
643
+ }
644
+ let localVarFormParams: any = {};
645
+
646
+ // verify required parameter 'workspaceUuid' is not null or undefined
647
+ if (workspaceUuid === null || workspaceUuid === undefined) {
648
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling updateWorkspace.');
649
+ }
650
+
651
+ // verify required parameter 'workspaceInput' is not null or undefined
652
+ if (workspaceInput === null || workspaceInput === undefined) {
653
+ throw new Error('Required parameter workspaceInput was null or undefined when calling updateWorkspace.');
654
+ }
655
+
656
+ (<any>Object).assign(localVarHeaderParams, options.headers);
657
+
658
+ let localVarUseFormData = false;
659
+
660
+ let localVarRequestOptions: localVarRequest.Options = {
661
+ method: 'PUT',
662
+ qs: localVarQueryParameters,
663
+ headers: localVarHeaderParams,
664
+ uri: localVarPath,
665
+ useQuerystring: this._useQuerystring,
666
+ json: true,
667
+ body: ObjectSerializer.serialize(workspaceInput, "WorkspaceInput")
668
+ };
669
+
670
+ let authenticationPromise = Promise.resolve();
671
+ if (this.authentications.bearerAuth.accessToken) {
672
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
673
+ }
674
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
675
+
676
+ let interceptorPromise = authenticationPromise;
677
+ for (const interceptor of this.interceptors) {
678
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
679
+ }
680
+
681
+ return interceptorPromise.then(() => {
682
+ if (Object.keys(localVarFormParams).length) {
683
+ if (localVarUseFormData) {
684
+ (<any>localVarRequestOptions).formData = localVarFormParams;
685
+ } else {
686
+ localVarRequestOptions.form = localVarFormParams;
687
+ }
688
+ }
689
+ return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
690
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
691
+ if (error) {
692
+ reject(error);
693
+ } else {
694
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
695
+ body = ObjectSerializer.deserialize(body, "object");
696
+ resolve({ response: response, body: body });
697
+ } else {
698
+ reject(new HttpError(response, body, response.statusCode));
699
+ }
700
+ }
701
+ });
702
+ });
703
+ });
704
+ }
705
+ /**
706
+ *
707
+ * @summary Update user role in workspace
708
+ * @param workspaceUuid UUID of the workspace.
709
+ * @param workspaceUserInput
710
+ */
711
+ public async updateWorkspaceUser (workspaceUuid: string, workspaceUserInput: WorkspaceUserInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
712
+ const localVarPath = this.basePath + '/panel/workspaces/{workspaceUuid}/users'
713
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
714
+ let localVarQueryParameters: any = {};
715
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
716
+ const produces = ['application/json'];
717
+ // give precedence to 'application/json'
718
+ if (produces.indexOf('application/json') >= 0) {
719
+ localVarHeaderParams.Accept = 'application/json';
720
+ } else {
721
+ localVarHeaderParams.Accept = produces.join(',');
722
+ }
723
+ let localVarFormParams: any = {};
724
+
725
+ // verify required parameter 'workspaceUuid' is not null or undefined
726
+ if (workspaceUuid === null || workspaceUuid === undefined) {
727
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling updateWorkspaceUser.');
728
+ }
729
+
730
+ // verify required parameter 'workspaceUserInput' is not null or undefined
731
+ if (workspaceUserInput === null || workspaceUserInput === undefined) {
732
+ throw new Error('Required parameter workspaceUserInput was null or undefined when calling updateWorkspaceUser.');
733
+ }
734
+
735
+ (<any>Object).assign(localVarHeaderParams, options.headers);
736
+
737
+ let localVarUseFormData = false;
738
+
739
+ let localVarRequestOptions: localVarRequest.Options = {
740
+ method: 'PUT',
741
+ qs: localVarQueryParameters,
742
+ headers: localVarHeaderParams,
743
+ uri: localVarPath,
744
+ useQuerystring: this._useQuerystring,
745
+ json: true,
746
+ body: ObjectSerializer.serialize(workspaceUserInput, "WorkspaceUserInput")
747
+ };
748
+
749
+ let authenticationPromise = Promise.resolve();
750
+ if (this.authentications.bearerAuth.accessToken) {
751
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
752
+ }
753
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
754
+
755
+ let interceptorPromise = authenticationPromise;
756
+ for (const interceptor of this.interceptors) {
757
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
758
+ }
759
+
760
+ return interceptorPromise.then(() => {
761
+ if (Object.keys(localVarFormParams).length) {
762
+ if (localVarUseFormData) {
763
+ (<any>localVarRequestOptions).formData = localVarFormParams;
764
+ } else {
765
+ localVarRequestOptions.form = localVarFormParams;
766
+ }
767
+ }
768
+ return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
769
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
770
+ if (error) {
771
+ reject(error);
772
+ } else {
773
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
774
+ body = ObjectSerializer.deserialize(body, "object");
775
+ resolve({ response: response, body: body });
776
+ } else {
777
+ reject(new HttpError(response, body, response.statusCode));
778
+ }
779
+ }
780
+ });
781
+ });
782
+ });
783
+ }
784
+ }