postboost 1.6.0 → 1.8.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 (132) hide show
  1. package/README.md +1 -1
  2. package/api/aIApi.ts +2 -2
  3. package/api/accountsApi.ts +24 -4
  4. package/api/analyticsApi.ts +553 -0
  5. package/api/apis.ts +5 -1
  6. package/api/mediaApi.ts +381 -10
  7. package/api/mentionsApi.ts +507 -0
  8. package/api/postsApi.ts +182 -9
  9. package/api/receiptsApi.ts +2 -2
  10. package/api/subscriptionsApi.ts +10 -5
  11. package/api/tagsApi.ts +2 -2
  12. package/api/usersApi.ts +2 -2
  13. package/api/workspacesApi.ts +142 -3
  14. package/model/aICredits.ts +52 -0
  15. package/model/account.ts +35 -2
  16. package/model/accountAnalytics.ts +73 -0
  17. package/model/accountAnalyticsInitialSync.ts +37 -0
  18. package/model/accountSchedule.ts +49 -0
  19. package/model/addGenericSubscriptionRequest.ts +2 -2
  20. package/model/addPostToQueueRequest.ts +34 -0
  21. package/model/analyticsPeriod.ts +52 -0
  22. package/model/analyticsSummary.ts +39 -0
  23. package/model/analyticsSummaryData.ts +100 -0
  24. package/model/approvePostRequest.ts +62 -0
  25. package/model/bestPostingTimes.ts +41 -0
  26. package/model/bestPostingTimesTimesInner.ts +49 -0
  27. package/model/blogToSocial200Response.ts +2 -2
  28. package/model/blogToSocial429Response.ts +2 -2
  29. package/model/blogToSocialCaption.ts +2 -2
  30. package/model/blogToSocialInput.ts +2 -2
  31. package/model/blogToSocialMedia.ts +2 -2
  32. package/model/blogToSocialResponse.ts +2 -2
  33. package/model/cancelSubscription422Response.ts +38 -0
  34. package/model/cancelSubscription422ResponseErrors.ts +31 -0
  35. package/model/cancelSubscriptionRequest.ts +34 -0
  36. package/model/changeSubscriptionPlanRequest.ts +2 -2
  37. package/model/checkoutSubscription200Response.ts +2 -2
  38. package/model/checkoutSubscriptionRequest.ts +2 -2
  39. package/model/completeChunkedUploadRequest.ts +40 -0
  40. package/model/createMediaFolderRequest.ts +43 -0
  41. package/model/createMention201Response.ts +32 -0
  42. package/model/deleteMediaBulkRequest.ts +6 -5
  43. package/model/deleteMediaBulkRequestItemsInner.ts +26 -0
  44. package/model/deleteMediaFolderRequest.ts +31 -0
  45. package/model/deleteMode.ts +2 -2
  46. package/model/deletePostRequest.ts +2 -2
  47. package/model/deletePostsBulkRequest.ts +2 -2
  48. package/model/deleteReceiptsBulkRequest.ts +2 -2
  49. package/model/deleteResult.ts +2 -2
  50. package/model/deleteUser400Response.ts +2 -2
  51. package/model/deleteUsersBulkRequest.ts +2 -2
  52. package/model/deleteWorkspacesBulkRequest.ts +2 -2
  53. package/model/getRemoteUploadStatus200Response.ts +2 -2
  54. package/model/imageAltText200Response.ts +2 -2
  55. package/model/imageAltTextInput.ts +2 -2
  56. package/model/imageAltTextResponse.ts +2 -2
  57. package/model/imageEditInput.ts +2 -2
  58. package/model/imageGenerate200Response.ts +2 -2
  59. package/model/imageGenerate429Response.ts +2 -2
  60. package/model/imageGenerateInput.ts +2 -2
  61. package/model/imageGenerationResponse.ts +5 -5
  62. package/model/imagePrompt200Response.ts +2 -2
  63. package/model/imagePrompt429Response.ts +2 -2
  64. package/model/imagePromptInput.ts +2 -2
  65. package/model/imagePromptResponse.ts +2 -2
  66. package/model/imageVariations200Response.ts +2 -2
  67. package/model/imageVariationsInput.ts +2 -2
  68. package/model/imageVariationsResponse.ts +5 -5
  69. package/model/initiateChunkedUpload201Response.ts +2 -2
  70. package/model/initiateChunkedUploadRequest.ts +2 -2
  71. package/model/initiateRemoteUpload201Response.ts +60 -2
  72. package/model/initiateRemoteUpload201ResponseOneOf.ts +2 -2
  73. package/model/initiateRemoteUploadRequest.ts +11 -2
  74. package/model/listAccounts200Response.ts +2 -2
  75. package/model/listMedia200Response.ts +2 -2
  76. package/model/listMediaFolders200Response.ts +32 -0
  77. package/model/listMentions200Response.ts +46 -0
  78. package/model/listMyWorkspaces200Response.ts +32 -0
  79. package/model/listPosts200Response.ts +2 -2
  80. package/model/listReceipts200Response.ts +2 -2
  81. package/model/listTags200Response.ts +2 -2
  82. package/model/listUsers200Response.ts +2 -2
  83. package/model/listWorkspaces200Response.ts +2 -2
  84. package/model/media.ts +60 -2
  85. package/model/mediaFolder.ts +55 -0
  86. package/model/mediaFolderInput.ts +43 -0
  87. package/model/{generatedImageItem.ts → mediaFolderRef.ts} +10 -16
  88. package/model/mention.ts +65 -0
  89. package/model/mentionIdentity.ts +55 -0
  90. package/model/mentionIdentityInput.ts +67 -0
  91. package/model/mentionInput.ts +44 -0
  92. package/model/models.ts +125 -3
  93. package/model/paginationMeta.ts +2 -2
  94. package/model/paginationMetaLinks.ts +2 -2
  95. package/model/paginationMetaMeta.ts +2 -2
  96. package/model/post.ts +12 -2
  97. package/model/postAnalytics.ts +46 -0
  98. package/model/postContent.ts +2 -2
  99. package/model/postInput.ts +15 -2
  100. package/model/postStatus.ts +9 -3
  101. package/model/postVersion.ts +11 -2
  102. package/model/postingTimeSlot.ts +51 -0
  103. package/model/postingTimes.ts +88 -0
  104. package/model/postingTimesBestInner.ts +49 -0
  105. package/model/postingTimesDayIntervalsInnerInner.ts +69 -0
  106. package/model/postingTimesDaysInner.ts +57 -0
  107. package/model/publicWorkspace.ts +50 -0
  108. package/model/publicWorkspacePivot.ts +53 -0
  109. package/model/publishProgress.ts +46 -0
  110. package/model/receipt.ts +2 -2
  111. package/model/receiptInput.ts +2 -2
  112. package/model/receiptUpdateInput.ts +2 -2
  113. package/model/removeGenericSubscription422Response.ts +31 -0
  114. package/model/removeUserFromWorkspaceRequest.ts +2 -2
  115. package/model/retryPostAccountResult.ts +47 -0
  116. package/model/schedulePostRequest.ts +39 -2
  117. package/model/scheduleResult.ts +11 -2
  118. package/model/subscription.ts +2 -2
  119. package/model/subscriptionInput.ts +2 -2
  120. package/model/subscriptionStatus.ts +2 -2
  121. package/model/subscriptionUpdateInput.ts +2 -2
  122. package/model/tag.ts +2 -2
  123. package/model/tagInput.ts +2 -2
  124. package/model/updateMediaRequest.ts +18 -3
  125. package/model/uploadChunk201Response.ts +2 -2
  126. package/model/user.ts +11 -2
  127. package/model/userInput.ts +2 -2
  128. package/model/userUpdateInput.ts +2 -2
  129. package/model/workspace.ts +17 -3
  130. package/model/workspaceInput.ts +8 -3
  131. package/model/workspaceUserInput.ts +2 -2
  132. package/package.json +1 -1
