postboost 1.7.0 → 1.14.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 (288) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.yml +26 -0
  2. package/.github/ISSUE_TEMPLATE/config.yml +11 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.yml +14 -0
  4. package/.github/pull_request_template.md +6 -0
  5. package/CODE_OF_CONDUCT.md +7 -0
  6. package/CONTRIBUTING.md +31 -0
  7. package/README.md +46 -2
  8. package/SECURITY.md +9 -0
  9. package/api/aIApi.ts +460 -2
  10. package/api/accountGroupsApi.ts +501 -0
  11. package/api/accountsApi.ts +266 -4
  12. package/api/activityApi.ts +188 -0
  13. package/api/agentsApi.ts +918 -0
  14. package/api/analyticsApi.ts +1102 -0
  15. package/api/apis.ts +23 -1
  16. package/api/competitorsApi.ts +412 -0
  17. package/api/hashtagGroupsApi.ts +501 -0
  18. package/api/inboxApi.ts +957 -0
  19. package/api/mediaApi.ts +474 -13
  20. package/api/mentionsApi.ts +509 -0
  21. package/api/postingScheduleApi.ts +497 -0
  22. package/api/postsApi.ts +1375 -65
  23. package/api/receiptsApi.ts +2 -2
  24. package/api/subscriptionsApi.ts +10 -5
  25. package/api/tagsApi.ts +5 -3
  26. package/api/templatesApi.ts +501 -0
  27. package/api/usersApi.ts +2 -2
  28. package/api/webhooksApi.ts +327 -0
  29. package/api/workspacesApi.ts +603 -3
  30. package/model/aICredits.ts +52 -0
  31. package/model/aIUsage.ts +39 -0
  32. package/model/aIUsageText.ts +52 -0
  33. package/model/account.ts +59 -4
  34. package/model/accountAnalytics.ts +73 -0
  35. package/model/accountAnalyticsInitialSync.ts +37 -0
  36. package/model/accountConnectionHealth.ts +124 -0
  37. package/model/accountErrorsInner.ts +50 -0
  38. package/model/accountErrorsInnerOneOf.ts +49 -0
  39. package/model/accountGroup.ts +49 -0
  40. package/model/accountGroupInput.ts +40 -0
  41. package/model/accountHealth.ts +90 -0
  42. package/model/accountHealthDailyCap.ts +43 -0
  43. package/model/accountSchedule.ts +49 -0
  44. package/model/addCompetitor202Response.ts +43 -0
  45. package/model/addCompetitor409Response.ts +37 -0
  46. package/model/addGenericSubscriptionRequest.ts +2 -2
  47. package/model/addPostToQueueRequest.ts +34 -0
  48. package/model/agentPageMeta.ts +49 -0
  49. package/model/agentProposal.ts +137 -0
  50. package/model/agentProposalDecision.ts +31 -0
  51. package/model/agentRun.ts +129 -0
  52. package/model/analyticsPeriod.ts +52 -0
  53. package/model/analyticsSummary.ts +39 -0
  54. package/model/analyticsSummaryData.ts +100 -0
  55. package/model/apiActivity.ts +94 -0
  56. package/model/apiActivityOutcome.ts +27 -0
  57. package/model/apiKey.ts +77 -0
  58. package/model/apiKeyAbility.ts +21 -0
  59. package/model/apiKeyInput.ts +56 -0
  60. package/model/approveAgentProposal200Response.ts +32 -0
  61. package/model/approveAgentProposal409Response.ts +38 -0
  62. package/model/approveInboxReplyDraft403Response.ts +43 -0
  63. package/model/approvePostRequest.ts +62 -0
  64. package/model/bestPostingTimes.ts +41 -0
  65. package/model/bestPostingTimesTimesInner.ts +49 -0
  66. package/model/blogToSocial200Response.ts +9 -2
  67. package/model/blogToSocial429Response.ts +2 -2
  68. package/model/blogToSocialCaption.ts +2 -2
  69. package/model/blogToSocialInput.ts +11 -2
  70. package/model/blogToSocialMedia.ts +2 -2
  71. package/model/blogToSocialResponse.ts +2 -2
  72. package/model/brandVoice.ts +136 -0
  73. package/model/brandVoiceInput.ts +142 -0
  74. package/model/brandVoiceMeta.ts +34 -0
  75. package/model/cancelSubscription422Response.ts +38 -0
  76. package/model/cancelSubscription422ResponseErrors.ts +31 -0
  77. package/model/cancelSubscriptionRequest.ts +34 -0
  78. package/model/changeSubscriptionPlanRequest.ts +2 -2
  79. package/model/channelAccount.ts +101 -0
  80. package/model/checkoutSubscription200Response.ts +2 -2
  81. package/model/checkoutSubscriptionRequest.ts +2 -2
  82. package/model/codedError.ts +46 -0
  83. package/model/competitor.ts +82 -0
  84. package/model/competitorDetail.ts +96 -0
  85. package/model/competitorInput.ts +43 -0
  86. package/model/competitorMedia.ts +61 -0
  87. package/model/competitorSnapshot.ts +43 -0
  88. package/model/completeChunkedUploadRequest.ts +40 -0
  89. package/model/connectChannelInput.ts +64 -0
  90. package/model/createAccountGroup201Response.ts +32 -0
  91. package/model/createAgent201Response.ts +32 -0
  92. package/model/createApiKey201Response.ts +32 -0
  93. package/model/createApiKey201ResponseData.ts +86 -0
  94. package/model/createHashtagGroup201Response.ts +32 -0
  95. package/model/createInboxReplyDraft201Response.ts +32 -0
  96. package/model/createMediaFolderRequest.ts +43 -0
  97. package/model/createMention201Response.ts +32 -0
  98. package/model/createRecyclingRule201Response.ts +32 -0
  99. package/model/createReportExport201Response.ts +32 -0
  100. package/model/createResellerClient201Response.ts +32 -0
  101. package/model/createRssFeed201Response.ts +32 -0
  102. package/model/createTemplate201Response.ts +32 -0
  103. package/model/createWebhookSubscription201Response.ts +32 -0
  104. package/model/createWebhookSubscription201ResponseData.ts +70 -0
  105. package/model/deleteAgent200Response.ts +31 -0
  106. package/model/deleteMediaBulkRequest.ts +6 -5
  107. package/model/deleteMediaBulkRequestItemsInner.ts +26 -0
  108. package/model/deleteMediaFolderRequest.ts +31 -0
  109. package/model/deleteMode.ts +2 -2
  110. package/model/deletePostRequest.ts +2 -2
  111. package/model/deletePostsBulkRequest.ts +2 -2
  112. package/model/deleteReceiptsBulkRequest.ts +2 -2
  113. package/model/deleteResult.ts +2 -2
  114. package/model/deleteUser400Response.ts +2 -2
  115. package/model/deleteUsersBulkRequest.ts +2 -2
  116. package/model/deleteWorkspacesBulkRequest.ts +2 -2
  117. package/model/getAccountHealth200Response.ts +32 -0
  118. package/model/getBrandVoice200Response.ts +32 -0
  119. package/model/getCompetitor200Response.ts +32 -0
  120. package/model/getInboxConversation200Response.ts +32 -0
  121. package/model/getPostingSchedule200Response.ts +32 -0
  122. package/model/getRemoteUploadStatus200Response.ts +2 -2
  123. package/model/getReportBranding200Response.ts +32 -0
  124. package/model/guardrailError.ts +82 -0
  125. package/model/hashtagGroup.ts +46 -0
  126. package/model/hashtagGroupInput.ts +37 -0
  127. package/model/imageAltText200Response.ts +2 -2
  128. package/model/imageAltTextInput.ts +2 -2
  129. package/model/imageAltTextResponse.ts +2 -2
  130. package/model/imageCreditBalance.ts +67 -0
  131. package/model/imageEditInput.ts +11 -2
  132. package/model/imageGenerate200Response.ts +9 -2
  133. package/model/imageGenerate429Response.ts +2 -2
  134. package/model/imageGenerateInput.ts +14 -2
  135. package/model/imageGenerationResponse.ts +2 -2
  136. package/model/imagePrompt200Response.ts +9 -2
  137. package/model/imagePrompt429Response.ts +2 -2
  138. package/model/imagePromptInput.ts +14 -2
  139. package/model/imagePromptResponse.ts +2 -2
  140. package/model/imageVariations200Response.ts +2 -2
  141. package/model/imageVariationsInput.ts +2 -2
  142. package/model/imageVariationsResponse.ts +2 -2
  143. package/model/inboxAuthor.ts +43 -0
  144. package/model/inboxConversation.ts +139 -0
  145. package/model/inboxConversationAccount.ts +49 -0
  146. package/model/inboxConversationUpdate.ts +43 -0
  147. package/model/inboxMessage.ts +95 -0
  148. package/model/inboxMessageAuthor.ts +43 -0
  149. package/model/inboxReplyDraft.ts +132 -0
  150. package/model/inboxReplyDraftApprove.ts +34 -0
  151. package/model/inboxReplyDraftEdit.ts +31 -0
  152. package/model/inboxReplyDraftInput.ts +43 -0
  153. package/model/initiateChunkedUpload201Response.ts +2 -2
  154. package/model/initiateChunkedUploadRequest.ts +2 -2
  155. package/model/initiateRemoteUpload201Response.ts +60 -2
  156. package/model/initiateRemoteUpload201ResponseOneOf.ts +2 -2
  157. package/model/initiateRemoteUploadRequest.ts +11 -2
  158. package/model/learnBrandVoiceInput.ts +61 -0
  159. package/model/learnBrandVoiceResponse.ts +39 -0
  160. package/model/learnBrandVoiceResponseMeta.ts +55 -0
  161. package/model/listAccountGroups200Response.ts +46 -0
  162. package/model/listAccounts200Response.ts +2 -2
  163. package/model/listAgentProposals200Response.ts +39 -0
  164. package/model/listAgentRuns200Response.ts +39 -0
  165. package/model/listAgents200Response.ts +32 -0
  166. package/model/listApiActivity200Response.ts +46 -0
  167. package/model/listApiKeys200Response.ts +32 -0
  168. package/model/listCompetitors200Response.ts +32 -0
  169. package/model/listHashtagGroups200Response.ts +46 -0
  170. package/model/listInboxConversations200Response.ts +46 -0
  171. package/model/listInboxReplyDrafts200Response.ts +46 -0
  172. package/model/listMedia200Response.ts +2 -2
  173. package/model/listMediaFolders200Response.ts +32 -0
  174. package/model/listMentions200Response.ts +46 -0
  175. package/model/listMyWorkspaces200Response.ts +32 -0
  176. package/model/listPosts200Response.ts +2 -2
  177. package/model/listReceipts200Response.ts +2 -2
  178. package/model/listRecyclingRules200Response.ts +32 -0
  179. package/model/listRecyclingRuns200Response.ts +32 -0
  180. package/model/listReportExports200Response.ts +32 -0
  181. package/model/listResellerClients200Response.ts +39 -0
  182. package/model/listRssFeeds200Response.ts +32 -0
  183. package/model/listTags200Response.ts +2 -2
  184. package/model/listTemplates200Response.ts +46 -0
  185. package/model/listUsers200Response.ts +2 -2
  186. package/model/listWebhookSubscriptions200Response.ts +32 -0
  187. package/model/listWorkspaces200Response.ts +2 -2
  188. package/model/media.ts +60 -2
  189. package/model/mediaBase64Input.ts +61 -0
  190. package/model/mediaFolder.ts +55 -0
  191. package/model/mediaFolderInput.ts +43 -0
  192. package/model/mediaFolderRef.ts +37 -0
  193. package/model/mention.ts +65 -0
  194. package/model/mentionIdentity.ts +55 -0
  195. package/model/mentionIdentityInput.ts +67 -0
  196. package/model/mentionInput.ts +44 -0
  197. package/model/messageOnly.ts +31 -0
  198. package/model/models.ts +600 -0
  199. package/model/paginationMeta.ts +2 -2
  200. package/model/paginationMetaLinks.ts +4 -4
  201. package/model/paginationMetaMeta.ts +4 -4
  202. package/model/pollRssFeed200Response.ts +50 -0
  203. package/model/post.ts +12 -2
  204. package/model/postAnalytics.ts +46 -0
  205. package/model/postContent.ts +6 -3
  206. package/model/postInput.ts +33 -2
  207. package/model/postOptionsInstagram.ts +59 -0
  208. package/model/postOptionsTikTok.ts +97 -0
  209. package/model/postOptionsYoutube.ts +62 -0
  210. package/model/postStatus.ts +9 -3
  211. package/model/postVersion.ts +16 -6
  212. package/model/postVersionOptions.ts +55 -0
  213. package/model/postingSchedule.ts +74 -0
  214. package/model/postingScheduleDay.ts +50 -0
  215. package/model/postingScheduleDayTimesInner.ts +34 -0
  216. package/model/postingScheduleInput.ts +53 -0
  217. package/model/postingTimeSlot.ts +51 -0
  218. package/model/postingTimes.ts +88 -0
  219. package/model/postingTimesBestInner.ts +49 -0
  220. package/model/postingTimesDayIntervalsInnerInner.ts +69 -0
  221. package/model/postingTimesDaysInner.ts +57 -0
  222. package/model/preflightResult.ts +69 -0
  223. package/model/publicWorkspace.ts +50 -0
  224. package/model/publicWorkspacePivot.ts +53 -0
  225. package/model/publishProgress.ts +46 -0
  226. package/model/queueSlots.ts +43 -0
  227. package/model/receipt.ts +2 -2
  228. package/model/receiptInput.ts +2 -2
  229. package/model/receiptUpdateInput.ts +2 -2
  230. package/model/recommendedPostingTimes.ts +61 -0
  231. package/model/reconnectLink.ts +46 -0
  232. package/model/recyclingRule.ts +117 -0
  233. package/model/recyclingRuleInput.ts +114 -0
  234. package/model/recyclingRuleSettings.ts +83 -0
  235. package/model/recyclingRuleUpdate.ts +71 -0
  236. package/model/recyclingRun.ts +71 -0
  237. package/model/removeGenericSubscription422Response.ts +31 -0
  238. package/model/removeUserFromWorkspaceRequest.ts +2 -2
  239. package/model/reportBranding.ts +61 -0
  240. package/model/reportBrandingInput.ts +55 -0
  241. package/model/reportExport.ts +121 -0
  242. package/model/reportExportInput.ts +91 -0
  243. package/model/repurposeContent200Response.ts +39 -0
  244. package/model/repurposeInput.ts +213 -0
  245. package/model/repurposeInputTheme.ts +46 -0
  246. package/model/repurposeResult.ts +89 -0
  247. package/model/repurposeResultMedia.ts +40 -0
  248. package/model/repurposeResultSource.ts +51 -0
  249. package/model/repurposeSlide.ts +43 -0
  250. package/model/resellerClient.ts +82 -0
  251. package/model/resellerClientInput.ts +31 -0
  252. package/model/resellerClientUsage.ts +43 -0
  253. package/model/retryPostAccountResult.ts +47 -0
  254. package/model/rssFeed.ts +100 -0
  255. package/model/rssFeedInput.ts +79 -0
  256. package/model/rssFeedUpdate.ts +73 -0
  257. package/model/runAgent202Response.ts +32 -0
  258. package/model/schedulePostRequest.ts +39 -2
  259. package/model/scheduleResult.ts +11 -2
  260. package/model/subscription.ts +2 -2
  261. package/model/subscriptionInput.ts +2 -2
  262. package/model/subscriptionStatus.ts +2 -2
  263. package/model/subscriptionUpdateInput.ts +2 -2
  264. package/model/tag.ts +2 -2
  265. package/model/tagInput.ts +2 -2
  266. package/model/template.ts +47 -0
  267. package/model/templateContentItem.ts +40 -0
  268. package/model/templateInput.ts +41 -0
  269. package/model/templateInputContentInner.ts +40 -0
  270. package/model/updateMediaRequest.ts +18 -3
  271. package/model/uploadChunk201Response.ts +2 -2
  272. package/model/user.ts +11 -2
  273. package/model/userInput.ts +2 -2
  274. package/model/userUpdateInput.ts +2 -2
  275. package/model/webhookEventName.ts +31 -0
  276. package/model/webhookEventPayload.ts +43 -0
  277. package/model/webhookSubscription.ts +61 -0
  278. package/model/webhookSubscriptionInput.ts +67 -0
  279. package/model/workspace.ts +17 -3
  280. package/model/workspaceAgent.ts +91 -0
  281. package/model/workspaceAgentInput.ts +67 -0
  282. package/model/workspaceAgentSettings.ts +70 -0
  283. package/model/workspaceAgentUpdate.ts +58 -0
  284. package/model/workspaceInput.ts +8 -3
  285. package/model/workspaceUserInput.ts +2 -2
  286. package/model/xUsage.ts +68 -0
  287. package/model/xUsageCounter.ts +40 -0
  288. package/package.json +1 -1
