asposeslidescloud 22.2.0 → 22.6.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/README.md +122 -87
- package/api.d.ts +3617 -3507
- package/api.js +12226 -11829
- package/internal/configuration.d.ts +44 -44
- package/internal/configuration.js +61 -60
- package/internal/objectSerializer.d.ts +18 -18
- package/internal/objectSerializer.js +185 -184
- package/internal/requestHelper.d.ts +33 -33
- package/internal/requestHelper.js +249 -247
- package/model.d.ts +7633 -6782
- package/model.js +4637 -4164
- package/package.json +24 -24
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import request = require("request");
|
|
2
|
-
import { Configuration } from "./configuration";
|
|
3
|
-
export declare function checkMultipartContent(options: request.Options, files: any): void;
|
|
4
|
-
/**
|
|
5
|
-
* Invoke api method
|
|
6
|
-
* @param requestOptions request parameters
|
|
7
|
-
* @param confguration api configuration
|
|
8
|
-
* @param notApplyAuthToRequest if setted to true, auth is not applied to request
|
|
9
|
-
*/
|
|
10
|
-
export declare function invokeApiMethod(requestOptions: request.Options, confguration: Configuration, notApplyAuthToRequest?: boolean): Promise<request.RequestResponse>;
|
|
11
|
-
/**
|
|
12
|
-
* Add parameter to query
|
|
13
|
-
* @param url url
|
|
14
|
-
* @param queryParameters queryParameters
|
|
15
|
-
* @param parameterName parameterName
|
|
16
|
-
* @param parameterValue parameterValue
|
|
17
|
-
*/
|
|
18
|
-
export declare function addQueryParameterToUrl(url: string, queryParameters: Array<string>, parameterName: string, parameterValue: any): string;
|
|
19
|
-
/**
|
|
20
|
-
* Add parameter to query
|
|
21
|
-
* @param url url
|
|
22
|
-
* @param queryParameters queryParameters
|
|
23
|
-
* @param parameterName parameterName
|
|
24
|
-
* @param parameterValue parameterValue
|
|
25
|
-
*/
|
|
26
|
-
export declare function addPathParameterToUrl(url: string, parameterName: string, parameterValue: string): string;
|
|
27
|
-
/**
|
|
28
|
-
* Add parameter to headers
|
|
29
|
-
* @param headers headers
|
|
30
|
-
* @param parameterName parameterName
|
|
31
|
-
* @param parameterValue parameterValue
|
|
32
|
-
*/
|
|
33
|
-
export declare function addHeaderParameter(headers: any, parameterName: string, parameterValue: any): void;
|
|
1
|
+
import request = require("request");
|
|
2
|
+
import { Configuration } from "./configuration";
|
|
3
|
+
export declare function checkMultipartContent(options: request.Options, files: any): void;
|
|
4
|
+
/**
|
|
5
|
+
* Invoke api method
|
|
6
|
+
* @param requestOptions request parameters
|
|
7
|
+
* @param confguration api configuration
|
|
8
|
+
* @param notApplyAuthToRequest if setted to true, auth is not applied to request
|
|
9
|
+
*/
|
|
10
|
+
export declare function invokeApiMethod(requestOptions: request.Options, confguration: Configuration, notApplyAuthToRequest?: boolean): Promise<request.RequestResponse>;
|
|
11
|
+
/**
|
|
12
|
+
* Add parameter to query
|
|
13
|
+
* @param url url
|
|
14
|
+
* @param queryParameters queryParameters
|
|
15
|
+
* @param parameterName parameterName
|
|
16
|
+
* @param parameterValue parameterValue
|
|
17
|
+
*/
|
|
18
|
+
export declare function addQueryParameterToUrl(url: string, queryParameters: Array<string>, parameterName: string, parameterValue: any): string;
|
|
19
|
+
/**
|
|
20
|
+
* Add parameter to query
|
|
21
|
+
* @param url url
|
|
22
|
+
* @param queryParameters queryParameters
|
|
23
|
+
* @param parameterName parameterName
|
|
24
|
+
* @param parameterValue parameterValue
|
|
25
|
+
*/
|
|
26
|
+
export declare function addPathParameterToUrl(url: string, parameterName: string, parameterValue: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Add parameter to headers
|
|
29
|
+
* @param headers headers
|
|
30
|
+
* @param parameterName parameterName
|
|
31
|
+
* @param parameterValue parameterValue
|
|
32
|
+
*/
|
|
33
|
+
export declare function addHeaderParameter(headers: any, parameterName: string, parameterValue: any): void;
|
|
@@ -1,247 +1,249 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* MIT License
|
|
4
|
-
|
|
5
|
-
* Copyright (c) 2018 Aspose Pty Ltd
|
|
6
|
-
|
|
7
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
-
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
-
* in the Software without restriction, including without limitation the rights
|
|
10
|
-
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
-
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
-
* furnished to do so, subject to the following conditions:
|
|
13
|
-
|
|
14
|
-
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
-
* copies or substantial portions of the Software.
|
|
16
|
-
|
|
17
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
-
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
-
* SOFTWARE.
|
|
24
|
-
*/
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
return
|
|
27
|
-
|
|
28
|
-
function
|
|
29
|
-
function
|
|
30
|
-
step(
|
|
31
|
-
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
* @param
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
*
|
|
81
|
-
* @param
|
|
82
|
-
* @param
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
*
|
|
106
|
-
* @param
|
|
107
|
-
* @param
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
*
|
|
120
|
-
* @param
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
*
|
|
132
|
-
* @param
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* MIT License
|
|
4
|
+
|
|
5
|
+
* Copyright (c) 2018 Aspose Pty Ltd
|
|
6
|
+
|
|
7
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
8
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
9
|
+
* in the Software without restriction, including without limitation the rights
|
|
10
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
11
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
12
|
+
* furnished to do so, subject to the following conditions:
|
|
13
|
+
|
|
14
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
15
|
+
* copies or substantial portions of the Software.
|
|
16
|
+
|
|
17
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
20
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
21
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
22
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
23
|
+
* SOFTWARE.
|
|
24
|
+
*/
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
exports.addHeaderParameter = exports.addPathParameterToUrl = exports.addQueryParameterToUrl = exports.invokeApiMethod = exports.checkMultipartContent = void 0;
|
|
36
|
+
const request = require("request");
|
|
37
|
+
const requestDebug = require("request-debug");
|
|
38
|
+
const objectSerializer_1 = require("./objectSerializer");
|
|
39
|
+
function checkMultipartContent(options, files) {
|
|
40
|
+
if (files && files.length) {
|
|
41
|
+
const data = {
|
|
42
|
+
pipeline: null,
|
|
43
|
+
attachments: []
|
|
44
|
+
};
|
|
45
|
+
if (options.json !== true && options.json) {
|
|
46
|
+
data.pipeline = JSON.stringify(options.json);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
delete data.pipeline;
|
|
50
|
+
}
|
|
51
|
+
for (var i = 0; i < files.length; i++) {
|
|
52
|
+
data.attachments.push(files[i]);
|
|
53
|
+
}
|
|
54
|
+
options.formData = data;
|
|
55
|
+
options.json = null;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.checkMultipartContent = checkMultipartContent;
|
|
59
|
+
/**
|
|
60
|
+
* Invoke api method
|
|
61
|
+
* @param requestOptions request parameters
|
|
62
|
+
* @param confguration api configuration
|
|
63
|
+
* @param notApplyAuthToRequest if setted to true, auth is not applied to request
|
|
64
|
+
*/
|
|
65
|
+
function invokeApiMethod(requestOptions, confguration, notApplyAuthToRequest) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
try {
|
|
68
|
+
return yield invokeApiMethodInternal(requestOptions, confguration, notApplyAuthToRequest);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
if (e instanceof NeedRepeatException) {
|
|
72
|
+
return yield invokeApiMethodInternal(requestOptions, confguration, notApplyAuthToRequest);
|
|
73
|
+
}
|
|
74
|
+
throw e;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
exports.invokeApiMethod = invokeApiMethod;
|
|
79
|
+
/**
|
|
80
|
+
* Add parameter to query
|
|
81
|
+
* @param url url
|
|
82
|
+
* @param queryParameters queryParameters
|
|
83
|
+
* @param parameterName parameterName
|
|
84
|
+
* @param parameterValue parameterValue
|
|
85
|
+
*/
|
|
86
|
+
function addQueryParameterToUrl(url, queryParameters, parameterName, parameterValue) {
|
|
87
|
+
if (parameterValue !== undefined && parameterValue != null) {
|
|
88
|
+
if (Array.isArray(parameterValue)) {
|
|
89
|
+
parameterValue = parameterValue.join(",");
|
|
90
|
+
}
|
|
91
|
+
if (url.indexOf("{" + parameterName + "}") >= 0) {
|
|
92
|
+
url = url.replace("{" + parameterName + "}", String(parameterValue));
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
queryParameters[parameterName] = String(parameterValue);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
url = url.replace("/{" + parameterName + "}", "");
|
|
100
|
+
}
|
|
101
|
+
return url;
|
|
102
|
+
}
|
|
103
|
+
exports.addQueryParameterToUrl = addQueryParameterToUrl;
|
|
104
|
+
/**
|
|
105
|
+
* Add parameter to query
|
|
106
|
+
* @param url url
|
|
107
|
+
* @param queryParameters queryParameters
|
|
108
|
+
* @param parameterName parameterName
|
|
109
|
+
* @param parameterValue parameterValue
|
|
110
|
+
*/
|
|
111
|
+
function addPathParameterToUrl(url, parameterName, parameterValue) {
|
|
112
|
+
if (!parameterValue) {
|
|
113
|
+
return url.replace("/{" + parameterName + "}", "");
|
|
114
|
+
}
|
|
115
|
+
return url.replace("{" + parameterName + "}", parameterValue);
|
|
116
|
+
}
|
|
117
|
+
exports.addPathParameterToUrl = addPathParameterToUrl;
|
|
118
|
+
/**
|
|
119
|
+
* Add parameter to headers
|
|
120
|
+
* @param headers headers
|
|
121
|
+
* @param parameterName parameterName
|
|
122
|
+
* @param parameterValue parameterValue
|
|
123
|
+
*/
|
|
124
|
+
function addHeaderParameter(headers, parameterName, parameterValue) {
|
|
125
|
+
if (parameterValue) {
|
|
126
|
+
headers[parameterName] = String(parameterValue);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
exports.addHeaderParameter = addHeaderParameter;
|
|
130
|
+
/**
|
|
131
|
+
* Invoke api method
|
|
132
|
+
* @param requestOptions request parameters
|
|
133
|
+
* @param confguration api configuration
|
|
134
|
+
* @param notApplyAuthToRequest if setted to true, auth is not applied to request
|
|
135
|
+
*/
|
|
136
|
+
function invokeApiMethodInternal(requestOptions, confguration, notApplyAuthToRequest) {
|
|
137
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
138
|
+
requestDebug(request, (type, data, r) => {
|
|
139
|
+
if (r.writeDebugToConsole) {
|
|
140
|
+
const toLog = {};
|
|
141
|
+
toLog[type] = data;
|
|
142
|
+
// tslint:disable-next-line:no-console
|
|
143
|
+
console.log(JSON.stringify(toLog, undefined, 2));
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
if (!requestOptions.headers) {
|
|
147
|
+
requestOptions.headers = {};
|
|
148
|
+
}
|
|
149
|
+
requestOptions.headers["x-aspose-client"] = "nodejs sdk v22.6.0";
|
|
150
|
+
if (confguration.timeout) {
|
|
151
|
+
requestOptions.headers["x-aspose-timeout"] = confguration.timeout;
|
|
152
|
+
}
|
|
153
|
+
for (var key in confguration.customHeaders) {
|
|
154
|
+
requestOptions.headers[key] = confguration.customHeaders[key];
|
|
155
|
+
}
|
|
156
|
+
if (!notApplyAuthToRequest) {
|
|
157
|
+
yield addAuthHeader(requestOptions, confguration);
|
|
158
|
+
}
|
|
159
|
+
return new Promise((resolve, reject) => {
|
|
160
|
+
const r = request(requestOptions, (error, response) => __awaiter(this, void 0, void 0, function* () {
|
|
161
|
+
if (error) {
|
|
162
|
+
reject(error);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
if (response.statusCode >= 200 && response.statusCode <= 299) {
|
|
166
|
+
resolve(response);
|
|
167
|
+
}
|
|
168
|
+
else if (!notApplyAuthToRequest && response.statusCode === 401) {
|
|
169
|
+
yield requestToken(confguration);
|
|
170
|
+
reject(new NeedRepeatException());
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
try {
|
|
174
|
+
if (response.statusCode == 400 && response.body && response.body.error && typeof response.body.error == "string") {
|
|
175
|
+
reject({ message: response.body.error, code: 401 });
|
|
176
|
+
}
|
|
177
|
+
else if (response.body && (response.body.length === undefined || response.body.length)) {
|
|
178
|
+
let bodyContent = response.body;
|
|
179
|
+
let bodyString = bodyContent;
|
|
180
|
+
if (bodyContent instanceof Buffer) {
|
|
181
|
+
bodyString = bodyContent.toString("utf8");
|
|
182
|
+
bodyContent = JSON.parse(bodyString);
|
|
183
|
+
}
|
|
184
|
+
let result = objectSerializer_1.ObjectSerializer.deserialize(bodyContent, "SlidesApiErrorResponse");
|
|
185
|
+
try {
|
|
186
|
+
result = JSON.parse(result);
|
|
187
|
+
}
|
|
188
|
+
catch (_a) {
|
|
189
|
+
//Error means the object is already deserialized
|
|
190
|
+
reject({ message: result.error ? result.error.message : bodyString, code: response.statusCode });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else {
|
|
194
|
+
reject({ message: response.statusMessage, code: response.statusCode });
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
reject({ message: "Error while parse server error: " + error });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}));
|
|
203
|
+
r.writeDebugToConsole = confguration.debugMode;
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
function addAuthHeader(requestOptions, configuration) {
|
|
208
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
209
|
+
if (configuration.appSid || configuration.appKey) {
|
|
210
|
+
if (isRequestTokenPending) {
|
|
211
|
+
yield requestingToken;
|
|
212
|
+
}
|
|
213
|
+
if (!configuration.accessToken) {
|
|
214
|
+
isRequestTokenPending = true;
|
|
215
|
+
requestingToken = requestToken(configuration).catch((err) => { isRequestTokenPending = false; throw (err); });
|
|
216
|
+
yield requestingToken;
|
|
217
|
+
}
|
|
218
|
+
isRequestTokenPending = false;
|
|
219
|
+
if (requestOptions && requestOptions.headers) {
|
|
220
|
+
requestOptions.headers.Authorization = "Bearer " + configuration.accessToken;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
return Promise.resolve();
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
function requestToken(configuration) {
|
|
227
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
+
const requestOptions = {
|
|
229
|
+
method: "POST",
|
|
230
|
+
json: true,
|
|
231
|
+
uri: configuration.authBaseUrl + "/connect/token",
|
|
232
|
+
form: {
|
|
233
|
+
grant_type: "client_credentials",
|
|
234
|
+
client_id: configuration.appSid,
|
|
235
|
+
client_secret: configuration.appKey,
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
const response = yield invokeApiMethod(requestOptions, configuration, true);
|
|
239
|
+
configuration.accessToken = response.body.access_token;
|
|
240
|
+
return Promise.resolve();
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
var requestingToken = null;
|
|
244
|
+
var isRequestTokenPending = false;
|
|
245
|
+
/**
|
|
246
|
+
* Exception, indicating necessity of request repeat
|
|
247
|
+
*/
|
|
248
|
+
class NeedRepeatException extends Error {
|
|
249
|
+
}
|