package/README.md CHANGED
@@ -13,7 +13,7 @@ npm install postboost
13
13
  | **npm** | [npmjs.com/package/postboost](https://www.npmjs.com/package/postboost) |
14
14
  | **GitHub** | [postboost-co/postboost-node](https://github.com/postboost-co/postboost-node) |
15
15
  | **Docs** | [postboost.co/docs/api](https://postboost.co/docs/api) |
16
- | **Version** | v1.6.0 |
16
+ | **Version** | v1.8.0 |
17
17
 
18
18
  ## Quick start
19
19
 
package/api/aIApi.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * PostBoost API
3
- * The PostBoost REST API lets you publish, schedule, and analyze social media posts across 12+ 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 ```
3
+ * The PostBoost REST API lets you publish, schedule, and analyze social media posts across 12+ 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`. ## Plan access Every workspace-scoped endpoint returns `403` when the workspace\'s plan does not include API access (capability `api`). ## Dates and times Post dates and times (`date`, `time`, `accounts_schedule`) are read in the request\'s `timezone` when one is given, otherwise in the workspace timezone. ## 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
4
  *
5
- * The version of the OpenAPI document: 1.0.0
5
+ * The version of the OpenAPI document: 1.8.0
6
6
  * Contact: hi@postboost.co
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * PostBoost API
3
- * The PostBoost REST API lets you publish, schedule, and analyze social media posts across 12+ 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 ```
3
+ * The PostBoost REST API lets you publish, schedule, and analyze social media posts across 12+ 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`. ## Plan access Every workspace-scoped endpoint returns `403` when the workspace\'s plan does not include API access (capability `api`). ## Dates and times Post dates and times (`date`, `time`, `accounts_schedule`) are read in the request\'s `timezone` when one is given, otherwise in the workspace timezone. ## 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
4
  *
5
- * The version of the OpenAPI document: 1.0.0
5
+ * The version of the OpenAPI document: 1.8.0
6
6
  * Contact: hi@postboost.co
7
7
  *
8
8
  * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
@@ -173,11 +173,15 @@ export class AccountsApi {
173
173
  });
174
174
  }
175
175
  /**
176
- * Returns all social media accounts connected to the workspace.
176
+ * Returns all social media accounts connected to the workspace, newest first. Optional filters narrow the list.
177
177
  * @summary List accounts
178
178
  * @param workspaceUuid UUID of the workspace.
179
+ * @param keyword Match the account name or username.
180
+ * @param group Only accounts in this account group.
181
+ * @param providers Only accounts of these providers (for example `instagram`, `linkedin`).
182
+ * @param unauthorized When `true`, only accounts that need to be reconnected.
179
183
  */
180
- public async listAccounts (workspaceUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ListAccounts200Response; }> {
184
+ public async listAccounts (workspaceUuid: string, keyword?: string, group?: string, providers?: Array<string>, unauthorized?: boolean, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ListAccounts200Response; }> {
181
185
  const localVarPath = this.basePath + '/{workspaceUuid}/accounts'
182
186
  .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
183
187
  let localVarQueryParameters: any = {};
@@ -196,6 +200,22 @@ export class AccountsApi {
196
200
  throw new Error('Required parameter workspaceUuid was null or undefined when calling listAccounts.');
197
201
  }
198
202
 
203
+ if (keyword !== undefined) {
204
+ localVarQueryParameters['keyword'] = ObjectSerializer.serialize(keyword, "string");
205
+ }
206
+
207
+ if (group !== undefined) {
208
+ localVarQueryParameters['group'] = ObjectSerializer.serialize(group, "string");
209
+ }
210
+
211
+ if (providers !== undefined) {
212
+ localVarQueryParameters['providers[]'] = ObjectSerializer.serialize(providers, "Array<string>");
213
+ }
214
+
215
+ if (unauthorized !== undefined) {
216
+ localVarQueryParameters['unauthorized'] = ObjectSerializer.serialize(unauthorized, "boolean");
217
+ }
218
+
199
219
  (<any>Object).assign(localVarHeaderParams, options.headers);
200
220
 
201
221
  let localVarUseFormData = false;
@@ -0,0 +1,553 @@
1
+ /**
2
+ * PostBoost API
3
+ * The PostBoost REST API lets you publish, schedule, and analyze social media posts across 12+ 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`. ## Plan access Every workspace-scoped endpoint returns `403` when the workspace\'s plan does not include API access (capability `api`). ## Dates and times Post dates and times (`date`, `time`, `accounts_schedule`) are read in the request\'s `timezone` when one is given, otherwise in the workspace timezone. ## 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.8.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 { AccountAnalytics } from '../model/accountAnalytics';
19
+ import { AnalyticsSummary } from '../model/analyticsSummary';
20
+ import { BestPostingTimes } from '../model/bestPostingTimes';
21
+ import { PostAnalytics } from '../model/postAnalytics';
22
+ import { PostingTimes } from '../model/postingTimes';
23
+
24
+ import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
25
+ import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
26
+
27
+ import { HttpError, RequestFile } from './apis';
28
+
29
+ let defaultBasePath = 'https://postboost.co/app/api';
30
+
31
+ // ===============================================
32
+ // This file is autogenerated - Please do not edit
33
+ // ===============================================
34
+
35
+ export enum AnalyticsApiApiKeys {
36
+ }
37
+
38
+ export class AnalyticsApi {
39
+ protected _basePath = defaultBasePath;
40
+ protected _defaultHeaders : any = {};
41
+ protected _useQuerystring : boolean = false;
42
+
43
+ protected authentications = {
44
+ 'default': <Authentication>new VoidAuth(),
45
+ 'bearerAuth': new HttpBearerAuth(),
46
+ }
47
+
48
+ protected interceptors: Interceptor[] = [];
49
+
50
+ constructor(basePath?: string);
51
+ constructor(basePathOrUsername: string, password?: string, basePath?: string) {
52
+ if (password) {
53
+ if (basePath) {
54
+ this.basePath = basePath;
55
+ }
56
+ } else {
57
+ if (basePathOrUsername) {
58
+ this.basePath = basePathOrUsername
59
+ }
60
+ }
61
+ }
62
+
63
+ set useQuerystring(value: boolean) {
64
+ this._useQuerystring = value;
65
+ }
66
+
67
+ set basePath(basePath: string) {
68
+ this._basePath = basePath;
69
+ }
70
+
71
+ set defaultHeaders(defaultHeaders: any) {
72
+ this._defaultHeaders = defaultHeaders;
73
+ }
74
+
75
+ get defaultHeaders() {
76
+ return this._defaultHeaders;
77
+ }
78
+
79
+ get basePath() {
80
+ return this._basePath;
81
+ }
82
+
83
+ public setDefaultAuthentication(auth: Authentication) {
84
+ this.authentications.default = auth;
85
+ }
86
+
87
+ public setApiKey(key: AnalyticsApiApiKeys, value: string) {
88
+ (this.authentications as any)[AnalyticsApiApiKeys[key]].apiKey = value;
89
+ }
90
+
91
+ set accessToken(accessToken: string | (() => string)) {
92
+ this.authentications.bearerAuth.accessToken = accessToken;
93
+ }
94
+
95
+ public addInterceptor(interceptor: Interceptor) {
96
+ this.interceptors.push(interceptor);
97
+ }
98
+
99
+ /**
100
+ * Analytics for one account. `type` selects one of the tabs the account supports (listed in `tabs` of the response); returns `422` when the account does not support analytics.
101
+ * @summary Get account analytics
102
+ * @param workspaceUuid UUID of the workspace.
103
+ * @param accountUuid UUID of the social media account.
104
+ * @param period Preset reporting period. Ignored when &#x60;date_from&#x60; and &#x60;date_to&#x60; are given.
105
+ * @param dateFrom Start of a custom range (Y-m-d). Required with &#x60;date_to&#x60;; the range may span at most 366 days.
106
+ * @param dateTo End of a custom range (Y-m-d). Required with &#x60;date_from&#x60;; must not be before it.
107
+ * @param type Analytics tab. Defaults to the account\&#39;s default tab.
108
+ * @param page Page for list-style tabs (for example per-post metrics).
109
+ * @param perPage
110
+ * @param sortBy
111
+ * @param sortDir
112
+ */
113
+ public async getAccountAnalytics (workspaceUuid: string, accountUuid: string, period?: 'this_week' | 'last_week' | 'this_month' | 'last_month' | 'last_3_months' | 'this_year', dateFrom?: string, dateTo?: string, type?: string, page?: number, perPage?: number, sortBy?: string, sortDir?: 'asc' | 'desc', options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: AccountAnalytics; }> {
114
+ const localVarPath = this.basePath + '/{workspaceUuid}/analytics/accounts/{accountUuid}'
115
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
116
+ .replace('{' + 'accountUuid' + '}', encodeURIComponent(String(accountUuid)));
117
+ let localVarQueryParameters: any = {};
118
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
119
+ const produces = ['application/json'];
120
+ // give precedence to 'application/json'
121
+ if (produces.indexOf('application/json') >= 0) {
122
+ localVarHeaderParams.Accept = 'application/json';
123
+ } else {
124
+ localVarHeaderParams.Accept = produces.join(',');
125
+ }
126
+ let localVarFormParams: any = {};
127
+
128
+ // verify required parameter 'workspaceUuid' is not null or undefined
129
+ if (workspaceUuid === null || workspaceUuid === undefined) {
130
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getAccountAnalytics.');
131
+ }
132
+
133
+ // verify required parameter 'accountUuid' is not null or undefined
134
+ if (accountUuid === null || accountUuid === undefined) {
135
+ throw new Error('Required parameter accountUuid was null or undefined when calling getAccountAnalytics.');
136
+ }
137
+
138
+ if (period !== undefined) {
139
+ localVarQueryParameters['period'] = ObjectSerializer.serialize(period, "'this_week' | 'last_week' | 'this_month' | 'last_month' | 'last_3_months' | 'this_year'");
140
+ }
141
+
142
+ if (dateFrom !== undefined) {
143
+ localVarQueryParameters['date_from'] = ObjectSerializer.serialize(dateFrom, "string");
144
+ }
145
+
146
+ if (dateTo !== undefined) {
147
+ localVarQueryParameters['date_to'] = ObjectSerializer.serialize(dateTo, "string");
148
+ }
149
+
150
+ if (type !== undefined) {
151
+ localVarQueryParameters['type'] = ObjectSerializer.serialize(type, "string");
152
+ }
153
+
154
+ if (page !== undefined) {
155
+ localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
156
+ }
157
+
158
+ if (perPage !== undefined) {
159
+ localVarQueryParameters['per_page'] = ObjectSerializer.serialize(perPage, "number");
160
+ }
161
+
162
+ if (sortBy !== undefined) {
163
+ localVarQueryParameters['sort_by'] = ObjectSerializer.serialize(sortBy, "string");
164
+ }
165
+
166
+ if (sortDir !== undefined) {
167
+ localVarQueryParameters['sort_dir'] = ObjectSerializer.serialize(sortDir, "'asc' | 'desc'");
168
+ }
169
+
170
+ (<any>Object).assign(localVarHeaderParams, options.headers);
171
+
172
+ let localVarUseFormData = false;
173
+
174
+ let localVarRequestOptions: localVarRequest.Options = {
175
+ method: 'GET',
176
+ qs: localVarQueryParameters,
177
+ headers: localVarHeaderParams,
178
+ uri: localVarPath,
179
+ useQuerystring: this._useQuerystring,
180
+ json: true,
181
+ };
182
+
183
+ let authenticationPromise = Promise.resolve();
184
+ if (this.authentications.bearerAuth.accessToken) {
185
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
186
+ }
187
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
188
+
189
+ let interceptorPromise = authenticationPromise;
190
+ for (const interceptor of this.interceptors) {
191
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
192
+ }
193
+
194
+ return interceptorPromise.then(() => {
195
+ if (Object.keys(localVarFormParams).length) {
196
+ if (localVarUseFormData) {
197
+ (<any>localVarRequestOptions).formData = localVarFormParams;
198
+ } else {
199
+ localVarRequestOptions.form = localVarFormParams;
200
+ }
201
+ }
202
+ return new Promise<{ response: http.IncomingMessage; body: AccountAnalytics; }>((resolve, reject) => {
203
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
204
+ if (error) {
205
+ reject(error);
206
+ } else {
207
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
208
+ body = ObjectSerializer.deserialize(body, "AccountAnalytics");
209
+ resolve({ response: response, body: body });
210
+ } else {
211
+ reject(new HttpError(response, body, response.statusCode));
212
+ }
213
+ }
214
+ });
215
+ });
216
+ });
217
+ }
218
+ /**
219
+ * Cross-platform summary (followers, growth, posts, leaderboard, posting streak) over every account that supports analytics, for a preset period or a custom date range.
220
+ * @summary Get analytics summary
221
+ * @param workspaceUuid UUID of the workspace.
222
+ * @param period Preset reporting period. Ignored when &#x60;date_from&#x60; and &#x60;date_to&#x60; are given.
223
+ * @param dateFrom Start of a custom range (Y-m-d). Required with &#x60;date_to&#x60;; the range may span at most 366 days.
224
+ * @param dateTo End of a custom range (Y-m-d). Required with &#x60;date_from&#x60;; must not be before it.
225
+ */
226
+ public async getAnalyticsSummary (workspaceUuid: string, period?: 'this_week' | 'last_week' | 'this_month' | 'last_month' | 'last_3_months' | 'this_year', dateFrom?: string, dateTo?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: AnalyticsSummary; }> {
227
+ const localVarPath = this.basePath + '/{workspaceUuid}/analytics'
228
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
229
+ let localVarQueryParameters: any = {};
230
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
231
+ const produces = ['application/json'];
232
+ // give precedence to 'application/json'
233
+ if (produces.indexOf('application/json') >= 0) {
234
+ localVarHeaderParams.Accept = 'application/json';
235
+ } else {
236
+ localVarHeaderParams.Accept = produces.join(',');
237
+ }
238
+ let localVarFormParams: any = {};
239
+
240
+ // verify required parameter 'workspaceUuid' is not null or undefined
241
+ if (workspaceUuid === null || workspaceUuid === undefined) {
242
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getAnalyticsSummary.');
243
+ }
244
+
245
+ if (period !== undefined) {
246
+ localVarQueryParameters['period'] = ObjectSerializer.serialize(period, "'this_week' | 'last_week' | 'this_month' | 'last_month' | 'last_3_months' | 'this_year'");
247
+ }
248
+
249
+ if (dateFrom !== undefined) {
250
+ localVarQueryParameters['date_from'] = ObjectSerializer.serialize(dateFrom, "string");
251
+ }
252
+
253
+ if (dateTo !== undefined) {
254
+ localVarQueryParameters['date_to'] = ObjectSerializer.serialize(dateTo, "string");
255
+ }
256
+
257
+ (<any>Object).assign(localVarHeaderParams, options.headers);
258
+
259
+ let localVarUseFormData = false;
260
+
261
+ let localVarRequestOptions: localVarRequest.Options = {
262
+ method: 'GET',
263
+ qs: localVarQueryParameters,
264
+ headers: localVarHeaderParams,
265
+ uri: localVarPath,
266
+ useQuerystring: this._useQuerystring,
267
+ json: true,
268
+ };
269
+
270
+ let authenticationPromise = Promise.resolve();
271
+ if (this.authentications.bearerAuth.accessToken) {
272
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
273
+ }
274
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
275
+
276
+ let interceptorPromise = authenticationPromise;
277
+ for (const interceptor of this.interceptors) {
278
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
279
+ }
280
+
281
+ return interceptorPromise.then(() => {
282
+ if (Object.keys(localVarFormParams).length) {
283
+ if (localVarUseFormData) {
284
+ (<any>localVarRequestOptions).formData = localVarFormParams;
285
+ } else {
286
+ localVarRequestOptions.form = localVarFormParams;
287
+ }
288
+ }
289
+ return new Promise<{ response: http.IncomingMessage; body: AnalyticsSummary; }>((resolve, reject) => {
290
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
291
+ if (error) {
292
+ reject(error);
293
+ } else {
294
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
295
+ body = ObjectSerializer.deserialize(body, "AnalyticsSummary");
296
+ resolve({ response: response, body: body });
297
+ } else {
298
+ reject(new HttpError(response, body, response.statusCode));
299
+ }
300
+ }
301
+ });
302
+ });
303
+ });
304
+ }
305
+ /**
306
+ * The next recommended date and time per account, on or after `from` (never in the past), within the next 14 days.
307
+ * @summary Get best posting times
308
+ * @param workspaceUuid UUID of the workspace.
309
+ * @param accounts Account UUIDs. Defaults to every account in the workspace.
310
+ * @param from Earliest date to recommend (Y-m-d). Defaults to now.
311
+ * @param timezone Timezone for &#x60;from&#x60; and the returned times. Defaults to the workspace timezone.
312
+ */
313
+ public async getBestPostingTimes (workspaceUuid: string, accounts?: Array<string>, from?: string, timezone?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BestPostingTimes; }> {
314
+ const localVarPath = this.basePath + '/{workspaceUuid}/analytics/best-times'
315
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
316
+ let localVarQueryParameters: any = {};
317
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
318
+ const produces = ['application/json'];
319
+ // give precedence to 'application/json'
320
+ if (produces.indexOf('application/json') >= 0) {
321
+ localVarHeaderParams.Accept = 'application/json';
322
+ } else {
323
+ localVarHeaderParams.Accept = produces.join(',');
324
+ }
325
+ let localVarFormParams: any = {};
326
+
327
+ // verify required parameter 'workspaceUuid' is not null or undefined
328
+ if (workspaceUuid === null || workspaceUuid === undefined) {
329
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getBestPostingTimes.');
330
+ }
331
+
332
+ if (accounts !== undefined) {
333
+ localVarQueryParameters['accounts[]'] = ObjectSerializer.serialize(accounts, "Array<string>");
334
+ }
335
+
336
+ if (from !== undefined) {
337
+ localVarQueryParameters['from'] = ObjectSerializer.serialize(from, "string");
338
+ }
339
+
340
+ if (timezone !== undefined) {
341
+ localVarQueryParameters['timezone'] = ObjectSerializer.serialize(timezone, "string");
342
+ }
343
+
344
+ (<any>Object).assign(localVarHeaderParams, options.headers);
345
+
346
+ let localVarUseFormData = false;
347
+
348
+ let localVarRequestOptions: localVarRequest.Options = {
349
+ method: 'GET',
350
+ qs: localVarQueryParameters,
351
+ headers: localVarHeaderParams,
352
+ uri: localVarPath,
353
+ useQuerystring: this._useQuerystring,
354
+ json: true,
355
+ };
356
+
357
+ let authenticationPromise = Promise.resolve();
358
+ if (this.authentications.bearerAuth.accessToken) {
359
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
360
+ }
361
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
362
+
363
+ let interceptorPromise = authenticationPromise;
364
+ for (const interceptor of this.interceptors) {
365
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
366
+ }
367
+
368
+ return interceptorPromise.then(() => {
369
+ if (Object.keys(localVarFormParams).length) {
370
+ if (localVarUseFormData) {
371
+ (<any>localVarRequestOptions).formData = localVarFormParams;
372
+ } else {
373
+ localVarRequestOptions.form = localVarFormParams;
374
+ }
375
+ }
376
+ return new Promise<{ response: http.IncomingMessage; body: BestPostingTimes; }>((resolve, reject) => {
377
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
378
+ if (error) {
379
+ reject(error);
380
+ } else {
381
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
382
+ body = ObjectSerializer.deserialize(body, "BestPostingTimes");
383
+ resolve({ response: response, body: body });
384
+ } else {
385
+ reject(new HttpError(response, body, response.statusCode));
386
+ }
387
+ }
388
+ });
389
+ });
390
+ });
391
+ }
392
+ /**
393
+ * Engagement metrics for a published post across its accounts (also works for trashed posts), with totals, trends and the best-performing account.
394
+ * @summary Get post analytics
395
+ * @param workspaceUuid UUID of the workspace.
396
+ * @param postUuid UUID of the post.
397
+ */
398
+ public async getPostAnalytics (workspaceUuid: string, postUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: PostAnalytics; }> {
399
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts/{postUuid}/analytics'
400
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
401
+ .replace('{' + 'postUuid' + '}', encodeURIComponent(String(postUuid)));
402
+ let localVarQueryParameters: any = {};
403
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
404
+ const produces = ['application/json'];
405
+ // give precedence to 'application/json'
406
+ if (produces.indexOf('application/json') >= 0) {
407
+ localVarHeaderParams.Accept = 'application/json';
408
+ } else {
409
+ localVarHeaderParams.Accept = produces.join(',');
410
+ }
411
+ let localVarFormParams: any = {};
412
+
413
+ // verify required parameter 'workspaceUuid' is not null or undefined
414
+ if (workspaceUuid === null || workspaceUuid === undefined) {
415
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getPostAnalytics.');
416
+ }
417
+
418
+ // verify required parameter 'postUuid' is not null or undefined
419
+ if (postUuid === null || postUuid === undefined) {
420
+ throw new Error('Required parameter postUuid was null or undefined when calling getPostAnalytics.');
421
+ }
422
+
423
+ (<any>Object).assign(localVarHeaderParams, options.headers);
424
+
425
+ let localVarUseFormData = false;
426
+
427
+ let localVarRequestOptions: localVarRequest.Options = {
428
+ method: 'GET',
429
+ qs: localVarQueryParameters,
430
+ headers: localVarHeaderParams,
431
+ uri: localVarPath,
432
+ useQuerystring: this._useQuerystring,
433
+ json: true,
434
+ };
435
+
436
+ let authenticationPromise = Promise.resolve();
437
+ if (this.authentications.bearerAuth.accessToken) {
438
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
439
+ }
440
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
441
+
442
+ let interceptorPromise = authenticationPromise;
443
+ for (const interceptor of this.interceptors) {
444
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
445
+ }
446
+
447
+ return interceptorPromise.then(() => {
448
+ if (Object.keys(localVarFormParams).length) {
449
+ if (localVarUseFormData) {
450
+ (<any>localVarRequestOptions).formData = localVarFormParams;
451
+ } else {
452
+ localVarRequestOptions.form = localVarFormParams;
453
+ }
454
+ }
455
+ return new Promise<{ response: http.IncomingMessage; body: PostAnalytics; }>((resolve, reject) => {
456
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
457
+ if (error) {
458
+ reject(error);
459
+ } else {
460
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
461
+ body = ObjectSerializer.deserialize(body, "PostAnalytics");
462
+ resolve({ response: response, body: body });
463
+ } else {
464
+ reject(new HttpError(response, body, response.statusCode));
465
+ }
466
+ }
467
+ });
468
+ });
469
+ });
470
+ }
471
+ /**
472
+ * Engagement scores per weekday and hour, merged across the given accounts (all accounts when none is given), in the requested timezone. Also returns up to three recommended slots.
473
+ * @summary Get posting times heatmap
474
+ * @param workspaceUuid UUID of the workspace.
475
+ * @param accounts Account UUIDs. Defaults to every account in the workspace.
476
+ * @param timezone Timezone the grid is expressed in. Defaults to the workspace timezone.
477
+ */
478
+ public async getPostingTimes (workspaceUuid: string, accounts?: Array<string>, timezone?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: PostingTimes; }> {
479
+ const localVarPath = this.basePath + '/{workspaceUuid}/analytics/posting-times'
480
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
481
+ let localVarQueryParameters: any = {};
482
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
483
+ const produces = ['application/json'];
484
+ // give precedence to 'application/json'
485
+ if (produces.indexOf('application/json') >= 0) {
486
+ localVarHeaderParams.Accept = 'application/json';
487
+ } else {
488
+ localVarHeaderParams.Accept = produces.join(',');
489
+ }
490
+ let localVarFormParams: any = {};
491
+
492
+ // verify required parameter 'workspaceUuid' is not null or undefined
493
+ if (workspaceUuid === null || workspaceUuid === undefined) {
494
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getPostingTimes.');
495
+ }
496
+
497
+ if (accounts !== undefined) {
498
+ localVarQueryParameters['accounts[]'] = ObjectSerializer.serialize(accounts, "Array<string>");
499
+ }
500
+
501
+ if (timezone !== undefined) {
502
+ localVarQueryParameters['timezone'] = ObjectSerializer.serialize(timezone, "string");
503
+ }
504
+
505
+ (<any>Object).assign(localVarHeaderParams, options.headers);
506
+
507
+ let localVarUseFormData = false;
508
+
509
+ let localVarRequestOptions: localVarRequest.Options = {
510
+ method: 'GET',
511
+ qs: localVarQueryParameters,
512
+ headers: localVarHeaderParams,
513
+ uri: localVarPath,
514
+ useQuerystring: this._useQuerystring,
515
+ json: true,
516
+ };
517
+
518
+ let authenticationPromise = Promise.resolve();
519
+ if (this.authentications.bearerAuth.accessToken) {
520
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
521
+ }
522
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
523
+
524
+ let interceptorPromise = authenticationPromise;
525
+ for (const interceptor of this.interceptors) {
526
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
527
+ }
528
+
529
+ return interceptorPromise.then(() => {
530
+ if (Object.keys(localVarFormParams).length) {
531
+ if (localVarUseFormData) {
532
+ (<any>localVarRequestOptions).formData = localVarFormParams;
533
+ } else {
534
+ localVarRequestOptions.form = localVarFormParams;
535
+ }
536
+ }
537
+ return new Promise<{ response: http.IncomingMessage; body: PostingTimes; }>((resolve, reject) => {
538
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
539
+ if (error) {
540
+ reject(error);
541
+ } else {
542
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
543
+ body = ObjectSerializer.deserialize(body, "PostingTimes");
544
+ resolve({ response: response, body: body });
545
+ } else {
546
+ reject(new HttpError(response, body, response.statusCode));
547
+ }
548
+ }
549
+ });
550
+ });
551
+ });
552
+ }
553
+ }
package/api/apis.ts CHANGED
@@ -2,8 +2,12 @@ export * from './aIApi';
2
2
  import { AIApi } from './aIApi';
3
3
  export * from './accountsApi';
4
4
  import { AccountsApi } from './accountsApi';
5
+ export * from './analyticsApi';
6
+ import { AnalyticsApi } from './analyticsApi';
5
7
  export * from './mediaApi';
6
8
  import { MediaApi } from './mediaApi';
9
+ export * from './mentionsApi';
10
+ import { MentionsApi } from './mentionsApi';
7
11
  export * from './postsApi';
8
12
  import { PostsApi } from './postsApi';
9
13
  export * from './receiptsApi';
@@ -27,4 +31,4 @@ export class HttpError extends Error {
27
31
 
28
32
  export { RequestFile } from '../model/models';
29
33
 
30
- export const APIS = [AIApi, AccountsApi, MediaApi, PostsApi, ReceiptsApi, SubscriptionsApi, TagsApi, UsersApi, WorkspacesApi];
34
+ export const APIS = [AIApi, AccountsApi, AnalyticsApi, MediaApi, MentionsApi, PostsApi, ReceiptsApi, SubscriptionsApi, TagsApi, UsersApi, WorkspacesApi];