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,827 @@
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 { DeletePostRequest } from '../model/deletePostRequest';
19
+ import { DeletePostsBulkRequest } from '../model/deletePostsBulkRequest';
20
+ import { DeleteResult } from '../model/deleteResult';
21
+ import { ListPosts200Response } from '../model/listPosts200Response';
22
+ import { Post } from '../model/post';
23
+ import { PostInput } from '../model/postInput';
24
+ import { SchedulePostRequest } from '../model/schedulePostRequest';
25
+ import { ScheduleResult } from '../model/scheduleResult';
26
+
27
+ import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
28
+ import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
29
+
30
+ import { HttpError, RequestFile } from './apis';
31
+
32
+ let defaultBasePath = 'https://postboost.co/app/api';
33
+
34
+ // ===============================================
35
+ // This file is autogenerated - Please do not edit
36
+ // ===============================================
37
+
38
+ export enum PostsApiApiKeys {
39
+ }
40
+
41
+ export class PostsApi {
42
+ protected _basePath = defaultBasePath;
43
+ protected _defaultHeaders : any = {};
44
+ protected _useQuerystring : boolean = false;
45
+
46
+ protected authentications = {
47
+ 'default': <Authentication>new VoidAuth(),
48
+ 'bearerAuth': new HttpBearerAuth(),
49
+ }
50
+
51
+ protected interceptors: Interceptor[] = [];
52
+
53
+ constructor(basePath?: string);
54
+ constructor(basePathOrUsername: string, password?: string, basePath?: string) {
55
+ if (password) {
56
+ if (basePath) {
57
+ this.basePath = basePath;
58
+ }
59
+ } else {
60
+ if (basePathOrUsername) {
61
+ this.basePath = basePathOrUsername
62
+ }
63
+ }
64
+ }
65
+
66
+ set useQuerystring(value: boolean) {
67
+ this._useQuerystring = value;
68
+ }
69
+
70
+ set basePath(basePath: string) {
71
+ this._basePath = basePath;
72
+ }
73
+
74
+ set defaultHeaders(defaultHeaders: any) {
75
+ this._defaultHeaders = defaultHeaders;
76
+ }
77
+
78
+ get defaultHeaders() {
79
+ return this._defaultHeaders;
80
+ }
81
+
82
+ get basePath() {
83
+ return this._basePath;
84
+ }
85
+
86
+ public setDefaultAuthentication(auth: Authentication) {
87
+ this.authentications.default = auth;
88
+ }
89
+
90
+ public setApiKey(key: PostsApiApiKeys, value: string) {
91
+ (this.authentications as any)[PostsApiApiKeys[key]].apiKey = value;
92
+ }
93
+
94
+ set accessToken(accessToken: string | (() => string)) {
95
+ this.authentications.bearerAuth.accessToken = accessToken;
96
+ }
97
+
98
+ public addInterceptor(interceptor: Interceptor) {
99
+ this.interceptors.push(interceptor);
100
+ }
101
+
102
+ /**
103
+ * Add an existing post to the smart publishing queue.
104
+ * @summary Add post to queue
105
+ * @param workspaceUuid UUID of the workspace.
106
+ * @param postUuid UUID of the post.
107
+ */
108
+ public async addPostToQueue (workspaceUuid: string, postUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ScheduleResult; }> {
109
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts/add-to-queue/{postUuid}'
110
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
111
+ .replace('{' + 'postUuid' + '}', encodeURIComponent(String(postUuid)));
112
+ let localVarQueryParameters: any = {};
113
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
114
+ const produces = ['application/json'];
115
+ // give precedence to 'application/json'
116
+ if (produces.indexOf('application/json') >= 0) {
117
+ localVarHeaderParams.Accept = 'application/json';
118
+ } else {
119
+ localVarHeaderParams.Accept = produces.join(',');
120
+ }
121
+ let localVarFormParams: any = {};
122
+
123
+ // verify required parameter 'workspaceUuid' is not null or undefined
124
+ if (workspaceUuid === null || workspaceUuid === undefined) {
125
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling addPostToQueue.');
126
+ }
127
+
128
+ // verify required parameter 'postUuid' is not null or undefined
129
+ if (postUuid === null || postUuid === undefined) {
130
+ throw new Error('Required parameter postUuid was null or undefined when calling addPostToQueue.');
131
+ }
132
+
133
+ (<any>Object).assign(localVarHeaderParams, options.headers);
134
+
135
+ let localVarUseFormData = false;
136
+
137
+ let localVarRequestOptions: localVarRequest.Options = {
138
+ method: 'POST',
139
+ qs: localVarQueryParameters,
140
+ headers: localVarHeaderParams,
141
+ uri: localVarPath,
142
+ useQuerystring: this._useQuerystring,
143
+ json: true,
144
+ };
145
+
146
+ let authenticationPromise = Promise.resolve();
147
+ if (this.authentications.bearerAuth.accessToken) {
148
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
149
+ }
150
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
151
+
152
+ let interceptorPromise = authenticationPromise;
153
+ for (const interceptor of this.interceptors) {
154
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
155
+ }
156
+
157
+ return interceptorPromise.then(() => {
158
+ if (Object.keys(localVarFormParams).length) {
159
+ if (localVarUseFormData) {
160
+ (<any>localVarRequestOptions).formData = localVarFormParams;
161
+ } else {
162
+ localVarRequestOptions.form = localVarFormParams;
163
+ }
164
+ }
165
+ return new Promise<{ response: http.IncomingMessage; body: ScheduleResult; }>((resolve, reject) => {
166
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
167
+ if (error) {
168
+ reject(error);
169
+ } else {
170
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
171
+ body = ObjectSerializer.deserialize(body, "ScheduleResult");
172
+ resolve({ response: response, body: body });
173
+ } else {
174
+ reject(new HttpError(response, body, response.statusCode));
175
+ }
176
+ }
177
+ });
178
+ });
179
+ });
180
+ }
181
+ /**
182
+ * Approve a post that is pending review.
183
+ * @summary Approve post
184
+ * @param workspaceUuid UUID of the workspace.
185
+ * @param postUuid UUID of the post.
186
+ */
187
+ public async approvePost (workspaceUuid: string, postUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ScheduleResult; }> {
188
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts/approve/{postUuid}'
189
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
190
+ .replace('{' + 'postUuid' + '}', encodeURIComponent(String(postUuid)));
191
+ let localVarQueryParameters: any = {};
192
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
193
+ const produces = ['application/json'];
194
+ // give precedence to 'application/json'
195
+ if (produces.indexOf('application/json') >= 0) {
196
+ localVarHeaderParams.Accept = 'application/json';
197
+ } else {
198
+ localVarHeaderParams.Accept = produces.join(',');
199
+ }
200
+ let localVarFormParams: any = {};
201
+
202
+ // verify required parameter 'workspaceUuid' is not null or undefined
203
+ if (workspaceUuid === null || workspaceUuid === undefined) {
204
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling approvePost.');
205
+ }
206
+
207
+ // verify required parameter 'postUuid' is not null or undefined
208
+ if (postUuid === null || postUuid === undefined) {
209
+ throw new Error('Required parameter postUuid was null or undefined when calling approvePost.');
210
+ }
211
+
212
+ (<any>Object).assign(localVarHeaderParams, options.headers);
213
+
214
+ let localVarUseFormData = false;
215
+
216
+ let localVarRequestOptions: localVarRequest.Options = {
217
+ method: 'POST',
218
+ qs: localVarQueryParameters,
219
+ headers: localVarHeaderParams,
220
+ uri: localVarPath,
221
+ useQuerystring: this._useQuerystring,
222
+ json: true,
223
+ };
224
+
225
+ let authenticationPromise = Promise.resolve();
226
+ if (this.authentications.bearerAuth.accessToken) {
227
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
228
+ }
229
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
230
+
231
+ let interceptorPromise = authenticationPromise;
232
+ for (const interceptor of this.interceptors) {
233
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
234
+ }
235
+
236
+ return interceptorPromise.then(() => {
237
+ if (Object.keys(localVarFormParams).length) {
238
+ if (localVarUseFormData) {
239
+ (<any>localVarRequestOptions).formData = localVarFormParams;
240
+ } else {
241
+ localVarRequestOptions.form = localVarFormParams;
242
+ }
243
+ }
244
+ return new Promise<{ response: http.IncomingMessage; body: ScheduleResult; }>((resolve, reject) => {
245
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
246
+ if (error) {
247
+ reject(error);
248
+ } else {
249
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
250
+ body = ObjectSerializer.deserialize(body, "ScheduleResult");
251
+ resolve({ response: response, body: body });
252
+ } else {
253
+ reject(new HttpError(response, body, response.statusCode));
254
+ }
255
+ }
256
+ });
257
+ });
258
+ });
259
+ }
260
+ /**
261
+ * Create a new post. Use `schedule: true` with `date` and `time` to schedule, `schedule_now: true` to publish immediately, or `queue: true` to add to the smart publishing queue.
262
+ * @summary Create post
263
+ * @param workspaceUuid UUID of the workspace.
264
+ * @param postInput
265
+ */
266
+ public async createPost (workspaceUuid: string, postInput: PostInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Post; }> {
267
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts'
268
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
269
+ let localVarQueryParameters: any = {};
270
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
271
+ const produces = ['application/json'];
272
+ // give precedence to 'application/json'
273
+ if (produces.indexOf('application/json') >= 0) {
274
+ localVarHeaderParams.Accept = 'application/json';
275
+ } else {
276
+ localVarHeaderParams.Accept = produces.join(',');
277
+ }
278
+ let localVarFormParams: any = {};
279
+
280
+ // verify required parameter 'workspaceUuid' is not null or undefined
281
+ if (workspaceUuid === null || workspaceUuid === undefined) {
282
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling createPost.');
283
+ }
284
+
285
+ // verify required parameter 'postInput' is not null or undefined
286
+ if (postInput === null || postInput === undefined) {
287
+ throw new Error('Required parameter postInput was null or undefined when calling createPost.');
288
+ }
289
+
290
+ (<any>Object).assign(localVarHeaderParams, options.headers);
291
+
292
+ let localVarUseFormData = false;
293
+
294
+ let localVarRequestOptions: localVarRequest.Options = {
295
+ method: 'POST',
296
+ qs: localVarQueryParameters,
297
+ headers: localVarHeaderParams,
298
+ uri: localVarPath,
299
+ useQuerystring: this._useQuerystring,
300
+ json: true,
301
+ body: ObjectSerializer.serialize(postInput, "PostInput")
302
+ };
303
+
304
+ let authenticationPromise = Promise.resolve();
305
+ if (this.authentications.bearerAuth.accessToken) {
306
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
307
+ }
308
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
309
+
310
+ let interceptorPromise = authenticationPromise;
311
+ for (const interceptor of this.interceptors) {
312
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
313
+ }
314
+
315
+ return interceptorPromise.then(() => {
316
+ if (Object.keys(localVarFormParams).length) {
317
+ if (localVarUseFormData) {
318
+ (<any>localVarRequestOptions).formData = localVarFormParams;
319
+ } else {
320
+ localVarRequestOptions.form = localVarFormParams;
321
+ }
322
+ }
323
+ return new Promise<{ response: http.IncomingMessage; body: Post; }>((resolve, reject) => {
324
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
325
+ if (error) {
326
+ reject(error);
327
+ } else {
328
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
329
+ body = ObjectSerializer.deserialize(body, "Post");
330
+ resolve({ response: response, body: body });
331
+ } else {
332
+ reject(new HttpError(response, body, response.statusCode));
333
+ }
334
+ }
335
+ });
336
+ });
337
+ });
338
+ }
339
+ /**
340
+ *
341
+ * @summary Delete post
342
+ * @param workspaceUuid UUID of the workspace.
343
+ * @param postUuid UUID of the post.
344
+ * @param deletePostRequest
345
+ */
346
+ public async deletePost (workspaceUuid: string, postUuid: string, deletePostRequest?: DeletePostRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DeleteResult; }> {
347
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts/{postUuid}'
348
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
349
+ .replace('{' + 'postUuid' + '}', encodeURIComponent(String(postUuid)));
350
+ let localVarQueryParameters: any = {};
351
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
352
+ const produces = ['application/json'];
353
+ // give precedence to 'application/json'
354
+ if (produces.indexOf('application/json') >= 0) {
355
+ localVarHeaderParams.Accept = 'application/json';
356
+ } else {
357
+ localVarHeaderParams.Accept = produces.join(',');
358
+ }
359
+ let localVarFormParams: any = {};
360
+
361
+ // verify required parameter 'workspaceUuid' is not null or undefined
362
+ if (workspaceUuid === null || workspaceUuid === undefined) {
363
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling deletePost.');
364
+ }
365
+
366
+ // verify required parameter 'postUuid' is not null or undefined
367
+ if (postUuid === null || postUuid === undefined) {
368
+ throw new Error('Required parameter postUuid was null or undefined when calling deletePost.');
369
+ }
370
+
371
+ (<any>Object).assign(localVarHeaderParams, options.headers);
372
+
373
+ let localVarUseFormData = false;
374
+
375
+ let localVarRequestOptions: localVarRequest.Options = {
376
+ method: 'DELETE',
377
+ qs: localVarQueryParameters,
378
+ headers: localVarHeaderParams,
379
+ uri: localVarPath,
380
+ useQuerystring: this._useQuerystring,
381
+ json: true,
382
+ body: ObjectSerializer.serialize(deletePostRequest, "DeletePostRequest")
383
+ };
384
+
385
+ let authenticationPromise = Promise.resolve();
386
+ if (this.authentications.bearerAuth.accessToken) {
387
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
388
+ }
389
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
390
+
391
+ let interceptorPromise = authenticationPromise;
392
+ for (const interceptor of this.interceptors) {
393
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
394
+ }
395
+
396
+ return interceptorPromise.then(() => {
397
+ if (Object.keys(localVarFormParams).length) {
398
+ if (localVarUseFormData) {
399
+ (<any>localVarRequestOptions).formData = localVarFormParams;
400
+ } else {
401
+ localVarRequestOptions.form = localVarFormParams;
402
+ }
403
+ }
404
+ return new Promise<{ response: http.IncomingMessage; body: DeleteResult; }>((resolve, reject) => {
405
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
406
+ if (error) {
407
+ reject(error);
408
+ } else {
409
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
410
+ body = ObjectSerializer.deserialize(body, "DeleteResult");
411
+ resolve({ response: response, body: body });
412
+ } else {
413
+ reject(new HttpError(response, body, response.statusCode));
414
+ }
415
+ }
416
+ });
417
+ });
418
+ });
419
+ }
420
+ /**
421
+ * Delete multiple posts at once.
422
+ * @summary Delete posts (bulk)
423
+ * @param workspaceUuid UUID of the workspace.
424
+ * @param deletePostsBulkRequest
425
+ */
426
+ public async deletePostsBulk (workspaceUuid: string, deletePostsBulkRequest: DeletePostsBulkRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: DeleteResult; }> {
427
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts'
428
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
429
+ let localVarQueryParameters: any = {};
430
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
431
+ const produces = ['application/json'];
432
+ // give precedence to 'application/json'
433
+ if (produces.indexOf('application/json') >= 0) {
434
+ localVarHeaderParams.Accept = 'application/json';
435
+ } else {
436
+ localVarHeaderParams.Accept = produces.join(',');
437
+ }
438
+ let localVarFormParams: any = {};
439
+
440
+ // verify required parameter 'workspaceUuid' is not null or undefined
441
+ if (workspaceUuid === null || workspaceUuid === undefined) {
442
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling deletePostsBulk.');
443
+ }
444
+
445
+ // verify required parameter 'deletePostsBulkRequest' is not null or undefined
446
+ if (deletePostsBulkRequest === null || deletePostsBulkRequest === undefined) {
447
+ throw new Error('Required parameter deletePostsBulkRequest was null or undefined when calling deletePostsBulk.');
448
+ }
449
+
450
+ (<any>Object).assign(localVarHeaderParams, options.headers);
451
+
452
+ let localVarUseFormData = false;
453
+
454
+ let localVarRequestOptions: localVarRequest.Options = {
455
+ method: 'DELETE',
456
+ qs: localVarQueryParameters,
457
+ headers: localVarHeaderParams,
458
+ uri: localVarPath,
459
+ useQuerystring: this._useQuerystring,
460
+ json: true,
461
+ body: ObjectSerializer.serialize(deletePostsBulkRequest, "DeletePostsBulkRequest")
462
+ };
463
+
464
+ let authenticationPromise = Promise.resolve();
465
+ if (this.authentications.bearerAuth.accessToken) {
466
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
467
+ }
468
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
469
+
470
+ let interceptorPromise = authenticationPromise;
471
+ for (const interceptor of this.interceptors) {
472
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
473
+ }
474
+
475
+ return interceptorPromise.then(() => {
476
+ if (Object.keys(localVarFormParams).length) {
477
+ if (localVarUseFormData) {
478
+ (<any>localVarRequestOptions).formData = localVarFormParams;
479
+ } else {
480
+ localVarRequestOptions.form = localVarFormParams;
481
+ }
482
+ }
483
+ return new Promise<{ response: http.IncomingMessage; body: DeleteResult; }>((resolve, reject) => {
484
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
485
+ if (error) {
486
+ reject(error);
487
+ } else {
488
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
489
+ body = ObjectSerializer.deserialize(body, "DeleteResult");
490
+ resolve({ response: response, body: body });
491
+ } else {
492
+ reject(new HttpError(response, body, response.statusCode));
493
+ }
494
+ }
495
+ });
496
+ });
497
+ });
498
+ }
499
+ /**
500
+ *
501
+ * @summary Get post
502
+ * @param workspaceUuid UUID of the workspace.
503
+ * @param postUuid UUID of the post.
504
+ */
505
+ public async getPost (workspaceUuid: string, postUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Post; }> {
506
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts/{postUuid}'
507
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
508
+ .replace('{' + 'postUuid' + '}', encodeURIComponent(String(postUuid)));
509
+ let localVarQueryParameters: any = {};
510
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
511
+ const produces = ['application/json'];
512
+ // give precedence to 'application/json'
513
+ if (produces.indexOf('application/json') >= 0) {
514
+ localVarHeaderParams.Accept = 'application/json';
515
+ } else {
516
+ localVarHeaderParams.Accept = produces.join(',');
517
+ }
518
+ let localVarFormParams: any = {};
519
+
520
+ // verify required parameter 'workspaceUuid' is not null or undefined
521
+ if (workspaceUuid === null || workspaceUuid === undefined) {
522
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getPost.');
523
+ }
524
+
525
+ // verify required parameter 'postUuid' is not null or undefined
526
+ if (postUuid === null || postUuid === undefined) {
527
+ throw new Error('Required parameter postUuid was null or undefined when calling getPost.');
528
+ }
529
+
530
+ (<any>Object).assign(localVarHeaderParams, options.headers);
531
+
532
+ let localVarUseFormData = false;
533
+
534
+ let localVarRequestOptions: localVarRequest.Options = {
535
+ method: 'GET',
536
+ qs: localVarQueryParameters,
537
+ headers: localVarHeaderParams,
538
+ uri: localVarPath,
539
+ useQuerystring: this._useQuerystring,
540
+ json: true,
541
+ };
542
+
543
+ let authenticationPromise = Promise.resolve();
544
+ if (this.authentications.bearerAuth.accessToken) {
545
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
546
+ }
547
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
548
+
549
+ let interceptorPromise = authenticationPromise;
550
+ for (const interceptor of this.interceptors) {
551
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
552
+ }
553
+
554
+ return interceptorPromise.then(() => {
555
+ if (Object.keys(localVarFormParams).length) {
556
+ if (localVarUseFormData) {
557
+ (<any>localVarRequestOptions).formData = localVarFormParams;
558
+ } else {
559
+ localVarRequestOptions.form = localVarFormParams;
560
+ }
561
+ }
562
+ return new Promise<{ response: http.IncomingMessage; body: Post; }>((resolve, reject) => {
563
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
564
+ if (error) {
565
+ reject(error);
566
+ } else {
567
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
568
+ body = ObjectSerializer.deserialize(body, "Post");
569
+ resolve({ response: response, body: body });
570
+ } else {
571
+ reject(new HttpError(response, body, response.statusCode));
572
+ }
573
+ }
574
+ });
575
+ });
576
+ });
577
+ }
578
+ /**
579
+ * Returns a paginated list of posts in the workspace.
580
+ * @summary List posts
581
+ * @param workspaceUuid UUID of the workspace.
582
+ * @param page
583
+ */
584
+ public async listPosts (workspaceUuid: string, page?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ListPosts200Response; }> {
585
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts'
586
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
587
+ let localVarQueryParameters: any = {};
588
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
589
+ const produces = ['application/json'];
590
+ // give precedence to 'application/json'
591
+ if (produces.indexOf('application/json') >= 0) {
592
+ localVarHeaderParams.Accept = 'application/json';
593
+ } else {
594
+ localVarHeaderParams.Accept = produces.join(',');
595
+ }
596
+ let localVarFormParams: any = {};
597
+
598
+ // verify required parameter 'workspaceUuid' is not null or undefined
599
+ if (workspaceUuid === null || workspaceUuid === undefined) {
600
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling listPosts.');
601
+ }
602
+
603
+ if (page !== undefined) {
604
+ localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
605
+ }
606
+
607
+ (<any>Object).assign(localVarHeaderParams, options.headers);
608
+
609
+ let localVarUseFormData = false;
610
+
611
+ let localVarRequestOptions: localVarRequest.Options = {
612
+ method: 'GET',
613
+ qs: localVarQueryParameters,
614
+ headers: localVarHeaderParams,
615
+ uri: localVarPath,
616
+ useQuerystring: this._useQuerystring,
617
+ json: true,
618
+ };
619
+
620
+ let authenticationPromise = Promise.resolve();
621
+ if (this.authentications.bearerAuth.accessToken) {
622
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
623
+ }
624
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
625
+
626
+ let interceptorPromise = authenticationPromise;
627
+ for (const interceptor of this.interceptors) {
628
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
629
+ }
630
+
631
+ return interceptorPromise.then(() => {
632
+ if (Object.keys(localVarFormParams).length) {
633
+ if (localVarUseFormData) {
634
+ (<any>localVarRequestOptions).formData = localVarFormParams;
635
+ } else {
636
+ localVarRequestOptions.form = localVarFormParams;
637
+ }
638
+ }
639
+ return new Promise<{ response: http.IncomingMessage; body: ListPosts200Response; }>((resolve, reject) => {
640
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
641
+ if (error) {
642
+ reject(error);
643
+ } else {
644
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
645
+ body = ObjectSerializer.deserialize(body, "ListPosts200Response");
646
+ resolve({ response: response, body: body });
647
+ } else {
648
+ reject(new HttpError(response, body, response.statusCode));
649
+ }
650
+ }
651
+ });
652
+ });
653
+ });
654
+ }
655
+ /**
656
+ * Schedule an existing post. Set `postNow: true` to publish immediately.
657
+ * @summary Schedule post
658
+ * @param workspaceUuid UUID of the workspace.
659
+ * @param postUuid UUID of the post.
660
+ * @param schedulePostRequest
661
+ */
662
+ public async schedulePost (workspaceUuid: string, postUuid: string, schedulePostRequest: SchedulePostRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ScheduleResult; }> {
663
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts/schedule/{postUuid}'
664
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
665
+ .replace('{' + 'postUuid' + '}', encodeURIComponent(String(postUuid)));
666
+ let localVarQueryParameters: any = {};
667
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
668
+ const produces = ['application/json'];
669
+ // give precedence to 'application/json'
670
+ if (produces.indexOf('application/json') >= 0) {
671
+ localVarHeaderParams.Accept = 'application/json';
672
+ } else {
673
+ localVarHeaderParams.Accept = produces.join(',');
674
+ }
675
+ let localVarFormParams: any = {};
676
+
677
+ // verify required parameter 'workspaceUuid' is not null or undefined
678
+ if (workspaceUuid === null || workspaceUuid === undefined) {
679
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling schedulePost.');
680
+ }
681
+
682
+ // verify required parameter 'postUuid' is not null or undefined
683
+ if (postUuid === null || postUuid === undefined) {
684
+ throw new Error('Required parameter postUuid was null or undefined when calling schedulePost.');
685
+ }
686
+
687
+ // verify required parameter 'schedulePostRequest' is not null or undefined
688
+ if (schedulePostRequest === null || schedulePostRequest === undefined) {
689
+ throw new Error('Required parameter schedulePostRequest was null or undefined when calling schedulePost.');
690
+ }
691
+
692
+ (<any>Object).assign(localVarHeaderParams, options.headers);
693
+
694
+ let localVarUseFormData = false;
695
+
696
+ let localVarRequestOptions: localVarRequest.Options = {
697
+ method: 'POST',
698
+ qs: localVarQueryParameters,
699
+ headers: localVarHeaderParams,
700
+ uri: localVarPath,
701
+ useQuerystring: this._useQuerystring,
702
+ json: true,
703
+ body: ObjectSerializer.serialize(schedulePostRequest, "SchedulePostRequest")
704
+ };
705
+
706
+ let authenticationPromise = Promise.resolve();
707
+ if (this.authentications.bearerAuth.accessToken) {
708
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
709
+ }
710
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
711
+
712
+ let interceptorPromise = authenticationPromise;
713
+ for (const interceptor of this.interceptors) {
714
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
715
+ }
716
+
717
+ return interceptorPromise.then(() => {
718
+ if (Object.keys(localVarFormParams).length) {
719
+ if (localVarUseFormData) {
720
+ (<any>localVarRequestOptions).formData = localVarFormParams;
721
+ } else {
722
+ localVarRequestOptions.form = localVarFormParams;
723
+ }
724
+ }
725
+ return new Promise<{ response: http.IncomingMessage; body: ScheduleResult; }>((resolve, reject) => {
726
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
727
+ if (error) {
728
+ reject(error);
729
+ } else {
730
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
731
+ body = ObjectSerializer.deserialize(body, "ScheduleResult");
732
+ resolve({ response: response, body: body });
733
+ } else {
734
+ reject(new HttpError(response, body, response.statusCode));
735
+ }
736
+ }
737
+ });
738
+ });
739
+ });
740
+ }
741
+ /**
742
+ *
743
+ * @summary Update post
744
+ * @param workspaceUuid UUID of the workspace.
745
+ * @param postUuid UUID of the post.
746
+ * @param postInput
747
+ */
748
+ public async updatePost (workspaceUuid: string, postUuid: string, postInput: PostInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
749
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts/{postUuid}'
750
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
751
+ .replace('{' + 'postUuid' + '}', encodeURIComponent(String(postUuid)));
752
+ let localVarQueryParameters: any = {};
753
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
754
+ const produces = ['application/json'];
755
+ // give precedence to 'application/json'
756
+ if (produces.indexOf('application/json') >= 0) {
757
+ localVarHeaderParams.Accept = 'application/json';
758
+ } else {
759
+ localVarHeaderParams.Accept = produces.join(',');
760
+ }
761
+ let localVarFormParams: any = {};
762
+
763
+ // verify required parameter 'workspaceUuid' is not null or undefined
764
+ if (workspaceUuid === null || workspaceUuid === undefined) {
765
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling updatePost.');
766
+ }
767
+
768
+ // verify required parameter 'postUuid' is not null or undefined
769
+ if (postUuid === null || postUuid === undefined) {
770
+ throw new Error('Required parameter postUuid was null or undefined when calling updatePost.');
771
+ }
772
+
773
+ // verify required parameter 'postInput' is not null or undefined
774
+ if (postInput === null || postInput === undefined) {
775
+ throw new Error('Required parameter postInput was null or undefined when calling updatePost.');
776
+ }
777
+
778
+ (<any>Object).assign(localVarHeaderParams, options.headers);
779
+
780
+ let localVarUseFormData = false;
781
+
782
+ let localVarRequestOptions: localVarRequest.Options = {
783
+ method: 'PUT',
784
+ qs: localVarQueryParameters,
785
+ headers: localVarHeaderParams,
786
+ uri: localVarPath,
787
+ useQuerystring: this._useQuerystring,
788
+ json: true,
789
+ body: ObjectSerializer.serialize(postInput, "PostInput")
790
+ };
791
+
792
+ let authenticationPromise = Promise.resolve();
793
+ if (this.authentications.bearerAuth.accessToken) {
794
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
795
+ }
796
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
797
+
798
+ let interceptorPromise = authenticationPromise;
799
+ for (const interceptor of this.interceptors) {
800
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
801
+ }
802
+
803
+ return interceptorPromise.then(() => {
804
+ if (Object.keys(localVarFormParams).length) {
805
+ if (localVarUseFormData) {
806
+ (<any>localVarRequestOptions).formData = localVarFormParams;
807
+ } else {
808
+ localVarRequestOptions.form = localVarFormParams;
809
+ }
810
+ }
811
+ return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
812
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
813
+ if (error) {
814
+ reject(error);
815
+ } else {
816
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
817
+ body = ObjectSerializer.deserialize(body, "object");
818
+ resolve({ response: response, body: body });
819
+ } else {
820
+ reject(new HttpError(response, body, response.statusCode));
821
+ }
822
+ }
823
+ });
824
+ });
825
+ });
826
+ }
827
+ }