@unified-api/typescript-sdk 1.0.26 → 1.0.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/dist/sdk/channel.d.ts +15 -0
  2. package/dist/sdk/channel.js +213 -0
  3. package/dist/sdk/kms.d.ts +55 -0
  4. package/dist/sdk/kms.js +907 -0
  5. package/dist/sdk/message.d.ts +31 -0
  6. package/dist/sdk/message.js +505 -0
  7. package/dist/sdk/messaging.d.ts +39 -0
  8. package/dist/sdk/messaging.js +631 -0
  9. package/dist/sdk/models/operations/createkmspage.d.ts +28 -0
  10. package/dist/sdk/models/operations/createkmspage.js +95 -0
  11. package/dist/sdk/models/operations/createkmsspace.d.ts +28 -0
  12. package/dist/sdk/models/operations/createkmsspace.js +95 -0
  13. package/dist/sdk/models/operations/createmessagingmessage.d.ts +28 -0
  14. package/dist/sdk/models/operations/createmessagingmessage.js +95 -0
  15. package/dist/sdk/models/operations/getkmspage.d.ts +35 -0
  16. package/dist/sdk/models/operations/getkmspage.js +99 -0
  17. package/dist/sdk/models/operations/getkmsspace.d.ts +35 -0
  18. package/dist/sdk/models/operations/getkmsspace.js +99 -0
  19. package/dist/sdk/models/operations/getmessagingchannel.d.ts +35 -0
  20. package/dist/sdk/models/operations/getmessagingchannel.js +99 -0
  21. package/dist/sdk/models/operations/getmessagingmessage.d.ts +35 -0
  22. package/dist/sdk/models/operations/getmessagingmessage.js +99 -0
  23. package/dist/sdk/models/operations/getunifiedintegrationauth.d.ts +10 -1
  24. package/dist/sdk/models/operations/getunifiedintegrationauth.js +9 -0
  25. package/dist/sdk/models/operations/index.d.ts +20 -0
  26. package/dist/sdk/models/operations/index.js +20 -0
  27. package/dist/sdk/models/operations/listkmspages.d.ts +45 -0
  28. package/dist/sdk/models/operations/listkmspages.js +127 -0
  29. package/dist/sdk/models/operations/listkmsspaces.d.ts +44 -0
  30. package/dist/sdk/models/operations/listkmsspaces.js +123 -0
  31. package/dist/sdk/models/operations/listmessagingchannels.d.ts +43 -0
  32. package/dist/sdk/models/operations/listmessagingchannels.js +119 -0
  33. package/dist/sdk/models/operations/listmessagingmessages.d.ts +45 -0
  34. package/dist/sdk/models/operations/listmessagingmessages.js +127 -0
  35. package/dist/sdk/models/operations/listunifiedconnections.d.ts +3 -1
  36. package/dist/sdk/models/operations/listunifiedconnections.js +2 -0
  37. package/dist/sdk/models/operations/listunifiedintegrations.d.ts +3 -1
  38. package/dist/sdk/models/operations/listunifiedintegrations.js +2 -0
  39. package/dist/sdk/models/operations/listunifiedintegrationworkspaces.d.ts +3 -1
  40. package/dist/sdk/models/operations/listunifiedintegrationworkspaces.js +2 -0
  41. package/dist/sdk/models/operations/patchkmspage.d.ts +32 -0
  42. package/dist/sdk/models/operations/patchkmspage.js +99 -0
  43. package/dist/sdk/models/operations/patchkmsspace.d.ts +32 -0
  44. package/dist/sdk/models/operations/patchkmsspace.js +99 -0
  45. package/dist/sdk/models/operations/patchmessagingmessage.d.ts +32 -0
  46. package/dist/sdk/models/operations/patchmessagingmessage.js +99 -0
  47. package/dist/sdk/models/operations/removekmspage.d.ts +30 -0
  48. package/dist/sdk/models/operations/removekmspage.js +71 -0
  49. package/dist/sdk/models/operations/removekmsspace.d.ts +30 -0
  50. package/dist/sdk/models/operations/removekmsspace.js +71 -0
  51. package/dist/sdk/models/operations/removemessagingmessage.d.ts +30 -0
  52. package/dist/sdk/models/operations/removemessagingmessage.js +71 -0
  53. package/dist/sdk/models/operations/updatekmspage.d.ts +32 -0
  54. package/dist/sdk/models/operations/updatekmspage.js +99 -0
  55. package/dist/sdk/models/operations/updatekmsspace.d.ts +32 -0
  56. package/dist/sdk/models/operations/updatekmsspace.js +99 -0
  57. package/dist/sdk/models/operations/updatemessagingmessage.d.ts +32 -0
  58. package/dist/sdk/models/operations/updatemessagingmessage.js +99 -0
  59. package/dist/sdk/models/shared/atsactivity.d.ts +3 -0
  60. package/dist/sdk/models/shared/index.d.ts +6 -0
  61. package/dist/sdk/models/shared/index.js +6 -0
  62. package/dist/sdk/models/shared/integrationsupport.d.ts +3 -0
  63. package/dist/sdk/models/shared/integrationsupport.js +15 -0
  64. package/dist/sdk/models/shared/kmspage.d.ts +19 -0
  65. package/dist/sdk/models/shared/kmspage.js +109 -0
  66. package/dist/sdk/models/shared/kmsspace.d.ts +12 -0
  67. package/dist/sdk/models/shared/kmsspace.js +93 -0
  68. package/dist/sdk/models/shared/messagingchannel.d.ts +16 -0
  69. package/dist/sdk/models/shared/messagingchannel.js +106 -0
  70. package/dist/sdk/models/shared/messagingmember.d.ts +6 -0
  71. package/dist/sdk/models/shared/messagingmember.js +55 -0
  72. package/dist/sdk/models/shared/messagingmessage.d.ts +18 -0
  73. package/dist/sdk/models/shared/messagingmessage.js +111 -0
  74. package/dist/sdk/models/shared/propertyconnectioncategories.d.ts +3 -1
  75. package/dist/sdk/models/shared/propertyconnectioncategories.js +2 -0
  76. package/dist/sdk/models/shared/propertyconnectionpermissions.d.ts +10 -1
  77. package/dist/sdk/models/shared/propertyconnectionpermissions.js +9 -0
  78. package/dist/sdk/models/shared/propertyintegrationcategories.d.ts +3 -1
  79. package/dist/sdk/models/shared/propertyintegrationcategories.js +2 -0
  80. package/dist/sdk/models/shared/propertymessagingmessageauthormember.d.ts +6 -0
  81. package/dist/sdk/models/shared/propertymessagingmessageauthormember.js +55 -0
  82. package/dist/sdk/models/shared/webhook.d.ts +5 -1
  83. package/dist/sdk/models/shared/webhook.js +4 -0
  84. package/dist/sdk/page.d.ts +31 -0
  85. package/dist/sdk/page.js +505 -0
  86. package/dist/sdk/sdk.d.ts +12 -0
  87. package/dist/sdk/sdk.js +14 -2
  88. package/dist/sdk/space.d.ts +31 -0
  89. package/dist/sdk/space.js +505 -0
  90. package/docs/sdk/models/operations/categories.md +3 -1
  91. package/docs/sdk/models/operations/createkmspagerequest.md +9 -0
  92. package/docs/sdk/models/operations/createkmspageresponse.md +11 -0
  93. package/docs/sdk/models/operations/createkmsspacerequest.md +9 -0
  94. package/docs/sdk/models/operations/createkmsspaceresponse.md +11 -0
  95. package/docs/sdk/models/operations/createmessagingmessagerequest.md +9 -0
  96. package/docs/sdk/models/operations/createmessagingmessageresponse.md +11 -0
  97. package/docs/sdk/models/operations/getkmspagerequest.md +10 -0
  98. package/docs/sdk/models/operations/getkmspageresponse.md +11 -0
  99. package/docs/sdk/models/operations/getkmsspacerequest.md +10 -0
  100. package/docs/sdk/models/operations/getkmsspaceresponse.md +11 -0
  101. package/docs/sdk/models/operations/getmessagingchannelrequest.md +10 -0
  102. package/docs/sdk/models/operations/getmessagingchannelresponse.md +11 -0
  103. package/docs/sdk/models/operations/getmessagingmessagerequest.md +10 -0
  104. package/docs/sdk/models/operations/getmessagingmessageresponse.md +11 -0
  105. package/docs/sdk/models/operations/listkmspagesrequest.md +17 -0
  106. package/docs/sdk/models/operations/listkmspagesresponse.md +11 -0
  107. package/docs/sdk/models/operations/listkmsspacesrequest.md +16 -0
  108. package/docs/sdk/models/operations/listkmsspacesresponse.md +11 -0
  109. package/docs/sdk/models/operations/listmessagingchannelsrequest.md +15 -0
  110. package/docs/sdk/models/operations/listmessagingchannelsresponse.md +11 -0
  111. package/docs/sdk/models/operations/listmessagingmessagesrequest.md +17 -0
  112. package/docs/sdk/models/operations/listmessagingmessagesresponse.md +11 -0
  113. package/docs/sdk/models/operations/listunifiedintegrationsqueryparamcategories.md +3 -1
  114. package/docs/sdk/models/operations/patchkmspagerequest.md +10 -0
  115. package/docs/sdk/models/operations/patchkmspageresponse.md +11 -0
  116. package/docs/sdk/models/operations/patchkmsspacerequest.md +10 -0
  117. package/docs/sdk/models/operations/patchkmsspaceresponse.md +11 -0
  118. package/docs/sdk/models/operations/patchmessagingmessagerequest.md +10 -0
  119. package/docs/sdk/models/operations/patchmessagingmessageresponse.md +11 -0
  120. package/docs/sdk/models/operations/queryparamcategories.md +3 -1
  121. package/docs/sdk/models/operations/removekmspagerequest.md +9 -0
  122. package/docs/sdk/models/operations/removekmspageresponse.md +11 -0
  123. package/docs/sdk/models/operations/removekmsspacerequest.md +9 -0
  124. package/docs/sdk/models/operations/removekmsspaceresponse.md +11 -0
  125. package/docs/sdk/models/operations/removemessagingmessagerequest.md +9 -0
  126. package/docs/sdk/models/operations/removemessagingmessageresponse.md +11 -0
  127. package/docs/sdk/models/operations/scopes.md +10 -1
  128. package/docs/sdk/models/operations/updatekmspagerequest.md +10 -0
  129. package/docs/sdk/models/operations/updatekmspageresponse.md +11 -0
  130. package/docs/sdk/models/operations/updatekmsspacerequest.md +10 -0
  131. package/docs/sdk/models/operations/updatekmsspaceresponse.md +11 -0
  132. package/docs/sdk/models/operations/updatemessagingmessagerequest.md +10 -0
  133. package/docs/sdk/models/operations/updatemessagingmessageresponse.md +11 -0
  134. package/docs/sdk/models/shared/atsactivity.md +1 -1
  135. package/docs/sdk/models/shared/integrationsupport.md +3 -0
  136. package/docs/sdk/models/shared/kmspage.md +18 -0
  137. package/docs/sdk/models/shared/kmspagetype.md +10 -0
  138. package/docs/sdk/models/shared/kmsspace.md +16 -0
  139. package/docs/sdk/models/shared/messagingchannel.md +19 -0
  140. package/docs/sdk/models/shared/messagingmember.md +10 -0
  141. package/docs/sdk/models/shared/messagingmessage.md +20 -0
  142. package/docs/sdk/models/shared/objecttype.md +5 -1
  143. package/docs/sdk/models/shared/propertyconnectioncategories.md +3 -1
  144. package/docs/sdk/models/shared/propertyconnectionpermissions.md +10 -1
  145. package/docs/sdk/models/shared/propertyintegrationcategories.md +3 -1
  146. package/docs/sdk/models/shared/propertymessagingmessageauthormember.md +10 -0
  147. package/package.json +1 -1
