postboost 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.openapi-generator/FILES +72 -0
- package/.openapi-generator/VERSION +1 -0
- package/.openapi-generator-ignore +23 -0
- package/LICENSE +21 -0
- package/README.md +0 -0
- package/api/accountsApi.ts +247 -0
- package/api/apis.ts +28 -0
- package/api/mediaApi.ts +1007 -0
- package/api/postsApi.ts +827 -0
- package/api/receiptsApi.ts +541 -0
- package/api/subscriptionsApi.ts +856 -0
- package/api/tagsApi.ts +492 -0
- package/api/usersApi.ts +537 -0
- package/api/workspacesApi.ts +784 -0
- package/api.ts +3 -0
- package/git_push.sh +57 -0
- package/model/account.ts +94 -0
- package/model/addGenericSubscriptionRequest.ts +43 -0
- package/model/changeSubscriptionPlanRequest.ts +55 -0
- package/model/checkoutSubscription200Response.ts +31 -0
- package/model/checkoutSubscriptionRequest.ts +49 -0
- package/model/deleteMediaBulkRequest.ts +34 -0
- package/model/deleteMode.ts +22 -0
- package/model/deletePostRequest.ts +40 -0
- package/model/deletePostsBulkRequest.ts +52 -0
- package/model/deleteReceiptsBulkRequest.ts +31 -0
- package/model/deleteResult.ts +43 -0
- package/model/deleteUser400Response.ts +37 -0
- package/model/deleteUsersBulkRequest.ts +31 -0
- package/model/deleteWorkspacesBulkRequest.ts +31 -0
- package/model/getRemoteUploadStatus200Response.ts +49 -0
- package/model/initiateChunkedUpload200Response.ts +43 -0
- package/model/initiateChunkedUploadRequest.ts +46 -0
- package/model/initiateRemoteUpload200Response.ts +94 -0
- package/model/initiateRemoteUpload200ResponseOneOf.ts +31 -0
- package/model/initiateRemoteUploadRequest.ts +40 -0
- package/model/listAccounts200Response.ts +32 -0
- package/model/listMedia200Response.ts +46 -0
- package/model/listPosts200Response.ts +46 -0
- package/model/listReceipts200Response.ts +46 -0
- package/model/listTags200Response.ts +32 -0
- package/model/listUsers200Response.ts +46 -0
- package/model/listWorkspaces200Response.ts +46 -0
- package/model/media.ts +86 -0
- package/model/models.ts +443 -0
- package/model/paginationMeta.ts +39 -0
- package/model/paginationMetaLinks.ts +49 -0
- package/model/paginationMetaMeta.ts +61 -0
- package/model/post.ts +91 -0
- package/model/postContent.ts +55 -0
- package/model/postInput.ts +98 -0
- package/model/postStatus.ts +19 -0
- package/model/postVersion.ts +59 -0
- package/model/receipt.ts +85 -0
- package/model/receiptInput.ts +79 -0
- package/model/receiptUpdateInput.ts +73 -0
- package/model/removeUserFromWorkspaceRequest.ts +31 -0
- package/model/schedulePostRequest.ts +31 -0
- package/model/scheduleResult.ts +37 -0
- package/model/subscription.ts +76 -0
- package/model/subscriptionInput.ts +55 -0
- package/model/subscriptionStatus.ts +22 -0
- package/model/subscriptionUpdateInput.ts +58 -0
- package/model/tag.ts +49 -0
- package/model/tagInput.ts +37 -0
- package/model/updateMediaRequest.ts +34 -0
- package/model/uploadChunk200Response.ts +34 -0
- package/model/user.ts +61 -0
- package/model/userInput.ts +55 -0
- package/model/userUpdateInput.ts +58 -0
- package/model/workspace.ts +69 -0
- package/model/workspaceInput.ts +56 -0
- package/model/workspaceUserInput.ts +56 -0
- package/package.json +28 -0
- package/tsconfig.json +24 -0
package/api/mediaApi.ts
ADDED
|
@@ -0,0 +1,1007 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PostBoost API
|
|
3
|
+
* The PostBoost REST API lets you publish, schedule, and analyze social media posts across 8+ platforms from a single integration. No OAuth apps to maintain — PostBoost handles platform authorization for you. ## Base URL All workspace-scoped endpoints are prefixed with `/{workspaceUuid}`. Panel/admin endpoints are prefixed with `/panel`. ## Authentication All requests require a Bearer token in the `Authorization` header. Generate tokens in your PostBoost dashboard under **Settings → Access Tokens**. ``` Authorization: Bearer YOUR_API_TOKEN ```
|
|
4
|
+
*
|
|
5
|
+
* The version of the OpenAPI document: 1.0.0
|
|
6
|
+
* Contact: hi@postboost.co
|
|
7
|
+
*
|
|
8
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
|
9
|
+
* https://openapi-generator.tech
|
|
10
|
+
* Do not edit the class manually.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
import localVarRequest from 'request';
|
|
15
|
+
import http from 'http';
|
|
16
|
+
|
|
17
|
+
/* tslint:disable:no-unused-locals */
|
|
18
|
+
import { DeleteMediaBulkRequest } from '../model/deleteMediaBulkRequest';
|
|
19
|
+
import { GetRemoteUploadStatus200Response } from '../model/getRemoteUploadStatus200Response';
|
|
20
|
+
import { InitiateChunkedUpload200Response } from '../model/initiateChunkedUpload200Response';
|
|
21
|
+
import { InitiateChunkedUploadRequest } from '../model/initiateChunkedUploadRequest';
|
|
22
|
+
import { InitiateRemoteUpload200Response } from '../model/initiateRemoteUpload200Response';
|
|
23
|
+
import { InitiateRemoteUploadRequest } from '../model/initiateRemoteUploadRequest';
|
|
24
|
+
import { ListMedia200Response } from '../model/listMedia200Response';
|
|
25
|
+
import { Media } from '../model/media';
|
|
26
|
+
import { UpdateMediaRequest } from '../model/updateMediaRequest';
|
|
27
|
+
import { UploadChunk200Response } from '../model/uploadChunk200Response';
|
|
28
|
+
|
|
29
|
+
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
|
|
30
|
+
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
|
|
31
|
+
|
|
32
|
+
import { HttpError, RequestFile } from './apis';
|
|
33
|
+
|
|
34
|
+
let defaultBasePath = 'https://postboost.co/app/api';
|
|
35
|
+
|
|
36
|
+
// ===============================================
|
|
37
|
+
// This file is autogenerated - Please do not edit
|
|
38
|
+
// ===============================================
|
|
39
|
+
|
|
40
|
+
export enum MediaApiApiKeys {
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export class MediaApi {
|
|
44
|
+
protected _basePath = defaultBasePath;
|
|
45
|
+
protected _defaultHeaders : any = {};
|
|
46
|
+
protected _useQuerystring : boolean = false;
|
|
47
|
+
|
|
48
|
+
protected authentications = {
|
|
49
|
+
'default': <Authentication>new VoidAuth(),
|
|
50
|
+
'bearerAuth': new HttpBearerAuth(),
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
protected interceptors: Interceptor[] = [];
|
|
54
|
+
|
|
55
|
+
constructor(basePath?: string);
|
|
56
|
+
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
|
|
57
|
+
if (password) {
|
|
58
|
+
if (basePath) {
|
|
59
|
+
this.basePath = basePath;
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
if (basePathOrUsername) {
|
|
63
|
+
this.basePath = basePathOrUsername
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
set useQuerystring(value: boolean) {
|
|
69
|
+
this._useQuerystring = value;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
set basePath(basePath: string) {
|
|
73
|
+
this._basePath = basePath;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
set defaultHeaders(defaultHeaders: any) {
|
|
77
|
+
this._defaultHeaders = defaultHeaders;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get defaultHeaders() {
|
|
81
|
+
return this._defaultHeaders;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
get basePath() {
|
|
85
|
+
return this._basePath;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public setDefaultAuthentication(auth: Authentication) {
|
|
89
|
+
this.authentications.default = auth;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
public setApiKey(key: MediaApiApiKeys, value: string) {
|
|
93
|
+
(this.authentications as any)[MediaApiApiKeys[key]].apiKey = value;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
set accessToken(accessToken: string | (() => string)) {
|
|
97
|
+
this.authentications.bearerAuth.accessToken = accessToken;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
public addInterceptor(interceptor: Interceptor) {
|
|
101
|
+
this.interceptors.push(interceptor);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Cancel an in-progress chunked upload session and clean up uploaded chunks.
|
|
106
|
+
* @summary Abort chunked upload
|
|
107
|
+
* @param workspaceUuid UUID of the workspace.
|
|
108
|
+
* @param uploadUuid
|
|
109
|
+
*/
|
|
110
|
+
public async abortChunkedUpload (workspaceUuid: string, uploadUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body?: any; }> {
|
|
111
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media/chunked/{uploadUuid}'
|
|
112
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
|
|
113
|
+
.replace('{' + 'uploadUuid' + '}', encodeURIComponent(String(uploadUuid)));
|
|
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 abortChunkedUpload.');
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// verify required parameter 'uploadUuid' is not null or undefined
|
|
131
|
+
if (uploadUuid === null || uploadUuid === undefined) {
|
|
132
|
+
throw new Error('Required parameter uploadUuid was null or undefined when calling abortChunkedUpload.');
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
136
|
+
|
|
137
|
+
let localVarUseFormData = false;
|
|
138
|
+
|
|
139
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
140
|
+
method: 'DELETE',
|
|
141
|
+
qs: localVarQueryParameters,
|
|
142
|
+
headers: localVarHeaderParams,
|
|
143
|
+
uri: localVarPath,
|
|
144
|
+
useQuerystring: this._useQuerystring,
|
|
145
|
+
json: true,
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
let authenticationPromise = Promise.resolve();
|
|
149
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
150
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
151
|
+
}
|
|
152
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
153
|
+
|
|
154
|
+
let interceptorPromise = authenticationPromise;
|
|
155
|
+
for (const interceptor of this.interceptors) {
|
|
156
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
return interceptorPromise.then(() => {
|
|
160
|
+
if (Object.keys(localVarFormParams).length) {
|
|
161
|
+
if (localVarUseFormData) {
|
|
162
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
163
|
+
} else {
|
|
164
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return new Promise<{ response: http.IncomingMessage; body?: any; }>((resolve, reject) => {
|
|
168
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
169
|
+
if (error) {
|
|
170
|
+
reject(error);
|
|
171
|
+
} else {
|
|
172
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
173
|
+
resolve({ response: response, body: body });
|
|
174
|
+
} else {
|
|
175
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Signal that all chunks have been uploaded. Returns the final media object.
|
|
184
|
+
* @summary Complete chunked upload
|
|
185
|
+
* @param workspaceUuid UUID of the workspace.
|
|
186
|
+
* @param uploadUuid
|
|
187
|
+
*/
|
|
188
|
+
public async completeChunkedUpload (workspaceUuid: string, uploadUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Media; }> {
|
|
189
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media/chunked/{uploadUuid}/complete'
|
|
190
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
|
|
191
|
+
.replace('{' + 'uploadUuid' + '}', encodeURIComponent(String(uploadUuid)));
|
|
192
|
+
let localVarQueryParameters: any = {};
|
|
193
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
194
|
+
const produces = ['application/json'];
|
|
195
|
+
// give precedence to 'application/json'
|
|
196
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
197
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
198
|
+
} else {
|
|
199
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
200
|
+
}
|
|
201
|
+
let localVarFormParams: any = {};
|
|
202
|
+
|
|
203
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
204
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
205
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling completeChunkedUpload.');
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// verify required parameter 'uploadUuid' is not null or undefined
|
|
209
|
+
if (uploadUuid === null || uploadUuid === undefined) {
|
|
210
|
+
throw new Error('Required parameter uploadUuid was null or undefined when calling completeChunkedUpload.');
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
214
|
+
|
|
215
|
+
let localVarUseFormData = false;
|
|
216
|
+
|
|
217
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
218
|
+
method: 'POST',
|
|
219
|
+
qs: localVarQueryParameters,
|
|
220
|
+
headers: localVarHeaderParams,
|
|
221
|
+
uri: localVarPath,
|
|
222
|
+
useQuerystring: this._useQuerystring,
|
|
223
|
+
json: true,
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
let authenticationPromise = Promise.resolve();
|
|
227
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
228
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
229
|
+
}
|
|
230
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
231
|
+
|
|
232
|
+
let interceptorPromise = authenticationPromise;
|
|
233
|
+
for (const interceptor of this.interceptors) {
|
|
234
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return interceptorPromise.then(() => {
|
|
238
|
+
if (Object.keys(localVarFormParams).length) {
|
|
239
|
+
if (localVarUseFormData) {
|
|
240
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
241
|
+
} else {
|
|
242
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return new Promise<{ response: http.IncomingMessage; body: Media; }>((resolve, reject) => {
|
|
246
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
247
|
+
if (error) {
|
|
248
|
+
reject(error);
|
|
249
|
+
} else {
|
|
250
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
251
|
+
body = ObjectSerializer.deserialize(body, "Media");
|
|
252
|
+
resolve({ response: response, body: body });
|
|
253
|
+
} else {
|
|
254
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
});
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Delete one or more media items by their IDs.
|
|
263
|
+
* @summary Delete media (bulk)
|
|
264
|
+
* @param workspaceUuid UUID of the workspace.
|
|
265
|
+
* @param deleteMediaBulkRequest
|
|
266
|
+
*/
|
|
267
|
+
public async deleteMediaBulk (workspaceUuid: string, deleteMediaBulkRequest: DeleteMediaBulkRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
|
|
268
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media'
|
|
269
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
|
|
270
|
+
let localVarQueryParameters: any = {};
|
|
271
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
272
|
+
const produces = ['application/json'];
|
|
273
|
+
// give precedence to 'application/json'
|
|
274
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
275
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
276
|
+
} else {
|
|
277
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
278
|
+
}
|
|
279
|
+
let localVarFormParams: any = {};
|
|
280
|
+
|
|
281
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
282
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
283
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling deleteMediaBulk.');
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// verify required parameter 'deleteMediaBulkRequest' is not null or undefined
|
|
287
|
+
if (deleteMediaBulkRequest === null || deleteMediaBulkRequest === undefined) {
|
|
288
|
+
throw new Error('Required parameter deleteMediaBulkRequest was null or undefined when calling deleteMediaBulk.');
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
292
|
+
|
|
293
|
+
let localVarUseFormData = false;
|
|
294
|
+
|
|
295
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
296
|
+
method: 'DELETE',
|
|
297
|
+
qs: localVarQueryParameters,
|
|
298
|
+
headers: localVarHeaderParams,
|
|
299
|
+
uri: localVarPath,
|
|
300
|
+
useQuerystring: this._useQuerystring,
|
|
301
|
+
json: true,
|
|
302
|
+
body: ObjectSerializer.serialize(deleteMediaBulkRequest, "DeleteMediaBulkRequest")
|
|
303
|
+
};
|
|
304
|
+
|
|
305
|
+
let authenticationPromise = Promise.resolve();
|
|
306
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
307
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
308
|
+
}
|
|
309
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
310
|
+
|
|
311
|
+
let interceptorPromise = authenticationPromise;
|
|
312
|
+
for (const interceptor of this.interceptors) {
|
|
313
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
return interceptorPromise.then(() => {
|
|
317
|
+
if (Object.keys(localVarFormParams).length) {
|
|
318
|
+
if (localVarUseFormData) {
|
|
319
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
320
|
+
} else {
|
|
321
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
|
|
325
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
326
|
+
if (error) {
|
|
327
|
+
reject(error);
|
|
328
|
+
} else {
|
|
329
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
330
|
+
body = ObjectSerializer.deserialize(body, "object");
|
|
331
|
+
resolve({ response: response, body: body });
|
|
332
|
+
} else {
|
|
333
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
});
|
|
338
|
+
});
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Returns a single media asset.
|
|
342
|
+
* @summary Get media
|
|
343
|
+
* @param workspaceUuid UUID of the workspace.
|
|
344
|
+
* @param mediaUuid UUID of the media asset.
|
|
345
|
+
*/
|
|
346
|
+
public async getMedia (workspaceUuid: string, mediaUuid: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Media; }> {
|
|
347
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media/{mediaUuid}'
|
|
348
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
|
|
349
|
+
.replace('{' + 'mediaUuid' + '}', encodeURIComponent(String(mediaUuid)));
|
|
350
|
+
let localVarQueryParameters: any = {};
|
|
351
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
352
|
+
const produces = ['application/json'];
|
|
353
|
+
// give precedence to 'application/json'
|
|
354
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
355
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
356
|
+
} else {
|
|
357
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
358
|
+
}
|
|
359
|
+
let localVarFormParams: any = {};
|
|
360
|
+
|
|
361
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
362
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
363
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling getMedia.');
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
// verify required parameter 'mediaUuid' is not null or undefined
|
|
367
|
+
if (mediaUuid === null || mediaUuid === undefined) {
|
|
368
|
+
throw new Error('Required parameter mediaUuid was null or undefined when calling getMedia.');
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
372
|
+
|
|
373
|
+
let localVarUseFormData = false;
|
|
374
|
+
|
|
375
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
376
|
+
method: 'GET',
|
|
377
|
+
qs: localVarQueryParameters,
|
|
378
|
+
headers: localVarHeaderParams,
|
|
379
|
+
uri: localVarPath,
|
|
380
|
+
useQuerystring: this._useQuerystring,
|
|
381
|
+
json: true,
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
let authenticationPromise = Promise.resolve();
|
|
385
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
386
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
387
|
+
}
|
|
388
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
389
|
+
|
|
390
|
+
let interceptorPromise = authenticationPromise;
|
|
391
|
+
for (const interceptor of this.interceptors) {
|
|
392
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return interceptorPromise.then(() => {
|
|
396
|
+
if (Object.keys(localVarFormParams).length) {
|
|
397
|
+
if (localVarUseFormData) {
|
|
398
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
399
|
+
} else {
|
|
400
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return new Promise<{ response: http.IncomingMessage; body: Media; }>((resolve, reject) => {
|
|
404
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
405
|
+
if (error) {
|
|
406
|
+
reject(error);
|
|
407
|
+
} else {
|
|
408
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
409
|
+
body = ObjectSerializer.deserialize(body, "Media");
|
|
410
|
+
resolve({ response: response, body: body });
|
|
411
|
+
} else {
|
|
412
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Poll the status of an in-progress remote media download.
|
|
421
|
+
* @summary Get remote upload status
|
|
422
|
+
* @param workspaceUuid UUID of the workspace.
|
|
423
|
+
* @param downloadId
|
|
424
|
+
*/
|
|
425
|
+
public async getRemoteUploadStatus (workspaceUuid: string, downloadId: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: GetRemoteUploadStatus200Response; }> {
|
|
426
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media/remote/{downloadId}/status'
|
|
427
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
|
|
428
|
+
.replace('{' + 'downloadId' + '}', encodeURIComponent(String(downloadId)));
|
|
429
|
+
let localVarQueryParameters: any = {};
|
|
430
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
431
|
+
const produces = ['application/json'];
|
|
432
|
+
// give precedence to 'application/json'
|
|
433
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
434
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
435
|
+
} else {
|
|
436
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
437
|
+
}
|
|
438
|
+
let localVarFormParams: any = {};
|
|
439
|
+
|
|
440
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
441
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
442
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling getRemoteUploadStatus.');
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
// verify required parameter 'downloadId' is not null or undefined
|
|
446
|
+
if (downloadId === null || downloadId === undefined) {
|
|
447
|
+
throw new Error('Required parameter downloadId was null or undefined when calling getRemoteUploadStatus.');
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
451
|
+
|
|
452
|
+
let localVarUseFormData = false;
|
|
453
|
+
|
|
454
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
455
|
+
method: 'GET',
|
|
456
|
+
qs: localVarQueryParameters,
|
|
457
|
+
headers: localVarHeaderParams,
|
|
458
|
+
uri: localVarPath,
|
|
459
|
+
useQuerystring: this._useQuerystring,
|
|
460
|
+
json: true,
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
let authenticationPromise = Promise.resolve();
|
|
464
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
465
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
466
|
+
}
|
|
467
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
468
|
+
|
|
469
|
+
let interceptorPromise = authenticationPromise;
|
|
470
|
+
for (const interceptor of this.interceptors) {
|
|
471
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
return interceptorPromise.then(() => {
|
|
475
|
+
if (Object.keys(localVarFormParams).length) {
|
|
476
|
+
if (localVarUseFormData) {
|
|
477
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
478
|
+
} else {
|
|
479
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
return new Promise<{ response: http.IncomingMessage; body: GetRemoteUploadStatus200Response; }>((resolve, reject) => {
|
|
483
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
484
|
+
if (error) {
|
|
485
|
+
reject(error);
|
|
486
|
+
} else {
|
|
487
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
488
|
+
body = ObjectSerializer.deserialize(body, "GetRemoteUploadStatus200Response");
|
|
489
|
+
resolve({ response: response, body: body });
|
|
490
|
+
} else {
|
|
491
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
});
|
|
495
|
+
});
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Start a chunked upload session for large files. Returns an `upload_uuid`, `chunk_size`, and `total_chunks` to use for subsequent chunk requests.
|
|
500
|
+
* @summary Initiate chunked upload
|
|
501
|
+
* @param workspaceUuid UUID of the workspace.
|
|
502
|
+
* @param initiateChunkedUploadRequest
|
|
503
|
+
*/
|
|
504
|
+
public async initiateChunkedUpload (workspaceUuid: string, initiateChunkedUploadRequest: InitiateChunkedUploadRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: InitiateChunkedUpload200Response; }> {
|
|
505
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media/chunked/initiate'
|
|
506
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
|
|
507
|
+
let localVarQueryParameters: any = {};
|
|
508
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
509
|
+
const produces = ['application/json'];
|
|
510
|
+
// give precedence to 'application/json'
|
|
511
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
512
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
513
|
+
} else {
|
|
514
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
515
|
+
}
|
|
516
|
+
let localVarFormParams: any = {};
|
|
517
|
+
|
|
518
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
519
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
520
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling initiateChunkedUpload.');
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
// verify required parameter 'initiateChunkedUploadRequest' is not null or undefined
|
|
524
|
+
if (initiateChunkedUploadRequest === null || initiateChunkedUploadRequest === undefined) {
|
|
525
|
+
throw new Error('Required parameter initiateChunkedUploadRequest was null or undefined when calling initiateChunkedUpload.');
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
529
|
+
|
|
530
|
+
let localVarUseFormData = false;
|
|
531
|
+
|
|
532
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
533
|
+
method: 'POST',
|
|
534
|
+
qs: localVarQueryParameters,
|
|
535
|
+
headers: localVarHeaderParams,
|
|
536
|
+
uri: localVarPath,
|
|
537
|
+
useQuerystring: this._useQuerystring,
|
|
538
|
+
json: true,
|
|
539
|
+
body: ObjectSerializer.serialize(initiateChunkedUploadRequest, "InitiateChunkedUploadRequest")
|
|
540
|
+
};
|
|
541
|
+
|
|
542
|
+
let authenticationPromise = Promise.resolve();
|
|
543
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
544
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
545
|
+
}
|
|
546
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
547
|
+
|
|
548
|
+
let interceptorPromise = authenticationPromise;
|
|
549
|
+
for (const interceptor of this.interceptors) {
|
|
550
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
return interceptorPromise.then(() => {
|
|
554
|
+
if (Object.keys(localVarFormParams).length) {
|
|
555
|
+
if (localVarUseFormData) {
|
|
556
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
557
|
+
} else {
|
|
558
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
return new Promise<{ response: http.IncomingMessage; body: InitiateChunkedUpload200Response; }>((resolve, reject) => {
|
|
562
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
563
|
+
if (error) {
|
|
564
|
+
reject(error);
|
|
565
|
+
} else {
|
|
566
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
567
|
+
body = ObjectSerializer.deserialize(body, "InitiateChunkedUpload200Response");
|
|
568
|
+
resolve({ response: response, body: body });
|
|
569
|
+
} else {
|
|
570
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
/**
|
|
578
|
+
* Download a file from a remote URL into the media library. For small files the media object is returned immediately. For large files a `download_id` is returned — poll the status endpoint.
|
|
579
|
+
* @summary Initiate remote upload
|
|
580
|
+
* @param workspaceUuid UUID of the workspace.
|
|
581
|
+
* @param initiateRemoteUploadRequest
|
|
582
|
+
*/
|
|
583
|
+
public async initiateRemoteUpload (workspaceUuid: string, initiateRemoteUploadRequest: InitiateRemoteUploadRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: InitiateRemoteUpload200Response; }> {
|
|
584
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media/remote/initiate'
|
|
585
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
|
|
586
|
+
let localVarQueryParameters: any = {};
|
|
587
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
588
|
+
const produces = ['application/json'];
|
|
589
|
+
// give precedence to 'application/json'
|
|
590
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
591
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
592
|
+
} else {
|
|
593
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
594
|
+
}
|
|
595
|
+
let localVarFormParams: any = {};
|
|
596
|
+
|
|
597
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
598
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
599
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling initiateRemoteUpload.');
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
// verify required parameter 'initiateRemoteUploadRequest' is not null or undefined
|
|
603
|
+
if (initiateRemoteUploadRequest === null || initiateRemoteUploadRequest === undefined) {
|
|
604
|
+
throw new Error('Required parameter initiateRemoteUploadRequest was null or undefined when calling initiateRemoteUpload.');
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
608
|
+
|
|
609
|
+
let localVarUseFormData = false;
|
|
610
|
+
|
|
611
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
612
|
+
method: 'POST',
|
|
613
|
+
qs: localVarQueryParameters,
|
|
614
|
+
headers: localVarHeaderParams,
|
|
615
|
+
uri: localVarPath,
|
|
616
|
+
useQuerystring: this._useQuerystring,
|
|
617
|
+
json: true,
|
|
618
|
+
body: ObjectSerializer.serialize(initiateRemoteUploadRequest, "InitiateRemoteUploadRequest")
|
|
619
|
+
};
|
|
620
|
+
|
|
621
|
+
let authenticationPromise = Promise.resolve();
|
|
622
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
623
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
624
|
+
}
|
|
625
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
626
|
+
|
|
627
|
+
let interceptorPromise = authenticationPromise;
|
|
628
|
+
for (const interceptor of this.interceptors) {
|
|
629
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
return interceptorPromise.then(() => {
|
|
633
|
+
if (Object.keys(localVarFormParams).length) {
|
|
634
|
+
if (localVarUseFormData) {
|
|
635
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
636
|
+
} else {
|
|
637
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
return new Promise<{ response: http.IncomingMessage; body: InitiateRemoteUpload200Response; }>((resolve, reject) => {
|
|
641
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
642
|
+
if (error) {
|
|
643
|
+
reject(error);
|
|
644
|
+
} else {
|
|
645
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
646
|
+
body = ObjectSerializer.deserialize(body, "InitiateRemoteUpload200Response");
|
|
647
|
+
resolve({ response: response, body: body });
|
|
648
|
+
} else {
|
|
649
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
650
|
+
}
|
|
651
|
+
}
|
|
652
|
+
});
|
|
653
|
+
});
|
|
654
|
+
});
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Returns a paginated list of media assets in the workspace library.
|
|
658
|
+
* @summary List media
|
|
659
|
+
* @param workspaceUuid UUID of the workspace.
|
|
660
|
+
* @param page Page number (20 items per page).
|
|
661
|
+
*/
|
|
662
|
+
public async listMedia (workspaceUuid: string, page?: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ListMedia200Response; }> {
|
|
663
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media'
|
|
664
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
|
|
665
|
+
let localVarQueryParameters: any = {};
|
|
666
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
667
|
+
const produces = ['application/json'];
|
|
668
|
+
// give precedence to 'application/json'
|
|
669
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
670
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
671
|
+
} else {
|
|
672
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
673
|
+
}
|
|
674
|
+
let localVarFormParams: any = {};
|
|
675
|
+
|
|
676
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
677
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
678
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling listMedia.');
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
if (page !== undefined) {
|
|
682
|
+
localVarQueryParameters['page'] = ObjectSerializer.serialize(page, "number");
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
686
|
+
|
|
687
|
+
let localVarUseFormData = false;
|
|
688
|
+
|
|
689
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
690
|
+
method: 'GET',
|
|
691
|
+
qs: localVarQueryParameters,
|
|
692
|
+
headers: localVarHeaderParams,
|
|
693
|
+
uri: localVarPath,
|
|
694
|
+
useQuerystring: this._useQuerystring,
|
|
695
|
+
json: true,
|
|
696
|
+
};
|
|
697
|
+
|
|
698
|
+
let authenticationPromise = Promise.resolve();
|
|
699
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
700
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
701
|
+
}
|
|
702
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
703
|
+
|
|
704
|
+
let interceptorPromise = authenticationPromise;
|
|
705
|
+
for (const interceptor of this.interceptors) {
|
|
706
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
return interceptorPromise.then(() => {
|
|
710
|
+
if (Object.keys(localVarFormParams).length) {
|
|
711
|
+
if (localVarUseFormData) {
|
|
712
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
713
|
+
} else {
|
|
714
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
return new Promise<{ response: http.IncomingMessage; body: ListMedia200Response; }>((resolve, reject) => {
|
|
718
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
719
|
+
if (error) {
|
|
720
|
+
reject(error);
|
|
721
|
+
} else {
|
|
722
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
723
|
+
body = ObjectSerializer.deserialize(body, "ListMedia200Response");
|
|
724
|
+
resolve({ response: response, body: body });
|
|
725
|
+
} else {
|
|
726
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
});
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Update the alt text of a media asset.
|
|
735
|
+
* @summary Update media
|
|
736
|
+
* @param workspaceUuid UUID of the workspace.
|
|
737
|
+
* @param mediaUuid UUID of the media asset.
|
|
738
|
+
* @param updateMediaRequest
|
|
739
|
+
*/
|
|
740
|
+
public async updateMedia (workspaceUuid: string, mediaUuid: string, updateMediaRequest: UpdateMediaRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
|
|
741
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media/{mediaUuid}'
|
|
742
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
|
|
743
|
+
.replace('{' + 'mediaUuid' + '}', encodeURIComponent(String(mediaUuid)));
|
|
744
|
+
let localVarQueryParameters: any = {};
|
|
745
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
746
|
+
const produces = ['application/json'];
|
|
747
|
+
// give precedence to 'application/json'
|
|
748
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
749
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
750
|
+
} else {
|
|
751
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
752
|
+
}
|
|
753
|
+
let localVarFormParams: any = {};
|
|
754
|
+
|
|
755
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
756
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
757
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling updateMedia.');
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
// verify required parameter 'mediaUuid' is not null or undefined
|
|
761
|
+
if (mediaUuid === null || mediaUuid === undefined) {
|
|
762
|
+
throw new Error('Required parameter mediaUuid was null or undefined when calling updateMedia.');
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// verify required parameter 'updateMediaRequest' is not null or undefined
|
|
766
|
+
if (updateMediaRequest === null || updateMediaRequest === undefined) {
|
|
767
|
+
throw new Error('Required parameter updateMediaRequest was null or undefined when calling updateMedia.');
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
771
|
+
|
|
772
|
+
let localVarUseFormData = false;
|
|
773
|
+
|
|
774
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
775
|
+
method: 'PUT',
|
|
776
|
+
qs: localVarQueryParameters,
|
|
777
|
+
headers: localVarHeaderParams,
|
|
778
|
+
uri: localVarPath,
|
|
779
|
+
useQuerystring: this._useQuerystring,
|
|
780
|
+
json: true,
|
|
781
|
+
body: ObjectSerializer.serialize(updateMediaRequest, "UpdateMediaRequest")
|
|
782
|
+
};
|
|
783
|
+
|
|
784
|
+
let authenticationPromise = Promise.resolve();
|
|
785
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
786
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
787
|
+
}
|
|
788
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
789
|
+
|
|
790
|
+
let interceptorPromise = authenticationPromise;
|
|
791
|
+
for (const interceptor of this.interceptors) {
|
|
792
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
return interceptorPromise.then(() => {
|
|
796
|
+
if (Object.keys(localVarFormParams).length) {
|
|
797
|
+
if (localVarUseFormData) {
|
|
798
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
799
|
+
} else {
|
|
800
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
|
|
804
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
805
|
+
if (error) {
|
|
806
|
+
reject(error);
|
|
807
|
+
} else {
|
|
808
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
809
|
+
body = ObjectSerializer.deserialize(body, "object");
|
|
810
|
+
resolve({ response: response, body: body });
|
|
811
|
+
} else {
|
|
812
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
813
|
+
}
|
|
814
|
+
}
|
|
815
|
+
});
|
|
816
|
+
});
|
|
817
|
+
});
|
|
818
|
+
}
|
|
819
|
+
/**
|
|
820
|
+
* Upload a single chunk of a chunked upload session.
|
|
821
|
+
* @summary Upload a chunk
|
|
822
|
+
* @param workspaceUuid UUID of the workspace.
|
|
823
|
+
* @param uploadUuid
|
|
824
|
+
* @param chunk
|
|
825
|
+
* @param chunkIndex Zero-based index of this chunk.
|
|
826
|
+
*/
|
|
827
|
+
public async uploadChunk (workspaceUuid: string, uploadUuid: string, chunk: RequestFile, chunkIndex: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: UploadChunk200Response; }> {
|
|
828
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media/chunked/{uploadUuid}/upload'
|
|
829
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)))
|
|
830
|
+
.replace('{' + 'uploadUuid' + '}', encodeURIComponent(String(uploadUuid)));
|
|
831
|
+
let localVarQueryParameters: any = {};
|
|
832
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
833
|
+
const produces = ['application/json'];
|
|
834
|
+
// give precedence to 'application/json'
|
|
835
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
836
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
837
|
+
} else {
|
|
838
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
839
|
+
}
|
|
840
|
+
let localVarFormParams: any = {};
|
|
841
|
+
|
|
842
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
843
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
844
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling uploadChunk.');
|
|
845
|
+
}
|
|
846
|
+
|
|
847
|
+
// verify required parameter 'uploadUuid' is not null or undefined
|
|
848
|
+
if (uploadUuid === null || uploadUuid === undefined) {
|
|
849
|
+
throw new Error('Required parameter uploadUuid was null or undefined when calling uploadChunk.');
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// verify required parameter 'chunk' is not null or undefined
|
|
853
|
+
if (chunk === null || chunk === undefined) {
|
|
854
|
+
throw new Error('Required parameter chunk was null or undefined when calling uploadChunk.');
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// verify required parameter 'chunkIndex' is not null or undefined
|
|
858
|
+
if (chunkIndex === null || chunkIndex === undefined) {
|
|
859
|
+
throw new Error('Required parameter chunkIndex was null or undefined when calling uploadChunk.');
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
863
|
+
|
|
864
|
+
let localVarUseFormData = false;
|
|
865
|
+
|
|
866
|
+
if (chunk !== undefined) {
|
|
867
|
+
localVarFormParams['chunk'] = chunk;
|
|
868
|
+
}
|
|
869
|
+
localVarUseFormData = true;
|
|
870
|
+
|
|
871
|
+
if (chunkIndex !== undefined) {
|
|
872
|
+
localVarFormParams['chunk_index'] = ObjectSerializer.serialize(chunkIndex, "number");
|
|
873
|
+
}
|
|
874
|
+
|
|
875
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
876
|
+
method: 'POST',
|
|
877
|
+
qs: localVarQueryParameters,
|
|
878
|
+
headers: localVarHeaderParams,
|
|
879
|
+
uri: localVarPath,
|
|
880
|
+
useQuerystring: this._useQuerystring,
|
|
881
|
+
json: true,
|
|
882
|
+
};
|
|
883
|
+
|
|
884
|
+
let authenticationPromise = Promise.resolve();
|
|
885
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
886
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
887
|
+
}
|
|
888
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
889
|
+
|
|
890
|
+
let interceptorPromise = authenticationPromise;
|
|
891
|
+
for (const interceptor of this.interceptors) {
|
|
892
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
return interceptorPromise.then(() => {
|
|
896
|
+
if (Object.keys(localVarFormParams).length) {
|
|
897
|
+
if (localVarUseFormData) {
|
|
898
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
899
|
+
} else {
|
|
900
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
return new Promise<{ response: http.IncomingMessage; body: UploadChunk200Response; }>((resolve, reject) => {
|
|
904
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
905
|
+
if (error) {
|
|
906
|
+
reject(error);
|
|
907
|
+
} else {
|
|
908
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
909
|
+
body = ObjectSerializer.deserialize(body, "UploadChunk200Response");
|
|
910
|
+
resolve({ response: response, body: body });
|
|
911
|
+
} else {
|
|
912
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
});
|
|
916
|
+
});
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
/**
|
|
920
|
+
* Upload a file directly as multipart form data.
|
|
921
|
+
* @summary Upload media (binary)
|
|
922
|
+
* @param workspaceUuid UUID of the workspace.
|
|
923
|
+
* @param file The file to upload.
|
|
924
|
+
* @param altText Alternative text for accessibility.
|
|
925
|
+
*/
|
|
926
|
+
public async uploadMedia (workspaceUuid: string, file: RequestFile, altText?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: Media; }> {
|
|
927
|
+
const localVarPath = this.basePath + '/{workspaceUuid}/media'
|
|
928
|
+
.replace('{' + 'workspaceUuid' + '}', encodeURIComponent(String(workspaceUuid)));
|
|
929
|
+
let localVarQueryParameters: any = {};
|
|
930
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
931
|
+
const produces = ['application/json'];
|
|
932
|
+
// give precedence to 'application/json'
|
|
933
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
934
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
935
|
+
} else {
|
|
936
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
937
|
+
}
|
|
938
|
+
let localVarFormParams: any = {};
|
|
939
|
+
|
|
940
|
+
// verify required parameter 'workspaceUuid' is not null or undefined
|
|
941
|
+
if (workspaceUuid === null || workspaceUuid === undefined) {
|
|
942
|
+
throw new Error('Required parameter workspaceUuid was null or undefined when calling uploadMedia.');
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
// verify required parameter 'file' is not null or undefined
|
|
946
|
+
if (file === null || file === undefined) {
|
|
947
|
+
throw new Error('Required parameter file was null or undefined when calling uploadMedia.');
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
951
|
+
|
|
952
|
+
let localVarUseFormData = false;
|
|
953
|
+
|
|
954
|
+
if (file !== undefined) {
|
|
955
|
+
localVarFormParams['file'] = file;
|
|
956
|
+
}
|
|
957
|
+
localVarUseFormData = true;
|
|
958
|
+
|
|
959
|
+
if (altText !== undefined) {
|
|
960
|
+
localVarFormParams['alt_text'] = ObjectSerializer.serialize(altText, "string");
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
964
|
+
method: 'POST',
|
|
965
|
+
qs: localVarQueryParameters,
|
|
966
|
+
headers: localVarHeaderParams,
|
|
967
|
+
uri: localVarPath,
|
|
968
|
+
useQuerystring: this._useQuerystring,
|
|
969
|
+
json: true,
|
|
970
|
+
};
|
|
971
|
+
|
|
972
|
+
let authenticationPromise = Promise.resolve();
|
|
973
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
974
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
975
|
+
}
|
|
976
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
977
|
+
|
|
978
|
+
let interceptorPromise = authenticationPromise;
|
|
979
|
+
for (const interceptor of this.interceptors) {
|
|
980
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
return interceptorPromise.then(() => {
|
|
984
|
+
if (Object.keys(localVarFormParams).length) {
|
|
985
|
+
if (localVarUseFormData) {
|
|
986
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
987
|
+
} else {
|
|
988
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
989
|
+
}
|
|
990
|
+
}
|
|
991
|
+
return new Promise<{ response: http.IncomingMessage; body: Media; }>((resolve, reject) => {
|
|
992
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
993
|
+
if (error) {
|
|
994
|
+
reject(error);
|
|
995
|
+
} else {
|
|
996
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
997
|
+
body = ObjectSerializer.deserialize(body, "Media");
|
|
998
|
+
resolve({ response: response, body: body });
|
|
999
|
+
} else {
|
|
1000
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
});
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
}
|