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/usersApi.ts
ADDED
|
@@ -0,0 +1,537 @@
|
|
|
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 { DeleteUser400Response } from '../model/deleteUser400Response';
|
|
19
|
+
import { DeleteUsersBulkRequest } from '../model/deleteUsersBulkRequest';
|
|
20
|
+
import { ListUsers200Response } from '../model/listUsers200Response';
|
|
21
|
+
import { User } from '../model/user';
|
|
22
|
+
import { UserInput } from '../model/userInput';
|
|
23
|
+
import { UserUpdateInput } from '../model/userUpdateInput';
|
|
24
|
+
|
|
25
|
+
import { ObjectSerializer, Authentication, VoidAuth, Interceptor } from '../model/models';
|
|
26
|
+
import { HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth } from '../model/models';
|
|
27
|
+
|
|
28
|
+
import { HttpError, RequestFile } from './apis';
|
|
29
|
+
|
|
30
|
+
let defaultBasePath = 'https://postboost.co/app/api';
|
|
31
|
+
|
|
32
|
+
// ===============================================
|
|
33
|
+
// This file is autogenerated - Please do not edit
|
|
34
|
+
// ===============================================
|
|
35
|
+
|
|
36
|
+
export enum UsersApiApiKeys {
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export class UsersApi {
|
|
40
|
+
protected _basePath = defaultBasePath;
|
|
41
|
+
protected _defaultHeaders : any = {};
|
|
42
|
+
protected _useQuerystring : boolean = false;
|
|
43
|
+
|
|
44
|
+
protected authentications = {
|
|
45
|
+
'default': <Authentication>new VoidAuth(),
|
|
46
|
+
'bearerAuth': new HttpBearerAuth(),
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
protected interceptors: Interceptor[] = [];
|
|
50
|
+
|
|
51
|
+
constructor(basePath?: string);
|
|
52
|
+
constructor(basePathOrUsername: string, password?: string, basePath?: string) {
|
|
53
|
+
if (password) {
|
|
54
|
+
if (basePath) {
|
|
55
|
+
this.basePath = basePath;
|
|
56
|
+
}
|
|
57
|
+
} else {
|
|
58
|
+
if (basePathOrUsername) {
|
|
59
|
+
this.basePath = basePathOrUsername
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
set useQuerystring(value: boolean) {
|
|
65
|
+
this._useQuerystring = value;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
set basePath(basePath: string) {
|
|
69
|
+
this._basePath = basePath;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
set defaultHeaders(defaultHeaders: any) {
|
|
73
|
+
this._defaultHeaders = defaultHeaders;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
get defaultHeaders() {
|
|
77
|
+
return this._defaultHeaders;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
get basePath() {
|
|
81
|
+
return this._basePath;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
public setDefaultAuthentication(auth: Authentication) {
|
|
85
|
+
this.authentications.default = auth;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
public setApiKey(key: UsersApiApiKeys, value: string) {
|
|
89
|
+
(this.authentications as any)[UsersApiApiKeys[key]].apiKey = value;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
set accessToken(accessToken: string | (() => string)) {
|
|
93
|
+
this.authentications.bearerAuth.accessToken = accessToken;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
public addInterceptor(interceptor: Interceptor) {
|
|
97
|
+
this.interceptors.push(interceptor);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
*
|
|
102
|
+
* @summary Create user
|
|
103
|
+
* @param userInput
|
|
104
|
+
*/
|
|
105
|
+
public async createUser (userInput: UserInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: User; }> {
|
|
106
|
+
const localVarPath = this.basePath + '/panel/users';
|
|
107
|
+
let localVarQueryParameters: any = {};
|
|
108
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
109
|
+
const produces = ['application/json'];
|
|
110
|
+
// give precedence to 'application/json'
|
|
111
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
112
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
113
|
+
} else {
|
|
114
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
115
|
+
}
|
|
116
|
+
let localVarFormParams: any = {};
|
|
117
|
+
|
|
118
|
+
// verify required parameter 'userInput' is not null or undefined
|
|
119
|
+
if (userInput === null || userInput === undefined) {
|
|
120
|
+
throw new Error('Required parameter userInput was null or undefined when calling createUser.');
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
124
|
+
|
|
125
|
+
let localVarUseFormData = false;
|
|
126
|
+
|
|
127
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
qs: localVarQueryParameters,
|
|
130
|
+
headers: localVarHeaderParams,
|
|
131
|
+
uri: localVarPath,
|
|
132
|
+
useQuerystring: this._useQuerystring,
|
|
133
|
+
json: true,
|
|
134
|
+
body: ObjectSerializer.serialize(userInput, "UserInput")
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
let authenticationPromise = Promise.resolve();
|
|
138
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
139
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
140
|
+
}
|
|
141
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
142
|
+
|
|
143
|
+
let interceptorPromise = authenticationPromise;
|
|
144
|
+
for (const interceptor of this.interceptors) {
|
|
145
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return interceptorPromise.then(() => {
|
|
149
|
+
if (Object.keys(localVarFormParams).length) {
|
|
150
|
+
if (localVarUseFormData) {
|
|
151
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
152
|
+
} else {
|
|
153
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return new Promise<{ response: http.IncomingMessage; body: User; }>((resolve, reject) => {
|
|
157
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
158
|
+
if (error) {
|
|
159
|
+
reject(error);
|
|
160
|
+
} else {
|
|
161
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
162
|
+
body = ObjectSerializer.deserialize(body, "User");
|
|
163
|
+
resolve({ response: response, body: body });
|
|
164
|
+
} else {
|
|
165
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
*
|
|
174
|
+
* @summary Delete user
|
|
175
|
+
* @param userId ID of the user.
|
|
176
|
+
*/
|
|
177
|
+
public async deleteUser (userId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
|
|
178
|
+
const localVarPath = this.basePath + '/panel/users/{userId}'
|
|
179
|
+
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
|
|
180
|
+
let localVarQueryParameters: any = {};
|
|
181
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
182
|
+
const produces = ['application/json'];
|
|
183
|
+
// give precedence to 'application/json'
|
|
184
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
185
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
186
|
+
} else {
|
|
187
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
188
|
+
}
|
|
189
|
+
let localVarFormParams: any = {};
|
|
190
|
+
|
|
191
|
+
// verify required parameter 'userId' is not null or undefined
|
|
192
|
+
if (userId === null || userId === undefined) {
|
|
193
|
+
throw new Error('Required parameter userId was null or undefined when calling deleteUser.');
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
197
|
+
|
|
198
|
+
let localVarUseFormData = false;
|
|
199
|
+
|
|
200
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
201
|
+
method: 'DELETE',
|
|
202
|
+
qs: localVarQueryParameters,
|
|
203
|
+
headers: localVarHeaderParams,
|
|
204
|
+
uri: localVarPath,
|
|
205
|
+
useQuerystring: this._useQuerystring,
|
|
206
|
+
json: true,
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
let authenticationPromise = Promise.resolve();
|
|
210
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
211
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
212
|
+
}
|
|
213
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
214
|
+
|
|
215
|
+
let interceptorPromise = authenticationPromise;
|
|
216
|
+
for (const interceptor of this.interceptors) {
|
|
217
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return interceptorPromise.then(() => {
|
|
221
|
+
if (Object.keys(localVarFormParams).length) {
|
|
222
|
+
if (localVarUseFormData) {
|
|
223
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
224
|
+
} else {
|
|
225
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
|
|
229
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
230
|
+
if (error) {
|
|
231
|
+
reject(error);
|
|
232
|
+
} else {
|
|
233
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
234
|
+
body = ObjectSerializer.deserialize(body, "object");
|
|
235
|
+
resolve({ response: response, body: body });
|
|
236
|
+
} else {
|
|
237
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
});
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
*
|
|
246
|
+
* @summary Delete users (bulk)
|
|
247
|
+
* @param deleteUsersBulkRequest
|
|
248
|
+
*/
|
|
249
|
+
public async deleteUsersBulk (deleteUsersBulkRequest: DeleteUsersBulkRequest, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
|
|
250
|
+
const localVarPath = this.basePath + '/panel/users';
|
|
251
|
+
let localVarQueryParameters: any = {};
|
|
252
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
253
|
+
const produces = ['application/json'];
|
|
254
|
+
// give precedence to 'application/json'
|
|
255
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
256
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
257
|
+
} else {
|
|
258
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
259
|
+
}
|
|
260
|
+
let localVarFormParams: any = {};
|
|
261
|
+
|
|
262
|
+
// verify required parameter 'deleteUsersBulkRequest' is not null or undefined
|
|
263
|
+
if (deleteUsersBulkRequest === null || deleteUsersBulkRequest === undefined) {
|
|
264
|
+
throw new Error('Required parameter deleteUsersBulkRequest was null or undefined when calling deleteUsersBulk.');
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
268
|
+
|
|
269
|
+
let localVarUseFormData = false;
|
|
270
|
+
|
|
271
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
272
|
+
method: 'DELETE',
|
|
273
|
+
qs: localVarQueryParameters,
|
|
274
|
+
headers: localVarHeaderParams,
|
|
275
|
+
uri: localVarPath,
|
|
276
|
+
useQuerystring: this._useQuerystring,
|
|
277
|
+
json: true,
|
|
278
|
+
body: ObjectSerializer.serialize(deleteUsersBulkRequest, "DeleteUsersBulkRequest")
|
|
279
|
+
};
|
|
280
|
+
|
|
281
|
+
let authenticationPromise = Promise.resolve();
|
|
282
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
283
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
284
|
+
}
|
|
285
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
286
|
+
|
|
287
|
+
let interceptorPromise = authenticationPromise;
|
|
288
|
+
for (const interceptor of this.interceptors) {
|
|
289
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
return interceptorPromise.then(() => {
|
|
293
|
+
if (Object.keys(localVarFormParams).length) {
|
|
294
|
+
if (localVarUseFormData) {
|
|
295
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
296
|
+
} else {
|
|
297
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
|
|
301
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
302
|
+
if (error) {
|
|
303
|
+
reject(error);
|
|
304
|
+
} else {
|
|
305
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
306
|
+
body = ObjectSerializer.deserialize(body, "object");
|
|
307
|
+
resolve({ response: response, body: body });
|
|
308
|
+
} else {
|
|
309
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
});
|
|
313
|
+
});
|
|
314
|
+
});
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
*
|
|
318
|
+
* @summary Get user
|
|
319
|
+
* @param userId ID of the user.
|
|
320
|
+
*/
|
|
321
|
+
public async getUser (userId: number, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: User; }> {
|
|
322
|
+
const localVarPath = this.basePath + '/panel/users/{userId}'
|
|
323
|
+
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
|
|
324
|
+
let localVarQueryParameters: any = {};
|
|
325
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
326
|
+
const produces = ['application/json'];
|
|
327
|
+
// give precedence to 'application/json'
|
|
328
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
329
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
330
|
+
} else {
|
|
331
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
332
|
+
}
|
|
333
|
+
let localVarFormParams: any = {};
|
|
334
|
+
|
|
335
|
+
// verify required parameter 'userId' is not null or undefined
|
|
336
|
+
if (userId === null || userId === undefined) {
|
|
337
|
+
throw new Error('Required parameter userId was null or undefined when calling getUser.');
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
341
|
+
|
|
342
|
+
let localVarUseFormData = false;
|
|
343
|
+
|
|
344
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
345
|
+
method: 'GET',
|
|
346
|
+
qs: localVarQueryParameters,
|
|
347
|
+
headers: localVarHeaderParams,
|
|
348
|
+
uri: localVarPath,
|
|
349
|
+
useQuerystring: this._useQuerystring,
|
|
350
|
+
json: true,
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
let authenticationPromise = Promise.resolve();
|
|
354
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
355
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
356
|
+
}
|
|
357
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
358
|
+
|
|
359
|
+
let interceptorPromise = authenticationPromise;
|
|
360
|
+
for (const interceptor of this.interceptors) {
|
|
361
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
return interceptorPromise.then(() => {
|
|
365
|
+
if (Object.keys(localVarFormParams).length) {
|
|
366
|
+
if (localVarUseFormData) {
|
|
367
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
368
|
+
} else {
|
|
369
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
return new Promise<{ response: http.IncomingMessage; body: User; }>((resolve, reject) => {
|
|
373
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
374
|
+
if (error) {
|
|
375
|
+
reject(error);
|
|
376
|
+
} else {
|
|
377
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
378
|
+
body = ObjectSerializer.deserialize(body, "User");
|
|
379
|
+
resolve({ response: response, body: body });
|
|
380
|
+
} else {
|
|
381
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
*
|
|
390
|
+
* @summary List users
|
|
391
|
+
* @param keyword Search by name or email.
|
|
392
|
+
*/
|
|
393
|
+
public async listUsers (keyword?: string, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: ListUsers200Response; }> {
|
|
394
|
+
const localVarPath = this.basePath + '/panel/users';
|
|
395
|
+
let localVarQueryParameters: any = {};
|
|
396
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
397
|
+
const produces = ['application/json'];
|
|
398
|
+
// give precedence to 'application/json'
|
|
399
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
400
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
401
|
+
} else {
|
|
402
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
403
|
+
}
|
|
404
|
+
let localVarFormParams: any = {};
|
|
405
|
+
|
|
406
|
+
if (keyword !== undefined) {
|
|
407
|
+
localVarQueryParameters['keyword'] = ObjectSerializer.serialize(keyword, "string");
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
411
|
+
|
|
412
|
+
let localVarUseFormData = false;
|
|
413
|
+
|
|
414
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
415
|
+
method: 'GET',
|
|
416
|
+
qs: localVarQueryParameters,
|
|
417
|
+
headers: localVarHeaderParams,
|
|
418
|
+
uri: localVarPath,
|
|
419
|
+
useQuerystring: this._useQuerystring,
|
|
420
|
+
json: true,
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
let authenticationPromise = Promise.resolve();
|
|
424
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
425
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
426
|
+
}
|
|
427
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
428
|
+
|
|
429
|
+
let interceptorPromise = authenticationPromise;
|
|
430
|
+
for (const interceptor of this.interceptors) {
|
|
431
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return interceptorPromise.then(() => {
|
|
435
|
+
if (Object.keys(localVarFormParams).length) {
|
|
436
|
+
if (localVarUseFormData) {
|
|
437
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
438
|
+
} else {
|
|
439
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
return new Promise<{ response: http.IncomingMessage; body: ListUsers200Response; }>((resolve, reject) => {
|
|
443
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
444
|
+
if (error) {
|
|
445
|
+
reject(error);
|
|
446
|
+
} else {
|
|
447
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
448
|
+
body = ObjectSerializer.deserialize(body, "ListUsers200Response");
|
|
449
|
+
resolve({ response: response, body: body });
|
|
450
|
+
} else {
|
|
451
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
});
|
|
455
|
+
});
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
/**
|
|
459
|
+
*
|
|
460
|
+
* @summary Update user
|
|
461
|
+
* @param userId ID of the user.
|
|
462
|
+
* @param userUpdateInput
|
|
463
|
+
*/
|
|
464
|
+
public async updateUser (userId: number, userUpdateInput: UserUpdateInput, options: {headers: {[name: string]: string}} = {headers: {}}) : Promise<{ response: http.IncomingMessage; body: object; }> {
|
|
465
|
+
const localVarPath = this.basePath + '/panel/users/{userId}'
|
|
466
|
+
.replace('{' + 'userId' + '}', encodeURIComponent(String(userId)));
|
|
467
|
+
let localVarQueryParameters: any = {};
|
|
468
|
+
let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
|
|
469
|
+
const produces = ['application/json'];
|
|
470
|
+
// give precedence to 'application/json'
|
|
471
|
+
if (produces.indexOf('application/json') >= 0) {
|
|
472
|
+
localVarHeaderParams.Accept = 'application/json';
|
|
473
|
+
} else {
|
|
474
|
+
localVarHeaderParams.Accept = produces.join(',');
|
|
475
|
+
}
|
|
476
|
+
let localVarFormParams: any = {};
|
|
477
|
+
|
|
478
|
+
// verify required parameter 'userId' is not null or undefined
|
|
479
|
+
if (userId === null || userId === undefined) {
|
|
480
|
+
throw new Error('Required parameter userId was null or undefined when calling updateUser.');
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// verify required parameter 'userUpdateInput' is not null or undefined
|
|
484
|
+
if (userUpdateInput === null || userUpdateInput === undefined) {
|
|
485
|
+
throw new Error('Required parameter userUpdateInput was null or undefined when calling updateUser.');
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
(<any>Object).assign(localVarHeaderParams, options.headers);
|
|
489
|
+
|
|
490
|
+
let localVarUseFormData = false;
|
|
491
|
+
|
|
492
|
+
let localVarRequestOptions: localVarRequest.Options = {
|
|
493
|
+
method: 'PUT',
|
|
494
|
+
qs: localVarQueryParameters,
|
|
495
|
+
headers: localVarHeaderParams,
|
|
496
|
+
uri: localVarPath,
|
|
497
|
+
useQuerystring: this._useQuerystring,
|
|
498
|
+
json: true,
|
|
499
|
+
body: ObjectSerializer.serialize(userUpdateInput, "UserUpdateInput")
|
|
500
|
+
};
|
|
501
|
+
|
|
502
|
+
let authenticationPromise = Promise.resolve();
|
|
503
|
+
if (this.authentications.bearerAuth.accessToken) {
|
|
504
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.bearerAuth.applyToRequest(localVarRequestOptions));
|
|
505
|
+
}
|
|
506
|
+
authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
|
|
507
|
+
|
|
508
|
+
let interceptorPromise = authenticationPromise;
|
|
509
|
+
for (const interceptor of this.interceptors) {
|
|
510
|
+
interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
return interceptorPromise.then(() => {
|
|
514
|
+
if (Object.keys(localVarFormParams).length) {
|
|
515
|
+
if (localVarUseFormData) {
|
|
516
|
+
(<any>localVarRequestOptions).formData = localVarFormParams;
|
|
517
|
+
} else {
|
|
518
|
+
localVarRequestOptions.form = localVarFormParams;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
return new Promise<{ response: http.IncomingMessage; body: object; }>((resolve, reject) => {
|
|
522
|
+
localVarRequest(localVarRequestOptions, (error, response, body) => {
|
|
523
|
+
if (error) {
|
|
524
|
+
reject(error);
|
|
525
|
+
} else {
|
|
526
|
+
if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) {
|
|
527
|
+
body = ObjectSerializer.deserialize(body, "object");
|
|
528
|
+
resolve({ response: response, body: body });
|
|
529
|
+
} else {
|
|
530
|
+
reject(new HttpError(response, body, response.statusCode));
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
});
|
|
534
|
+
});
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
}
|