@@ -0,0 +1,1102 @@
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. ## Idempotent requests Send an `Idempotency-Key` header (any unique string, for example a UUID) with a `POST`. Repeating the request with the same key within 24 hours returns the stored response with `Idempotent-Replayed: true` and creates nothing new. Reusing a key with a different body returns `422`; a request still in progress with the same key returns `409`. `5xx` and `429` responses are not stored, so they can be retried with the same key. ## Guardrails for automated clients Create and update requests are checked before anything is written: a post whose content matches one created for the same account in the last 24 hours returns `409` (`code: duplicate_post`, override with `allow_duplicate: true`), scheduling past an account\'s daily cap returns `429` (`code: account_daily_cap_reached`), and scheduling to an account that must be reconnected returns `422` (`code: account_unauthorized` or `account_token_missing`). Use `POST /{workspaceUuid}/posts/validate` for a dry run and `GET /{workspaceUuid}/activity` to review what API clients did. ## 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.14.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 { CreateReportExport201Response } from '../model/createReportExport201Response';
22
+ import { GetReportBranding200Response } from '../model/getReportBranding200Response';
23
+ import { ListReportExports200Response } from '../model/listReportExports200Response';
24
+ import { MessageOnly } from '../model/messageOnly';
25
+ import { PostAnalytics } from '../model/postAnalytics';
26
+ import { PostingTimes } from '../model/postingTimes';
27
+ import { ReportBrandingInput } from '../model/reportBrandingInput';
28
+ import { ReportExportInput } from '../model/reportExportInput';
29
+
30
+ import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
31
+ import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
32
+
33
+ import { HttpError, RequestFile } from './apis';
34
+
35
+ let defaultBasePath = 'https://postboost.co/app/api';
36
+
37
+ // ===============================================
38
+ // This file is autogenerated - Please do not edit
39
+ // ===============================================
40
+
41
+ export enum AnalyticsApiApiKeys {
42
+ }
43
+
44
+ export class AnalyticsApi {
45
+ protected _basePath = defaultBasePath;
46
+ protected _defaultHeaders : any = {};
47
+ protected _useQuerystring : boolean = false;
48
+
49
+ protected authentications = {
50
+ 'default': <Authentication>new VoidAuth(),
51
+ 'bearerAuth': new HttpBearerAuth(),
52
+ }
53
+
54
+ protected interceptors: Interceptor[] = [];
55
+
56
+ constructor(basePath?: string);
57
+ constructor(basePathOrUsername: string, password?: string, basePath?: string) {
58
+ if (password) {
59
+ if (basePath) {
60
+ this.basePath = basePath;
61
+ }
62
+ } else {
63
+ if (basePathOrUsername) {
64
+ this.basePath = basePathOrUsername
65
+ }
66
+ }
67
+ }
68
+
69
+ set useQuerystring(value: boolean) {
70
+ this._useQuerystring = value;
71
+ }
72
+
73
+ set basePath(basePath: string) {
74
+ this._basePath = basePath;
75
+ }
76
+
77
+ set defaultHeaders(defaultHeaders: any) {
78
+ this._defaultHeaders = defaultHeaders;
79
+ }
80
+
81
+ get defaultHeaders() {
82
+ return this._defaultHeaders;
83
+ }
84
+
85
+ get basePath() {
86
+ return this._basePath;
87
+ }
88
+
89
+ public setDefaultAuthentication(auth: Authentication) {
90
+ this.authentications.default = auth;
91
+ }
92
+
93
+ public setApiKey(key: AnalyticsApiApiKeys, value: string) {
94
+ (this.authentications as any)[AnalyticsApiApiKeys[key]].apiKey = value;
95
+ }
96
+
97
+ set accessToken(accessToken: string | (() => string)) {
98
+ this.authentications.bearerAuth.accessToken = accessToken;
99
+ }
100
+
101
+ public addInterceptor(interceptor: Interceptor) {
102
+ this.interceptors.push(interceptor);
103
+ }
104
+
105
+ /**
106
+ * Generates a report for a period (default `last_month`) or a custom `date_from`/`date_to` range: a branded PDF (summary, accounts, top 10 posts; the header uses the report branding) or a CSV with one row per published post and account (`dataset: posts`, default) or per account (`dataset: accounts`). CSV files are UTF-8 with a byte order mark. At most 500 posts per report. The file is ready when the call returns; fetch it from `download_url` with the same token. Admins and members only; 20 per minute.
107
+ * @summary Create a report export
108
+ * @param workspaceUuid UUID of the workspace.
109
+ * @param reportExportInput
110
+ */
111
+ public async createReportExport (workspaceUuid: string, reportExportInput: ReportExportInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateReportExport201Response; }> {
112
+ const localVarPath = this.basePath + '/{workspaceUuid}/reports/exports'
113
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
114
+ let localVarQueryParameters: any = {};
115
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
116
+ const produces = ['application/json'];
117
+ // give precedence to 'application/json'
118
+ if (produces.indexOf('application/json') >= 0) {
119
+ localVarHeaderParams.Accept = 'application/json';
120
+ } else {
121
+ localVarHeaderParams.Accept = produces.join(',');
122
+ }
123
+ let localVarFormParams: any = {};
124
+
125
+ // verify required parameter 'workspaceUuid' is not null or undefined
126
+ if (workspaceUuid === null || workspaceUuid === undefined) {
127
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling createReportExport.');
128
+ }
129
+
130
+ // verify required parameter 'reportExportInput' is not null or undefined
131
+ if (reportExportInput === null || reportExportInput === undefined) {
132
+ throw new Error('Required parameter reportExportInput was null or undefined when calling createReportExport.');
133
+ }
134
+
135
+ (<any>Object).assign(localVarHeaderParams, options.headers);
136
+
137
+ let localVarUseFormData = false;
138
+
139
+ let localVarRequestOptions: localVarRequest.Options = {
140
+ method: 'POST',
141
+ qs: localVarQueryParameters,
142
+ headers: localVarHeaderParams,
143
+ uri: localVarPath,
144
+ useQuerystring: this._useQuerystring,
145
+ json: true,
146
+ body: ObjectSerializer.serialize(reportExportInput, "ReportExportInput")
147
+ };
148
+
149
+ let authenticationPromise = Promise.resolve();
150
+ if (this.authentications.bearerAuth.accessToken) {
151
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
152
+ }
153
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
154
+
155
+ let interceptorPromise = authenticationPromise;
156
+ for (const interceptor of this.interceptors) {
157
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
158
+ }
159
+
160
+ return interceptorPromise.then(() => {
161
+ if (Object.keys(localVarFormParams).length) {
162
+ if (localVarUseFormData) {
163
+ (<any>localVarRequestOptions).formData = localVarFormParams;
164
+ } else {
165
+ localVarRequestOptions.form = localVarFormParams;
166
+ }
167
+ }
168
+ return new Promise<{ response: http.IncomingMessage; body: CreateReportExport201Response; }>((resolve, reject) => {
169
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
170
+ if (error) {
171
+ reject(error);
172
+ } else {
173
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
174
+ body = ObjectSerializer.deserialize(body, "CreateReportExport201Response");
175
+ resolve({ response: response, body: body });
176
+ } else {
177
+ reject(new HttpError(response, body, response.statusCode));
178
+ }
179
+ }
180
+ });
181
+ });
182
+ });
183
+ }
184
+ /**
185
+ * The PDF or CSV file. `410` once it expired (7 days) or if the export failed.
186
+ * @summary Download a report file
187
+ * @param workspaceUuid UUID of the workspace.
188
+ * @param exportUuid UUID of the report export.
189
+ */
190
+ public async downloadReportExport (workspaceUuid: string, exportUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Buffer; }> {
191
+ const localVarPath = this.basePath + '/{workspaceUuid}/reports/exports/{exportUuid}/download'
192
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
193
+ .replace('{' + 'exportUuid' + '}', encodeURIComponent(String(exportUuid)));
194
+ let localVarQueryParameters: any = {};
195
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
196
+ const produces = ['application/pdf', 'text/csv', 'application/json'];
197
+ // give precedence to 'application/json'
198
+ if (produces.indexOf('application/json') >= 0) {
199
+ localVarHeaderParams.Accept = 'application/json';
200
+ } else {
201
+ localVarHeaderParams.Accept = produces.join(',');
202
+ }
203
+ let localVarFormParams: any = {};
204
+
205
+ // verify required parameter 'workspaceUuid' is not null or undefined
206
+ if (workspaceUuid === null || workspaceUuid === undefined) {
207
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling downloadReportExport.');
208
+ }
209
+
210
+ // verify required parameter 'exportUuid' is not null or undefined
211
+ if (exportUuid === null || exportUuid === undefined) {
212
+ throw new Error('Required parameter exportUuid was null or undefined when calling downloadReportExport.');
213
+ }
214
+
215
+ (<any>Object).assign(localVarHeaderParams, options.headers);
216
+
217
+ let localVarUseFormData = false;
218
+
219
+ let localVarRequestOptions: localVarRequest.Options = {
220
+ method: 'GET',
221
+ qs: localVarQueryParameters,
222
+ headers: localVarHeaderParams,
223
+ uri: localVarPath,
224
+ useQuerystring: this._useQuerystring,
225
+ encoding: null,
226
+ };
227
+
228
+ let authenticationPromise = Promise.resolve();
229
+ if (this.authentications.bearerAuth.accessToken) {
230
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
231
+ }
232
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
233
+
234
+ let interceptorPromise = authenticationPromise;
235
+ for (const interceptor of this.interceptors) {
236
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
237
+ }
238
+
239
+ return interceptorPromise.then(() => {
240
+ if (Object.keys(localVarFormParams).length) {
241
+ if (localVarUseFormData) {
242
+ (<any>localVarRequestOptions).formData = localVarFormParams;
243
+ } else {
244
+ localVarRequestOptions.form = localVarFormParams;
245
+ }
246
+ }
247
+ return new Promise<{ response: http.IncomingMessage; body: Buffer; }>((resolve, reject) => {
248
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
249
+ if (error) {
250
+ reject(error);
251
+ } else {
252
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
253
+ body = ObjectSerializer.deserialize(body, "Buffer");
254
+ resolve({ response: response, body: body });
255
+ } else {
256
+ reject(new HttpError(response, body, response.statusCode));
257
+ }
258
+ }
259
+ });
260
+ });
261
+ });
262
+ }
263
+ /**
264
+ * 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.
265
+ * @summary Get account analytics
266
+ * @param workspaceUuid UUID of the workspace.
267
+ * @param accountUuid UUID of the social media account.
268
+ * @param period Preset reporting period. Ignored when &#x60;date_from&#x60; and &#x60;date_to&#x60; are given.
269
+ * @param dateFrom Start of a custom range (Y-m-d). Required with &#x60;date_to&#x60;; the range may span at most 366 days.
270
+ * @param dateTo End of a custom range (Y-m-d). Required with &#x60;date_from&#x60;; must not be before it.
271
+ * @param type Analytics tab. Defaults to the account\&#39;s default tab.
272
+ * @param page Page for list-style tabs (for example per-post metrics).
273
+ * @param perPage
274
+ * @param sortBy
275
+ * @param sortDir
276
+ */
277
+ 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; }> {
278
+ const localVarPath = this.basePath + '/{workspaceUuid}/analytics/accounts/{accountUuid}'
279
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
280
+ .replace('{' + 'accountUuid' + '}', encodeURIComponent(String(accountUuid)));
281
+ let localVarQueryParameters: any = {};
282
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
283
+ const produces = ['application/json'];
284
+ // give precedence to 'application/json'
285
+ if (produces.indexOf('application/json') >= 0) {
286
+ localVarHeaderParams.Accept = 'application/json';
287
+ } else {
288
+ localVarHeaderParams.Accept = produces.join(',');
289
+ }
290
+ let localVarFormParams: any = {};
291
+
292
+ // verify required parameter 'workspaceUuid' is not null or undefined
293
+ if (workspaceUuid === null || workspaceUuid === undefined) {
294
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getAccountAnalytics.');
295
+ }
296
+
297
+ // verify required parameter 'accountUuid' is not null or undefined
298
+ if (accountUuid === null || accountUuid === undefined) {
299
+ throw new Error('Required parameter accountUuid was null or undefined when calling getAccountAnalytics.');
300
+ }
301
+
302
+ if (period !== undefined) {
303
+ localVarQueryParameters['period'] = ObjectSerializer.serialize(period, "'this_week' | 'last_week' | 'this_month' | 'last_month' | 'last_3_months' | 'this_year'");
304
+ }
305
+
306
+ if (dateFrom !== undefined) {
307
+ localVarQueryParameters['date_from'] = ObjectSerializer.serialize(dateFrom, "string");
308
+ }
309
+
310
+ if (dateTo !== undefined) {
311
+ localVarQueryParameters['date_to'] = ObjectSerializer.serialize(dateTo, "string");
312
+ }
313
+
314
+ if (type !== undefined) {
315
+ localVarQueryParameters['type'] = ObjectSerializer.serialize(type, "string");
316
+ }
317
+
318
+ if (page !== undefined) {
319
+ localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
320
+ }
321
+
322
+ if (perPage !== undefined) {
323
+ localVarQueryParameters['per_page'] = ObjectSerializer.serialize(perPage, "number");
324
+ }
325
+
326
+ if (sortBy !== undefined) {
327
+ localVarQueryParameters['sort_by'] = ObjectSerializer.serialize(sortBy, "string");
328
+ }
329
+
330
+ if (sortDir !== undefined) {
331
+ localVarQueryParameters['sort_dir'] = ObjectSerializer.serialize(sortDir, "'asc' | 'desc'");
332
+ }
333
+
334
+ (<any>Object).assign(localVarHeaderParams, options.headers);
335
+
336
+ let localVarUseFormData = false;
337
+
338
+ let localVarRequestOptions: localVarRequest.Options = {
339
+ method: 'GET',
340
+ qs: localVarQueryParameters,
341
+ headers: localVarHeaderParams,
342
+ uri: localVarPath,
343
+ useQuerystring: this._useQuerystring,
344
+ json: true,
345
+ };
346
+
347
+ let authenticationPromise = Promise.resolve();
348
+ if (this.authentications.bearerAuth.accessToken) {
349
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
350
+ }
351
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
352
+
353
+ let interceptorPromise = authenticationPromise;
354
+ for (const interceptor of this.interceptors) {
355
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
356
+ }
357
+
358
+ return interceptorPromise.then(() => {
359
+ if (Object.keys(localVarFormParams).length) {
360
+ if (localVarUseFormData) {
361
+ (<any>localVarRequestOptions).formData = localVarFormParams;
362
+ } else {
363
+ localVarRequestOptions.form = localVarFormParams;
364
+ }
365
+ }
366
+ return new Promise<{ response: http.IncomingMessage; body: AccountAnalytics; }>((resolve, reject) => {
367
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
368
+ if (error) {
369
+ reject(error);
370
+ } else {
371
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
372
+ body = ObjectSerializer.deserialize(body, "AccountAnalytics");
373
+ resolve({ response: response, body: body });
374
+ } else {
375
+ reject(new HttpError(response, body, response.statusCode));
376
+ }
377
+ }
378
+ });
379
+ });
380
+ });
381
+ }
382
+ /**
383
+ * Cross-platform summary (followers, growth, posts, leaderboard, posting streak) over every account that supports analytics, for a preset period or a custom date range.
384
+ * @summary Get analytics summary
385
+ * @param workspaceUuid UUID of the workspace.
386
+ * @param period Preset reporting period. Ignored when &#x60;date_from&#x60; and &#x60;date_to&#x60; are given.
387
+ * @param dateFrom Start of a custom range (Y-m-d). Required with &#x60;date_to&#x60;; the range may span at most 366 days.
388
+ * @param dateTo End of a custom range (Y-m-d). Required with &#x60;date_from&#x60;; must not be before it.
389
+ */
390
+ 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; }> {
391
+ const localVarPath = this.basePath + '/{workspaceUuid}/analytics'
392
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
393
+ let localVarQueryParameters: any = {};
394
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
395
+ const produces = ['application/json'];
396
+ // give precedence to 'application/json'
397
+ if (produces.indexOf('application/json') >= 0) {
398
+ localVarHeaderParams.Accept = 'application/json';
399
+ } else {
400
+ localVarHeaderParams.Accept = produces.join(',');
401
+ }
402
+ let localVarFormParams: any = {};
403
+
404
+ // verify required parameter 'workspaceUuid' is not null or undefined
405
+ if (workspaceUuid === null || workspaceUuid === undefined) {
406
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getAnalyticsSummary.');
407
+ }
408
+
409
+ if (period !== undefined) {
410
+ localVarQueryParameters['period'] = ObjectSerializer.serialize(period, "'this_week' | 'last_week' | 'this_month' | 'last_month' | 'last_3_months' | 'this_year'");
411
+ }
412
+
413
+ if (dateFrom !== undefined) {
414
+ localVarQueryParameters['date_from'] = ObjectSerializer.serialize(dateFrom, "string");
415
+ }
416
+
417
+ if (dateTo !== undefined) {
418
+ localVarQueryParameters['date_to'] = ObjectSerializer.serialize(dateTo, "string");
419
+ }
420
+
421
+ (<any>Object).assign(localVarHeaderParams, options.headers);
422
+
423
+ let localVarUseFormData = false;
424
+
425
+ let localVarRequestOptions: localVarRequest.Options = {
426
+ method: 'GET',
427
+ qs: localVarQueryParameters,
428
+ headers: localVarHeaderParams,
429
+ uri: localVarPath,
430
+ useQuerystring: this._useQuerystring,
431
+ json: true,
432
+ };
433
+
434
+ let authenticationPromise = Promise.resolve();
435
+ if (this.authentications.bearerAuth.accessToken) {
436
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
437
+ }
438
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
439
+
440
+ let interceptorPromise = authenticationPromise;
441
+ for (const interceptor of this.interceptors) {
442
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
443
+ }
444
+
445
+ return interceptorPromise.then(() => {
446
+ if (Object.keys(localVarFormParams).length) {
447
+ if (localVarUseFormData) {
448
+ (<any>localVarRequestOptions).formData = localVarFormParams;
449
+ } else {
450
+ localVarRequestOptions.form = localVarFormParams;
451
+ }
452
+ }
453
+ return new Promise<{ response: http.IncomingMessage; body: AnalyticsSummary; }>((resolve, reject) => {
454
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
455
+ if (error) {
456
+ reject(error);
457
+ } else {
458
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
459
+ body = ObjectSerializer.deserialize(body, "AnalyticsSummary");
460
+ resolve({ response: response, body: body });
461
+ } else {
462
+ reject(new HttpError(response, body, response.statusCode));
463
+ }
464
+ }
465
+ });
466
+ });
467
+ });
468
+ }
469
+ /**
470
+ * The next recommended date and time per account, on or after `from` (never in the past), within the next 14 days.
471
+ * @summary Get best posting times
472
+ * @param workspaceUuid UUID of the workspace.
473
+ * @param accounts Account UUIDs. Defaults to every account in the workspace.
474
+ * @param from Earliest date to recommend (Y-m-d). Defaults to now.
475
+ * @param timezone Timezone for &#x60;from&#x60; and the returned times. Defaults to the workspace timezone.
476
+ */
477
+ public async getBestPostingTimes (workspaceUuid: string, accounts?: Array<string>, from?: string, timezone?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: BestPostingTimes; }> {
478
+ const localVarPath = this.basePath + '/{workspaceUuid}/analytics/best-times'
479
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
480
+ let localVarQueryParameters: any = {};
481
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
482
+ const produces = ['application/json'];
483
+ // give precedence to 'application/json'
484
+ if (produces.indexOf('application/json') >= 0) {
485
+ localVarHeaderParams.Accept = 'application/json';
486
+ } else {
487
+ localVarHeaderParams.Accept = produces.join(',');
488
+ }
489
+ let localVarFormParams: any = {};
490
+
491
+ // verify required parameter 'workspaceUuid' is not null or undefined
492
+ if (workspaceUuid === null || workspaceUuid === undefined) {
493
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getBestPostingTimes.');
494
+ }
495
+
496
+ if (accounts !== undefined) {
497
+ localVarQueryParameters['accounts[]'] = ObjectSerializer.serialize(accounts, "Array<string>");
498
+ }
499
+
500
+ if (from !== undefined) {
501
+ localVarQueryParameters['from'] = ObjectSerializer.serialize(from, "string");
502
+ }
503
+
504
+ if (timezone !== undefined) {
505
+ localVarQueryParameters['timezone'] = ObjectSerializer.serialize(timezone, "string");
506
+ }
507
+
508
+ (<any>Object).assign(localVarHeaderParams, options.headers);
509
+
510
+ let localVarUseFormData = false;
511
+
512
+ let localVarRequestOptions: localVarRequest.Options = {
513
+ method: 'GET',
514
+ qs: localVarQueryParameters,
515
+ headers: localVarHeaderParams,
516
+ uri: localVarPath,
517
+ useQuerystring: this._useQuerystring,
518
+ json: true,
519
+ };
520
+
521
+ let authenticationPromise = Promise.resolve();
522
+ if (this.authentications.bearerAuth.accessToken) {
523
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
524
+ }
525
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
526
+
527
+ let interceptorPromise = authenticationPromise;
528
+ for (const interceptor of this.interceptors) {
529
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
530
+ }
531
+
532
+ return interceptorPromise.then(() => {
533
+ if (Object.keys(localVarFormParams).length) {
534
+ if (localVarUseFormData) {
535
+ (<any>localVarRequestOptions).formData = localVarFormParams;
536
+ } else {
537
+ localVarRequestOptions.form = localVarFormParams;
538
+ }
539
+ }
540
+ return new Promise<{ response: http.IncomingMessage; body: BestPostingTimes; }>((resolve, reject) => {
541
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
542
+ if (error) {
543
+ reject(error);
544
+ } else {
545
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
546
+ body = ObjectSerializer.deserialize(body, "BestPostingTimes");
547
+ resolve({ response: response, body: body });
548
+ } else {
549
+ reject(new HttpError(response, body, response.statusCode));
550
+ }
551
+ }
552
+ });
553
+ });
554
+ });
555
+ }
556
+ /**
557
+ * Engagement metrics for a published post across its accounts (also works for trashed posts), with totals, trends and the best-performing account.
558
+ * @summary Get post analytics
559
+ * @param workspaceUuid UUID of the workspace.
560
+ * @param postUuid UUID of the post.
561
+ */
562
+ public async getPostAnalytics (workspaceUuid: string, postUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: PostAnalytics; }> {
563
+ const localVarPath = this.basePath + '/{workspaceUuid}/posts/{postUuid}/analytics'
564
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
565
+ .replace('{' + 'postUuid' + '}', encodeURIComponent(String(postUuid)));
566
+ let localVarQueryParameters: any = {};
567
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
568
+ const produces = ['application/json'];
569
+ // give precedence to 'application/json'
570
+ if (produces.indexOf('application/json') >= 0) {
571
+ localVarHeaderParams.Accept = 'application/json';
572
+ } else {
573
+ localVarHeaderParams.Accept = produces.join(',');
574
+ }
575
+ let localVarFormParams: any = {};
576
+
577
+ // verify required parameter 'workspaceUuid' is not null or undefined
578
+ if (workspaceUuid === null || workspaceUuid === undefined) {
579
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getPostAnalytics.');
580
+ }
581
+
582
+ // verify required parameter 'postUuid' is not null or undefined
583
+ if (postUuid === null || postUuid === undefined) {
584
+ throw new Error('Required parameter postUuid was null or undefined when calling getPostAnalytics.');
585
+ }
586
+
587
+ (<any>Object).assign(localVarHeaderParams, options.headers);
588
+
589
+ let localVarUseFormData = false;
590
+
591
+ let localVarRequestOptions: localVarRequest.Options = {
592
+ method: 'GET',
593
+ qs: localVarQueryParameters,
594
+ headers: localVarHeaderParams,
595
+ uri: localVarPath,
596
+ useQuerystring: this._useQuerystring,
597
+ json: true,
598
+ };
599
+
600
+ let authenticationPromise = Promise.resolve();
601
+ if (this.authentications.bearerAuth.accessToken) {
602
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
603
+ }
604
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
605
+
606
+ let interceptorPromise = authenticationPromise;
607
+ for (const interceptor of this.interceptors) {
608
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
609
+ }
610
+
611
+ return interceptorPromise.then(() => {
612
+ if (Object.keys(localVarFormParams).length) {
613
+ if (localVarUseFormData) {
614
+ (<any>localVarRequestOptions).formData = localVarFormParams;
615
+ } else {
616
+ localVarRequestOptions.form = localVarFormParams;
617
+ }
618
+ }
619
+ return new Promise<{ response: http.IncomingMessage; body: PostAnalytics; }>((resolve, reject) => {
620
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
621
+ if (error) {
622
+ reject(error);
623
+ } else {
624
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
625
+ body = ObjectSerializer.deserialize(body, "PostAnalytics");
626
+ resolve({ response: response, body: body });
627
+ } else {
628
+ reject(new HttpError(response, body, response.statusCode));
629
+ }
630
+ }
631
+ });
632
+ });
633
+ });
634
+ }
635
+ /**
636
+ * 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.
637
+ * @summary Get posting times heatmap
638
+ * @param workspaceUuid UUID of the workspace.
639
+ * @param accounts Account UUIDs. Defaults to every account in the workspace.
640
+ * @param timezone Timezone the grid is expressed in. Defaults to the workspace timezone.
641
+ */
642
+ public async getPostingTimes (workspaceUuid: string, accounts?: Array<string>, timezone?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: PostingTimes; }> {
643
+ const localVarPath = this.basePath + '/{workspaceUuid}/analytics/posting-times'
644
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
645
+ let localVarQueryParameters: any = {};
646
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
647
+ const produces = ['application/json'];
648
+ // give precedence to 'application/json'
649
+ if (produces.indexOf('application/json') >= 0) {
650
+ localVarHeaderParams.Accept = 'application/json';
651
+ } else {
652
+ localVarHeaderParams.Accept = produces.join(',');
653
+ }
654
+ let localVarFormParams: any = {};
655
+
656
+ // verify required parameter 'workspaceUuid' is not null or undefined
657
+ if (workspaceUuid === null || workspaceUuid === undefined) {
658
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getPostingTimes.');
659
+ }
660
+
661
+ if (accounts !== undefined) {
662
+ localVarQueryParameters['accounts[]'] = ObjectSerializer.serialize(accounts, "Array<string>");
663
+ }
664
+
665
+ if (timezone !== undefined) {
666
+ localVarQueryParameters['timezone'] = ObjectSerializer.serialize(timezone, "string");
667
+ }
668
+
669
+ (<any>Object).assign(localVarHeaderParams, options.headers);
670
+
671
+ let localVarUseFormData = false;
672
+
673
+ let localVarRequestOptions: localVarRequest.Options = {
674
+ method: 'GET',
675
+ qs: localVarQueryParameters,
676
+ headers: localVarHeaderParams,
677
+ uri: localVarPath,
678
+ useQuerystring: this._useQuerystring,
679
+ json: true,
680
+ };
681
+
682
+ let authenticationPromise = Promise.resolve();
683
+ if (this.authentications.bearerAuth.accessToken) {
684
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
685
+ }
686
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
687
+
688
+ let interceptorPromise = authenticationPromise;
689
+ for (const interceptor of this.interceptors) {
690
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
691
+ }
692
+
693
+ return interceptorPromise.then(() => {
694
+ if (Object.keys(localVarFormParams).length) {
695
+ if (localVarUseFormData) {
696
+ (<any>localVarRequestOptions).formData = localVarFormParams;
697
+ } else {
698
+ localVarRequestOptions.form = localVarFormParams;
699
+ }
700
+ }
701
+ return new Promise<{ response: http.IncomingMessage; body: PostingTimes; }>((resolve, reject) => {
702
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
703
+ if (error) {
704
+ reject(error);
705
+ } else {
706
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
707
+ body = ObjectSerializer.deserialize(body, "PostingTimes");
708
+ resolve({ response: response, body: body });
709
+ } else {
710
+ reject(new HttpError(response, body, response.statusCode));
711
+ }
712
+ }
713
+ });
714
+ });
715
+ });
716
+ }
717
+ /**
718
+ * The white-label header of the workspace\'s PDF reports. Unset fields are `null`; the workspace name is used then.
719
+ * @summary Get the report branding
720
+ * @param workspaceUuid UUID of the workspace.
721
+ */
722
+ public async getReportBranding (workspaceUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetReportBranding200Response; }> {
723
+ const localVarPath = this.basePath + '/{workspaceUuid}/report-branding'
724
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
725
+ let localVarQueryParameters: any = {};
726
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
727
+ const produces = ['application/json'];
728
+ // give precedence to 'application/json'
729
+ if (produces.indexOf('application/json') >= 0) {
730
+ localVarHeaderParams.Accept = 'application/json';
731
+ } else {
732
+ localVarHeaderParams.Accept = produces.join(',');
733
+ }
734
+ let localVarFormParams: any = {};
735
+
736
+ // verify required parameter 'workspaceUuid' is not null or undefined
737
+ if (workspaceUuid === null || workspaceUuid === undefined) {
738
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getReportBranding.');
739
+ }
740
+
741
+ (<any>Object).assign(localVarHeaderParams, options.headers);
742
+
743
+ let localVarUseFormData = false;
744
+
745
+ let localVarRequestOptions: localVarRequest.Options = {
746
+ method: 'GET',
747
+ qs: localVarQueryParameters,
748
+ headers: localVarHeaderParams,
749
+ uri: localVarPath,
750
+ useQuerystring: this._useQuerystring,
751
+ json: true,
752
+ };
753
+
754
+ let authenticationPromise = Promise.resolve();
755
+ if (this.authentications.bearerAuth.accessToken) {
756
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
757
+ }
758
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
759
+
760
+ let interceptorPromise = authenticationPromise;
761
+ for (const interceptor of this.interceptors) {
762
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
763
+ }
764
+
765
+ return interceptorPromise.then(() => {
766
+ if (Object.keys(localVarFormParams).length) {
767
+ if (localVarUseFormData) {
768
+ (<any>localVarRequestOptions).formData = localVarFormParams;
769
+ } else {
770
+ localVarRequestOptions.form = localVarFormParams;
771
+ }
772
+ }
773
+ return new Promise<{ response: http.IncomingMessage; body: GetReportBranding200Response; }>((resolve, reject) => {
774
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
775
+ if (error) {
776
+ reject(error);
777
+ } else {
778
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
779
+ body = ObjectSerializer.deserialize(body, "GetReportBranding200Response");
780
+ resolve({ response: response, body: body });
781
+ } else {
782
+ reject(new HttpError(response, body, response.statusCode));
783
+ }
784
+ }
785
+ });
786
+ });
787
+ });
788
+ }
789
+ /**
790
+ *
791
+ * @summary Get a report export
792
+ * @param workspaceUuid UUID of the workspace.
793
+ * @param exportUuid UUID of the report export.
794
+ */
795
+ public async getReportExport (workspaceUuid: string, exportUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: CreateReportExport201Response; }> {
796
+ const localVarPath = this.basePath + '/{workspaceUuid}/reports/exports/{exportUuid}'
797
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
798
+ .replace('{' + 'exportUuid' + '}', encodeURIComponent(String(exportUuid)));
799
+ let localVarQueryParameters: any = {};
800
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
801
+ const produces = ['application/json'];
802
+ // give precedence to 'application/json'
803
+ if (produces.indexOf('application/json') >= 0) {
804
+ localVarHeaderParams.Accept = 'application/json';
805
+ } else {
806
+ localVarHeaderParams.Accept = produces.join(',');
807
+ }
808
+ let localVarFormParams: any = {};
809
+
810
+ // verify required parameter 'workspaceUuid' is not null or undefined
811
+ if (workspaceUuid === null || workspaceUuid === undefined) {
812
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling getReportExport.');
813
+ }
814
+
815
+ // verify required parameter 'exportUuid' is not null or undefined
816
+ if (exportUuid === null || exportUuid === undefined) {
817
+ throw new Error('Required parameter exportUuid was null or undefined when calling getReportExport.');
818
+ }
819
+
820
+ (<any>Object).assign(localVarHeaderParams, options.headers);
821
+
822
+ let localVarUseFormData = false;
823
+
824
+ let localVarRequestOptions: localVarRequest.Options = {
825
+ method: 'GET',
826
+ qs: localVarQueryParameters,
827
+ headers: localVarHeaderParams,
828
+ uri: localVarPath,
829
+ useQuerystring: this._useQuerystring,
830
+ json: true,
831
+ };
832
+
833
+ let authenticationPromise = Promise.resolve();
834
+ if (this.authentications.bearerAuth.accessToken) {
835
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
836
+ }
837
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
838
+
839
+ let interceptorPromise = authenticationPromise;
840
+ for (const interceptor of this.interceptors) {
841
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
842
+ }
843
+
844
+ return interceptorPromise.then(() => {
845
+ if (Object.keys(localVarFormParams).length) {
846
+ if (localVarUseFormData) {
847
+ (<any>localVarRequestOptions).formData = localVarFormParams;
848
+ } else {
849
+ localVarRequestOptions.form = localVarFormParams;
850
+ }
851
+ }
852
+ return new Promise<{ response: http.IncomingMessage; body: CreateReportExport201Response; }>((resolve, reject) => {
853
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
854
+ if (error) {
855
+ reject(error);
856
+ } else {
857
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
858
+ body = ObjectSerializer.deserialize(body, "CreateReportExport201Response");
859
+ resolve({ response: response, body: body });
860
+ } else {
861
+ reject(new HttpError(response, body, response.statusCode));
862
+ }
863
+ }
864
+ });
865
+ });
866
+ });
867
+ }
868
+ /**
869
+ * The workspace\'s latest 50 report exports, newest first. Files can be downloaded for 7 days.
870
+ * @summary List report exports
871
+ * @param workspaceUuid UUID of the workspace.
872
+ */
873
+ public async listReportExports (workspaceUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ListReportExports200Response; }> {
874
+ const localVarPath = this.basePath + '/{workspaceUuid}/reports/exports'
875
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
876
+ let localVarQueryParameters: any = {};
877
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
878
+ const produces = ['application/json'];
879
+ // give precedence to 'application/json'
880
+ if (produces.indexOf('application/json') >= 0) {
881
+ localVarHeaderParams.Accept = 'application/json';
882
+ } else {
883
+ localVarHeaderParams.Accept = produces.join(',');
884
+ }
885
+ let localVarFormParams: any = {};
886
+
887
+ // verify required parameter 'workspaceUuid' is not null or undefined
888
+ if (workspaceUuid === null || workspaceUuid === undefined) {
889
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling listReportExports.');
890
+ }
891
+
892
+ (<any>Object).assign(localVarHeaderParams, options.headers);
893
+
894
+ let localVarUseFormData = false;
895
+
896
+ let localVarRequestOptions: localVarRequest.Options = {
897
+ method: 'GET',
898
+ qs: localVarQueryParameters,
899
+ headers: localVarHeaderParams,
900
+ uri: localVarPath,
901
+ useQuerystring: this._useQuerystring,
902
+ json: true,
903
+ };
904
+
905
+ let authenticationPromise = Promise.resolve();
906
+ if (this.authentications.bearerAuth.accessToken) {
907
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
908
+ }
909
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
910
+
911
+ let interceptorPromise = authenticationPromise;
912
+ for (const interceptor of this.interceptors) {
913
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
914
+ }
915
+
916
+ return interceptorPromise.then(() => {
917
+ if (Object.keys(localVarFormParams).length) {
918
+ if (localVarUseFormData) {
919
+ (<any>localVarRequestOptions).formData = localVarFormParams;
920
+ } else {
921
+ localVarRequestOptions.form = localVarFormParams;
922
+ }
923
+ }
924
+ return new Promise<{ response: http.IncomingMessage; body: ListReportExports200Response; }>((resolve, reject) => {
925
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
926
+ if (error) {
927
+ reject(error);
928
+ } else {
929
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
930
+ body = ObjectSerializer.deserialize(body, "ListReportExports200Response");
931
+ resolve({ response: response, body: body });
932
+ } else {
933
+ reject(new HttpError(response, body, response.statusCode));
934
+ }
935
+ }
936
+ });
937
+ });
938
+ });
939
+ }
940
+ /**
941
+ * Name, colour and footer of PDF reports. Fields you leave out keep their value. Upload the logo with `uploadReportBrandingLogo`. Admins and members only.
942
+ * @summary Update the report branding
943
+ * @param workspaceUuid UUID of the workspace.
944
+ * @param reportBrandingInput
945
+ */
946
+ public async updateReportBranding (workspaceUuid: string, reportBrandingInput: ReportBrandingInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetReportBranding200Response; }> {
947
+ const localVarPath = this.basePath + '/{workspaceUuid}/report-branding'
948
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
949
+ let localVarQueryParameters: any = {};
950
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
951
+ const produces = ['application/json'];
952
+ // give precedence to 'application/json'
953
+ if (produces.indexOf('application/json') >= 0) {
954
+ localVarHeaderParams.Accept = 'application/json';
955
+ } else {
956
+ localVarHeaderParams.Accept = produces.join(',');
957
+ }
958
+ let localVarFormParams: any = {};
959
+
960
+ // verify required parameter 'workspaceUuid' is not null or undefined
961
+ if (workspaceUuid === null || workspaceUuid === undefined) {
962
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling updateReportBranding.');
963
+ }
964
+
965
+ // verify required parameter 'reportBrandingInput' is not null or undefined
966
+ if (reportBrandingInput === null || reportBrandingInput === undefined) {
967
+ throw new Error('Required parameter reportBrandingInput was null or undefined when calling updateReportBranding.');
968
+ }
969
+
970
+ (<any>Object).assign(localVarHeaderParams, options.headers);
971
+
972
+ let localVarUseFormData = false;
973
+
974
+ let localVarRequestOptions: localVarRequest.Options = {
975
+ method: 'PUT',
976
+ qs: localVarQueryParameters,
977
+ headers: localVarHeaderParams,
978
+ uri: localVarPath,
979
+ useQuerystring: this._useQuerystring,
980
+ json: true,
981
+ body: ObjectSerializer.serialize(reportBrandingInput, "ReportBrandingInput")
982
+ };
983
+
984
+ let authenticationPromise = Promise.resolve();
985
+ if (this.authentications.bearerAuth.accessToken) {
986
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
987
+ }
988
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
989
+
990
+ let interceptorPromise = authenticationPromise;
991
+ for (const interceptor of this.interceptors) {
992
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
993
+ }
994
+
995
+ return interceptorPromise.then(() => {
996
+ if (Object.keys(localVarFormParams).length) {
997
+ if (localVarUseFormData) {
998
+ (<any>localVarRequestOptions).formData = localVarFormParams;
999
+ } else {
1000
+ localVarRequestOptions.form = localVarFormParams;
1001
+ }
1002
+ }
1003
+ return new Promise<{ response: http.IncomingMessage; body: GetReportBranding200Response; }>((resolve, reject) => {
1004
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1005
+ if (error) {
1006
+ reject(error);
1007
+ } else {
1008
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1009
+ body = ObjectSerializer.deserialize(body, "GetReportBranding200Response");
1010
+ resolve({ response: response, body: body });
1011
+ } else {
1012
+ reject(new HttpError(response, body, response.statusCode));
1013
+ }
1014
+ }
1015
+ });
1016
+ });
1017
+ });
1018
+ }
1019
+ /**
1020
+ * PNG or JPEG, up to 1 MB (SVG is not accepted). Replaces the current logo. Admins and members only.
1021
+ * @summary Upload the report logo
1022
+ * @param workspaceUuid UUID of the workspace.
1023
+ * @param logo
1024
+ */
1025
+ public async uploadReportBrandingLogo (workspaceUuid: string, logo: RequestFile, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetReportBranding200Response; }> {
1026
+ const localVarPath = this.basePath + '/{workspaceUuid}/report-branding/logo'
1027
+ .replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
1028
+ let localVarQueryParameters: any = {};
1029
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1030
+ const produces = ['application/json'];
1031
+ // give precedence to 'application/json'
1032
+ if (produces.indexOf('application/json') >= 0) {
1033
+ localVarHeaderParams.Accept = 'application/json';
1034
+ } else {
1035
+ localVarHeaderParams.Accept = produces.join(',');
1036
+ }
1037
+ let localVarFormParams: any = {};
1038
+
1039
+ // verify required parameter 'workspaceUuid' is not null or undefined
1040
+ if (workspaceUuid === null || workspaceUuid === undefined) {
1041
+ throw new Error('Required parameter workspaceUuid was null or undefined when calling uploadReportBrandingLogo.');
1042
+ }
1043
+
1044
+ // verify required parameter 'logo' is not null or undefined
1045
+ if (logo === null || logo === undefined) {
1046
+ throw new Error('Required parameter logo was null or undefined when calling uploadReportBrandingLogo.');
1047
+ }
1048
+
1049
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1050
+
1051
+ let localVarUseFormData = false;
1052
+
1053
+ if (logo !== undefined) {
1054
+ localVarFormParams['logo'] = logo;
1055
+ }
1056
+ localVarUseFormData = true;
1057
+
1058
+ let localVarRequestOptions: localVarRequest.Options = {
1059
+ method: 'POST',
1060
+ qs: localVarQueryParameters,
1061
+ headers: localVarHeaderParams,
1062
+ uri: localVarPath,
1063
+ useQuerystring: this._useQuerystring,
1064
+ json: true,
1065
+ };
1066
+
1067
+ let authenticationPromise = Promise.resolve();
1068
+ if (this.authentications.bearerAuth.accessToken) {
1069
+ authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
1070
+ }
1071
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1072
+
1073
+ let interceptorPromise = authenticationPromise;
1074
+ for (const interceptor of this.interceptors) {
1075
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1076
+ }
1077
+
1078
+ return interceptorPromise.then(() => {
1079
+ if (Object.keys(localVarFormParams).length) {
1080
+ if (localVarUseFormData) {
1081
+ (<any>localVarRequestOptions).formData = localVarFormParams;
1082
+ } else {
1083
+ localVarRequestOptions.form = localVarFormParams;
1084
+ }
1085
+ }
1086
+ return new Promise<{ response: http.IncomingMessage; body: GetReportBranding200Response; }>((resolve, reject) => {
1087
+ localVarRequest(localVarRequestOptions, (error, response, body) => {
1088
+ if (error) {
1089
+ reject(error);
1090
+ } else {
1091
+ if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
1092
+ body = ObjectSerializer.deserialize(body, "GetReportBranding200Response");
1093
+ resolve({ response: response, body: body });
1094
+ } else {
1095
+ reject(new HttpError(response, body, response.statusCode));
1096
+ }
1097
+ }
1098
+ });
1099
+ });
1100
+ });
1101
+ }
1102
+ }