@@ -0,0 +1,907 @@
1
+ "use strict";
2
+ /*
3
+ * Code generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
4
+ */
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ var desc = Object.getOwnPropertyDescriptor(m, k);
19
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
20
+ desc = { enumerable: true, get: function() { return m[k]; } };
21
+ }
22
+ Object.defineProperty(o, k2, desc);
23
+ }) : (function(o, m, k, k2) {
24
+ if (k2 === undefined) k2 = k;
25
+ o[k2] = m[k];
26
+ }));
27
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
28
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
29
+ }) : function(o, v) {
30
+ o["default"] = v;
31
+ });
32
+ var __importStar = (this && this.__importStar) || function (mod) {
33
+ if (mod && mod.__esModule) return mod;
34
+ var result = {};
35
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
36
+ __setModuleDefault(result, mod);
37
+ return result;
38
+ };
39
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
40
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
41
+ return new (P || (P = Promise))(function (resolve, reject) {
42
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
43
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
44
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
45
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
46
+ });
47
+ };
48
+ var __generator = (this && this.__generator) || function (thisArg, body) {
49
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
50
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
51
+ function verb(n) { return function (v) { return step([n, v]); }; }
52
+ function step(op) {
53
+ if (f) throw new TypeError("Generator is already executing.");
54
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
55
+ 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;
56
+ if (y = 0, t) op = [op[0] & 2, t.value];
57
+ switch (op[0]) {
58
+ case 0: case 1: t = op; break;
59
+ case 4: _.label++; return { value: op[1], done: false };
60
+ case 5: _.label++; y = op[1]; op = [0]; continue;
61
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
62
+ default:
63
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
64
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
65
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
66
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
67
+ if (t[2]) _.ops.pop();
68
+ _.trys.pop(); continue;
69
+ }
70
+ op = body.call(thisArg, _);
71
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
72
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
73
+ }
74
+ };
75
+ var __read = (this && this.__read) || function (o, n) {
76
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
77
+ if (!m) return o;
78
+ var i = m.call(o), r, ar = [], e;
79
+ try {
80
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
81
+ }
82
+ catch (error) { e = { error: error }; }
83
+ finally {
84
+ try {
85
+ if (r && !r.done && (m = i["return"])) m.call(i);
86
+ }
87
+ finally { if (e) throw e.error; }
88
+ }
89
+ return ar;
90
+ };
91
+ Object.defineProperty(exports, "__esModule", { value: true });
92
+ exports.Kms = void 0;
93
+ var utils = __importStar(require("../internal/utils"));
94
+ var errors = __importStar(require("../sdk/models/errors"));
95
+ var operations = __importStar(require("../sdk/models/operations"));
96
+ var shared = __importStar(require("../sdk/models/shared"));
97
+ var Kms = /** @class */ (function () {
98
+ function Kms(sdkConfig) {
99
+ this.sdkConfiguration = sdkConfig;
100
+ }
101
+ /**
102
+ * Create a page
103
+ */
104
+ Kms.prototype.createKmsPage = function (req, config) {
105
+ var _a, _b;
106
+ return __awaiter(this, void 0, void 0, function () {
107
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
108
+ var _d;
109
+ return __generator(this, function (_e) {
110
+ switch (_e.label) {
111
+ case 0:
112
+ if (!(req instanceof utils.SpeakeasyBase)) {
113
+ req = new operations.CreateKmsPageRequest(req);
114
+ }
115
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
116
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/page", req);
117
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
118
+ try {
119
+ _d = __read(utils.serializeRequestBody(req, "kmsPage", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
120
+ }
121
+ catch (e) {
122
+ if (e instanceof Error) {
123
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
124
+ }
125
+ }
126
+ client = this.sdkConfiguration.defaultClient;
127
+ globalSecurity = this.sdkConfiguration.security;
128
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
129
+ return [4 /*yield*/, globalSecurity()];
130
+ case 1:
131
+ globalSecurity = _e.sent();
132
+ _e.label = 2;
133
+ case 2:
134
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
135
+ globalSecurity = new shared.Security(globalSecurity);
136
+ }
137
+ properties = utils.parseSecurityProperties(globalSecurity);
138
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
139
+ headers["Accept"] = "application/json";
140
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
141
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
142
+ case 3:
143
+ httpRes = _e.sent();
144
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
145
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
146
+ throw new Error("status code not found in response: ".concat(httpRes));
147
+ }
148
+ res = new operations.CreateKmsPageResponse({
149
+ statusCode: httpRes.status,
150
+ contentType: responseContentType,
151
+ rawResponse: httpRes,
152
+ });
153
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
154
+ switch (true) {
155
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
156
+ if (utils.matchContentType(responseContentType, "application/json")) {
157
+ res.kmsPage = utils.objectToClass(JSON.parse(decodedRes), shared.KmsPage);
158
+ }
159
+ else {
160
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
161
+ }
162
+ break;
163
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
164
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
165
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
166
+ }
167
+ return [2 /*return*/, res];
168
+ }
169
+ });
170
+ });
171
+ };
172
+ /**
173
+ * Create a space
174
+ */
175
+ Kms.prototype.createKmsSpace = function (req, config) {
176
+ var _a, _b;
177
+ return __awaiter(this, void 0, void 0, function () {
178
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
179
+ var _d;
180
+ return __generator(this, function (_e) {
181
+ switch (_e.label) {
182
+ case 0:
183
+ if (!(req instanceof utils.SpeakeasyBase)) {
184
+ req = new operations.CreateKmsSpaceRequest(req);
185
+ }
186
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
187
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/space", req);
188
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
189
+ try {
190
+ _d = __read(utils.serializeRequestBody(req, "kmsSpace", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
191
+ }
192
+ catch (e) {
193
+ if (e instanceof Error) {
194
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
195
+ }
196
+ }
197
+ client = this.sdkConfiguration.defaultClient;
198
+ globalSecurity = this.sdkConfiguration.security;
199
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
200
+ return [4 /*yield*/, globalSecurity()];
201
+ case 1:
202
+ globalSecurity = _e.sent();
203
+ _e.label = 2;
204
+ case 2:
205
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
206
+ globalSecurity = new shared.Security(globalSecurity);
207
+ }
208
+ properties = utils.parseSecurityProperties(globalSecurity);
209
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
210
+ headers["Accept"] = "application/json";
211
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
212
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "post", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
213
+ case 3:
214
+ httpRes = _e.sent();
215
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
216
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
217
+ throw new Error("status code not found in response: ".concat(httpRes));
218
+ }
219
+ res = new operations.CreateKmsSpaceResponse({
220
+ statusCode: httpRes.status,
221
+ contentType: responseContentType,
222
+ rawResponse: httpRes,
223
+ });
224
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
225
+ switch (true) {
226
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
227
+ if (utils.matchContentType(responseContentType, "application/json")) {
228
+ res.kmsSpace = utils.objectToClass(JSON.parse(decodedRes), shared.KmsSpace);
229
+ }
230
+ else {
231
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
232
+ }
233
+ break;
234
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
235
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
236
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
237
+ }
238
+ return [2 /*return*/, res];
239
+ }
240
+ });
241
+ });
242
+ };
243
+ /**
244
+ * Retrieve a page
245
+ */
246
+ Kms.prototype.getKmsPage = function (req, config) {
247
+ var _a, _b;
248
+ return __awaiter(this, void 0, void 0, function () {
249
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
250
+ return __generator(this, function (_c) {
251
+ switch (_c.label) {
252
+ case 0:
253
+ if (!(req instanceof utils.SpeakeasyBase)) {
254
+ req = new operations.GetKmsPageRequest(req);
255
+ }
256
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
257
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/page/{id}", req);
258
+ client = this.sdkConfiguration.defaultClient;
259
+ globalSecurity = this.sdkConfiguration.security;
260
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
261
+ return [4 /*yield*/, globalSecurity()];
262
+ case 1:
263
+ globalSecurity = _c.sent();
264
+ _c.label = 2;
265
+ case 2:
266
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
267
+ globalSecurity = new shared.Security(globalSecurity);
268
+ }
269
+ properties = utils.parseSecurityProperties(globalSecurity);
270
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
271
+ queryParams = utils.serializeQueryParams(req);
272
+ headers["Accept"] = "application/json";
273
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
274
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
275
+ case 3:
276
+ httpRes = _c.sent();
277
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
278
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
279
+ throw new Error("status code not found in response: ".concat(httpRes));
280
+ }
281
+ res = new operations.GetKmsPageResponse({
282
+ statusCode: httpRes.status,
283
+ contentType: responseContentType,
284
+ rawResponse: httpRes,
285
+ });
286
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
287
+ switch (true) {
288
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
289
+ if (utils.matchContentType(responseContentType, "application/json")) {
290
+ res.kmsPage = utils.objectToClass(JSON.parse(decodedRes), shared.KmsPage);
291
+ }
292
+ else {
293
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
294
+ }
295
+ break;
296
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
297
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
298
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
299
+ }
300
+ return [2 /*return*/, res];
301
+ }
302
+ });
303
+ });
304
+ };
305
+ /**
306
+ * Retrieve a space
307
+ */
308
+ Kms.prototype.getKmsSpace = function (req, config) {
309
+ var _a, _b;
310
+ return __awaiter(this, void 0, void 0, function () {
311
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes;
312
+ return __generator(this, function (_c) {
313
+ switch (_c.label) {
314
+ case 0:
315
+ if (!(req instanceof utils.SpeakeasyBase)) {
316
+ req = new operations.GetKmsSpaceRequest(req);
317
+ }
318
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
319
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/space/{id}", req);
320
+ client = this.sdkConfiguration.defaultClient;
321
+ globalSecurity = this.sdkConfiguration.security;
322
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
323
+ return [4 /*yield*/, globalSecurity()];
324
+ case 1:
325
+ globalSecurity = _c.sent();
326
+ _c.label = 2;
327
+ case 2:
328
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
329
+ globalSecurity = new shared.Security(globalSecurity);
330
+ }
331
+ properties = utils.parseSecurityProperties(globalSecurity);
332
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
333
+ queryParams = utils.serializeQueryParams(req);
334
+ headers["Accept"] = "application/json";
335
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
336
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
337
+ case 3:
338
+ httpRes = _c.sent();
339
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
340
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
341
+ throw new Error("status code not found in response: ".concat(httpRes));
342
+ }
343
+ res = new operations.GetKmsSpaceResponse({
344
+ statusCode: httpRes.status,
345
+ contentType: responseContentType,
346
+ rawResponse: httpRes,
347
+ });
348
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
349
+ switch (true) {
350
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
351
+ if (utils.matchContentType(responseContentType, "application/json")) {
352
+ res.kmsSpace = utils.objectToClass(JSON.parse(decodedRes), shared.KmsSpace);
353
+ }
354
+ else {
355
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
356
+ }
357
+ break;
358
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
359
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
360
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
361
+ }
362
+ return [2 /*return*/, res];
363
+ }
364
+ });
365
+ });
366
+ };
367
+ /**
368
+ * List all pages
369
+ */
370
+ Kms.prototype.listKmsPages = function (req, config) {
371
+ var _a, _b;
372
+ return __awaiter(this, void 0, void 0, function () {
373
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes, resFieldDepth;
374
+ return __generator(this, function (_c) {
375
+ switch (_c.label) {
376
+ case 0:
377
+ if (!(req instanceof utils.SpeakeasyBase)) {
378
+ req = new operations.ListKmsPagesRequest(req);
379
+ }
380
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
381
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/page", req);
382
+ client = this.sdkConfiguration.defaultClient;
383
+ globalSecurity = this.sdkConfiguration.security;
384
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
385
+ return [4 /*yield*/, globalSecurity()];
386
+ case 1:
387
+ globalSecurity = _c.sent();
388
+ _c.label = 2;
389
+ case 2:
390
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
391
+ globalSecurity = new shared.Security(globalSecurity);
392
+ }
393
+ properties = utils.parseSecurityProperties(globalSecurity);
394
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
395
+ queryParams = utils.serializeQueryParams(req);
396
+ headers["Accept"] = "application/json";
397
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
398
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
399
+ case 3:
400
+ httpRes = _c.sent();
401
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
402
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
403
+ throw new Error("status code not found in response: ".concat(httpRes));
404
+ }
405
+ res = new operations.ListKmsPagesResponse({
406
+ statusCode: httpRes.status,
407
+ contentType: responseContentType,
408
+ rawResponse: httpRes,
409
+ });
410
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
411
+ switch (true) {
412
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
413
+ if (utils.matchContentType(responseContentType, "application/json")) {
414
+ res.kmsPages = [];
415
+ resFieldDepth = utils.getResFieldDepth(res);
416
+ res.kmsPages = utils.objectToClass(JSON.parse(decodedRes), shared.KmsPage, resFieldDepth);
417
+ }
418
+ else {
419
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
420
+ }
421
+ break;
422
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
423
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
424
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
425
+ }
426
+ return [2 /*return*/, res];
427
+ }
428
+ });
429
+ });
430
+ };
431
+ /**
432
+ * List all spaces
433
+ */
434
+ Kms.prototype.listKmsSpaces = function (req, config) {
435
+ var _a, _b;
436
+ return __awaiter(this, void 0, void 0, function () {
437
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, queryParams, httpRes, responseContentType, res, decodedRes, resFieldDepth;
438
+ return __generator(this, function (_c) {
439
+ switch (_c.label) {
440
+ case 0:
441
+ if (!(req instanceof utils.SpeakeasyBase)) {
442
+ req = new operations.ListKmsSpacesRequest(req);
443
+ }
444
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
445
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/space", req);
446
+ client = this.sdkConfiguration.defaultClient;
447
+ globalSecurity = this.sdkConfiguration.security;
448
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
449
+ return [4 /*yield*/, globalSecurity()];
450
+ case 1:
451
+ globalSecurity = _c.sent();
452
+ _c.label = 2;
453
+ case 2:
454
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
455
+ globalSecurity = new shared.Security(globalSecurity);
456
+ }
457
+ properties = utils.parseSecurityProperties(globalSecurity);
458
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
459
+ queryParams = utils.serializeQueryParams(req);
460
+ headers["Accept"] = "application/json";
461
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
462
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl + queryParams, method: "get", headers: headers, responseType: "arraybuffer" }, config))];
463
+ case 3:
464
+ httpRes = _c.sent();
465
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
466
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
467
+ throw new Error("status code not found in response: ".concat(httpRes));
468
+ }
469
+ res = new operations.ListKmsSpacesResponse({
470
+ statusCode: httpRes.status,
471
+ contentType: responseContentType,
472
+ rawResponse: httpRes,
473
+ });
474
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
475
+ switch (true) {
476
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
477
+ if (utils.matchContentType(responseContentType, "application/json")) {
478
+ res.kmsSpaces = [];
479
+ resFieldDepth = utils.getResFieldDepth(res);
480
+ res.kmsSpaces = utils.objectToClass(JSON.parse(decodedRes), shared.KmsSpace, resFieldDepth);
481
+ }
482
+ else {
483
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
484
+ }
485
+ break;
486
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
487
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
488
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
489
+ }
490
+ return [2 /*return*/, res];
491
+ }
492
+ });
493
+ });
494
+ };
495
+ /**
496
+ * Update a page
497
+ */
498
+ Kms.prototype.patchKmsPage = function (req, config) {
499
+ var _a, _b;
500
+ return __awaiter(this, void 0, void 0, function () {
501
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
502
+ var _d;
503
+ return __generator(this, function (_e) {
504
+ switch (_e.label) {
505
+ case 0:
506
+ if (!(req instanceof utils.SpeakeasyBase)) {
507
+ req = new operations.PatchKmsPageRequest(req);
508
+ }
509
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
510
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/page/{id}", req);
511
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
512
+ try {
513
+ _d = __read(utils.serializeRequestBody(req, "kmsPage", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
514
+ }
515
+ catch (e) {
516
+ if (e instanceof Error) {
517
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
518
+ }
519
+ }
520
+ client = this.sdkConfiguration.defaultClient;
521
+ globalSecurity = this.sdkConfiguration.security;
522
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
523
+ return [4 /*yield*/, globalSecurity()];
524
+ case 1:
525
+ globalSecurity = _e.sent();
526
+ _e.label = 2;
527
+ case 2:
528
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
529
+ globalSecurity = new shared.Security(globalSecurity);
530
+ }
531
+ properties = utils.parseSecurityProperties(globalSecurity);
532
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
533
+ headers["Accept"] = "application/json";
534
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
535
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "patch", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
536
+ case 3:
537
+ httpRes = _e.sent();
538
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
539
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
540
+ throw new Error("status code not found in response: ".concat(httpRes));
541
+ }
542
+ res = new operations.PatchKmsPageResponse({
543
+ statusCode: httpRes.status,
544
+ contentType: responseContentType,
545
+ rawResponse: httpRes,
546
+ });
547
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
548
+ switch (true) {
549
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
550
+ if (utils.matchContentType(responseContentType, "application/json")) {
551
+ res.kmsPage = utils.objectToClass(JSON.parse(decodedRes), shared.KmsPage);
552
+ }
553
+ else {
554
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
555
+ }
556
+ break;
557
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
558
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
559
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
560
+ }
561
+ return [2 /*return*/, res];
562
+ }
563
+ });
564
+ });
565
+ };
566
+ /**
567
+ * Update a space
568
+ */
569
+ Kms.prototype.patchKmsSpace = function (req, config) {
570
+ var _a, _b;
571
+ return __awaiter(this, void 0, void 0, function () {
572
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
573
+ var _d;
574
+ return __generator(this, function (_e) {
575
+ switch (_e.label) {
576
+ case 0:
577
+ if (!(req instanceof utils.SpeakeasyBase)) {
578
+ req = new operations.PatchKmsSpaceRequest(req);
579
+ }
580
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
581
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/space/{id}", req);
582
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
583
+ try {
584
+ _d = __read(utils.serializeRequestBody(req, "kmsSpace", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
585
+ }
586
+ catch (e) {
587
+ if (e instanceof Error) {
588
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
589
+ }
590
+ }
591
+ client = this.sdkConfiguration.defaultClient;
592
+ globalSecurity = this.sdkConfiguration.security;
593
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
594
+ return [4 /*yield*/, globalSecurity()];
595
+ case 1:
596
+ globalSecurity = _e.sent();
597
+ _e.label = 2;
598
+ case 2:
599
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
600
+ globalSecurity = new shared.Security(globalSecurity);
601
+ }
602
+ properties = utils.parseSecurityProperties(globalSecurity);
603
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
604
+ headers["Accept"] = "application/json";
605
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
606
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "patch", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
607
+ case 3:
608
+ httpRes = _e.sent();
609
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
610
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
611
+ throw new Error("status code not found in response: ".concat(httpRes));
612
+ }
613
+ res = new operations.PatchKmsSpaceResponse({
614
+ statusCode: httpRes.status,
615
+ contentType: responseContentType,
616
+ rawResponse: httpRes,
617
+ });
618
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
619
+ switch (true) {
620
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
621
+ if (utils.matchContentType(responseContentType, "application/json")) {
622
+ res.kmsSpace = utils.objectToClass(JSON.parse(decodedRes), shared.KmsSpace);
623
+ }
624
+ else {
625
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
626
+ }
627
+ break;
628
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
629
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
630
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
631
+ }
632
+ return [2 /*return*/, res];
633
+ }
634
+ });
635
+ });
636
+ };
637
+ /**
638
+ * Remove a page
639
+ */
640
+ Kms.prototype.removeKmsPage = function (req, config) {
641
+ var _a, _b;
642
+ return __awaiter(this, void 0, void 0, function () {
643
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
644
+ return __generator(this, function (_c) {
645
+ switch (_c.label) {
646
+ case 0:
647
+ if (!(req instanceof utils.SpeakeasyBase)) {
648
+ req = new operations.RemoveKmsPageRequest(req);
649
+ }
650
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
651
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/page/{id}", req);
652
+ client = this.sdkConfiguration.defaultClient;
653
+ globalSecurity = this.sdkConfiguration.security;
654
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
655
+ return [4 /*yield*/, globalSecurity()];
656
+ case 1:
657
+ globalSecurity = _c.sent();
658
+ _c.label = 2;
659
+ case 2:
660
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
661
+ globalSecurity = new shared.Security(globalSecurity);
662
+ }
663
+ properties = utils.parseSecurityProperties(globalSecurity);
664
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
665
+ headers["Accept"] = "application/json";
666
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
667
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
668
+ case 3:
669
+ httpRes = _c.sent();
670
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
671
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
672
+ throw new Error("status code not found in response: ".concat(httpRes));
673
+ }
674
+ res = new operations.RemoveKmsPageResponse({
675
+ statusCode: httpRes.status,
676
+ contentType: responseContentType,
677
+ rawResponse: httpRes,
678
+ });
679
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
680
+ switch (true) {
681
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 200 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 300:
682
+ break;
683
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
684
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
685
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
686
+ default:
687
+ if (utils.matchContentType(responseContentType, "application/json")) {
688
+ res.string = JSON.parse(decodedRes);
689
+ }
690
+ else {
691
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
692
+ }
693
+ break;
694
+ }
695
+ return [2 /*return*/, res];
696
+ }
697
+ });
698
+ });
699
+ };
700
+ /**
701
+ * Remove a space
702
+ */
703
+ Kms.prototype.removeKmsSpace = function (req, config) {
704
+ var _a, _b;
705
+ return __awaiter(this, void 0, void 0, function () {
706
+ var baseURL, operationUrl, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
707
+ return __generator(this, function (_c) {
708
+ switch (_c.label) {
709
+ case 0:
710
+ if (!(req instanceof utils.SpeakeasyBase)) {
711
+ req = new operations.RemoveKmsSpaceRequest(req);
712
+ }
713
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
714
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/space/{id}", req);
715
+ client = this.sdkConfiguration.defaultClient;
716
+ globalSecurity = this.sdkConfiguration.security;
717
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
718
+ return [4 /*yield*/, globalSecurity()];
719
+ case 1:
720
+ globalSecurity = _c.sent();
721
+ _c.label = 2;
722
+ case 2:
723
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
724
+ globalSecurity = new shared.Security(globalSecurity);
725
+ }
726
+ properties = utils.parseSecurityProperties(globalSecurity);
727
+ headers = __assign(__assign({}, config === null || config === void 0 ? void 0 : config.headers), properties.headers);
728
+ headers["Accept"] = "application/json";
729
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
730
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "delete", headers: headers, responseType: "arraybuffer" }, config))];
731
+ case 3:
732
+ httpRes = _c.sent();
733
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
734
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
735
+ throw new Error("status code not found in response: ".concat(httpRes));
736
+ }
737
+ res = new operations.RemoveKmsSpaceResponse({
738
+ statusCode: httpRes.status,
739
+ contentType: responseContentType,
740
+ rawResponse: httpRes,
741
+ });
742
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
743
+ switch (true) {
744
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 200 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 300:
745
+ break;
746
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
747
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
748
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
749
+ default:
750
+ if (utils.matchContentType(responseContentType, "application/json")) {
751
+ res.string = JSON.parse(decodedRes);
752
+ }
753
+ else {
754
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
755
+ }
756
+ break;
757
+ }
758
+ return [2 /*return*/, res];
759
+ }
760
+ });
761
+ });
762
+ };
763
+ /**
764
+ * Update a page
765
+ */
766
+ Kms.prototype.updateKmsPage = function (req, config) {
767
+ var _a, _b;
768
+ return __awaiter(this, void 0, void 0, function () {
769
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
770
+ var _d;
771
+ return __generator(this, function (_e) {
772
+ switch (_e.label) {
773
+ case 0:
774
+ if (!(req instanceof utils.SpeakeasyBase)) {
775
+ req = new operations.UpdateKmsPageRequest(req);
776
+ }
777
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
778
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/page/{id}", req);
779
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
780
+ try {
781
+ _d = __read(utils.serializeRequestBody(req, "kmsPage", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
782
+ }
783
+ catch (e) {
784
+ if (e instanceof Error) {
785
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
786
+ }
787
+ }
788
+ client = this.sdkConfiguration.defaultClient;
789
+ globalSecurity = this.sdkConfiguration.security;
790
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
791
+ return [4 /*yield*/, globalSecurity()];
792
+ case 1:
793
+ globalSecurity = _e.sent();
794
+ _e.label = 2;
795
+ case 2:
796
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
797
+ globalSecurity = new shared.Security(globalSecurity);
798
+ }
799
+ properties = utils.parseSecurityProperties(globalSecurity);
800
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
801
+ headers["Accept"] = "application/json";
802
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
803
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
804
+ case 3:
805
+ httpRes = _e.sent();
806
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
807
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
808
+ throw new Error("status code not found in response: ".concat(httpRes));
809
+ }
810
+ res = new operations.UpdateKmsPageResponse({
811
+ statusCode: httpRes.status,
812
+ contentType: responseContentType,
813
+ rawResponse: httpRes,
814
+ });
815
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
816
+ switch (true) {
817
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
818
+ if (utils.matchContentType(responseContentType, "application/json")) {
819
+ res.kmsPage = utils.objectToClass(JSON.parse(decodedRes), shared.KmsPage);
820
+ }
821
+ else {
822
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
823
+ }
824
+ break;
825
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
826
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
827
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
828
+ }
829
+ return [2 /*return*/, res];
830
+ }
831
+ });
832
+ });
833
+ };
834
+ /**
835
+ * Update a space
836
+ */
837
+ Kms.prototype.updateKmsSpace = function (req, config) {
838
+ var _a, _b;
839
+ return __awaiter(this, void 0, void 0, function () {
840
+ var baseURL, operationUrl, _c, reqBodyHeaders, reqBody, client, globalSecurity, properties, headers, httpRes, responseContentType, res, decodedRes;
841
+ var _d;
842
+ return __generator(this, function (_e) {
843
+ switch (_e.label) {
844
+ case 0:
845
+ if (!(req instanceof utils.SpeakeasyBase)) {
846
+ req = new operations.UpdateKmsSpaceRequest(req);
847
+ }
848
+ baseURL = utils.templateUrl(this.sdkConfiguration.serverURL, this.sdkConfiguration.serverDefaults);
849
+ operationUrl = utils.generateURL(baseURL, "/kms/{connection_id}/space/{id}", req);
850
+ _c = __read([{}, null], 2), reqBodyHeaders = _c[0], reqBody = _c[1];
851
+ try {
852
+ _d = __read(utils.serializeRequestBody(req, "kmsSpace", "json"), 2), reqBodyHeaders = _d[0], reqBody = _d[1];
853
+ }
854
+ catch (e) {
855
+ if (e instanceof Error) {
856
+ throw new Error("Error serializing request body, cause: ".concat(e.message));
857
+ }
858
+ }
859
+ client = this.sdkConfiguration.defaultClient;
860
+ globalSecurity = this.sdkConfiguration.security;
861
+ if (!(typeof globalSecurity === "function")) return [3 /*break*/, 2];
862
+ return [4 /*yield*/, globalSecurity()];
863
+ case 1:
864
+ globalSecurity = _e.sent();
865
+ _e.label = 2;
866
+ case 2:
867
+ if (!(globalSecurity instanceof utils.SpeakeasyBase)) {
868
+ globalSecurity = new shared.Security(globalSecurity);
869
+ }
870
+ properties = utils.parseSecurityProperties(globalSecurity);
871
+ headers = __assign(__assign(__assign({}, reqBodyHeaders), config === null || config === void 0 ? void 0 : config.headers), properties.headers);
872
+ headers["Accept"] = "application/json";
873
+ headers["user-agent"] = this.sdkConfiguration.userAgent;
874
+ return [4 /*yield*/, client.request(__assign({ validateStatus: function () { return true; }, url: operationUrl, method: "put", headers: headers, responseType: "arraybuffer", data: reqBody }, config))];
875
+ case 3:
876
+ httpRes = _e.sent();
877
+ responseContentType = (_b = (_a = httpRes === null || httpRes === void 0 ? void 0 : httpRes.headers) === null || _a === void 0 ? void 0 : _a["content-type"]) !== null && _b !== void 0 ? _b : "";
878
+ if ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == null) {
879
+ throw new Error("status code not found in response: ".concat(httpRes));
880
+ }
881
+ res = new operations.UpdateKmsSpaceResponse({
882
+ statusCode: httpRes.status,
883
+ contentType: responseContentType,
884
+ rawResponse: httpRes,
885
+ });
886
+ decodedRes = new TextDecoder().decode(httpRes === null || httpRes === void 0 ? void 0 : httpRes.data);
887
+ switch (true) {
888
+ case (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) == 200:
889
+ if (utils.matchContentType(responseContentType, "application/json")) {
890
+ res.kmsSpace = utils.objectToClass(JSON.parse(decodedRes), shared.KmsSpace);
891
+ }
892
+ else {
893
+ throw new errors.SDKError("unknown content-type received: " + responseContentType, httpRes.status, decodedRes, httpRes);
894
+ }
895
+ break;
896
+ case ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 400 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 500) ||
897
+ ((httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) >= 500 && (httpRes === null || httpRes === void 0 ? void 0 : httpRes.status) < 600):
898
+ throw new errors.SDKError("API error occurred", httpRes.status, decodedRes, httpRes);
899
+ }
900
+ return [2 /*return*/, res];
901
+ }
902
+ });
903
+ });
904
+ };
905
+ return Kms;
906
+ }());
907
+ exports.Kms = Kms;