UNPKG

190 kBJavaScriptView Raw
1"use strict";
2var __extends = (this && this.__extends) || (function () {
3 var extendStatics = function (d, b) {
4 extendStatics = Object.setPrototypeOf ||
5 ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6 function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7 return extendStatics(d, b);
8 };
9 return function (d, b) {
10 extendStatics(d, b);
11 function __() { this.constructor = d; }
12 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13 };
14})();
15var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
16 return new (P || (P = Promise))(function (resolve, reject) {
17 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19 function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
20 step((generator = generator.apply(thisArg, _arguments || [])).next());
21 });
22};
23var __generator = (this && this.__generator) || function (thisArg, body) {
24 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
25 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
26 function verb(n) { return function (v) { return step([n, v]); }; }
27 function step(op) {
28 if (f) throw new TypeError("Generator is already executing.");
29 while (_) try {
30 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
31 if (y = 0, t) op = [op[0] & 2, t.value];
32 switch (op[0]) {
33 case 0: case 1: t = op; break;
34 case 4: _.label++; return { value: op[1], done: false };
35 case 5: _.label++; y = op[1]; op = [0]; continue;
36 case 7: op = _.ops.pop(); _.trys.pop(); continue;
37 default:
38 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
39 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
40 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
41 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
42 if (t[2]) _.ops.pop();
43 _.trys.pop(); continue;
44 }
45 op = body.call(thisArg, _);
46 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
47 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
48 }
49};
50Object.defineProperty(exports, "__esModule", { value: true });
51var services;
52(function (services) {
53 /**
54 * Class to be used as the base class for the generated service clients.
55 */
56 var BaseServiceClient = /** @class */ (function () {
57 /**
58 * Creates new instance of the BaseServiceClient
59 * @param {ApiConfiguration} apiConfiguration configuration parameter to provide dependencies to service client instance
60 */
61 function BaseServiceClient(apiConfiguration) {
62 this.requestInterceptors = [];
63 this.responseInterceptors = [];
64 this.apiConfiguration = apiConfiguration;
65 }
66 BaseServiceClient.isCodeSuccessful = function (responseCode) {
67 return responseCode >= 200 && responseCode < 300;
68 };
69 BaseServiceClient.buildUrl = function (endpoint, path, queryParameters, pathParameters) {
70 var processedEndpoint = endpoint.endsWith('/') ? endpoint.substr(0, endpoint.length - 1) : endpoint;
71 var pathWithParams = this.interpolateParams(path, pathParameters);
72 var isConstantQueryPresent = pathWithParams.includes('?');
73 var queryString = this.buildQueryString(queryParameters, isConstantQueryPresent);
74 return processedEndpoint + pathWithParams + queryString;
75 };
76 BaseServiceClient.interpolateParams = function (path, params) {
77 if (!params) {
78 return path;
79 }
80 var result = path;
81 params.forEach(function (paramValue, paramName) {
82 result = result.replace('{' + paramName + '}', encodeURIComponent(paramValue));
83 });
84 return result;
85 };
86 BaseServiceClient.buildQueryString = function (params, isQueryStart) {
87 if (!params) {
88 return '';
89 }
90 var sb = [];
91 if (isQueryStart) {
92 sb.push('&');
93 }
94 else {
95 sb.push('?');
96 }
97 params.forEach(function (obj) {
98 sb.push(encodeURIComponent(obj.key));
99 sb.push('=');
100 sb.push(encodeURIComponent(obj.value));
101 sb.push('&');
102 });
103 sb.pop();
104 return sb.join('');
105 };
106 /**
107 * Sets array of functions that is going to be executed before the request is send
108 * @param {Function} requestInterceptor request interceptor function
109 * @returns {BaseServiceClient}
110 */
111 BaseServiceClient.prototype.withRequestInterceptors = function () {
112 var requestInterceptors = [];
113 for (var _i = 0; _i < arguments.length; _i++) {
114 requestInterceptors[_i] = arguments[_i];
115 }
116 for (var _a = 0, requestInterceptors_1 = requestInterceptors; _a < requestInterceptors_1.length; _a++) {
117 var interceptor = requestInterceptors_1[_a];
118 this.requestInterceptors.push(interceptor);
119 }
120 return this;
121 };
122 /**
123 * Sets array of functions that is going to be executed after the request is send
124 * @param {Function} responseInterceptor response interceptor function
125 * @returns {BaseServiceClient}
126 */
127 BaseServiceClient.prototype.withResponseInterceptors = function () {
128 var responseInterceptors = [];
129 for (var _i = 0; _i < arguments.length; _i++) {
130 responseInterceptors[_i] = arguments[_i];
131 }
132 for (var _a = 0, responseInterceptors_1 = responseInterceptors; _a < responseInterceptors_1.length; _a++) {
133 var interceptor = responseInterceptors_1[_a];
134 this.responseInterceptors.push(interceptor);
135 }
136 return this;
137 };
138 /**
139 * Invocation wrapper to implement service operations in generated classes
140 * @param method HTTP method, such as 'POST', 'GET', 'DELETE', etc.
141 * @param endpoint base API url
142 * @param path the path pattern with possible placeholders for path parameters in form {paramName}
143 * @param pathParams path parameters collection
144 * @param queryParams query parameters collection
145 * @param headerParams headers collection
146 * @param bodyParam if body parameter is present it is provided here, otherwise null or undefined
147 * @param errors maps recognized status codes to messages
148 * @param nonJsonBody if the body is in JSON format
149 */
150 BaseServiceClient.prototype.invoke = function (method, endpoint, path, pathParams, queryParams, headerParams, bodyParam, errors, nonJsonBody) {
151 return __awaiter(this, void 0, void 0, function () {
152 var request, apiClient, response, _i, _a, requestInterceptor, _b, _c, responseInterceptor, err_1, body, contentType, isJson, apiResponse, err;
153 return __generator(this, function (_d) {
154 switch (_d.label) {
155 case 0:
156 request = {
157 url: BaseServiceClient.buildUrl(endpoint, path, queryParams, pathParams),
158 method: method,
159 headers: headerParams,
160 };
161 if (bodyParam != null) {
162 request.body = nonJsonBody ? bodyParam : JSON.stringify(bodyParam);
163 }
164 apiClient = this.apiConfiguration.apiClient;
165 _d.label = 1;
166 case 1:
167 _d.trys.push([1, 11, , 12]);
168 _i = 0, _a = this.requestInterceptors;
169 _d.label = 2;
170 case 2:
171 if (!(_i < _a.length)) return [3 /*break*/, 5];
172 requestInterceptor = _a[_i];
173 return [4 /*yield*/, requestInterceptor(request)];
174 case 3:
175 _d.sent();
176 _d.label = 4;
177 case 4:
178 _i++;
179 return [3 /*break*/, 2];
180 case 5: return [4 /*yield*/, apiClient.invoke(request)];
181 case 6:
182 response = _d.sent();
183 _b = 0, _c = this.responseInterceptors;
184 _d.label = 7;
185 case 7:
186 if (!(_b < _c.length)) return [3 /*break*/, 10];
187 responseInterceptor = _c[_b];
188 return [4 /*yield*/, responseInterceptor(response)];
189 case 8:
190 _d.sent();
191 _d.label = 9;
192 case 9:
193 _b++;
194 return [3 /*break*/, 7];
195 case 10: return [3 /*break*/, 12];
196 case 11:
197 err_1 = _d.sent();
198 err_1.message = "Call to service failed: " + err_1.message;
199 throw err_1;
200 case 12:
201 try {
202 contentType = response.headers.find(function (h) { return h.key === 'content-type'; });
203 isJson = !contentType || contentType.value.includes('application/json');
204 body = response.body && isJson ? JSON.parse(response.body) : response.body;
205 // converting to undefined if empty string
206 body = body || undefined;
207 }
208 catch (err) {
209 throw new SyntaxError("Failed trying to parse the response body: " + response.body);
210 }
211 if (BaseServiceClient.isCodeSuccessful(response.statusCode)) {
212 apiResponse = {
213 headers: response.headers,
214 body: body,
215 statusCode: response.statusCode,
216 };
217 return [2 /*return*/, apiResponse];
218 }
219 err = new Error('Unknown error');
220 err.name = 'ServiceError';
221 err['statusCode'] = response.statusCode; // tslint:disable-line:no-string-literal
222 err['response'] = body; // tslint:disable-line:no-string-literal
223 if (errors && errors.has(response.statusCode)) {
224 err.message = errors.get(response.statusCode);
225 }
226 throw err;
227 }
228 });
229 });
230 };
231 return BaseServiceClient;
232 }());
233 services.BaseServiceClient = BaseServiceClient;
234 /**
235 * Class to be used to call Amazon LWA to retrieve access tokens.
236 */
237 var LwaServiceClient = /** @class */ (function (_super) {
238 __extends(LwaServiceClient, _super);
239 function LwaServiceClient(options) {
240 var _this = _super.call(this, options.apiConfiguration) || this;
241 if (options.authenticationConfiguration == null) {
242 throw new Error('AuthenticationConfiguration cannot be null or undefined.');
243 }
244 _this.grantType = options.grantType ? options.grantType : LwaServiceClient.CLIENT_CREDENTIALS_GRANT_TYPE;
245 _this.authenticationConfiguration = options.authenticationConfiguration;
246 _this.tokenStore = {};
247 return _this;
248 }
249 LwaServiceClient.prototype.getAccessTokenForScope = function (scope) {
250 return __awaiter(this, void 0, void 0, function () {
251 return __generator(this, function (_a) {
252 if (scope == null) {
253 throw new Error('Scope cannot be null or undefined.');
254 }
255 return [2 /*return*/, this.getAccessToken(scope)];
256 });
257 });
258 };
259 LwaServiceClient.prototype.getAccessToken = function (scope) {
260 return __awaiter(this, void 0, void 0, function () {
261 var cacheKey, accessToken, accessTokenRequest, accessTokenResponse;
262 return __generator(this, function (_a) {
263 switch (_a.label) {
264 case 0:
265 cacheKey = scope ? scope : LwaServiceClient.REFRESH_ACCESS_TOKEN;
266 accessToken = this.tokenStore[cacheKey];
267 if (accessToken && accessToken.expiry > Date.now() + LwaServiceClient.EXPIRY_OFFSET_MILLIS) {
268 return [2 /*return*/, accessToken.token];
269 }
270 accessTokenRequest = {
271 clientId: this.authenticationConfiguration.clientId,
272 clientSecret: this.authenticationConfiguration.clientSecret,
273 };
274 if (scope && this.authenticationConfiguration.refreshToken) {
275 throw new Error('Cannot support both refreshToken and scope.');
276 }
277 else if (scope == null && this.authenticationConfiguration.refreshToken == null) {
278 throw new Error('Either refreshToken or scope must be specified.');
279 }
280 else if (scope == null) {
281 accessTokenRequest.refreshToken = this.authenticationConfiguration.refreshToken;
282 }
283 else {
284 accessTokenRequest.scope = scope;
285 }
286 return [4 /*yield*/, this.generateAccessToken(accessTokenRequest)];
287 case 1:
288 accessTokenResponse = _a.sent();
289 this.tokenStore[cacheKey] = {
290 token: accessTokenResponse.access_token,
291 expiry: Date.now() + accessTokenResponse.expires_in * 1000,
292 };
293 return [2 /*return*/, accessTokenResponse.access_token];
294 }
295 });
296 });
297 };
298 LwaServiceClient.prototype.generateAccessToken = function (accessTokenRequest) {
299 return __awaiter(this, void 0, void 0, function () {
300 var authEndpoint, queryParams, headerParams, pathParams, paramInfo, bodyParams, errorDefinitions, apiResponse;
301 return __generator(this, function (_a) {
302 switch (_a.label) {
303 case 0:
304 authEndpoint = this.authenticationConfiguration.authEndpoint || LwaServiceClient.AUTH_ENDPOINT;
305 if (accessTokenRequest == null) {
306 throw new Error("Required parameter accessTokenRequest was null or undefined when calling generateAccessToken.");
307 }
308 queryParams = [];
309 headerParams = [];
310 headerParams.push({ key: 'Content-type', value: 'application/x-www-form-urlencoded' });
311 pathParams = new Map();
312 paramInfo = this.grantType === LwaServiceClient.LWA_CREDENTIALS_GRANT_TYPE ? "&refresh_token=" + accessTokenRequest.refreshToken : "&scope=" + accessTokenRequest.scope;
313 bodyParams = "grant_type=" + this.grantType + "&client_secret=" + accessTokenRequest.clientSecret + "&client_id=" + accessTokenRequest.clientId + paramInfo;
314 errorDefinitions = new Map();
315 errorDefinitions.set(200, 'Token request sent.');
316 errorDefinitions.set(400, 'Bad Request');
317 errorDefinitions.set(401, 'Authentication Failed');
318 errorDefinitions.set(500, 'Internal Server Error');
319 return [4 /*yield*/, this.invoke('POST', authEndpoint, '/auth/O2/token', pathParams, queryParams, headerParams, bodyParams, errorDefinitions, true)];
320 case 1:
321 apiResponse = _a.sent();
322 return [2 /*return*/, apiResponse.body];
323 }
324 });
325 });
326 };
327 LwaServiceClient.EXPIRY_OFFSET_MILLIS = 60000;
328 LwaServiceClient.REFRESH_ACCESS_TOKEN = 'refresh_access_token';
329 LwaServiceClient.CLIENT_CREDENTIALS_GRANT_TYPE = 'client_credentials';
330 LwaServiceClient.LWA_CREDENTIALS_GRANT_TYPE = 'refresh_token';
331 LwaServiceClient.AUTH_ENDPOINT = 'https://api.amazon.com';
332 return LwaServiceClient;
333 }(BaseServiceClient));
334 services.LwaServiceClient = LwaServiceClient;
335})(services = exports.services || (exports.services = {}));
336/**
337 * function creating an AskSdk user agent.
338 * @param packageVersion
339 * @param customUserAgent
340 */
341function createUserAgent(packageVersion, customUserAgent) {
342 var customUserAgentString = customUserAgent ? (' ' + customUserAgent) : '';
343 return "ask-node-model/" + packageVersion + " Node/" + process.version + customUserAgentString;
344}
345exports.createUserAgent = createUserAgent;
346(function (services) {
347 var datastore;
348 (function (datastore) {
349 /**
350 *
351 */
352 var DatastoreServiceClient = /** @class */ (function (_super) {
353 __extends(DatastoreServiceClient, _super);
354 function DatastoreServiceClient(apiConfiguration, authenticationConfiguration, customUserAgent) {
355 if (customUserAgent === void 0) { customUserAgent = null; }
356 var _this = _super.call(this, apiConfiguration) || this;
357 _this.lwaServiceClient = new services.LwaServiceClient({
358 apiConfiguration: apiConfiguration,
359 authenticationConfiguration: authenticationConfiguration,
360 });
361 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
362 return _this;
363 }
364 /**
365 * Send DataStore commands to Alexa device.
366 * @param {services.datastore.v1.CommandsRequest} commandsRequest
367 */
368 DatastoreServiceClient.prototype.callCommandsV1 = function (commandsRequest) {
369 return __awaiter(this, void 0, void 0, function () {
370 var __operationId__, queryParams, headerParams, pathParams, accessToken, authorizationValue, resourcePath, errorDefinitions;
371 return __generator(this, function (_a) {
372 switch (_a.label) {
373 case 0:
374 __operationId__ = 'callCommandsV1';
375 // verify required parameter 'commandsRequest' is not null or undefined
376 if (commandsRequest == null) {
377 throw new Error("Required parameter commandsRequest was null or undefined when calling " + __operationId__ + ".");
378 }
379 queryParams = [];
380 headerParams = [];
381 headerParams.push({ key: 'User-Agent', value: this.userAgent });
382 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
383 headerParams.push({ key: 'Content-type', value: 'application/json' });
384 }
385 pathParams = new Map();
386 return [4 /*yield*/, this.lwaServiceClient.getAccessTokenForScope("alexa::datastore")];
387 case 1:
388 accessToken = _a.sent();
389 authorizationValue = "Bearer " + accessToken;
390 headerParams.push({ key: "Authorization", value: authorizationValue });
391 resourcePath = "/v1/datastore/commands";
392 errorDefinitions = new Map();
393 errorDefinitions.set(200, "Multiple CommandsDispatchResults in response.");
394 errorDefinitions.set(400, "Request validation fails.");
395 errorDefinitions.set(401, "Not Authorized.");
396 errorDefinitions.set(403, "The skill is not allowed to execute commands.");
397 errorDefinitions.set(429, "The client has made more calls than the allowed limit.");
398 errorDefinitions.set(0, "Unexpected error.");
399 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, commandsRequest, errorDefinitions)];
400 }
401 });
402 });
403 };
404 /**
405 * Send DataStore commands to Alexa device.
406 * @param {services.datastore.v1.CommandsRequest} commandsRequest
407 */
408 DatastoreServiceClient.prototype.commandsV1 = function (commandsRequest) {
409 return __awaiter(this, void 0, void 0, function () {
410 var apiResponse;
411 return __generator(this, function (_a) {
412 switch (_a.label) {
413 case 0: return [4 /*yield*/, this.callCommandsV1(commandsRequest)];
414 case 1:
415 apiResponse = _a.sent();
416 return [2 /*return*/, apiResponse.body];
417 }
418 });
419 });
420 };
421 /**
422 * Cancel pending DataStore commands.
423 * @param {string} queuedResultId A unique identifier to query result for queued delivery for offline devices (DEVICE_UNAVAILABLE).
424 */
425 DatastoreServiceClient.prototype.callCancelCommandsV1 = function (queuedResultId) {
426 return __awaiter(this, void 0, void 0, function () {
427 var __operationId__, queryParams, headerParams, pathParams, accessToken, authorizationValue, resourcePath, errorDefinitions;
428 return __generator(this, function (_a) {
429 switch (_a.label) {
430 case 0:
431 __operationId__ = 'callCancelCommandsV1';
432 // verify required parameter 'queuedResultId' is not null or undefined
433 if (queuedResultId == null) {
434 throw new Error("Required parameter queuedResultId was null or undefined when calling " + __operationId__ + ".");
435 }
436 queryParams = [];
437 headerParams = [];
438 headerParams.push({ key: 'User-Agent', value: this.userAgent });
439 pathParams = new Map();
440 pathParams.set('queuedResultId', queuedResultId);
441 return [4 /*yield*/, this.lwaServiceClient.getAccessTokenForScope("alexa::datastore")];
442 case 1:
443 accessToken = _a.sent();
444 authorizationValue = "Bearer " + accessToken;
445 headerParams.push({ key: "Authorization", value: authorizationValue });
446 resourcePath = "/v1/datastore/queue/{queuedResultId}/cancel";
447 errorDefinitions = new Map();
448 errorDefinitions.set(204, "Success. No content.");
449 errorDefinitions.set(400, "Request validation fails.");
450 errorDefinitions.set(401, "Not Authorized.");
451 errorDefinitions.set(403, "The skill is not allowed to call this API commands.");
452 errorDefinitions.set(404, "Unable to find the pending request.");
453 errorDefinitions.set(429, "The client has made more calls than the allowed limit.");
454 errorDefinitions.set(0, "Unexpected error.");
455 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
456 }
457 });
458 });
459 };
460 /**
461 * Cancel pending DataStore commands.
462 * @param {string} queuedResultId A unique identifier to query result for queued delivery for offline devices (DEVICE_UNAVAILABLE).
463 */
464 DatastoreServiceClient.prototype.cancelCommandsV1 = function (queuedResultId) {
465 return __awaiter(this, void 0, void 0, function () {
466 return __generator(this, function (_a) {
467 switch (_a.label) {
468 case 0: return [4 /*yield*/, this.callCancelCommandsV1(queuedResultId)];
469 case 1:
470 _a.sent();
471 return [2 /*return*/];
472 }
473 });
474 });
475 };
476 /**
477 * Query statuses of deliveries to offline devices returned by commands API.
478 * @param {string} queuedResultId A unique identifier to query result for queued delivery for offline devices (DEVICE_UNAVAILABLE).
479 * @param {number} maxResults Maximum number of CommandsDispatchResult items to return.
480 * @param {string} nextToken The value of nextToken in the response to fetch next page. If not specified, the request fetches result for the first page.
481 */
482 DatastoreServiceClient.prototype.callQueuedResultV1 = function (queuedResultId, maxResults, nextToken) {
483 return __awaiter(this, void 0, void 0, function () {
484 var __operationId__, queryParams, maxResultsValues, nextTokenValues, headerParams, pathParams, accessToken, authorizationValue, resourcePath, errorDefinitions;
485 return __generator(this, function (_a) {
486 switch (_a.label) {
487 case 0:
488 __operationId__ = 'callQueuedResultV1';
489 // verify required parameter 'queuedResultId' is not null or undefined
490 if (queuedResultId == null) {
491 throw new Error("Required parameter queuedResultId was null or undefined when calling " + __operationId__ + ".");
492 }
493 queryParams = [];
494 if (maxResults != null) {
495 maxResultsValues = Array.isArray(maxResults) ? maxResults : [maxResults];
496 maxResultsValues.forEach(function (val) { return queryParams.push({ key: 'maxResults', value: val.toString() }); });
497 }
498 if (nextToken != null) {
499 nextTokenValues = Array.isArray(nextToken) ? nextToken : [nextToken];
500 nextTokenValues.forEach(function (val) { return queryParams.push({ key: 'nextToken', value: val }); });
501 }
502 headerParams = [];
503 headerParams.push({ key: 'User-Agent', value: this.userAgent });
504 pathParams = new Map();
505 pathParams.set('queuedResultId', queuedResultId);
506 return [4 /*yield*/, this.lwaServiceClient.getAccessTokenForScope("alexa::datastore")];
507 case 1:
508 accessToken = _a.sent();
509 authorizationValue = "Bearer " + accessToken;
510 headerParams.push({ key: "Authorization", value: authorizationValue });
511 resourcePath = "/v1/datastore/queue/{queuedResultId}";
512 errorDefinitions = new Map();
513 errorDefinitions.set(200, "Unordered array of CommandsDispatchResult and pagination details.");
514 errorDefinitions.set(400, "Request validation fails.");
515 errorDefinitions.set(401, "Not Authorized.");
516 errorDefinitions.set(403, "The skill is not allowed to call this API commands.");
517 errorDefinitions.set(429, "The client has made more calls than the allowed limit.");
518 errorDefinitions.set(0, "Unexpected error.");
519 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
520 }
521 });
522 });
523 };
524 /**
525 * Query statuses of deliveries to offline devices returned by commands API.
526 * @param {string} queuedResultId A unique identifier to query result for queued delivery for offline devices (DEVICE_UNAVAILABLE).
527 * @param {number} maxResults Maximum number of CommandsDispatchResult items to return.
528 * @param {string} nextToken The value of nextToken in the response to fetch next page. If not specified, the request fetches result for the first page.
529 */
530 DatastoreServiceClient.prototype.queuedResultV1 = function (queuedResultId, maxResults, nextToken) {
531 return __awaiter(this, void 0, void 0, function () {
532 var apiResponse;
533 return __generator(this, function (_a) {
534 switch (_a.label) {
535 case 0: return [4 /*yield*/, this.callQueuedResultV1(queuedResultId, maxResults, nextToken)];
536 case 1:
537 apiResponse = _a.sent();
538 return [2 /*return*/, apiResponse.body];
539 }
540 });
541 });
542 };
543 return DatastoreServiceClient;
544 }(services.BaseServiceClient));
545 datastore.DatastoreServiceClient = DatastoreServiceClient;
546 })(datastore = services.datastore || (services.datastore = {}));
547})(services = exports.services || (exports.services = {}));
548(function (services) {
549 var deviceAddress;
550 (function (deviceAddress) {
551 /**
552 *
553 */
554 var DeviceAddressServiceClient = /** @class */ (function (_super) {
555 __extends(DeviceAddressServiceClient, _super);
556 function DeviceAddressServiceClient(apiConfiguration, customUserAgent) {
557 if (customUserAgent === void 0) { customUserAgent = null; }
558 var _this = _super.call(this, apiConfiguration) || this;
559 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
560 return _this;
561 }
562 /**
563 * Gets the country and postal code of a device
564 * @param {string} deviceId The device Id for which to get the country and postal code
565 */
566 DeviceAddressServiceClient.prototype.callGetCountryAndPostalCode = function (deviceId) {
567 return __awaiter(this, void 0, void 0, function () {
568 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
569 return __generator(this, function (_a) {
570 __operationId__ = 'callGetCountryAndPostalCode';
571 // verify required parameter 'deviceId' is not null or undefined
572 if (deviceId == null) {
573 throw new Error("Required parameter deviceId was null or undefined when calling " + __operationId__ + ".");
574 }
575 queryParams = [];
576 headerParams = [];
577 headerParams.push({ key: 'User-Agent', value: this.userAgent });
578 pathParams = new Map();
579 pathParams.set('deviceId', deviceId);
580 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
581 headerParams.push({ key: "Authorization", value: authorizationValue });
582 resourcePath = "/v1/devices/{deviceId}/settings/address/countryAndPostalCode";
583 errorDefinitions = new Map();
584 errorDefinitions.set(200, "Successfully get the country and postal code of the deviceId");
585 errorDefinitions.set(204, "No content could be queried out");
586 errorDefinitions.set(403, "The authentication token is invalid or doesn&#39;t have access to the resource");
587 errorDefinitions.set(405, "The method is not supported");
588 errorDefinitions.set(429, "The request is throttled");
589 errorDefinitions.set(0, "Unexpected error");
590 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
591 });
592 });
593 };
594 /**
595 * Gets the country and postal code of a device
596 * @param {string} deviceId The device Id for which to get the country and postal code
597 */
598 DeviceAddressServiceClient.prototype.getCountryAndPostalCode = function (deviceId) {
599 return __awaiter(this, void 0, void 0, function () {
600 var apiResponse;
601 return __generator(this, function (_a) {
602 switch (_a.label) {
603 case 0: return [4 /*yield*/, this.callGetCountryAndPostalCode(deviceId)];
604 case 1:
605 apiResponse = _a.sent();
606 return [2 /*return*/, apiResponse.body];
607 }
608 });
609 });
610 };
611 /**
612 * Gets the address of a device
613 * @param {string} deviceId The device Id for which to get the address
614 */
615 DeviceAddressServiceClient.prototype.callGetFullAddress = function (deviceId) {
616 return __awaiter(this, void 0, void 0, function () {
617 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
618 return __generator(this, function (_a) {
619 __operationId__ = 'callGetFullAddress';
620 // verify required parameter 'deviceId' is not null or undefined
621 if (deviceId == null) {
622 throw new Error("Required parameter deviceId was null or undefined when calling " + __operationId__ + ".");
623 }
624 queryParams = [];
625 headerParams = [];
626 headerParams.push({ key: 'User-Agent', value: this.userAgent });
627 pathParams = new Map();
628 pathParams.set('deviceId', deviceId);
629 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
630 headerParams.push({ key: "Authorization", value: authorizationValue });
631 resourcePath = "/v1/devices/{deviceId}/settings/address";
632 errorDefinitions = new Map();
633 errorDefinitions.set(200, "Successfully get the address of the device");
634 errorDefinitions.set(204, "No content could be queried out");
635 errorDefinitions.set(403, "The authentication token is invalid or doesn&#39;t have access to the resource");
636 errorDefinitions.set(405, "The method is not supported");
637 errorDefinitions.set(429, "The request is throttled");
638 errorDefinitions.set(0, "Unexpected error");
639 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
640 });
641 });
642 };
643 /**
644 * Gets the address of a device
645 * @param {string} deviceId The device Id for which to get the address
646 */
647 DeviceAddressServiceClient.prototype.getFullAddress = function (deviceId) {
648 return __awaiter(this, void 0, void 0, function () {
649 var apiResponse;
650 return __generator(this, function (_a) {
651 switch (_a.label) {
652 case 0: return [4 /*yield*/, this.callGetFullAddress(deviceId)];
653 case 1:
654 apiResponse = _a.sent();
655 return [2 /*return*/, apiResponse.body];
656 }
657 });
658 });
659 };
660 return DeviceAddressServiceClient;
661 }(services.BaseServiceClient));
662 deviceAddress.DeviceAddressServiceClient = DeviceAddressServiceClient;
663 })(deviceAddress = services.deviceAddress || (services.deviceAddress = {}));
664})(services = exports.services || (exports.services = {}));
665(function (services) {
666 var directive;
667 (function (directive) {
668 /**
669 *
670 */
671 var DirectiveServiceClient = /** @class */ (function (_super) {
672 __extends(DirectiveServiceClient, _super);
673 function DirectiveServiceClient(apiConfiguration, customUserAgent) {
674 if (customUserAgent === void 0) { customUserAgent = null; }
675 var _this = _super.call(this, apiConfiguration) || this;
676 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
677 return _this;
678 }
679 /**
680 * Send directives to Alexa.
681 * @param {services.directive.SendDirectiveRequest} sendDirectiveRequest Represents the request object to send in the payload.
682 */
683 DirectiveServiceClient.prototype.callEnqueue = function (sendDirectiveRequest) {
684 return __awaiter(this, void 0, void 0, function () {
685 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
686 return __generator(this, function (_a) {
687 __operationId__ = 'callEnqueue';
688 // verify required parameter 'sendDirectiveRequest' is not null or undefined
689 if (sendDirectiveRequest == null) {
690 throw new Error("Required parameter sendDirectiveRequest was null or undefined when calling " + __operationId__ + ".");
691 }
692 queryParams = [];
693 headerParams = [];
694 headerParams.push({ key: 'User-Agent', value: this.userAgent });
695 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
696 headerParams.push({ key: 'Content-type', value: 'application/json' });
697 }
698 pathParams = new Map();
699 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
700 headerParams.push({ key: "Authorization", value: authorizationValue });
701 resourcePath = "/v1/directives";
702 errorDefinitions = new Map();
703 errorDefinitions.set(204, "Directive sent successfully.");
704 errorDefinitions.set(400, "Directive not valid.");
705 errorDefinitions.set(401, "Not Authorized.");
706 errorDefinitions.set(403, "The skill is not allowed to send directives at the moment.");
707 errorDefinitions.set(0, "Unexpected error.");
708 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, sendDirectiveRequest, errorDefinitions)];
709 });
710 });
711 };
712 /**
713 * Send directives to Alexa.
714 * @param {services.directive.SendDirectiveRequest} sendDirectiveRequest Represents the request object to send in the payload.
715 */
716 DirectiveServiceClient.prototype.enqueue = function (sendDirectiveRequest) {
717 return __awaiter(this, void 0, void 0, function () {
718 return __generator(this, function (_a) {
719 switch (_a.label) {
720 case 0: return [4 /*yield*/, this.callEnqueue(sendDirectiveRequest)];
721 case 1:
722 _a.sent();
723 return [2 /*return*/];
724 }
725 });
726 });
727 };
728 return DirectiveServiceClient;
729 }(services.BaseServiceClient));
730 directive.DirectiveServiceClient = DirectiveServiceClient;
731 })(directive = services.directive || (services.directive = {}));
732})(services = exports.services || (exports.services = {}));
733(function (services) {
734 var endpointEnumeration;
735 (function (endpointEnumeration) {
736 /**
737 *
738 */
739 var EndpointEnumerationServiceClient = /** @class */ (function (_super) {
740 __extends(EndpointEnumerationServiceClient, _super);
741 function EndpointEnumerationServiceClient(apiConfiguration, customUserAgent) {
742 if (customUserAgent === void 0) { customUserAgent = null; }
743 var _this = _super.call(this, apiConfiguration) || this;
744 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
745 return _this;
746 }
747 /**
748 * This API is invoked by the skill to retrieve endpoints connected to the Echo device.
749 */
750 EndpointEnumerationServiceClient.prototype.callGetEndpoints = function () {
751 return __awaiter(this, void 0, void 0, function () {
752 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
753 return __generator(this, function (_a) {
754 __operationId__ = 'callGetEndpoints';
755 queryParams = [];
756 headerParams = [];
757 headerParams.push({ key: 'User-Agent', value: this.userAgent });
758 pathParams = new Map();
759 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
760 headerParams.push({ key: "Authorization", value: authorizationValue });
761 resourcePath = "/v1/endpoints";
762 errorDefinitions = new Map();
763 errorDefinitions.set(200, "Successfully retrieved the list of connected endpoints.");
764 errorDefinitions.set(400, "Bad request. Returned when a required parameter is not present or badly formatted.");
765 errorDefinitions.set(401, "Unauthenticated. Returned when the request is not authenticated.");
766 errorDefinitions.set(403, "Forbidden. Returned when the request is authenticated but does not have sufficient permission.");
767 errorDefinitions.set(500, "Server Error. Returned when the server encountered an error processing the request.");
768 errorDefinitions.set(503, "Service Unavailable. Returned when the server is not ready to handle the request.");
769 errorDefinitions.set(0, "Unexpected error");
770 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
771 });
772 });
773 };
774 /**
775 * This API is invoked by the skill to retrieve endpoints connected to the Echo device.
776 */
777 EndpointEnumerationServiceClient.prototype.getEndpoints = function () {
778 return __awaiter(this, void 0, void 0, function () {
779 var apiResponse;
780 return __generator(this, function (_a) {
781 switch (_a.label) {
782 case 0: return [4 /*yield*/, this.callGetEndpoints()];
783 case 1:
784 apiResponse = _a.sent();
785 return [2 /*return*/, apiResponse.body];
786 }
787 });
788 });
789 };
790 return EndpointEnumerationServiceClient;
791 }(services.BaseServiceClient));
792 endpointEnumeration.EndpointEnumerationServiceClient = EndpointEnumerationServiceClient;
793 })(endpointEnumeration = services.endpointEnumeration || (services.endpointEnumeration = {}));
794})(services = exports.services || (exports.services = {}));
795(function (services) {
796 var listManagement;
797 (function (listManagement) {
798 /**
799 *
800 */
801 var ListManagementServiceClient = /** @class */ (function (_super) {
802 __extends(ListManagementServiceClient, _super);
803 function ListManagementServiceClient(apiConfiguration, customUserAgent) {
804 if (customUserAgent === void 0) { customUserAgent = null; }
805 var _this = _super.call(this, apiConfiguration) || this;
806 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
807 return _this;
808 }
809 /**
810 * Retrieves the metadata for all customer lists, including the customer’s default lists.
811 */
812 ListManagementServiceClient.prototype.callGetListsMetadata = function () {
813 return __awaiter(this, void 0, void 0, function () {
814 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
815 return __generator(this, function (_a) {
816 __operationId__ = 'callGetListsMetadata';
817 queryParams = [];
818 headerParams = [];
819 headerParams.push({ key: 'User-Agent', value: this.userAgent });
820 pathParams = new Map();
821 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
822 headerParams.push({ key: "Authorization", value: authorizationValue });
823 resourcePath = "/v2/householdlists";
824 errorDefinitions = new Map();
825 errorDefinitions.set(200, "Success");
826 errorDefinitions.set(403, "Forbidden");
827 errorDefinitions.set(500, "Internal Server Error");
828 return [2 /*return*/, this.invoke("GET", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
829 });
830 });
831 };
832 /**
833 * Retrieves the metadata for all customer lists, including the customer’s default lists.
834 */
835 ListManagementServiceClient.prototype.getListsMetadata = function () {
836 return __awaiter(this, void 0, void 0, function () {
837 var apiResponse;
838 return __generator(this, function (_a) {
839 switch (_a.label) {
840 case 0: return [4 /*yield*/, this.callGetListsMetadata()];
841 case 1:
842 apiResponse = _a.sent();
843 return [2 /*return*/, apiResponse.body];
844 }
845 });
846 });
847 };
848 /**
849 * This API deletes a customer custom list.
850 * @param {string} listId Value of the customer’s listId retrieved from a getListsMetadata call
851 */
852 ListManagementServiceClient.prototype.callDeleteList = function (listId) {
853 return __awaiter(this, void 0, void 0, function () {
854 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
855 return __generator(this, function (_a) {
856 __operationId__ = 'callDeleteList';
857 // verify required parameter 'listId' is not null or undefined
858 if (listId == null) {
859 throw new Error("Required parameter listId was null or undefined when calling " + __operationId__ + ".");
860 }
861 queryParams = [];
862 headerParams = [];
863 headerParams.push({ key: 'User-Agent', value: this.userAgent });
864 pathParams = new Map();
865 pathParams.set('listId', listId);
866 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
867 headerParams.push({ key: "Authorization", value: authorizationValue });
868 resourcePath = "/v2/householdlists/{listId}";
869 errorDefinitions = new Map();
870 errorDefinitions.set(200, "Success");
871 errorDefinitions.set(403, "Forbidden");
872 errorDefinitions.set(404, "Not Found");
873 errorDefinitions.set(500, "Internal Server Error");
874 errorDefinitions.set(0, "Internal Server Error");
875 return [2 /*return*/, this.invoke("DELETE", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
876 });
877 });
878 };
879 /**
880 * This API deletes a customer custom list.
881 * @param {string} listId Value of the customer’s listId retrieved from a getListsMetadata call
882 */
883 ListManagementServiceClient.prototype.deleteList = function (listId) {
884 return __awaiter(this, void 0, void 0, function () {
885 return __generator(this, function (_a) {
886 switch (_a.label) {
887 case 0: return [4 /*yield*/, this.callDeleteList(listId)];
888 case 1:
889 _a.sent();
890 return [2 /*return*/];
891 }
892 });
893 });
894 };
895 /**
896 * This API deletes an item in the specified list.
897 * @param {string} listId The customer’s listId is retrieved from a getListsMetadata call.
898 * @param {string} itemId The customer’s itemId is retrieved from a GetList call.
899 */
900 ListManagementServiceClient.prototype.callDeleteListItem = function (listId, itemId) {
901 return __awaiter(this, void 0, void 0, function () {
902 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
903 return __generator(this, function (_a) {
904 __operationId__ = 'callDeleteListItem';
905 // verify required parameter 'listId' is not null or undefined
906 if (listId == null) {
907 throw new Error("Required parameter listId was null or undefined when calling " + __operationId__ + ".");
908 }
909 // verify required parameter 'itemId' is not null or undefined
910 if (itemId == null) {
911 throw new Error("Required parameter itemId was null or undefined when calling " + __operationId__ + ".");
912 }
913 queryParams = [];
914 headerParams = [];
915 headerParams.push({ key: 'User-Agent', value: this.userAgent });
916 pathParams = new Map();
917 pathParams.set('listId', listId);
918 pathParams.set('itemId', itemId);
919 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
920 headerParams.push({ key: "Authorization", value: authorizationValue });
921 resourcePath = "/v2/householdlists/{listId}/items/{itemId}";
922 errorDefinitions = new Map();
923 errorDefinitions.set(200, "Success");
924 errorDefinitions.set(403, "Forbidden");
925 errorDefinitions.set(404, "Not Found");
926 errorDefinitions.set(500, "Internal Server Error");
927 errorDefinitions.set(0, "Internal Server Error");
928 return [2 /*return*/, this.invoke("DELETE", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
929 });
930 });
931 };
932 /**
933 * This API deletes an item in the specified list.
934 * @param {string} listId The customer’s listId is retrieved from a getListsMetadata call.
935 * @param {string} itemId The customer’s itemId is retrieved from a GetList call.
936 */
937 ListManagementServiceClient.prototype.deleteListItem = function (listId, itemId) {
938 return __awaiter(this, void 0, void 0, function () {
939 return __generator(this, function (_a) {
940 switch (_a.label) {
941 case 0: return [4 /*yield*/, this.callDeleteListItem(listId, itemId)];
942 case 1:
943 _a.sent();
944 return [2 /*return*/];
945 }
946 });
947 });
948 };
949 /**
950 * This API can be used to retrieve single item with in any list by listId and itemId. This API can read list items from an archived list. Attempting to read list items from a deleted list return an ObjectNotFound 404 error.
951 * @param {string} listId Retrieved from a call to getListsMetadata
952 * @param {string} itemId itemId within a list is retrieved from a getList call
953 */
954 ListManagementServiceClient.prototype.callGetListItem = function (listId, itemId) {
955 return __awaiter(this, void 0, void 0, function () {
956 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
957 return __generator(this, function (_a) {
958 __operationId__ = 'callGetListItem';
959 // verify required parameter 'listId' is not null or undefined
960 if (listId == null) {
961 throw new Error("Required parameter listId was null or undefined when calling " + __operationId__ + ".");
962 }
963 // verify required parameter 'itemId' is not null or undefined
964 if (itemId == null) {
965 throw new Error("Required parameter itemId was null or undefined when calling " + __operationId__ + ".");
966 }
967 queryParams = [];
968 headerParams = [];
969 headerParams.push({ key: 'User-Agent', value: this.userAgent });
970 pathParams = new Map();
971 pathParams.set('listId', listId);
972 pathParams.set('itemId', itemId);
973 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
974 headerParams.push({ key: "Authorization", value: authorizationValue });
975 resourcePath = "/v2/householdlists/{listId}/items/{itemId}";
976 errorDefinitions = new Map();
977 errorDefinitions.set(200, "Success");
978 errorDefinitions.set(403, "Forbidden");
979 errorDefinitions.set(404, "Not Found");
980 errorDefinitions.set(500, "Internal Server Error");
981 errorDefinitions.set(0, "Internal Server Error");
982 return [2 /*return*/, this.invoke("GET", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
983 });
984 });
985 };
986 /**
987 * This API can be used to retrieve single item with in any list by listId and itemId. This API can read list items from an archived list. Attempting to read list items from a deleted list return an ObjectNotFound 404 error.
988 * @param {string} listId Retrieved from a call to getListsMetadata
989 * @param {string} itemId itemId within a list is retrieved from a getList call
990 */
991 ListManagementServiceClient.prototype.getListItem = function (listId, itemId) {
992 return __awaiter(this, void 0, void 0, function () {
993 var apiResponse;
994 return __generator(this, function (_a) {
995 switch (_a.label) {
996 case 0: return [4 /*yield*/, this.callGetListItem(listId, itemId)];
997 case 1:
998 apiResponse = _a.sent();
999 return [2 /*return*/, apiResponse.body];
1000 }
1001 });
1002 });
1003 };
1004 /**
1005 * API used to update an item value or item status.
1006 * @param {string} listId Customer’s listId
1007 * @param {string} itemId itemId to be updated in the list
1008 * @param {services.listManagement.UpdateListItemRequest} updateListItemRequest
1009 */
1010 ListManagementServiceClient.prototype.callUpdateListItem = function (listId, itemId, updateListItemRequest) {
1011 return __awaiter(this, void 0, void 0, function () {
1012 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1013 return __generator(this, function (_a) {
1014 __operationId__ = 'callUpdateListItem';
1015 // verify required parameter 'listId' is not null or undefined
1016 if (listId == null) {
1017 throw new Error("Required parameter listId was null or undefined when calling " + __operationId__ + ".");
1018 }
1019 // verify required parameter 'itemId' is not null or undefined
1020 if (itemId == null) {
1021 throw new Error("Required parameter itemId was null or undefined when calling " + __operationId__ + ".");
1022 }
1023 // verify required parameter 'updateListItemRequest' is not null or undefined
1024 if (updateListItemRequest == null) {
1025 throw new Error("Required parameter updateListItemRequest was null or undefined when calling " + __operationId__ + ".");
1026 }
1027 queryParams = [];
1028 headerParams = [];
1029 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1030 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
1031 headerParams.push({ key: 'Content-type', value: 'application/json' });
1032 }
1033 pathParams = new Map();
1034 pathParams.set('listId', listId);
1035 pathParams.set('itemId', itemId);
1036 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1037 headerParams.push({ key: "Authorization", value: authorizationValue });
1038 resourcePath = "/v2/householdlists/{listId}/items/{itemId}";
1039 errorDefinitions = new Map();
1040 errorDefinitions.set(200, "Success");
1041 errorDefinitions.set(403, "Forbidden");
1042 errorDefinitions.set(404, "Not Found");
1043 errorDefinitions.set(409, "Conflict");
1044 errorDefinitions.set(500, "Internal Server Error");
1045 errorDefinitions.set(0, "Internal Server Error");
1046 return [2 /*return*/, this.invoke("PUT", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, updateListItemRequest, errorDefinitions)];
1047 });
1048 });
1049 };
1050 /**
1051 * API used to update an item value or item status.
1052 * @param {string} listId Customer’s listId
1053 * @param {string} itemId itemId to be updated in the list
1054 * @param {services.listManagement.UpdateListItemRequest} updateListItemRequest
1055 */
1056 ListManagementServiceClient.prototype.updateListItem = function (listId, itemId, updateListItemRequest) {
1057 return __awaiter(this, void 0, void 0, function () {
1058 var apiResponse;
1059 return __generator(this, function (_a) {
1060 switch (_a.label) {
1061 case 0: return [4 /*yield*/, this.callUpdateListItem(listId, itemId, updateListItemRequest)];
1062 case 1:
1063 apiResponse = _a.sent();
1064 return [2 /*return*/, apiResponse.body];
1065 }
1066 });
1067 });
1068 };
1069 /**
1070 * This API creates an item in an active list or in a default list.
1071 * @param {string} listId The customer’s listId retrieved from a getListsMetadata call.
1072 * @param {services.listManagement.CreateListItemRequest} createListItemRequest
1073 */
1074 ListManagementServiceClient.prototype.callCreateListItem = function (listId, createListItemRequest) {
1075 return __awaiter(this, void 0, void 0, function () {
1076 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1077 return __generator(this, function (_a) {
1078 __operationId__ = 'callCreateListItem';
1079 // verify required parameter 'listId' is not null or undefined
1080 if (listId == null) {
1081 throw new Error("Required parameter listId was null or undefined when calling " + __operationId__ + ".");
1082 }
1083 // verify required parameter 'createListItemRequest' is not null or undefined
1084 if (createListItemRequest == null) {
1085 throw new Error("Required parameter createListItemRequest was null or undefined when calling " + __operationId__ + ".");
1086 }
1087 queryParams = [];
1088 headerParams = [];
1089 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1090 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
1091 headerParams.push({ key: 'Content-type', value: 'application/json' });
1092 }
1093 pathParams = new Map();
1094 pathParams.set('listId', listId);
1095 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1096 headerParams.push({ key: "Authorization", value: authorizationValue });
1097 resourcePath = "/v2/householdlists/{listId}/items";
1098 errorDefinitions = new Map();
1099 errorDefinitions.set(201, "Success");
1100 errorDefinitions.set(400, "Bad Request");
1101 errorDefinitions.set(403, "Forbidden");
1102 errorDefinitions.set(404, "Not found");
1103 errorDefinitions.set(500, "Internal Server Error");
1104 errorDefinitions.set(0, "Internal Server Error");
1105 return [2 /*return*/, this.invoke("POST", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, createListItemRequest, errorDefinitions)];
1106 });
1107 });
1108 };
1109 /**
1110 * This API creates an item in an active list or in a default list.
1111 * @param {string} listId The customer’s listId retrieved from a getListsMetadata call.
1112 * @param {services.listManagement.CreateListItemRequest} createListItemRequest
1113 */
1114 ListManagementServiceClient.prototype.createListItem = function (listId, createListItemRequest) {
1115 return __awaiter(this, void 0, void 0, function () {
1116 var apiResponse;
1117 return __generator(this, function (_a) {
1118 switch (_a.label) {
1119 case 0: return [4 /*yield*/, this.callCreateListItem(listId, createListItemRequest)];
1120 case 1:
1121 apiResponse = _a.sent();
1122 return [2 /*return*/, apiResponse.body];
1123 }
1124 });
1125 });
1126 };
1127 /**
1128 * This API updates a custom list. Only the list name or state can be updated. An Alexa customer can turn an archived list into an active one.
1129 * @param {string} listId Value of the customer’s listId retrieved from a getListsMetadata call.
1130 * @param {services.listManagement.UpdateListRequest} updateListRequest
1131 */
1132 ListManagementServiceClient.prototype.callUpdateList = function (listId, updateListRequest) {
1133 return __awaiter(this, void 0, void 0, function () {
1134 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1135 return __generator(this, function (_a) {
1136 __operationId__ = 'callUpdateList';
1137 // verify required parameter 'listId' is not null or undefined
1138 if (listId == null) {
1139 throw new Error("Required parameter listId was null or undefined when calling " + __operationId__ + ".");
1140 }
1141 // verify required parameter 'updateListRequest' is not null or undefined
1142 if (updateListRequest == null) {
1143 throw new Error("Required parameter updateListRequest was null or undefined when calling " + __operationId__ + ".");
1144 }
1145 queryParams = [];
1146 headerParams = [];
1147 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1148 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
1149 headerParams.push({ key: 'Content-type', value: 'application/json' });
1150 }
1151 pathParams = new Map();
1152 pathParams.set('listId', listId);
1153 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1154 headerParams.push({ key: "Authorization", value: authorizationValue });
1155 resourcePath = "/v2/householdlists/{listId}";
1156 errorDefinitions = new Map();
1157 errorDefinitions.set(200, "Success");
1158 errorDefinitions.set(400, "Bad Request");
1159 errorDefinitions.set(403, "Forbidden");
1160 errorDefinitions.set(404, "List not found");
1161 errorDefinitions.set(409, "Conflict");
1162 errorDefinitions.set(500, "Internal Server Error");
1163 errorDefinitions.set(0, "Internal Server Error");
1164 return [2 /*return*/, this.invoke("PUT", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, updateListRequest, errorDefinitions)];
1165 });
1166 });
1167 };
1168 /**
1169 * This API updates a custom list. Only the list name or state can be updated. An Alexa customer can turn an archived list into an active one.
1170 * @param {string} listId Value of the customer’s listId retrieved from a getListsMetadata call.
1171 * @param {services.listManagement.UpdateListRequest} updateListRequest
1172 */
1173 ListManagementServiceClient.prototype.updateList = function (listId, updateListRequest) {
1174 return __awaiter(this, void 0, void 0, function () {
1175 var apiResponse;
1176 return __generator(this, function (_a) {
1177 switch (_a.label) {
1178 case 0: return [4 /*yield*/, this.callUpdateList(listId, updateListRequest)];
1179 case 1:
1180 apiResponse = _a.sent();
1181 return [2 /*return*/, apiResponse.body];
1182 }
1183 });
1184 });
1185 };
1186 /**
1187 * Retrieves the list metadata including the items in the list with requested status.
1188 * @param {string} listId Retrieved from a call to GetListsMetadata to specify the listId in the request path.
1189 * @param {string} status Specify the status of the list.
1190 */
1191 ListManagementServiceClient.prototype.callGetList = function (listId, status) {
1192 return __awaiter(this, void 0, void 0, function () {
1193 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1194 return __generator(this, function (_a) {
1195 __operationId__ = 'callGetList';
1196 // verify required parameter 'listId' is not null or undefined
1197 if (listId == null) {
1198 throw new Error("Required parameter listId was null or undefined when calling " + __operationId__ + ".");
1199 }
1200 // verify required parameter 'status' is not null or undefined
1201 if (status == null) {
1202 throw new Error("Required parameter status was null or undefined when calling " + __operationId__ + ".");
1203 }
1204 queryParams = [];
1205 headerParams = [];
1206 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1207 pathParams = new Map();
1208 pathParams.set('listId', listId);
1209 pathParams.set('status', status);
1210 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1211 headerParams.push({ key: "Authorization", value: authorizationValue });
1212 resourcePath = "/v2/householdlists/{listId}/{status}";
1213 errorDefinitions = new Map();
1214 errorDefinitions.set(200, "Success");
1215 errorDefinitions.set(400, "Bad Request");
1216 errorDefinitions.set(403, "Forbidden");
1217 errorDefinitions.set(404, "Not Found");
1218 errorDefinitions.set(500, "Internal Server Error");
1219 errorDefinitions.set(0, "Internal Server Error");
1220 return [2 /*return*/, this.invoke("GET", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
1221 });
1222 });
1223 };
1224 /**
1225 * Retrieves the list metadata including the items in the list with requested status.
1226 * @param {string} listId Retrieved from a call to GetListsMetadata to specify the listId in the request path.
1227 * @param {string} status Specify the status of the list.
1228 */
1229 ListManagementServiceClient.prototype.getList = function (listId, status) {
1230 return __awaiter(this, void 0, void 0, function () {
1231 var apiResponse;
1232 return __generator(this, function (_a) {
1233 switch (_a.label) {
1234 case 0: return [4 /*yield*/, this.callGetList(listId, status)];
1235 case 1:
1236 apiResponse = _a.sent();
1237 return [2 /*return*/, apiResponse.body];
1238 }
1239 });
1240 });
1241 };
1242 /**
1243 * This API creates a custom list. The new list name must be different than any existing list name.
1244 * @param {services.listManagement.CreateListRequest} createListRequest
1245 */
1246 ListManagementServiceClient.prototype.callCreateList = function (createListRequest) {
1247 return __awaiter(this, void 0, void 0, function () {
1248 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1249 return __generator(this, function (_a) {
1250 __operationId__ = 'callCreateList';
1251 // verify required parameter 'createListRequest' is not null or undefined
1252 if (createListRequest == null) {
1253 throw new Error("Required parameter createListRequest was null or undefined when calling " + __operationId__ + ".");
1254 }
1255 queryParams = [];
1256 headerParams = [];
1257 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1258 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
1259 headerParams.push({ key: 'Content-type', value: 'application/json' });
1260 }
1261 pathParams = new Map();
1262 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1263 headerParams.push({ key: "Authorization", value: authorizationValue });
1264 resourcePath = "/v2/householdlists";
1265 errorDefinitions = new Map();
1266 errorDefinitions.set(201, "Success");
1267 errorDefinitions.set(400, "Bad Request");
1268 errorDefinitions.set(403, "Forbidden");
1269 errorDefinitions.set(409, "Conflict");
1270 errorDefinitions.set(500, "Internal Server Error");
1271 errorDefinitions.set(0, "Internal Server Error");
1272 return [2 /*return*/, this.invoke("POST", "https://api.amazonalexa.com/", resourcePath, pathParams, queryParams, headerParams, createListRequest, errorDefinitions)];
1273 });
1274 });
1275 };
1276 /**
1277 * This API creates a custom list. The new list name must be different than any existing list name.
1278 * @param {services.listManagement.CreateListRequest} createListRequest
1279 */
1280 ListManagementServiceClient.prototype.createList = function (createListRequest) {
1281 return __awaiter(this, void 0, void 0, function () {
1282 var apiResponse;
1283 return __generator(this, function (_a) {
1284 switch (_a.label) {
1285 case 0: return [4 /*yield*/, this.callCreateList(createListRequest)];
1286 case 1:
1287 apiResponse = _a.sent();
1288 return [2 /*return*/, apiResponse.body];
1289 }
1290 });
1291 });
1292 };
1293 return ListManagementServiceClient;
1294 }(services.BaseServiceClient));
1295 listManagement.ListManagementServiceClient = ListManagementServiceClient;
1296 })(listManagement = services.listManagement || (services.listManagement = {}));
1297})(services = exports.services || (exports.services = {}));
1298(function (services) {
1299 var monetization;
1300 (function (monetization) {
1301 /**
1302 *
1303 */
1304 var MonetizationServiceClient = /** @class */ (function (_super) {
1305 __extends(MonetizationServiceClient, _super);
1306 function MonetizationServiceClient(apiConfiguration, customUserAgent) {
1307 if (customUserAgent === void 0) { customUserAgent = null; }
1308 var _this = _super.call(this, apiConfiguration) || this;
1309 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
1310 return _this;
1311 }
1312 /**
1313 * Gets In-Skill Products based on user's context for the Skill.
1314 * @param {string} acceptLanguage User&#39;s locale/language in context
1315 * @param {string} purchasable Filter products based on whether they are purchasable by the user or not. * &#39;PURCHASABLE&#39; - Products that are purchasable by the user. * &#39;NOT_PURCHASABLE&#39; - Products that are not purchasable by the user.
1316 * @param {string} entitled Filter products based on whether they are entitled to the user or not. * &#39;ENTITLED&#39; - Products that the user is entitled to. * &#39;NOT_ENTITLED&#39; - Products that the user is not entitled to.
1317 * @param {string} productType Product type. * &#39;SUBSCRIPTION&#39; - Once purchased, customers will own the content for the subscription period. * &#39;ENTITLEMENT&#39; - Once purchased, customers will own the content forever. * &#39;CONSUMABLE&#39; - Once purchased, customers will be entitled to the content until it is consumed. It can also be re-purchased.
1318 * @param {string} nextToken When response to this API call is truncated (that is, isTruncated response element value is true), the response also includes the nextToken element, the value of which can be used in the next request as the continuation-token to list the next set of objects. The continuation token is an opaque value that In-Skill Products API understands. Token has expiry of 24 hours.
1319 * @param {number} maxResults sets the maximum number of results returned in the response body. If you want to retrieve fewer than upper limit of 100 results, you can add this parameter to your request. maxResults should not exceed the upper limit. The response might contain fewer results than maxResults, but it will never contain more. If there are additional results that satisfy the search criteria, but these results were not returned because maxResults was exceeded, the response contains isTruncated &#x3D; true.
1320 */
1321 MonetizationServiceClient.prototype.callGetInSkillProducts = function (acceptLanguage, purchasable, entitled, productType, nextToken, maxResults) {
1322 return __awaiter(this, void 0, void 0, function () {
1323 var __operationId__, queryParams, purchasableValues, entitledValues, productTypeValues, nextTokenValues, maxResultsValues, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1324 return __generator(this, function (_a) {
1325 __operationId__ = 'callGetInSkillProducts';
1326 // verify required parameter 'acceptLanguage' is not null or undefined
1327 if (acceptLanguage == null) {
1328 throw new Error("Required parameter acceptLanguage was null or undefined when calling " + __operationId__ + ".");
1329 }
1330 queryParams = [];
1331 if (purchasable != null) {
1332 purchasableValues = Array.isArray(purchasable) ? purchasable : [purchasable];
1333 purchasableValues.forEach(function (val) { return queryParams.push({ key: 'purchasable', value: val }); });
1334 }
1335 if (entitled != null) {
1336 entitledValues = Array.isArray(entitled) ? entitled : [entitled];
1337 entitledValues.forEach(function (val) { return queryParams.push({ key: 'entitled', value: val }); });
1338 }
1339 if (productType != null) {
1340 productTypeValues = Array.isArray(productType) ? productType : [productType];
1341 productTypeValues.forEach(function (val) { return queryParams.push({ key: 'productType', value: val }); });
1342 }
1343 if (nextToken != null) {
1344 nextTokenValues = Array.isArray(nextToken) ? nextToken : [nextToken];
1345 nextTokenValues.forEach(function (val) { return queryParams.push({ key: 'nextToken', value: val }); });
1346 }
1347 if (maxResults != null) {
1348 maxResultsValues = Array.isArray(maxResults) ? maxResults : [maxResults];
1349 maxResultsValues.forEach(function (val) { return queryParams.push({ key: 'maxResults', value: val.toString() }); });
1350 }
1351 headerParams = [];
1352 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1353 headerParams.push({ key: 'Accept-Language', value: acceptLanguage });
1354 pathParams = new Map();
1355 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1356 headerParams.push({ key: "Authorization", value: authorizationValue });
1357 resourcePath = "/v1/users/~current/skills/~current/inSkillProducts";
1358 errorDefinitions = new Map();
1359 errorDefinitions.set(200, "Returns a list of In-Skill products on success.");
1360 errorDefinitions.set(400, "Invalid request");
1361 errorDefinitions.set(401, "The authentication token is invalid or doesn&#39;t have access to make this request");
1362 errorDefinitions.set(500, "Internal Server Error");
1363 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
1364 });
1365 });
1366 };
1367 /**
1368 * Gets In-Skill Products based on user's context for the Skill.
1369 * @param {string} acceptLanguage User&#39;s locale/language in context
1370 * @param {string} purchasable Filter products based on whether they are purchasable by the user or not. * &#39;PURCHASABLE&#39; - Products that are purchasable by the user. * &#39;NOT_PURCHASABLE&#39; - Products that are not purchasable by the user.
1371 * @param {string} entitled Filter products based on whether they are entitled to the user or not. * &#39;ENTITLED&#39; - Products that the user is entitled to. * &#39;NOT_ENTITLED&#39; - Products that the user is not entitled to.
1372 * @param {string} productType Product type. * &#39;SUBSCRIPTION&#39; - Once purchased, customers will own the content for the subscription period. * &#39;ENTITLEMENT&#39; - Once purchased, customers will own the content forever. * &#39;CONSUMABLE&#39; - Once purchased, customers will be entitled to the content until it is consumed. It can also be re-purchased.
1373 * @param {string} nextToken When response to this API call is truncated (that is, isTruncated response element value is true), the response also includes the nextToken element, the value of which can be used in the next request as the continuation-token to list the next set of objects. The continuation token is an opaque value that In-Skill Products API understands. Token has expiry of 24 hours.
1374 * @param {number} maxResults sets the maximum number of results returned in the response body. If you want to retrieve fewer than upper limit of 100 results, you can add this parameter to your request. maxResults should not exceed the upper limit. The response might contain fewer results than maxResults, but it will never contain more. If there are additional results that satisfy the search criteria, but these results were not returned because maxResults was exceeded, the response contains isTruncated &#x3D; true.
1375 */
1376 MonetizationServiceClient.prototype.getInSkillProducts = function (acceptLanguage, purchasable, entitled, productType, nextToken, maxResults) {
1377 return __awaiter(this, void 0, void 0, function () {
1378 var apiResponse;
1379 return __generator(this, function (_a) {
1380 switch (_a.label) {
1381 case 0: return [4 /*yield*/, this.callGetInSkillProducts(acceptLanguage, purchasable, entitled, productType, nextToken, maxResults)];
1382 case 1:
1383 apiResponse = _a.sent();
1384 return [2 /*return*/, apiResponse.body];
1385 }
1386 });
1387 });
1388 };
1389 /**
1390 * Get In-Skill Product information based on user context for the Skill.
1391 * @param {string} acceptLanguage User&#39;s locale/language in context
1392 * @param {string} productId Product Id.
1393 */
1394 MonetizationServiceClient.prototype.callGetInSkillProduct = function (acceptLanguage, productId) {
1395 return __awaiter(this, void 0, void 0, function () {
1396 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1397 return __generator(this, function (_a) {
1398 __operationId__ = 'callGetInSkillProduct';
1399 // verify required parameter 'acceptLanguage' is not null or undefined
1400 if (acceptLanguage == null) {
1401 throw new Error("Required parameter acceptLanguage was null or undefined when calling " + __operationId__ + ".");
1402 }
1403 // verify required parameter 'productId' is not null or undefined
1404 if (productId == null) {
1405 throw new Error("Required parameter productId was null or undefined when calling " + __operationId__ + ".");
1406 }
1407 queryParams = [];
1408 headerParams = [];
1409 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1410 headerParams.push({ key: 'Accept-Language', value: acceptLanguage });
1411 pathParams = new Map();
1412 pathParams.set('productId', productId);
1413 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1414 headerParams.push({ key: "Authorization", value: authorizationValue });
1415 resourcePath = "/v1/users/~current/skills/~current/inSkillProducts/{productId}";
1416 errorDefinitions = new Map();
1417 errorDefinitions.set(200, "Returns an In-Skill Product on success.");
1418 errorDefinitions.set(400, "Invalid request.");
1419 errorDefinitions.set(401, "The authentication token is invalid or doesn&#39;t have access to make this request");
1420 errorDefinitions.set(404, "Requested resource not found.");
1421 errorDefinitions.set(500, "Internal Server Error.");
1422 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
1423 });
1424 });
1425 };
1426 /**
1427 * Get In-Skill Product information based on user context for the Skill.
1428 * @param {string} acceptLanguage User&#39;s locale/language in context
1429 * @param {string} productId Product Id.
1430 */
1431 MonetizationServiceClient.prototype.getInSkillProduct = function (acceptLanguage, productId) {
1432 return __awaiter(this, void 0, void 0, function () {
1433 var apiResponse;
1434 return __generator(this, function (_a) {
1435 switch (_a.label) {
1436 case 0: return [4 /*yield*/, this.callGetInSkillProduct(acceptLanguage, productId)];
1437 case 1:
1438 apiResponse = _a.sent();
1439 return [2 /*return*/, apiResponse.body];
1440 }
1441 });
1442 });
1443 };
1444 /**
1445 * Returns transactions of all in skill products purchases of the customer
1446 * @param {string} acceptLanguage User&#39;s locale/language in context
1447 * @param {string} productId Product Id.
1448 * @param {string} status Transaction status for in skill product purchases. * &#39;PENDING_APPROVAL_BY_PARENT&#39; - The transaction is pending approval from parent. * &#39;APPROVED_BY_PARENT&#39; - The transaction was approved by parent and fulfilled successfully.. * &#39;DENIED_BY_PARENT&#39; - The transaction was declined by parent and hence not fulfilled. * &#39;EXPIRED_NO_ACTION_BY_PARENT&#39; - The transaction was expired due to no response from parent and hence not fulfilled. * &#39;ERROR&#39; - The transaction was not fullfiled as there was an error while processing the transaction.
1449 * @param {string} fromLastModifiedTime Filter transactions based on last modified time stamp, FROM duration in format (UTC ISO 8601) i.e. yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSS&#39;Z&#39;
1450 * @param {string} toLastModifiedTime Filter transactions based on last modified time stamp, TO duration in format (UTC ISO 8601) i.e. yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSS&#39;Z&#39;
1451 * @param {string} nextToken When response to this API call is truncated, the response also includes the nextToken in metadata, the value of which can be used in the next request as the continuation-token to list the next set of objects. The continuation token is an opaque value that In-Skill Products API understands. Token has expiry of 24 hours.
1452 * @param {number} maxResults sets the maximum number of results returned in the response body. If you want to retrieve fewer than upper limit of 100 results, you can add this parameter to your request. maxResults should not exceed the upper limit. The response might contain fewer results than maxResults, but it will never contain more. If there are additional results that satisfy the search criteria, but these results were not returned because maxResults was exceeded, the response contains nextToken which can be used to fetch next set of result.
1453 */
1454 MonetizationServiceClient.prototype.callGetInSkillProductsTransactions = function (acceptLanguage, productId, status, fromLastModifiedTime, toLastModifiedTime, nextToken, maxResults) {
1455 return __awaiter(this, void 0, void 0, function () {
1456 var __operationId__, queryParams, productIdValues, statusValues, fromLastModifiedTimeValues, toLastModifiedTimeValues, nextTokenValues, maxResultsValues, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1457 return __generator(this, function (_a) {
1458 __operationId__ = 'callGetInSkillProductsTransactions';
1459 // verify required parameter 'acceptLanguage' is not null or undefined
1460 if (acceptLanguage == null) {
1461 throw new Error("Required parameter acceptLanguage was null or undefined when calling " + __operationId__ + ".");
1462 }
1463 queryParams = [];
1464 if (productId != null) {
1465 productIdValues = Array.isArray(productId) ? productId : [productId];
1466 productIdValues.forEach(function (val) { return queryParams.push({ key: 'productId', value: val }); });
1467 }
1468 if (status != null) {
1469 statusValues = Array.isArray(status) ? status : [status];
1470 statusValues.forEach(function (val) { return queryParams.push({ key: 'status', value: val }); });
1471 }
1472 if (fromLastModifiedTime != null) {
1473 fromLastModifiedTimeValues = Array.isArray(fromLastModifiedTime) ? fromLastModifiedTime : [fromLastModifiedTime];
1474 fromLastModifiedTimeValues.forEach(function (val) { return queryParams.push({ key: 'fromLastModifiedTime', value: val.toString() }); });
1475 }
1476 if (toLastModifiedTime != null) {
1477 toLastModifiedTimeValues = Array.isArray(toLastModifiedTime) ? toLastModifiedTime : [toLastModifiedTime];
1478 toLastModifiedTimeValues.forEach(function (val) { return queryParams.push({ key: 'toLastModifiedTime', value: val.toString() }); });
1479 }
1480 if (nextToken != null) {
1481 nextTokenValues = Array.isArray(nextToken) ? nextToken : [nextToken];
1482 nextTokenValues.forEach(function (val) { return queryParams.push({ key: 'nextToken', value: val }); });
1483 }
1484 if (maxResults != null) {
1485 maxResultsValues = Array.isArray(maxResults) ? maxResults : [maxResults];
1486 maxResultsValues.forEach(function (val) { return queryParams.push({ key: 'maxResults', value: val.toString() }); });
1487 }
1488 headerParams = [];
1489 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1490 headerParams.push({ key: 'Accept-Language', value: acceptLanguage });
1491 pathParams = new Map();
1492 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1493 headerParams.push({ key: "Authorization", value: authorizationValue });
1494 resourcePath = "/v1/users/~current/skills/~current/inSkillProductsTransactions";
1495 errorDefinitions = new Map();
1496 errorDefinitions.set(200, "Returns a list of transactions of all in skill products purchases in last 30 days on success.");
1497 errorDefinitions.set(400, "Invalid request");
1498 errorDefinitions.set(401, "The authentication token is invalid or doesn&#39;t have access to make this request");
1499 errorDefinitions.set(403, "Forbidden request");
1500 errorDefinitions.set(404, "Product id doesn&#39;t exist / invalid / not found.");
1501 errorDefinitions.set(412, "Non-Child Directed Skill is not supported.");
1502 errorDefinitions.set(429, "The request is throttled.");
1503 errorDefinitions.set(500, "Internal Server Error");
1504 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
1505 });
1506 });
1507 };
1508 /**
1509 * Returns transactions of all in skill products purchases of the customer
1510 * @param {string} acceptLanguage User&#39;s locale/language in context
1511 * @param {string} productId Product Id.
1512 * @param {string} status Transaction status for in skill product purchases. * &#39;PENDING_APPROVAL_BY_PARENT&#39; - The transaction is pending approval from parent. * &#39;APPROVED_BY_PARENT&#39; - The transaction was approved by parent and fulfilled successfully.. * &#39;DENIED_BY_PARENT&#39; - The transaction was declined by parent and hence not fulfilled. * &#39;EXPIRED_NO_ACTION_BY_PARENT&#39; - The transaction was expired due to no response from parent and hence not fulfilled. * &#39;ERROR&#39; - The transaction was not fullfiled as there was an error while processing the transaction.
1513 * @param {string} fromLastModifiedTime Filter transactions based on last modified time stamp, FROM duration in format (UTC ISO 8601) i.e. yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSS&#39;Z&#39;
1514 * @param {string} toLastModifiedTime Filter transactions based on last modified time stamp, TO duration in format (UTC ISO 8601) i.e. yyyy-MM-dd&#39;T&#39;HH:mm:ss.SSS&#39;Z&#39;
1515 * @param {string} nextToken When response to this API call is truncated, the response also includes the nextToken in metadata, the value of which can be used in the next request as the continuation-token to list the next set of objects. The continuation token is an opaque value that In-Skill Products API understands. Token has expiry of 24 hours.
1516 * @param {number} maxResults sets the maximum number of results returned in the response body. If you want to retrieve fewer than upper limit of 100 results, you can add this parameter to your request. maxResults should not exceed the upper limit. The response might contain fewer results than maxResults, but it will never contain more. If there are additional results that satisfy the search criteria, but these results were not returned because maxResults was exceeded, the response contains nextToken which can be used to fetch next set of result.
1517 */
1518 MonetizationServiceClient.prototype.getInSkillProductsTransactions = function (acceptLanguage, productId, status, fromLastModifiedTime, toLastModifiedTime, nextToken, maxResults) {
1519 return __awaiter(this, void 0, void 0, function () {
1520 var apiResponse;
1521 return __generator(this, function (_a) {
1522 switch (_a.label) {
1523 case 0: return [4 /*yield*/, this.callGetInSkillProductsTransactions(acceptLanguage, productId, status, fromLastModifiedTime, toLastModifiedTime, nextToken, maxResults)];
1524 case 1:
1525 apiResponse = _a.sent();
1526 return [2 /*return*/, apiResponse.body];
1527 }
1528 });
1529 });
1530 };
1531 /**
1532 * Returns whether or not voice purchasing is enabled for the skill
1533 */
1534 MonetizationServiceClient.prototype.callGetVoicePurchaseSetting = function () {
1535 return __awaiter(this, void 0, void 0, function () {
1536 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1537 return __generator(this, function (_a) {
1538 __operationId__ = 'callGetVoicePurchaseSetting';
1539 queryParams = [];
1540 headerParams = [];
1541 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1542 pathParams = new Map();
1543 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1544 headerParams.push({ key: "Authorization", value: authorizationValue });
1545 resourcePath = "/v1/users/~current/skills/~current/settings/voicePurchasing.enabled";
1546 errorDefinitions = new Map();
1547 errorDefinitions.set(200, "Returns a boolean value for voice purchase setting on success.");
1548 errorDefinitions.set(400, "Invalid request.");
1549 errorDefinitions.set(401, "The authentication token is invalid or doesn&#39;t have access to make this request");
1550 errorDefinitions.set(500, "Internal Server Error.");
1551 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
1552 });
1553 });
1554 };
1555 /**
1556 * Returns whether or not voice purchasing is enabled for the skill
1557 */
1558 MonetizationServiceClient.prototype.getVoicePurchaseSetting = function () {
1559 return __awaiter(this, void 0, void 0, function () {
1560 var apiResponse;
1561 return __generator(this, function (_a) {
1562 switch (_a.label) {
1563 case 0: return [4 /*yield*/, this.callGetVoicePurchaseSetting()];
1564 case 1:
1565 apiResponse = _a.sent();
1566 return [2 /*return*/, apiResponse.body];
1567 }
1568 });
1569 });
1570 };
1571 return MonetizationServiceClient;
1572 }(services.BaseServiceClient));
1573 monetization.MonetizationServiceClient = MonetizationServiceClient;
1574 })(monetization = services.monetization || (services.monetization = {}));
1575})(services = exports.services || (exports.services = {}));
1576(function (services) {
1577 var proactiveEvents;
1578 (function (proactiveEvents) {
1579 /**
1580 *
1581 */
1582 var ProactiveEventsServiceClient = /** @class */ (function (_super) {
1583 __extends(ProactiveEventsServiceClient, _super);
1584 function ProactiveEventsServiceClient(apiConfiguration, authenticationConfiguration, customUserAgent) {
1585 if (customUserAgent === void 0) { customUserAgent = null; }
1586 var _this = _super.call(this, apiConfiguration) || this;
1587 _this.lwaServiceClient = new services.LwaServiceClient({
1588 apiConfiguration: apiConfiguration,
1589 authenticationConfiguration: authenticationConfiguration,
1590 });
1591 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
1592 return _this;
1593 }
1594 /**
1595 * Create a new proactive event in live stage.
1596 * @param {services.proactiveEvents.CreateProactiveEventRequest} createProactiveEventRequest Request to create a new proactive event.
1597 */
1598 ProactiveEventsServiceClient.prototype.callCreateProactiveEvent = function (createProactiveEventRequest, stage) {
1599 return __awaiter(this, void 0, void 0, function () {
1600 var __operationId__, queryParams, headerParams, pathParams, accessToken, authorizationValue, resourcePath, errorDefinitions;
1601 return __generator(this, function (_a) {
1602 switch (_a.label) {
1603 case 0:
1604 __operationId__ = 'callCreateProactiveEvent';
1605 // verify required parameter 'createProactiveEventRequest' is not null or undefined
1606 if (createProactiveEventRequest == null) {
1607 throw new Error("Required parameter createProactiveEventRequest was null or undefined when calling " + __operationId__ + ".");
1608 }
1609 queryParams = [];
1610 headerParams = [];
1611 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1612 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
1613 headerParams.push({ key: 'Content-type', value: 'application/json' });
1614 }
1615 pathParams = new Map();
1616 return [4 /*yield*/, this.lwaServiceClient.getAccessTokenForScope("alexa::proactive_events")];
1617 case 1:
1618 accessToken = _a.sent();
1619 authorizationValue = "Bearer " + accessToken;
1620 headerParams.push({ key: "Authorization", value: authorizationValue });
1621 resourcePath = "/v1/proactiveEvents";
1622 if (stage === 'DEVELOPMENT') {
1623 resourcePath += '/stages/development';
1624 }
1625 errorDefinitions = new Map();
1626 errorDefinitions.set(202, "Request accepted");
1627 errorDefinitions.set(400, "A required parameter is not present or is incorrectly formatted, or the requested creation of a resource has already been completed by a previous request. ");
1628 errorDefinitions.set(403, "The authentication token is invalid or doesn&#39;t have authentication to access the resource");
1629 errorDefinitions.set(409, "A skill attempts to create duplicate events using the same referenceId for the same customer.");
1630 errorDefinitions.set(429, "The client has made more calls than the allowed limit.");
1631 errorDefinitions.set(500, "The ProactiveEvents service encounters an internal error for a valid request.");
1632 errorDefinitions.set(0, "Unexpected error");
1633 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, createProactiveEventRequest, errorDefinitions)];
1634 }
1635 });
1636 });
1637 };
1638 /**
1639 * Create a new proactive event in live stage.
1640 * @param {services.proactiveEvents.CreateProactiveEventRequest} createProactiveEventRequest Request to create a new proactive event.
1641 */
1642 ProactiveEventsServiceClient.prototype.createProactiveEvent = function (createProactiveEventRequest, stage) {
1643 return __awaiter(this, void 0, void 0, function () {
1644 return __generator(this, function (_a) {
1645 switch (_a.label) {
1646 case 0: return [4 /*yield*/, this.callCreateProactiveEvent(createProactiveEventRequest, stage)];
1647 case 1:
1648 _a.sent();
1649 return [2 /*return*/];
1650 }
1651 });
1652 });
1653 };
1654 return ProactiveEventsServiceClient;
1655 }(services.BaseServiceClient));
1656 proactiveEvents.ProactiveEventsServiceClient = ProactiveEventsServiceClient;
1657 })(proactiveEvents = services.proactiveEvents || (services.proactiveEvents = {}));
1658})(services = exports.services || (exports.services = {}));
1659(function (services) {
1660 var reminderManagement;
1661 (function (reminderManagement) {
1662 /**
1663 *
1664 */
1665 var ReminderManagementServiceClient = /** @class */ (function (_super) {
1666 __extends(ReminderManagementServiceClient, _super);
1667 function ReminderManagementServiceClient(apiConfiguration, customUserAgent) {
1668 if (customUserAgent === void 0) { customUserAgent = null; }
1669 var _this = _super.call(this, apiConfiguration) || this;
1670 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
1671 return _this;
1672 }
1673 /**
1674 * This API is invoked by the skill to delete a single reminder.
1675 * @param {string} alertToken
1676 */
1677 ReminderManagementServiceClient.prototype.callDeleteReminder = function (alertToken) {
1678 return __awaiter(this, void 0, void 0, function () {
1679 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1680 return __generator(this, function (_a) {
1681 __operationId__ = 'callDeleteReminder';
1682 // verify required parameter 'alertToken' is not null or undefined
1683 if (alertToken == null) {
1684 throw new Error("Required parameter alertToken was null or undefined when calling " + __operationId__ + ".");
1685 }
1686 queryParams = [];
1687 headerParams = [];
1688 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1689 pathParams = new Map();
1690 pathParams.set('alertToken', alertToken);
1691 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1692 headerParams.push({ key: "Authorization", value: authorizationValue });
1693 resourcePath = "/v1/alerts/reminders/{alertToken}";
1694 errorDefinitions = new Map();
1695 errorDefinitions.set(200, "Success");
1696 errorDefinitions.set(401, "UserAuthenticationException. Request is not authorized/authenticated e.g. If customer does not have permission to create a reminder.");
1697 errorDefinitions.set(429, "RateExceededException e.g. When the skill is throttled for exceeding the max rate");
1698 errorDefinitions.set(500, "Internal Server Error");
1699 return [2 /*return*/, this.invoke("DELETE", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
1700 });
1701 });
1702 };
1703 /**
1704 * This API is invoked by the skill to delete a single reminder.
1705 * @param {string} alertToken
1706 */
1707 ReminderManagementServiceClient.prototype.deleteReminder = function (alertToken) {
1708 return __awaiter(this, void 0, void 0, function () {
1709 return __generator(this, function (_a) {
1710 switch (_a.label) {
1711 case 0: return [4 /*yield*/, this.callDeleteReminder(alertToken)];
1712 case 1:
1713 _a.sent();
1714 return [2 /*return*/];
1715 }
1716 });
1717 });
1718 };
1719 /**
1720 * This API is invoked by the skill to get a single reminder.
1721 * @param {string} alertToken
1722 */
1723 ReminderManagementServiceClient.prototype.callGetReminder = function (alertToken) {
1724 return __awaiter(this, void 0, void 0, function () {
1725 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1726 return __generator(this, function (_a) {
1727 __operationId__ = 'callGetReminder';
1728 // verify required parameter 'alertToken' is not null or undefined
1729 if (alertToken == null) {
1730 throw new Error("Required parameter alertToken was null or undefined when calling " + __operationId__ + ".");
1731 }
1732 queryParams = [];
1733 headerParams = [];
1734 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1735 pathParams = new Map();
1736 pathParams.set('alertToken', alertToken);
1737 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1738 headerParams.push({ key: "Authorization", value: authorizationValue });
1739 resourcePath = "/v1/alerts/reminders/{alertToken}";
1740 errorDefinitions = new Map();
1741 errorDefinitions.set(200, "Success");
1742 errorDefinitions.set(401, "UserAuthenticationException. Request is not authorized/authenticated e.g. If customer does not have permission to create a reminder.");
1743 errorDefinitions.set(429, "RateExceededException e.g. When the skill is throttled for exceeding the max rate");
1744 errorDefinitions.set(500, "Internal Server Error");
1745 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
1746 });
1747 });
1748 };
1749 /**
1750 * This API is invoked by the skill to get a single reminder.
1751 * @param {string} alertToken
1752 */
1753 ReminderManagementServiceClient.prototype.getReminder = function (alertToken) {
1754 return __awaiter(this, void 0, void 0, function () {
1755 var apiResponse;
1756 return __generator(this, function (_a) {
1757 switch (_a.label) {
1758 case 0: return [4 /*yield*/, this.callGetReminder(alertToken)];
1759 case 1:
1760 apiResponse = _a.sent();
1761 return [2 /*return*/, apiResponse.body];
1762 }
1763 });
1764 });
1765 };
1766 /**
1767 * This API is invoked by the skill to update a reminder.
1768 * @param {string} alertToken
1769 * @param {services.reminderManagement.ReminderRequest} reminderRequest
1770 */
1771 ReminderManagementServiceClient.prototype.callUpdateReminder = function (alertToken, reminderRequest) {
1772 return __awaiter(this, void 0, void 0, function () {
1773 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1774 return __generator(this, function (_a) {
1775 __operationId__ = 'callUpdateReminder';
1776 // verify required parameter 'alertToken' is not null or undefined
1777 if (alertToken == null) {
1778 throw new Error("Required parameter alertToken was null or undefined when calling " + __operationId__ + ".");
1779 }
1780 // verify required parameter 'reminderRequest' is not null or undefined
1781 if (reminderRequest == null) {
1782 throw new Error("Required parameter reminderRequest was null or undefined when calling " + __operationId__ + ".");
1783 }
1784 queryParams = [];
1785 headerParams = [];
1786 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1787 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
1788 headerParams.push({ key: 'Content-type', value: 'application/json' });
1789 }
1790 pathParams = new Map();
1791 pathParams.set('alertToken', alertToken);
1792 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1793 headerParams.push({ key: "Authorization", value: authorizationValue });
1794 resourcePath = "/v1/alerts/reminders/{alertToken}";
1795 errorDefinitions = new Map();
1796 errorDefinitions.set(200, "Success");
1797 errorDefinitions.set(400, "Bad Request");
1798 errorDefinitions.set(404, "NotFoundException e.g. Retured when reminder is not found");
1799 errorDefinitions.set(409, "UserAuthenticationException. Request is not authorized/authenticated e.g. If customer does not have permission to create a reminder.");
1800 errorDefinitions.set(429, "RateExceededException e.g. When the skill is throttled for exceeding the max rate");
1801 errorDefinitions.set(500, "Internal Server Error");
1802 return [2 /*return*/, this.invoke("PUT", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, reminderRequest, errorDefinitions)];
1803 });
1804 });
1805 };
1806 /**
1807 * This API is invoked by the skill to update a reminder.
1808 * @param {string} alertToken
1809 * @param {services.reminderManagement.ReminderRequest} reminderRequest
1810 */
1811 ReminderManagementServiceClient.prototype.updateReminder = function (alertToken, reminderRequest) {
1812 return __awaiter(this, void 0, void 0, function () {
1813 var apiResponse;
1814 return __generator(this, function (_a) {
1815 switch (_a.label) {
1816 case 0: return [4 /*yield*/, this.callUpdateReminder(alertToken, reminderRequest)];
1817 case 1:
1818 apiResponse = _a.sent();
1819 return [2 /*return*/, apiResponse.body];
1820 }
1821 });
1822 });
1823 };
1824 /**
1825 * This API is invoked by the skill to get a all reminders created by the caller.
1826 */
1827 ReminderManagementServiceClient.prototype.callGetReminders = function () {
1828 return __awaiter(this, void 0, void 0, function () {
1829 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1830 return __generator(this, function (_a) {
1831 __operationId__ = 'callGetReminders';
1832 queryParams = [];
1833 headerParams = [];
1834 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1835 pathParams = new Map();
1836 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1837 headerParams.push({ key: "Authorization", value: authorizationValue });
1838 resourcePath = "/v1/alerts/reminders";
1839 errorDefinitions = new Map();
1840 errorDefinitions.set(200, "Success");
1841 errorDefinitions.set(401, "UserAuthenticationException. Request is not authorized/authenticated e.g. If customer does not have permission to create a reminder.");
1842 errorDefinitions.set(429, "RateExceededException e.g. When the skill is throttled for exceeding the max rate");
1843 errorDefinitions.set(500, "Internal Server Error");
1844 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
1845 });
1846 });
1847 };
1848 /**
1849 * This API is invoked by the skill to get a all reminders created by the caller.
1850 */
1851 ReminderManagementServiceClient.prototype.getReminders = function () {
1852 return __awaiter(this, void 0, void 0, function () {
1853 var apiResponse;
1854 return __generator(this, function (_a) {
1855 switch (_a.label) {
1856 case 0: return [4 /*yield*/, this.callGetReminders()];
1857 case 1:
1858 apiResponse = _a.sent();
1859 return [2 /*return*/, apiResponse.body];
1860 }
1861 });
1862 });
1863 };
1864 /**
1865 * This API is invoked by the skill to create a new reminder.
1866 * @param {services.reminderManagement.ReminderRequest} reminderRequest
1867 */
1868 ReminderManagementServiceClient.prototype.callCreateReminder = function (reminderRequest) {
1869 return __awaiter(this, void 0, void 0, function () {
1870 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
1871 return __generator(this, function (_a) {
1872 __operationId__ = 'callCreateReminder';
1873 // verify required parameter 'reminderRequest' is not null or undefined
1874 if (reminderRequest == null) {
1875 throw new Error("Required parameter reminderRequest was null or undefined when calling " + __operationId__ + ".");
1876 }
1877 queryParams = [];
1878 headerParams = [];
1879 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1880 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
1881 headerParams.push({ key: 'Content-type', value: 'application/json' });
1882 }
1883 pathParams = new Map();
1884 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
1885 headerParams.push({ key: "Authorization", value: authorizationValue });
1886 resourcePath = "/v1/alerts/reminders";
1887 errorDefinitions = new Map();
1888 errorDefinitions.set(200, "Success");
1889 errorDefinitions.set(400, "Bad Request");
1890 errorDefinitions.set(403, "Forbidden");
1891 errorDefinitions.set(429, "RateExceededException e.g. When the skill is throttled for exceeding the max rate");
1892 errorDefinitions.set(500, "Internal Server Error");
1893 errorDefinitions.set(503, "Service Unavailable");
1894 errorDefinitions.set(504, "Gateway Timeout");
1895 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, reminderRequest, errorDefinitions)];
1896 });
1897 });
1898 };
1899 /**
1900 * This API is invoked by the skill to create a new reminder.
1901 * @param {services.reminderManagement.ReminderRequest} reminderRequest
1902 */
1903 ReminderManagementServiceClient.prototype.createReminder = function (reminderRequest) {
1904 return __awaiter(this, void 0, void 0, function () {
1905 var apiResponse;
1906 return __generator(this, function (_a) {
1907 switch (_a.label) {
1908 case 0: return [4 /*yield*/, this.callCreateReminder(reminderRequest)];
1909 case 1:
1910 apiResponse = _a.sent();
1911 return [2 /*return*/, apiResponse.body];
1912 }
1913 });
1914 });
1915 };
1916 return ReminderManagementServiceClient;
1917 }(services.BaseServiceClient));
1918 reminderManagement.ReminderManagementServiceClient = ReminderManagementServiceClient;
1919 })(reminderManagement = services.reminderManagement || (services.reminderManagement = {}));
1920})(services = exports.services || (exports.services = {}));
1921(function (services) {
1922 var skillMessaging;
1923 (function (skillMessaging) {
1924 /**
1925 *
1926 */
1927 var SkillMessagingServiceClient = /** @class */ (function (_super) {
1928 __extends(SkillMessagingServiceClient, _super);
1929 function SkillMessagingServiceClient(apiConfiguration, authenticationConfiguration, customUserAgent) {
1930 if (customUserAgent === void 0) { customUserAgent = null; }
1931 var _this = _super.call(this, apiConfiguration) || this;
1932 _this.lwaServiceClient = new services.LwaServiceClient({
1933 apiConfiguration: apiConfiguration,
1934 authenticationConfiguration: authenticationConfiguration,
1935 });
1936 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
1937 return _this;
1938 }
1939 /**
1940 * Send a message request to a skill for a specified user.
1941 * @param {string} userId The user Id for the specific user to send the message
1942 * @param {services.skillMessaging.SendSkillMessagingRequest} sendSkillMessagingRequest Message Request to be sent to the skill.
1943 */
1944 SkillMessagingServiceClient.prototype.callSendSkillMessage = function (userId, sendSkillMessagingRequest) {
1945 return __awaiter(this, void 0, void 0, function () {
1946 var __operationId__, queryParams, headerParams, pathParams, accessToken, authorizationValue, resourcePath, errorDefinitions;
1947 return __generator(this, function (_a) {
1948 switch (_a.label) {
1949 case 0:
1950 __operationId__ = 'callSendSkillMessage';
1951 // verify required parameter 'userId' is not null or undefined
1952 if (userId == null) {
1953 throw new Error("Required parameter userId was null or undefined when calling " + __operationId__ + ".");
1954 }
1955 // verify required parameter 'sendSkillMessagingRequest' is not null or undefined
1956 if (sendSkillMessagingRequest == null) {
1957 throw new Error("Required parameter sendSkillMessagingRequest was null or undefined when calling " + __operationId__ + ".");
1958 }
1959 queryParams = [];
1960 headerParams = [];
1961 headerParams.push({ key: 'User-Agent', value: this.userAgent });
1962 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
1963 headerParams.push({ key: 'Content-type', value: 'application/json' });
1964 }
1965 pathParams = new Map();
1966 pathParams.set('userId', userId);
1967 return [4 /*yield*/, this.lwaServiceClient.getAccessTokenForScope("alexa:skill_messaging")];
1968 case 1:
1969 accessToken = _a.sent();
1970 authorizationValue = "Bearer " + accessToken;
1971 headerParams.push({ key: "Authorization", value: authorizationValue });
1972 resourcePath = "/v1/skillmessages/users/{userId}";
1973 errorDefinitions = new Map();
1974 errorDefinitions.set(202, "Message has been successfully accepted, and will be sent to the skill ");
1975 errorDefinitions.set(400, "Data is missing or not valid ");
1976 errorDefinitions.set(403, "The skill messaging authentication token is expired or not valid ");
1977 errorDefinitions.set(404, "The passed userId does not exist ");
1978 errorDefinitions.set(429, "The requester has exceeded their maximum allowable rate of messages ");
1979 errorDefinitions.set(500, "The SkillMessaging service encountered an internal error for a valid request. ");
1980 errorDefinitions.set(0, "Unexpected error");
1981 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, sendSkillMessagingRequest, errorDefinitions)];
1982 }
1983 });
1984 });
1985 };
1986 /**
1987 * Send a message request to a skill for a specified user.
1988 * @param {string} userId The user Id for the specific user to send the message
1989 * @param {services.skillMessaging.SendSkillMessagingRequest} sendSkillMessagingRequest Message Request to be sent to the skill.
1990 */
1991 SkillMessagingServiceClient.prototype.sendSkillMessage = function (userId, sendSkillMessagingRequest) {
1992 return __awaiter(this, void 0, void 0, function () {
1993 return __generator(this, function (_a) {
1994 switch (_a.label) {
1995 case 0: return [4 /*yield*/, this.callSendSkillMessage(userId, sendSkillMessagingRequest)];
1996 case 1:
1997 _a.sent();
1998 return [2 /*return*/];
1999 }
2000 });
2001 });
2002 };
2003 return SkillMessagingServiceClient;
2004 }(services.BaseServiceClient));
2005 skillMessaging.SkillMessagingServiceClient = SkillMessagingServiceClient;
2006 })(skillMessaging = services.skillMessaging || (services.skillMessaging = {}));
2007})(services = exports.services || (exports.services = {}));
2008(function (services) {
2009 var timerManagement;
2010 (function (timerManagement) {
2011 /**
2012 *
2013 */
2014 var TimerManagementServiceClient = /** @class */ (function (_super) {
2015 __extends(TimerManagementServiceClient, _super);
2016 function TimerManagementServiceClient(apiConfiguration, customUserAgent) {
2017 if (customUserAgent === void 0) { customUserAgent = null; }
2018 var _this = _super.call(this, apiConfiguration) || this;
2019 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
2020 return _this;
2021 }
2022 /**
2023 * Delete all timers created by the skill.
2024 */
2025 TimerManagementServiceClient.prototype.callDeleteTimers = function () {
2026 return __awaiter(this, void 0, void 0, function () {
2027 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2028 return __generator(this, function (_a) {
2029 __operationId__ = 'callDeleteTimers';
2030 queryParams = [];
2031 headerParams = [];
2032 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2033 pathParams = new Map();
2034 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2035 headerParams.push({ key: "Authorization", value: authorizationValue });
2036 resourcePath = "/v1/alerts/timers";
2037 errorDefinitions = new Map();
2038 errorDefinitions.set(200, "Success");
2039 errorDefinitions.set(400, "Bad Request");
2040 errorDefinitions.set(401, "Unauthorized");
2041 errorDefinitions.set(500, "Internal Server Error");
2042 return [2 /*return*/, this.invoke("DELETE", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2043 });
2044 });
2045 };
2046 /**
2047 * Delete all timers created by the skill.
2048 */
2049 TimerManagementServiceClient.prototype.deleteTimers = function () {
2050 return __awaiter(this, void 0, void 0, function () {
2051 return __generator(this, function (_a) {
2052 switch (_a.label) {
2053 case 0: return [4 /*yield*/, this.callDeleteTimers()];
2054 case 1:
2055 _a.sent();
2056 return [2 /*return*/];
2057 }
2058 });
2059 });
2060 };
2061 /**
2062 * Get all timers created by the skill.
2063 */
2064 TimerManagementServiceClient.prototype.callGetTimers = function () {
2065 return __awaiter(this, void 0, void 0, function () {
2066 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2067 return __generator(this, function (_a) {
2068 __operationId__ = 'callGetTimers';
2069 queryParams = [];
2070 headerParams = [];
2071 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2072 pathParams = new Map();
2073 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2074 headerParams.push({ key: "Authorization", value: authorizationValue });
2075 resourcePath = "/v1/alerts/timers";
2076 errorDefinitions = new Map();
2077 errorDefinitions.set(200, "Success");
2078 errorDefinitions.set(400, "Bad Request");
2079 errorDefinitions.set(401, "Unauthorized");
2080 errorDefinitions.set(500, "Internal Server Error");
2081 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2082 });
2083 });
2084 };
2085 /**
2086 * Get all timers created by the skill.
2087 */
2088 TimerManagementServiceClient.prototype.getTimers = function () {
2089 return __awaiter(this, void 0, void 0, function () {
2090 var apiResponse;
2091 return __generator(this, function (_a) {
2092 switch (_a.label) {
2093 case 0: return [4 /*yield*/, this.callGetTimers()];
2094 case 1:
2095 apiResponse = _a.sent();
2096 return [2 /*return*/, apiResponse.body];
2097 }
2098 });
2099 });
2100 };
2101 /**
2102 * Delete a timer by ID.
2103 * @param {string} id
2104 */
2105 TimerManagementServiceClient.prototype.callDeleteTimer = function (id) {
2106 return __awaiter(this, void 0, void 0, function () {
2107 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2108 return __generator(this, function (_a) {
2109 __operationId__ = 'callDeleteTimer';
2110 // verify required parameter 'id' is not null or undefined
2111 if (id == null) {
2112 throw new Error("Required parameter id was null or undefined when calling " + __operationId__ + ".");
2113 }
2114 queryParams = [];
2115 headerParams = [];
2116 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2117 pathParams = new Map();
2118 pathParams.set('id', id);
2119 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2120 headerParams.push({ key: "Authorization", value: authorizationValue });
2121 resourcePath = "/v1/alerts/timers/{id}";
2122 errorDefinitions = new Map();
2123 errorDefinitions.set(200, "Success");
2124 errorDefinitions.set(400, "Bad Request");
2125 errorDefinitions.set(401, "Unauthorized");
2126 errorDefinitions.set(404, "Timer not found");
2127 errorDefinitions.set(500, "Internal Server Error");
2128 return [2 /*return*/, this.invoke("DELETE", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2129 });
2130 });
2131 };
2132 /**
2133 * Delete a timer by ID.
2134 * @param {string} id
2135 */
2136 TimerManagementServiceClient.prototype.deleteTimer = function (id) {
2137 return __awaiter(this, void 0, void 0, function () {
2138 return __generator(this, function (_a) {
2139 switch (_a.label) {
2140 case 0: return [4 /*yield*/, this.callDeleteTimer(id)];
2141 case 1:
2142 _a.sent();
2143 return [2 /*return*/];
2144 }
2145 });
2146 });
2147 };
2148 /**
2149 * Get timer by ID.
2150 * @param {string} id
2151 */
2152 TimerManagementServiceClient.prototype.callGetTimer = function (id) {
2153 return __awaiter(this, void 0, void 0, function () {
2154 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2155 return __generator(this, function (_a) {
2156 __operationId__ = 'callGetTimer';
2157 // verify required parameter 'id' is not null or undefined
2158 if (id == null) {
2159 throw new Error("Required parameter id was null or undefined when calling " + __operationId__ + ".");
2160 }
2161 queryParams = [];
2162 headerParams = [];
2163 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2164 pathParams = new Map();
2165 pathParams.set('id', id);
2166 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2167 headerParams.push({ key: "Authorization", value: authorizationValue });
2168 resourcePath = "/v1/alerts/timers/{id}";
2169 errorDefinitions = new Map();
2170 errorDefinitions.set(200, "Success");
2171 errorDefinitions.set(400, "Bad Request");
2172 errorDefinitions.set(401, "Unauthorized");
2173 errorDefinitions.set(404, "Timer not found");
2174 errorDefinitions.set(500, "Internal Server Error");
2175 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2176 });
2177 });
2178 };
2179 /**
2180 * Get timer by ID.
2181 * @param {string} id
2182 */
2183 TimerManagementServiceClient.prototype.getTimer = function (id) {
2184 return __awaiter(this, void 0, void 0, function () {
2185 var apiResponse;
2186 return __generator(this, function (_a) {
2187 switch (_a.label) {
2188 case 0: return [4 /*yield*/, this.callGetTimer(id)];
2189 case 1:
2190 apiResponse = _a.sent();
2191 return [2 /*return*/, apiResponse.body];
2192 }
2193 });
2194 });
2195 };
2196 /**
2197 * Pause a timer.
2198 * @param {string} id
2199 */
2200 TimerManagementServiceClient.prototype.callPauseTimer = function (id) {
2201 return __awaiter(this, void 0, void 0, function () {
2202 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2203 return __generator(this, function (_a) {
2204 __operationId__ = 'callPauseTimer';
2205 // verify required parameter 'id' is not null or undefined
2206 if (id == null) {
2207 throw new Error("Required parameter id was null or undefined when calling " + __operationId__ + ".");
2208 }
2209 queryParams = [];
2210 headerParams = [];
2211 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2212 pathParams = new Map();
2213 pathParams.set('id', id);
2214 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2215 headerParams.push({ key: "Authorization", value: authorizationValue });
2216 resourcePath = "/v1/alerts/timers/{id}/pause";
2217 errorDefinitions = new Map();
2218 errorDefinitions.set(200, "Success");
2219 errorDefinitions.set(400, "Bad Request");
2220 errorDefinitions.set(401, "Unauthorized");
2221 errorDefinitions.set(404, "Timer not found");
2222 errorDefinitions.set(500, "Internal Server Error");
2223 errorDefinitions.set(504, "Device offline");
2224 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2225 });
2226 });
2227 };
2228 /**
2229 * Pause a timer.
2230 * @param {string} id
2231 */
2232 TimerManagementServiceClient.prototype.pauseTimer = function (id) {
2233 return __awaiter(this, void 0, void 0, function () {
2234 return __generator(this, function (_a) {
2235 switch (_a.label) {
2236 case 0: return [4 /*yield*/, this.callPauseTimer(id)];
2237 case 1:
2238 _a.sent();
2239 return [2 /*return*/];
2240 }
2241 });
2242 });
2243 };
2244 /**
2245 * Resume a timer.
2246 * @param {string} id
2247 */
2248 TimerManagementServiceClient.prototype.callResumeTimer = function (id) {
2249 return __awaiter(this, void 0, void 0, function () {
2250 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2251 return __generator(this, function (_a) {
2252 __operationId__ = 'callResumeTimer';
2253 // verify required parameter 'id' is not null or undefined
2254 if (id == null) {
2255 throw new Error("Required parameter id was null or undefined when calling " + __operationId__ + ".");
2256 }
2257 queryParams = [];
2258 headerParams = [];
2259 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2260 pathParams = new Map();
2261 pathParams.set('id', id);
2262 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2263 headerParams.push({ key: "Authorization", value: authorizationValue });
2264 resourcePath = "/v1/alerts/timers/{id}/resume";
2265 errorDefinitions = new Map();
2266 errorDefinitions.set(200, "Success");
2267 errorDefinitions.set(400, "Bad Request");
2268 errorDefinitions.set(401, "Unauthorized");
2269 errorDefinitions.set(404, "Timer not found");
2270 errorDefinitions.set(500, "Internal Server Error");
2271 errorDefinitions.set(504, "Device offline");
2272 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2273 });
2274 });
2275 };
2276 /**
2277 * Resume a timer.
2278 * @param {string} id
2279 */
2280 TimerManagementServiceClient.prototype.resumeTimer = function (id) {
2281 return __awaiter(this, void 0, void 0, function () {
2282 return __generator(this, function (_a) {
2283 switch (_a.label) {
2284 case 0: return [4 /*yield*/, this.callResumeTimer(id)];
2285 case 1:
2286 _a.sent();
2287 return [2 /*return*/];
2288 }
2289 });
2290 });
2291 };
2292 /**
2293 * Create a new timer.
2294 * @param {services.timerManagement.TimerRequest} timerRequest
2295 */
2296 TimerManagementServiceClient.prototype.callCreateTimer = function (timerRequest) {
2297 return __awaiter(this, void 0, void 0, function () {
2298 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2299 return __generator(this, function (_a) {
2300 __operationId__ = 'callCreateTimer';
2301 // verify required parameter 'timerRequest' is not null or undefined
2302 if (timerRequest == null) {
2303 throw new Error("Required parameter timerRequest was null or undefined when calling " + __operationId__ + ".");
2304 }
2305 queryParams = [];
2306 headerParams = [];
2307 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2308 if (!headerParams.find(function (param) { return param.key.toLowerCase() === 'content-type'; })) {
2309 headerParams.push({ key: 'Content-type', value: 'application/json' });
2310 }
2311 pathParams = new Map();
2312 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2313 headerParams.push({ key: "Authorization", value: authorizationValue });
2314 resourcePath = "/v1/alerts/timers";
2315 errorDefinitions = new Map();
2316 errorDefinitions.set(200, "Success");
2317 errorDefinitions.set(400, "Bad Request");
2318 errorDefinitions.set(401, "Unauthorized");
2319 errorDefinitions.set(403, "Forbidden");
2320 errorDefinitions.set(500, "Internal Server Error");
2321 errorDefinitions.set(504, "Device offline");
2322 return [2 /*return*/, this.invoke("POST", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, timerRequest, errorDefinitions)];
2323 });
2324 });
2325 };
2326 /**
2327 * Create a new timer.
2328 * @param {services.timerManagement.TimerRequest} timerRequest
2329 */
2330 TimerManagementServiceClient.prototype.createTimer = function (timerRequest) {
2331 return __awaiter(this, void 0, void 0, function () {
2332 var apiResponse;
2333 return __generator(this, function (_a) {
2334 switch (_a.label) {
2335 case 0: return [4 /*yield*/, this.callCreateTimer(timerRequest)];
2336 case 1:
2337 apiResponse = _a.sent();
2338 return [2 /*return*/, apiResponse.body];
2339 }
2340 });
2341 });
2342 };
2343 return TimerManagementServiceClient;
2344 }(services.BaseServiceClient));
2345 timerManagement.TimerManagementServiceClient = TimerManagementServiceClient;
2346 })(timerManagement = services.timerManagement || (services.timerManagement = {}));
2347})(services = exports.services || (exports.services = {}));
2348(function (services) {
2349 var ups;
2350 (function (ups) {
2351 /**
2352 *
2353 */
2354 var UpsServiceClient = /** @class */ (function (_super) {
2355 __extends(UpsServiceClient, _super);
2356 function UpsServiceClient(apiConfiguration, customUserAgent) {
2357 if (customUserAgent === void 0) { customUserAgent = null; }
2358 var _this = _super.call(this, apiConfiguration) || this;
2359 _this.userAgent = createUserAgent("" + require('./package.json').version, customUserAgent);
2360 return _this;
2361 }
2362 /**
2363 * Gets the email address of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:email:read]
2364 */
2365 UpsServiceClient.prototype.callGetProfileEmail = function () {
2366 return __awaiter(this, void 0, void 0, function () {
2367 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2368 return __generator(this, function (_a) {
2369 __operationId__ = 'callGetProfileEmail';
2370 queryParams = [];
2371 headerParams = [];
2372 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2373 pathParams = new Map();
2374 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2375 headerParams.push({ key: "Authorization", value: authorizationValue });
2376 resourcePath = "/v2/accounts/~current/settings/Profile.email";
2377 errorDefinitions = new Map();
2378 errorDefinitions.set(200, "Successfully retrieved the requested information.");
2379 errorDefinitions.set(204, "The query did not return any results.");
2380 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2381 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2382 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2383 errorDefinitions.set(0, "An unexpected error occurred.");
2384 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2385 });
2386 });
2387 };
2388 /**
2389 * Gets the email address of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:email:read]
2390 */
2391 UpsServiceClient.prototype.getProfileEmail = function () {
2392 return __awaiter(this, void 0, void 0, function () {
2393 var apiResponse;
2394 return __generator(this, function (_a) {
2395 switch (_a.label) {
2396 case 0: return [4 /*yield*/, this.callGetProfileEmail()];
2397 case 1:
2398 apiResponse = _a.sent();
2399 return [2 /*return*/, apiResponse.body];
2400 }
2401 });
2402 });
2403 };
2404 /**
2405 * Gets the given name (first name) of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:given_name:read]
2406 */
2407 UpsServiceClient.prototype.callGetProfileGivenName = function () {
2408 return __awaiter(this, void 0, void 0, function () {
2409 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2410 return __generator(this, function (_a) {
2411 __operationId__ = 'callGetProfileGivenName';
2412 queryParams = [];
2413 headerParams = [];
2414 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2415 pathParams = new Map();
2416 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2417 headerParams.push({ key: "Authorization", value: authorizationValue });
2418 resourcePath = "/v2/accounts/~current/settings/Profile.givenName";
2419 errorDefinitions = new Map();
2420 errorDefinitions.set(200, "Successfully retrieved the requested information.");
2421 errorDefinitions.set(204, "The query did not return any results.");
2422 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2423 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2424 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2425 errorDefinitions.set(0, "An unexpected error occurred.");
2426 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2427 });
2428 });
2429 };
2430 /**
2431 * Gets the given name (first name) of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:given_name:read]
2432 */
2433 UpsServiceClient.prototype.getProfileGivenName = function () {
2434 return __awaiter(this, void 0, void 0, function () {
2435 var apiResponse;
2436 return __generator(this, function (_a) {
2437 switch (_a.label) {
2438 case 0: return [4 /*yield*/, this.callGetProfileGivenName()];
2439 case 1:
2440 apiResponse = _a.sent();
2441 return [2 /*return*/, apiResponse.body];
2442 }
2443 });
2444 });
2445 };
2446 /**
2447 * Gets the mobile phone number of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:mobile_number:read]
2448 */
2449 UpsServiceClient.prototype.callGetProfileMobileNumber = function () {
2450 return __awaiter(this, void 0, void 0, function () {
2451 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2452 return __generator(this, function (_a) {
2453 __operationId__ = 'callGetProfileMobileNumber';
2454 queryParams = [];
2455 headerParams = [];
2456 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2457 pathParams = new Map();
2458 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2459 headerParams.push({ key: "Authorization", value: authorizationValue });
2460 resourcePath = "/v2/accounts/~current/settings/Profile.mobileNumber";
2461 errorDefinitions = new Map();
2462 errorDefinitions.set(200, "Successfully retrieved the requested information.");
2463 errorDefinitions.set(204, "The query did not return any results.");
2464 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2465 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2466 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2467 errorDefinitions.set(0, "An unexpected error occurred.");
2468 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2469 });
2470 });
2471 };
2472 /**
2473 * Gets the mobile phone number of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:mobile_number:read]
2474 */
2475 UpsServiceClient.prototype.getProfileMobileNumber = function () {
2476 return __awaiter(this, void 0, void 0, function () {
2477 var apiResponse;
2478 return __generator(this, function (_a) {
2479 switch (_a.label) {
2480 case 0: return [4 /*yield*/, this.callGetProfileMobileNumber()];
2481 case 1:
2482 apiResponse = _a.sent();
2483 return [2 /*return*/, apiResponse.body];
2484 }
2485 });
2486 });
2487 };
2488 /**
2489 * Gets the full name of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:name:read]
2490 */
2491 UpsServiceClient.prototype.callGetProfileName = function () {
2492 return __awaiter(this, void 0, void 0, function () {
2493 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2494 return __generator(this, function (_a) {
2495 __operationId__ = 'callGetProfileName';
2496 queryParams = [];
2497 headerParams = [];
2498 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2499 pathParams = new Map();
2500 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2501 headerParams.push({ key: "Authorization", value: authorizationValue });
2502 resourcePath = "/v2/accounts/~current/settings/Profile.name";
2503 errorDefinitions = new Map();
2504 errorDefinitions.set(200, "Successfully retrieved the requested information.");
2505 errorDefinitions.set(204, "The query did not return any results.");
2506 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2507 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2508 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2509 errorDefinitions.set(0, "An unexpected error occurred.");
2510 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2511 });
2512 });
2513 };
2514 /**
2515 * Gets the full name of the customer associated with the current enablement. Requires customer consent for scopes: [alexa::profile:name:read]
2516 */
2517 UpsServiceClient.prototype.getProfileName = function () {
2518 return __awaiter(this, void 0, void 0, function () {
2519 var apiResponse;
2520 return __generator(this, function (_a) {
2521 switch (_a.label) {
2522 case 0: return [4 /*yield*/, this.callGetProfileName()];
2523 case 1:
2524 apiResponse = _a.sent();
2525 return [2 /*return*/, apiResponse.body];
2526 }
2527 });
2528 });
2529 };
2530 /**
2531 * Gets the distance measurement unit of the device. Does not require explict customer consent.
2532 * @param {string} deviceId The device Id
2533 */
2534 UpsServiceClient.prototype.callGetSystemDistanceUnits = function (deviceId) {
2535 return __awaiter(this, void 0, void 0, function () {
2536 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2537 return __generator(this, function (_a) {
2538 __operationId__ = 'callGetSystemDistanceUnits';
2539 // verify required parameter 'deviceId' is not null or undefined
2540 if (deviceId == null) {
2541 throw new Error("Required parameter deviceId was null or undefined when calling " + __operationId__ + ".");
2542 }
2543 queryParams = [];
2544 headerParams = [];
2545 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2546 pathParams = new Map();
2547 pathParams.set('deviceId', deviceId);
2548 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2549 headerParams.push({ key: "Authorization", value: authorizationValue });
2550 resourcePath = "/v2/devices/{deviceId}/settings/System.distanceUnits";
2551 errorDefinitions = new Map();
2552 errorDefinitions.set(200, "Successfully get the setting");
2553 errorDefinitions.set(204, "The query did not return any results.");
2554 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2555 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2556 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2557 errorDefinitions.set(0, "An unexpected error occurred.");
2558 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2559 });
2560 });
2561 };
2562 /**
2563 * Gets the distance measurement unit of the device. Does not require explict customer consent.
2564 * @param {string} deviceId The device Id
2565 */
2566 UpsServiceClient.prototype.getSystemDistanceUnits = function (deviceId) {
2567 return __awaiter(this, void 0, void 0, function () {
2568 var apiResponse;
2569 return __generator(this, function (_a) {
2570 switch (_a.label) {
2571 case 0: return [4 /*yield*/, this.callGetSystemDistanceUnits(deviceId)];
2572 case 1:
2573 apiResponse = _a.sent();
2574 return [2 /*return*/, apiResponse.body];
2575 }
2576 });
2577 });
2578 };
2579 /**
2580 * Gets the temperature measurement units of the device. Does not require explict customer consent.
2581 * @param {string} deviceId The device Id
2582 */
2583 UpsServiceClient.prototype.callGetSystemTemperatureUnit = function (deviceId) {
2584 return __awaiter(this, void 0, void 0, function () {
2585 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2586 return __generator(this, function (_a) {
2587 __operationId__ = 'callGetSystemTemperatureUnit';
2588 // verify required parameter 'deviceId' is not null or undefined
2589 if (deviceId == null) {
2590 throw new Error("Required parameter deviceId was null or undefined when calling " + __operationId__ + ".");
2591 }
2592 queryParams = [];
2593 headerParams = [];
2594 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2595 pathParams = new Map();
2596 pathParams.set('deviceId', deviceId);
2597 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2598 headerParams.push({ key: "Authorization", value: authorizationValue });
2599 resourcePath = "/v2/devices/{deviceId}/settings/System.temperatureUnit";
2600 errorDefinitions = new Map();
2601 errorDefinitions.set(200, "Successfully get the setting");
2602 errorDefinitions.set(204, "The query did not return any results.");
2603 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2604 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2605 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2606 errorDefinitions.set(0, "An unexpected error occurred.");
2607 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2608 });
2609 });
2610 };
2611 /**
2612 * Gets the temperature measurement units of the device. Does not require explict customer consent.
2613 * @param {string} deviceId The device Id
2614 */
2615 UpsServiceClient.prototype.getSystemTemperatureUnit = function (deviceId) {
2616 return __awaiter(this, void 0, void 0, function () {
2617 var apiResponse;
2618 return __generator(this, function (_a) {
2619 switch (_a.label) {
2620 case 0: return [4 /*yield*/, this.callGetSystemTemperatureUnit(deviceId)];
2621 case 1:
2622 apiResponse = _a.sent();
2623 return [2 /*return*/, apiResponse.body];
2624 }
2625 });
2626 });
2627 };
2628 /**
2629 * Gets the time zone of the device. Does not require explict customer consent.
2630 * @param {string} deviceId The device Id
2631 */
2632 UpsServiceClient.prototype.callGetSystemTimeZone = function (deviceId) {
2633 return __awaiter(this, void 0, void 0, function () {
2634 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2635 return __generator(this, function (_a) {
2636 __operationId__ = 'callGetSystemTimeZone';
2637 // verify required parameter 'deviceId' is not null or undefined
2638 if (deviceId == null) {
2639 throw new Error("Required parameter deviceId was null or undefined when calling " + __operationId__ + ".");
2640 }
2641 queryParams = [];
2642 headerParams = [];
2643 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2644 pathParams = new Map();
2645 pathParams.set('deviceId', deviceId);
2646 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2647 headerParams.push({ key: "Authorization", value: authorizationValue });
2648 resourcePath = "/v2/devices/{deviceId}/settings/System.timeZone";
2649 errorDefinitions = new Map();
2650 errorDefinitions.set(200, "Successfully get the setting");
2651 errorDefinitions.set(204, "The query did not return any results.");
2652 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2653 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2654 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2655 errorDefinitions.set(0, "An unexpected error occurred.");
2656 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2657 });
2658 });
2659 };
2660 /**
2661 * Gets the time zone of the device. Does not require explict customer consent.
2662 * @param {string} deviceId The device Id
2663 */
2664 UpsServiceClient.prototype.getSystemTimeZone = function (deviceId) {
2665 return __awaiter(this, void 0, void 0, function () {
2666 var apiResponse;
2667 return __generator(this, function (_a) {
2668 switch (_a.label) {
2669 case 0: return [4 /*yield*/, this.callGetSystemTimeZone(deviceId)];
2670 case 1:
2671 apiResponse = _a.sent();
2672 return [2 /*return*/, apiResponse.body];
2673 }
2674 });
2675 });
2676 };
2677 /**
2678 * Gets the given name (first name) of the recognized speaker at person-level. Requires speaker consent at person-level for scopes: [alexa::profile:given_name:read]
2679 */
2680 UpsServiceClient.prototype.callGetPersonsProfileGivenName = function () {
2681 return __awaiter(this, void 0, void 0, function () {
2682 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2683 return __generator(this, function (_a) {
2684 __operationId__ = 'callGetPersonsProfileGivenName';
2685 queryParams = [];
2686 headerParams = [];
2687 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2688 pathParams = new Map();
2689 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2690 headerParams.push({ key: "Authorization", value: authorizationValue });
2691 resourcePath = "/v2/persons/~current/profile/givenName";
2692 errorDefinitions = new Map();
2693 errorDefinitions.set(200, "Successfully retrieved the requested information.");
2694 errorDefinitions.set(204, "The query did not return any results.");
2695 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2696 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2697 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2698 errorDefinitions.set(0, "An unexpected error occurred.");
2699 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2700 });
2701 });
2702 };
2703 /**
2704 * Gets the given name (first name) of the recognized speaker at person-level. Requires speaker consent at person-level for scopes: [alexa::profile:given_name:read]
2705 */
2706 UpsServiceClient.prototype.getPersonsProfileGivenName = function () {
2707 return __awaiter(this, void 0, void 0, function () {
2708 var apiResponse;
2709 return __generator(this, function (_a) {
2710 switch (_a.label) {
2711 case 0: return [4 /*yield*/, this.callGetPersonsProfileGivenName()];
2712 case 1:
2713 apiResponse = _a.sent();
2714 return [2 /*return*/, apiResponse.body];
2715 }
2716 });
2717 });
2718 };
2719 /**
2720 * Gets the mobile phone number of the recognized speaker at person-level. Requires speaker consent at person-level for scopes: [alexa::profile:mobile_number:read]
2721 */
2722 UpsServiceClient.prototype.callGetPersonsProfileMobileNumber = function () {
2723 return __awaiter(this, void 0, void 0, function () {
2724 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2725 return __generator(this, function (_a) {
2726 __operationId__ = 'callGetPersonsProfileMobileNumber';
2727 queryParams = [];
2728 headerParams = [];
2729 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2730 pathParams = new Map();
2731 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2732 headerParams.push({ key: "Authorization", value: authorizationValue });
2733 resourcePath = "/v2/persons/~current/profile/mobileNumber";
2734 errorDefinitions = new Map();
2735 errorDefinitions.set(200, "Successfully retrieved the requested information.");
2736 errorDefinitions.set(204, "The query did not return any results.");
2737 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2738 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2739 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2740 errorDefinitions.set(0, "An unexpected error occurred.");
2741 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2742 });
2743 });
2744 };
2745 /**
2746 * Gets the mobile phone number of the recognized speaker at person-level. Requires speaker consent at person-level for scopes: [alexa::profile:mobile_number:read]
2747 */
2748 UpsServiceClient.prototype.getPersonsProfileMobileNumber = function () {
2749 return __awaiter(this, void 0, void 0, function () {
2750 var apiResponse;
2751 return __generator(this, function (_a) {
2752 switch (_a.label) {
2753 case 0: return [4 /*yield*/, this.callGetPersonsProfileMobileNumber()];
2754 case 1:
2755 apiResponse = _a.sent();
2756 return [2 /*return*/, apiResponse.body];
2757 }
2758 });
2759 });
2760 };
2761 /**
2762 * Gets the full name of the recognized speaker at person-level. Requires speaker consent at person-level for scopes: [alexa::profile:name:read]
2763 */
2764 UpsServiceClient.prototype.callGetPersonsProfileName = function () {
2765 return __awaiter(this, void 0, void 0, function () {
2766 var __operationId__, queryParams, headerParams, pathParams, authorizationValue, resourcePath, errorDefinitions;
2767 return __generator(this, function (_a) {
2768 __operationId__ = 'callGetPersonsProfileName';
2769 queryParams = [];
2770 headerParams = [];
2771 headerParams.push({ key: 'User-Agent', value: this.userAgent });
2772 pathParams = new Map();
2773 authorizationValue = "Bearer " + this.apiConfiguration.authorizationValue;
2774 headerParams.push({ key: "Authorization", value: authorizationValue });
2775 resourcePath = "/v2/persons/~current/profile/name";
2776 errorDefinitions = new Map();
2777 errorDefinitions.set(200, "Successfully retrieved the requested information.");
2778 errorDefinitions.set(204, "The query did not return any results.");
2779 errorDefinitions.set(401, "The authentication token is malformed or invalid.");
2780 errorDefinitions.set(403, "The authentication token does not have access to resource.");
2781 errorDefinitions.set(429, "The skill has been throttled due to an excessive number of requests.");
2782 errorDefinitions.set(0, "An unexpected error occurred.");
2783 return [2 /*return*/, this.invoke("GET", this.apiConfiguration.apiEndpoint, resourcePath, pathParams, queryParams, headerParams, null, errorDefinitions)];
2784 });
2785 });
2786 };
2787 /**
2788 * Gets the full name of the recognized speaker at person-level. Requires speaker consent at person-level for scopes: [alexa::profile:name:read]
2789 */
2790 UpsServiceClient.prototype.getPersonsProfileName = function () {
2791 return __awaiter(this, void 0, void 0, function () {
2792 var apiResponse;
2793 return __generator(this, function (_a) {
2794 switch (_a.label) {
2795 case 0: return [4 /*yield*/, this.callGetPersonsProfileName()];
2796 case 1:
2797 apiResponse = _a.sent();
2798 return [2 /*return*/, apiResponse.body];
2799 }
2800 });
2801 });
2802 };
2803 return UpsServiceClient;
2804 }(services.BaseServiceClient));
2805 ups.UpsServiceClient = UpsServiceClient;
2806 })(ups = services.ups || (services.ups = {}));
2807})(services = exports.services || (exports.services = {}));
2808(function (services) {
2809 /**
2810 * Helper class that instantiates an ServiceClient implementation automatically resolving its
2811 * required ApiConfiguration.
2812 * @export
2813 * @class ServiceClientFactory
2814 */
2815 var ServiceClientFactory = /** @class */ (function () {
2816 function ServiceClientFactory(apiConfiguration) {
2817 this.apiConfiguration = apiConfiguration;
2818 }
2819 /*
2820 * Gets an instance of { deviceAddress.DeviceAddressService }.
2821 * @returns { deviceAddress.DeviceAddressService }
2822 */
2823 ServiceClientFactory.prototype.getDeviceAddressServiceClient = function () {
2824 try {
2825 return new services.deviceAddress.DeviceAddressServiceClient(this.apiConfiguration);
2826 }
2827 catch (e) {
2828 var factoryError = new Error("ServiceClientFactory Error while initializing DeviceAddressServiceClient: " + e.message);
2829 factoryError['name'] = 'ServiceClientFactoryError';
2830 throw factoryError;
2831 }
2832 };
2833 /*
2834 * Gets an instance of { directive.DirectiveService }.
2835 * @returns { directive.DirectiveService }
2836 */
2837 ServiceClientFactory.prototype.getDirectiveServiceClient = function () {
2838 try {
2839 return new services.directive.DirectiveServiceClient(this.apiConfiguration);
2840 }
2841 catch (e) {
2842 var factoryError = new Error("ServiceClientFactory Error while initializing DirectiveServiceClient: " + e.message);
2843 factoryError['name'] = 'ServiceClientFactoryError';
2844 throw factoryError;
2845 }
2846 };
2847 /*
2848 * Gets an instance of { endpointEnumeration.EndpointEnumerationService }.
2849 * @returns { endpointEnumeration.EndpointEnumerationService }
2850 */
2851 ServiceClientFactory.prototype.getEndpointEnumerationServiceClient = function () {
2852 try {
2853 return new services.endpointEnumeration.EndpointEnumerationServiceClient(this.apiConfiguration);
2854 }
2855 catch (e) {
2856 var factoryError = new Error("ServiceClientFactory Error while initializing EndpointEnumerationServiceClient: " + e.message);
2857 factoryError['name'] = 'ServiceClientFactoryError';
2858 throw factoryError;
2859 }
2860 };
2861 /*
2862 * Gets an instance of { listManagement.ListManagementService }.
2863 * @returns { listManagement.ListManagementService }
2864 */
2865 ServiceClientFactory.prototype.getListManagementServiceClient = function () {
2866 try {
2867 return new services.listManagement.ListManagementServiceClient(this.apiConfiguration);
2868 }
2869 catch (e) {
2870 var factoryError = new Error("ServiceClientFactory Error while initializing ListManagementServiceClient: " + e.message);
2871 factoryError['name'] = 'ServiceClientFactoryError';
2872 throw factoryError;
2873 }
2874 };
2875 /*
2876 * Gets an instance of { monetization.MonetizationService }.
2877 * @returns { monetization.MonetizationService }
2878 */
2879 ServiceClientFactory.prototype.getMonetizationServiceClient = function () {
2880 try {
2881 return new services.monetization.MonetizationServiceClient(this.apiConfiguration);
2882 }
2883 catch (e) {
2884 var factoryError = new Error("ServiceClientFactory Error while initializing MonetizationServiceClient: " + e.message);
2885 factoryError['name'] = 'ServiceClientFactoryError';
2886 throw factoryError;
2887 }
2888 };
2889 /*
2890 * Gets an instance of { reminderManagement.ReminderManagementService }.
2891 * @returns { reminderManagement.ReminderManagementService }
2892 */
2893 ServiceClientFactory.prototype.getReminderManagementServiceClient = function () {
2894 try {
2895 return new services.reminderManagement.ReminderManagementServiceClient(this.apiConfiguration);
2896 }
2897 catch (e) {
2898 var factoryError = new Error("ServiceClientFactory Error while initializing ReminderManagementServiceClient: " + e.message);
2899 factoryError['name'] = 'ServiceClientFactoryError';
2900 throw factoryError;
2901 }
2902 };
2903 /*
2904 * Gets an instance of { timerManagement.TimerManagementService }.
2905 * @returns { timerManagement.TimerManagementService }
2906 */
2907 ServiceClientFactory.prototype.getTimerManagementServiceClient = function () {
2908 try {
2909 return new services.timerManagement.TimerManagementServiceClient(this.apiConfiguration);
2910 }
2911 catch (e) {
2912 var factoryError = new Error("ServiceClientFactory Error while initializing TimerManagementServiceClient: " + e.message);
2913 factoryError['name'] = 'ServiceClientFactoryError';
2914 throw factoryError;
2915 }
2916 };
2917 /*
2918 * Gets an instance of { ups.UpsService }.
2919 * @returns { ups.UpsService }
2920 */
2921 ServiceClientFactory.prototype.getUpsServiceClient = function () {
2922 try {
2923 return new services.ups.UpsServiceClient(this.apiConfiguration);
2924 }
2925 catch (e) {
2926 var factoryError = new Error("ServiceClientFactory Error while initializing UpsServiceClient: " + e.message);
2927 factoryError['name'] = 'ServiceClientFactoryError';
2928 throw factoryError;
2929 }
2930 };
2931 return ServiceClientFactory;
2932 }());
2933 services.ServiceClientFactory = ServiceClientFactory;
2934})(services = exports.services || (exports.services = {}));
2935//# sourceMappingURL=index.js.map
\No newline at end of file