@oumla/sdk 0.0.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +266 -9
- package/dist/index.cjs +4091 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2229 -445
- package/dist/index.js +3815 -3748
- package/dist/index.js.map +1 -0
- package/package.json +57 -22
- package/.changeset/README.md +0 -8
- package/.changeset/config.json +0 -11
- package/.prettierrc +0 -7
- package/dist/index.mjs +0 -3992
- package/tsconfig.json +0 -12
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,4091 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __export = (target, all) => {
|
|
5
|
+
for (var name in all)
|
|
6
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
// api/index.ts
|
|
10
|
+
var api_exports = {};
|
|
11
|
+
__export(api_exports, {
|
|
12
|
+
BadRequestError: () => BadRequestError,
|
|
13
|
+
GetDeployedContractsRequestNetwork: () => GetDeployedContractsRequestNetwork,
|
|
14
|
+
addresses: () => addresses_exports,
|
|
15
|
+
assets: () => assets_exports,
|
|
16
|
+
contractInteractions: () => contractInteractions_exports,
|
|
17
|
+
contractTemplates: () => contractTemplates_exports,
|
|
18
|
+
deployedContracts: () => deployedContracts_exports,
|
|
19
|
+
profiles: () => profiles_exports,
|
|
20
|
+
tokenization: () => tokenization_exports,
|
|
21
|
+
transactions: () => transactions_exports,
|
|
22
|
+
wallets: () => wallets_exports,
|
|
23
|
+
withdrawals: () => withdrawals_exports
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
// api/resources/deployedContracts/index.ts
|
|
27
|
+
var deployedContracts_exports = {};
|
|
28
|
+
__export(deployedContracts_exports, {
|
|
29
|
+
GetDeployedContractsRequestNetwork: () => GetDeployedContractsRequestNetwork
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
// api/resources/deployedContracts/types/GetDeployedContractsRequestNetwork.ts
|
|
33
|
+
var GetDeployedContractsRequestNetwork = {
|
|
34
|
+
TBtc: "tBTC",
|
|
35
|
+
TEth: "tETH"
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
// api/resources/profiles/index.ts
|
|
39
|
+
var profiles_exports = {};
|
|
40
|
+
|
|
41
|
+
// api/resources/profiles/client/requests/CreateProfileRequest.ts
|
|
42
|
+
var CreateProfileRequest;
|
|
43
|
+
((CreateProfileRequest2) => {
|
|
44
|
+
CreateProfileRequest2.Type = {
|
|
45
|
+
User: "User",
|
|
46
|
+
Department: "Department",
|
|
47
|
+
Merchant: "Merchant"
|
|
48
|
+
};
|
|
49
|
+
})(CreateProfileRequest || (CreateProfileRequest = {}));
|
|
50
|
+
|
|
51
|
+
// api/resources/wallets/index.ts
|
|
52
|
+
var wallets_exports = {};
|
|
53
|
+
|
|
54
|
+
// api/resources/wallets/client/requests/CreateWalletRequest.ts
|
|
55
|
+
var CreateWalletRequest;
|
|
56
|
+
((CreateWalletRequest2) => {
|
|
57
|
+
CreateWalletRequest2.Network = {
|
|
58
|
+
TBtc: "tBTC",
|
|
59
|
+
TEth: "tETH"
|
|
60
|
+
};
|
|
61
|
+
})(CreateWalletRequest || (CreateWalletRequest = {}));
|
|
62
|
+
|
|
63
|
+
// api/resources/addresses/index.ts
|
|
64
|
+
var addresses_exports = {};
|
|
65
|
+
|
|
66
|
+
// api/resources/addresses/client/requests/CreateAddressRequest.ts
|
|
67
|
+
var CreateAddressRequest;
|
|
68
|
+
((CreateAddressRequest2) => {
|
|
69
|
+
CreateAddressRequest2.Network = {
|
|
70
|
+
TBtc: "tBTC",
|
|
71
|
+
TEth: "tETH"
|
|
72
|
+
};
|
|
73
|
+
})(CreateAddressRequest || (CreateAddressRequest = {}));
|
|
74
|
+
|
|
75
|
+
// api/resources/transactions/index.ts
|
|
76
|
+
var transactions_exports = {};
|
|
77
|
+
|
|
78
|
+
// api/resources/assets/index.ts
|
|
79
|
+
var assets_exports = {};
|
|
80
|
+
|
|
81
|
+
// api/resources/withdrawals/index.ts
|
|
82
|
+
var withdrawals_exports = {};
|
|
83
|
+
|
|
84
|
+
// api/resources/withdrawals/client/requests/CreateWithdrawalRequest.ts
|
|
85
|
+
var CreateWithdrawalRequest;
|
|
86
|
+
((CreateWithdrawalRequest2) => {
|
|
87
|
+
CreateWithdrawalRequest2.Network = {
|
|
88
|
+
TBtc: "tBTC",
|
|
89
|
+
TEth: "tETH"
|
|
90
|
+
};
|
|
91
|
+
})(CreateWithdrawalRequest || (CreateWithdrawalRequest = {}));
|
|
92
|
+
|
|
93
|
+
// api/resources/contractTemplates/index.ts
|
|
94
|
+
var contractTemplates_exports = {};
|
|
95
|
+
|
|
96
|
+
// api/resources/contractTemplates/client/requests/CreateContractTemplateRequest.ts
|
|
97
|
+
var CreateContractTemplateRequest;
|
|
98
|
+
((CreateContractTemplateRequest2) => {
|
|
99
|
+
((Docs2) => {
|
|
100
|
+
Docs2.Kind = {
|
|
101
|
+
Dev: "dev",
|
|
102
|
+
User: "user"
|
|
103
|
+
};
|
|
104
|
+
})(CreateContractTemplateRequest2.Docs || (CreateContractTemplateRequest2.Docs = {}));
|
|
105
|
+
})(CreateContractTemplateRequest || (CreateContractTemplateRequest = {}));
|
|
106
|
+
|
|
107
|
+
// api/resources/contractInteractions/index.ts
|
|
108
|
+
var contractInteractions_exports = {};
|
|
109
|
+
|
|
110
|
+
// api/resources/contractInteractions/client/requests/WriteFunctionRequest.ts
|
|
111
|
+
var WriteFunctionRequest;
|
|
112
|
+
((WriteFunctionRequest2) => {
|
|
113
|
+
WriteFunctionRequest2.FeeLevel = {
|
|
114
|
+
Low: "LOW",
|
|
115
|
+
Medium: "MEDIUM",
|
|
116
|
+
High: "HIGH"
|
|
117
|
+
};
|
|
118
|
+
})(WriteFunctionRequest || (WriteFunctionRequest = {}));
|
|
119
|
+
|
|
120
|
+
// api/resources/tokenization/index.ts
|
|
121
|
+
var tokenization_exports = {};
|
|
122
|
+
|
|
123
|
+
// api/resources/tokenization/client/requests/CreateCollectionRequest.ts
|
|
124
|
+
var CreateCollectionRequest;
|
|
125
|
+
((CreateCollectionRequest2) => {
|
|
126
|
+
CreateCollectionRequest2.Type = {
|
|
127
|
+
NonFungibleToken: "NON_FUNGIBLE_TOKEN",
|
|
128
|
+
SemiFungibleToken: "SEMI_FUNGIBLE_TOKEN"
|
|
129
|
+
};
|
|
130
|
+
})(CreateCollectionRequest || (CreateCollectionRequest = {}));
|
|
131
|
+
|
|
132
|
+
// core/json.ts
|
|
133
|
+
var toJson = (value, replacer, space) => {
|
|
134
|
+
return JSON.stringify(value, replacer, space);
|
|
135
|
+
};
|
|
136
|
+
function fromJson(text, reviver) {
|
|
137
|
+
return JSON.parse(text, reviver);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// errors/OumlaSdkApiError.ts
|
|
141
|
+
var OumlaSdkApiError = class extends Error {
|
|
142
|
+
constructor({
|
|
143
|
+
message,
|
|
144
|
+
statusCode,
|
|
145
|
+
body,
|
|
146
|
+
rawResponse
|
|
147
|
+
}) {
|
|
148
|
+
super(buildMessage({ message, statusCode, body }));
|
|
149
|
+
Object.setPrototypeOf(this, OumlaSdkApiError.prototype);
|
|
150
|
+
this.statusCode = statusCode;
|
|
151
|
+
this.body = body;
|
|
152
|
+
this.rawResponse = rawResponse;
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
function buildMessage({
|
|
156
|
+
message,
|
|
157
|
+
statusCode,
|
|
158
|
+
body
|
|
159
|
+
}) {
|
|
160
|
+
let lines = [];
|
|
161
|
+
if (message != null) {
|
|
162
|
+
lines.push(message);
|
|
163
|
+
}
|
|
164
|
+
if (statusCode != null) {
|
|
165
|
+
lines.push(`Status code: ${statusCode.toString()}`);
|
|
166
|
+
}
|
|
167
|
+
if (body != null) {
|
|
168
|
+
lines.push(`Body: ${toJson(body, void 0, 2)}`);
|
|
169
|
+
}
|
|
170
|
+
return lines.join("\n");
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// errors/OumlaSdkApiTimeoutError.ts
|
|
174
|
+
var OumlaSdkApiTimeoutError = class extends Error {
|
|
175
|
+
constructor(message) {
|
|
176
|
+
super(message);
|
|
177
|
+
Object.setPrototypeOf(this, OumlaSdkApiTimeoutError.prototype);
|
|
178
|
+
}
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// api/errors/BadRequestError.ts
|
|
182
|
+
var BadRequestError = class extends OumlaSdkApiError {
|
|
183
|
+
constructor(body, rawResponse) {
|
|
184
|
+
super({
|
|
185
|
+
message: "BadRequestError",
|
|
186
|
+
statusCode: 400,
|
|
187
|
+
body,
|
|
188
|
+
rawResponse
|
|
189
|
+
});
|
|
190
|
+
Object.setPrototypeOf(this, BadRequestError.prototype);
|
|
191
|
+
}
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
// core/fetcher/EndpointSupplier.ts
|
|
195
|
+
var EndpointSupplier = {
|
|
196
|
+
get: async (supplier, arg) => {
|
|
197
|
+
if (typeof supplier === "function") {
|
|
198
|
+
return supplier(arg);
|
|
199
|
+
} else {
|
|
200
|
+
return supplier;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
// core/url/qs.ts
|
|
206
|
+
var defaultQsOptions = {
|
|
207
|
+
arrayFormat: "indices",
|
|
208
|
+
encode: true
|
|
209
|
+
};
|
|
210
|
+
function encodeValue(value, shouldEncode) {
|
|
211
|
+
if (value === void 0) {
|
|
212
|
+
return "";
|
|
213
|
+
}
|
|
214
|
+
if (value === null) {
|
|
215
|
+
return "";
|
|
216
|
+
}
|
|
217
|
+
const stringValue = String(value);
|
|
218
|
+
return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
|
|
219
|
+
}
|
|
220
|
+
function stringifyObject(obj, prefix = "", options) {
|
|
221
|
+
const parts = [];
|
|
222
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
223
|
+
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
224
|
+
if (value === void 0) {
|
|
225
|
+
continue;
|
|
226
|
+
}
|
|
227
|
+
if (Array.isArray(value)) {
|
|
228
|
+
if (value.length === 0) {
|
|
229
|
+
continue;
|
|
230
|
+
}
|
|
231
|
+
for (let i = 0; i < value.length; i++) {
|
|
232
|
+
const item = value[i];
|
|
233
|
+
if (item === void 0) {
|
|
234
|
+
continue;
|
|
235
|
+
}
|
|
236
|
+
if (typeof item === "object" && !Array.isArray(item) && item !== null) {
|
|
237
|
+
const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
238
|
+
parts.push(...stringifyObject(item, arrayKey, options));
|
|
239
|
+
} else {
|
|
240
|
+
const arrayKey = options.arrayFormat === "indices" ? `${fullKey}[${i}]` : fullKey;
|
|
241
|
+
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
242
|
+
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
} else if (typeof value === "object" && value !== null) {
|
|
246
|
+
if (Object.keys(value).length === 0) {
|
|
247
|
+
continue;
|
|
248
|
+
}
|
|
249
|
+
parts.push(...stringifyObject(value, fullKey, options));
|
|
250
|
+
} else {
|
|
251
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
252
|
+
parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
return parts;
|
|
256
|
+
}
|
|
257
|
+
function toQueryString(obj, options) {
|
|
258
|
+
if (obj == null || typeof obj !== "object") {
|
|
259
|
+
return "";
|
|
260
|
+
}
|
|
261
|
+
const parts = stringifyObject(obj, "", {
|
|
262
|
+
...defaultQsOptions,
|
|
263
|
+
...options
|
|
264
|
+
});
|
|
265
|
+
return parts.join("&");
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
// core/fetcher/createRequestUrl.ts
|
|
269
|
+
function createRequestUrl(baseUrl, queryParameters) {
|
|
270
|
+
const queryString = toQueryString(queryParameters, { arrayFormat: "repeat" });
|
|
271
|
+
return queryString ? `${baseUrl}?${queryString}` : baseUrl;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
// core/fetcher/BinaryResponse.ts
|
|
275
|
+
function getBinaryResponse(response) {
|
|
276
|
+
const binaryResponse = {
|
|
277
|
+
get bodyUsed() {
|
|
278
|
+
return response.bodyUsed;
|
|
279
|
+
},
|
|
280
|
+
stream: () => response.body,
|
|
281
|
+
arrayBuffer: response.arrayBuffer.bind(response),
|
|
282
|
+
blob: response.blob.bind(response)
|
|
283
|
+
};
|
|
284
|
+
if ("bytes" in response && typeof response.bytes === "function") {
|
|
285
|
+
binaryResponse.bytes = response.bytes.bind(response);
|
|
286
|
+
}
|
|
287
|
+
return binaryResponse;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// core/fetcher/ResponseWithBody.ts
|
|
291
|
+
function isResponseWithBody(response) {
|
|
292
|
+
return response.body != null;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// core/fetcher/getResponseBody.ts
|
|
296
|
+
async function getResponseBody(response, responseType) {
|
|
297
|
+
if (!isResponseWithBody(response)) {
|
|
298
|
+
return void 0;
|
|
299
|
+
}
|
|
300
|
+
switch (responseType) {
|
|
301
|
+
case "binary-response":
|
|
302
|
+
return getBinaryResponse(response);
|
|
303
|
+
case "blob":
|
|
304
|
+
return await response.blob();
|
|
305
|
+
case "arrayBuffer":
|
|
306
|
+
return await response.arrayBuffer();
|
|
307
|
+
case "sse":
|
|
308
|
+
return response.body;
|
|
309
|
+
case "streaming":
|
|
310
|
+
return response.body;
|
|
311
|
+
case "text":
|
|
312
|
+
return await response.text();
|
|
313
|
+
}
|
|
314
|
+
const text = await response.text();
|
|
315
|
+
if (text.length > 0) {
|
|
316
|
+
try {
|
|
317
|
+
let responseBody = fromJson(text);
|
|
318
|
+
return responseBody;
|
|
319
|
+
} catch (err) {
|
|
320
|
+
return {
|
|
321
|
+
ok: false,
|
|
322
|
+
error: {
|
|
323
|
+
reason: "non-json",
|
|
324
|
+
statusCode: response.status,
|
|
325
|
+
rawBody: text
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
return void 0;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
// core/fetcher/getErrorResponseBody.ts
|
|
334
|
+
async function getErrorResponseBody(response) {
|
|
335
|
+
let contentType = response.headers.get("Content-Type")?.toLowerCase();
|
|
336
|
+
if (contentType == null || contentType.length === 0) {
|
|
337
|
+
return getResponseBody(response);
|
|
338
|
+
}
|
|
339
|
+
if (contentType.indexOf(";") !== -1) {
|
|
340
|
+
contentType = contentType.split(";")[0]?.trim() ?? "";
|
|
341
|
+
}
|
|
342
|
+
switch (contentType) {
|
|
343
|
+
case "application/hal+json":
|
|
344
|
+
case "application/json":
|
|
345
|
+
case "application/ld+json":
|
|
346
|
+
case "application/problem+json":
|
|
347
|
+
case "application/vnd.api+json":
|
|
348
|
+
case "text/json":
|
|
349
|
+
const text = await response.text();
|
|
350
|
+
return text.length > 0 ? fromJson(text) : void 0;
|
|
351
|
+
default:
|
|
352
|
+
if (contentType.startsWith("application/vnd.") && contentType.endsWith("+json")) {
|
|
353
|
+
const text2 = await response.text();
|
|
354
|
+
return text2.length > 0 ? fromJson(text2) : void 0;
|
|
355
|
+
}
|
|
356
|
+
return await response.text();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
// core/fetcher/getFetchFn.ts
|
|
361
|
+
async function getFetchFn() {
|
|
362
|
+
return fetch;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// core/fetcher/getRequestBody.ts
|
|
366
|
+
async function getRequestBody({ body, type }) {
|
|
367
|
+
if (type.includes("json")) {
|
|
368
|
+
return toJson(body);
|
|
369
|
+
} else {
|
|
370
|
+
return body;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
// core/fetcher/signals.ts
|
|
375
|
+
var TIMEOUT = "timeout";
|
|
376
|
+
function getTimeoutSignal(timeoutMs) {
|
|
377
|
+
const controller = new AbortController();
|
|
378
|
+
const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
|
|
379
|
+
return { signal: controller.signal, abortId };
|
|
380
|
+
}
|
|
381
|
+
function anySignal(...args) {
|
|
382
|
+
const signals = args.length === 1 && Array.isArray(args[0]) ? args[0] : args;
|
|
383
|
+
const controller = new AbortController();
|
|
384
|
+
for (const signal of signals) {
|
|
385
|
+
if (signal.aborted) {
|
|
386
|
+
controller.abort(signal?.reason);
|
|
387
|
+
break;
|
|
388
|
+
}
|
|
389
|
+
signal.addEventListener("abort", () => controller.abort(signal?.reason), {
|
|
390
|
+
signal: controller.signal
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
return controller.signal;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// core/fetcher/makeRequest.ts
|
|
397
|
+
var makeRequest = async (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex) => {
|
|
398
|
+
const signals = [];
|
|
399
|
+
let timeoutAbortId = void 0;
|
|
400
|
+
if (timeoutMs != null) {
|
|
401
|
+
const { signal, abortId } = getTimeoutSignal(timeoutMs);
|
|
402
|
+
timeoutAbortId = abortId;
|
|
403
|
+
signals.push(signal);
|
|
404
|
+
}
|
|
405
|
+
if (abortSignal != null) {
|
|
406
|
+
signals.push(abortSignal);
|
|
407
|
+
}
|
|
408
|
+
let newSignals = anySignal(signals);
|
|
409
|
+
const response = await fetchFn(url, {
|
|
410
|
+
method,
|
|
411
|
+
headers,
|
|
412
|
+
body: requestBody,
|
|
413
|
+
signal: newSignals,
|
|
414
|
+
credentials: withCredentials ? "include" : void 0,
|
|
415
|
+
// @ts-ignore
|
|
416
|
+
duplex
|
|
417
|
+
});
|
|
418
|
+
if (timeoutAbortId != null) {
|
|
419
|
+
clearTimeout(timeoutAbortId);
|
|
420
|
+
}
|
|
421
|
+
return response;
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
// core/fetcher/Headers.ts
|
|
425
|
+
var Headers;
|
|
426
|
+
if (typeof globalThis.Headers !== "undefined") {
|
|
427
|
+
Headers = globalThis.Headers;
|
|
428
|
+
} else {
|
|
429
|
+
Headers = class Headers2 {
|
|
430
|
+
constructor(init) {
|
|
431
|
+
this.headers = /* @__PURE__ */ new Map();
|
|
432
|
+
if (init) {
|
|
433
|
+
if (init instanceof Headers2) {
|
|
434
|
+
init.forEach((value, key) => this.append(key, value));
|
|
435
|
+
} else if (Array.isArray(init)) {
|
|
436
|
+
for (const [key, value] of init) {
|
|
437
|
+
if (typeof key === "string" && typeof value === "string") {
|
|
438
|
+
this.append(key, value);
|
|
439
|
+
} else {
|
|
440
|
+
throw new TypeError("Each header entry must be a [string, string] tuple");
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
} else {
|
|
444
|
+
for (const [key, value] of Object.entries(init)) {
|
|
445
|
+
if (typeof value === "string") {
|
|
446
|
+
this.append(key, value);
|
|
447
|
+
} else {
|
|
448
|
+
throw new TypeError("Header values must be strings");
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
append(name, value) {
|
|
455
|
+
const key = name.toLowerCase();
|
|
456
|
+
const existing = this.headers.get(key) || [];
|
|
457
|
+
this.headers.set(key, [...existing, value]);
|
|
458
|
+
}
|
|
459
|
+
delete(name) {
|
|
460
|
+
const key = name.toLowerCase();
|
|
461
|
+
this.headers.delete(key);
|
|
462
|
+
}
|
|
463
|
+
get(name) {
|
|
464
|
+
const key = name.toLowerCase();
|
|
465
|
+
const values = this.headers.get(key);
|
|
466
|
+
return values ? values.join(", ") : null;
|
|
467
|
+
}
|
|
468
|
+
has(name) {
|
|
469
|
+
const key = name.toLowerCase();
|
|
470
|
+
return this.headers.has(key);
|
|
471
|
+
}
|
|
472
|
+
set(name, value) {
|
|
473
|
+
const key = name.toLowerCase();
|
|
474
|
+
this.headers.set(key, [value]);
|
|
475
|
+
}
|
|
476
|
+
forEach(callbackfn, thisArg) {
|
|
477
|
+
const boundCallback = thisArg ? callbackfn.bind(thisArg) : callbackfn;
|
|
478
|
+
this.headers.forEach((values, key) => boundCallback(values.join(", "), key, this));
|
|
479
|
+
}
|
|
480
|
+
getSetCookie() {
|
|
481
|
+
return this.headers.get("set-cookie") || [];
|
|
482
|
+
}
|
|
483
|
+
*entries() {
|
|
484
|
+
for (const [key, values] of this.headers.entries()) {
|
|
485
|
+
yield [key, values.join(", ")];
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
*keys() {
|
|
489
|
+
yield* this.headers.keys();
|
|
490
|
+
}
|
|
491
|
+
*values() {
|
|
492
|
+
for (const values of this.headers.values()) {
|
|
493
|
+
yield values.join(", ");
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
[Symbol.iterator]() {
|
|
497
|
+
return this.entries();
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
// core/fetcher/RawResponse.ts
|
|
503
|
+
var abortRawResponse = {
|
|
504
|
+
headers: new Headers(),
|
|
505
|
+
redirected: false,
|
|
506
|
+
status: 499,
|
|
507
|
+
statusText: "Client Closed Request",
|
|
508
|
+
type: "error",
|
|
509
|
+
url: ""
|
|
510
|
+
};
|
|
511
|
+
var unknownRawResponse = {
|
|
512
|
+
headers: new Headers(),
|
|
513
|
+
redirected: false,
|
|
514
|
+
status: 0,
|
|
515
|
+
statusText: "Unknown Error",
|
|
516
|
+
type: "error",
|
|
517
|
+
url: ""
|
|
518
|
+
};
|
|
519
|
+
function toRawResponse(response) {
|
|
520
|
+
return {
|
|
521
|
+
headers: response.headers,
|
|
522
|
+
redirected: response.redirected,
|
|
523
|
+
status: response.status,
|
|
524
|
+
statusText: response.statusText,
|
|
525
|
+
type: response.type,
|
|
526
|
+
url: response.url
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
// core/fetcher/requestWithRetries.ts
|
|
531
|
+
var INITIAL_RETRY_DELAY = 1e3;
|
|
532
|
+
var MAX_RETRY_DELAY = 6e4;
|
|
533
|
+
var DEFAULT_MAX_RETRIES = 2;
|
|
534
|
+
var JITTER_FACTOR = 0.2;
|
|
535
|
+
function addPositiveJitter(delay) {
|
|
536
|
+
const jitterMultiplier = 1 + Math.random() * JITTER_FACTOR;
|
|
537
|
+
return delay * jitterMultiplier;
|
|
538
|
+
}
|
|
539
|
+
function addSymmetricJitter(delay) {
|
|
540
|
+
const jitterMultiplier = 1 + (Math.random() - 0.5) * JITTER_FACTOR;
|
|
541
|
+
return delay * jitterMultiplier;
|
|
542
|
+
}
|
|
543
|
+
function getRetryDelayFromHeaders(response, retryAttempt) {
|
|
544
|
+
const retryAfter = response.headers.get("Retry-After");
|
|
545
|
+
if (retryAfter) {
|
|
546
|
+
const retryAfterSeconds = parseInt(retryAfter, 10);
|
|
547
|
+
if (!isNaN(retryAfterSeconds) && retryAfterSeconds > 0) {
|
|
548
|
+
return Math.min(retryAfterSeconds * 1e3, MAX_RETRY_DELAY);
|
|
549
|
+
}
|
|
550
|
+
const retryAfterDate = new Date(retryAfter);
|
|
551
|
+
if (!isNaN(retryAfterDate.getTime())) {
|
|
552
|
+
const delay = retryAfterDate.getTime() - Date.now();
|
|
553
|
+
if (delay > 0) {
|
|
554
|
+
return Math.min(Math.max(delay, 0), MAX_RETRY_DELAY);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
const rateLimitReset = response.headers.get("X-RateLimit-Reset");
|
|
559
|
+
if (rateLimitReset) {
|
|
560
|
+
const resetTime = parseInt(rateLimitReset, 10);
|
|
561
|
+
if (!isNaN(resetTime)) {
|
|
562
|
+
const delay = resetTime * 1e3 - Date.now();
|
|
563
|
+
if (delay > 0) {
|
|
564
|
+
return addPositiveJitter(Math.min(delay, MAX_RETRY_DELAY));
|
|
565
|
+
}
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return addSymmetricJitter(Math.min(INITIAL_RETRY_DELAY * Math.pow(2, retryAttempt), MAX_RETRY_DELAY));
|
|
569
|
+
}
|
|
570
|
+
async function requestWithRetries(requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
|
|
571
|
+
let response = await requestFn();
|
|
572
|
+
for (let i = 0; i < maxRetries; ++i) {
|
|
573
|
+
if ([408, 429].includes(response.status) || response.status >= 500) {
|
|
574
|
+
const delay = getRetryDelayFromHeaders(response, i);
|
|
575
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
576
|
+
response = await requestFn();
|
|
577
|
+
} else {
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
return response;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
// core/fetcher/Fetcher.ts
|
|
585
|
+
async function getHeaders(args) {
|
|
586
|
+
const newHeaders = {};
|
|
587
|
+
if (args.body !== void 0 && args.contentType != null) {
|
|
588
|
+
newHeaders["Content-Type"] = args.contentType;
|
|
589
|
+
}
|
|
590
|
+
if (args.headers == null) {
|
|
591
|
+
return newHeaders;
|
|
592
|
+
}
|
|
593
|
+
for (const [key, value] of Object.entries(args.headers)) {
|
|
594
|
+
const result = await EndpointSupplier.get(value, { endpointMetadata: args.endpointMetadata ?? {} });
|
|
595
|
+
if (typeof result === "string") {
|
|
596
|
+
newHeaders[key] = result;
|
|
597
|
+
continue;
|
|
598
|
+
}
|
|
599
|
+
if (result == null) {
|
|
600
|
+
continue;
|
|
601
|
+
}
|
|
602
|
+
newHeaders[key] = `${result}`;
|
|
603
|
+
}
|
|
604
|
+
return newHeaders;
|
|
605
|
+
}
|
|
606
|
+
async function fetcherImpl(args) {
|
|
607
|
+
const url = createRequestUrl(args.url, args.queryParameters);
|
|
608
|
+
const requestBody = await getRequestBody({
|
|
609
|
+
body: args.body,
|
|
610
|
+
type: args.requestType === "json" ? "json" : "other"
|
|
611
|
+
});
|
|
612
|
+
const fetchFn = await getFetchFn();
|
|
613
|
+
try {
|
|
614
|
+
const response = await requestWithRetries(
|
|
615
|
+
async () => makeRequest(
|
|
616
|
+
fetchFn,
|
|
617
|
+
url,
|
|
618
|
+
args.method,
|
|
619
|
+
await getHeaders(args),
|
|
620
|
+
requestBody,
|
|
621
|
+
args.timeoutMs,
|
|
622
|
+
args.abortSignal,
|
|
623
|
+
args.withCredentials,
|
|
624
|
+
args.duplex
|
|
625
|
+
),
|
|
626
|
+
args.maxRetries
|
|
627
|
+
);
|
|
628
|
+
if (response.status >= 200 && response.status < 400) {
|
|
629
|
+
return {
|
|
630
|
+
ok: true,
|
|
631
|
+
body: await getResponseBody(response, args.responseType),
|
|
632
|
+
headers: response.headers,
|
|
633
|
+
rawResponse: toRawResponse(response)
|
|
634
|
+
};
|
|
635
|
+
} else {
|
|
636
|
+
return {
|
|
637
|
+
ok: false,
|
|
638
|
+
error: {
|
|
639
|
+
reason: "status-code",
|
|
640
|
+
statusCode: response.status,
|
|
641
|
+
body: await getErrorResponseBody(response)
|
|
642
|
+
},
|
|
643
|
+
rawResponse: toRawResponse(response)
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
} catch (error) {
|
|
647
|
+
if (args.abortSignal != null && args.abortSignal.aborted) {
|
|
648
|
+
return {
|
|
649
|
+
ok: false,
|
|
650
|
+
error: {
|
|
651
|
+
reason: "unknown",
|
|
652
|
+
errorMessage: "The user aborted a request"
|
|
653
|
+
},
|
|
654
|
+
rawResponse: abortRawResponse
|
|
655
|
+
};
|
|
656
|
+
} else if (error instanceof Error && error.name === "AbortError") {
|
|
657
|
+
return {
|
|
658
|
+
ok: false,
|
|
659
|
+
error: {
|
|
660
|
+
reason: "timeout"
|
|
661
|
+
},
|
|
662
|
+
rawResponse: abortRawResponse
|
|
663
|
+
};
|
|
664
|
+
} else if (error instanceof Error) {
|
|
665
|
+
return {
|
|
666
|
+
ok: false,
|
|
667
|
+
error: {
|
|
668
|
+
reason: "unknown",
|
|
669
|
+
errorMessage: error.message
|
|
670
|
+
},
|
|
671
|
+
rawResponse: unknownRawResponse
|
|
672
|
+
};
|
|
673
|
+
}
|
|
674
|
+
return {
|
|
675
|
+
ok: false,
|
|
676
|
+
error: {
|
|
677
|
+
reason: "unknown",
|
|
678
|
+
errorMessage: toJson(error)
|
|
679
|
+
},
|
|
680
|
+
rawResponse: unknownRawResponse
|
|
681
|
+
};
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
var fetcher = fetcherImpl;
|
|
685
|
+
|
|
686
|
+
// core/fetcher/HttpResponsePromise.ts
|
|
687
|
+
var HttpResponsePromise = class extends Promise {
|
|
688
|
+
constructor(promise) {
|
|
689
|
+
super((resolve) => {
|
|
690
|
+
resolve(void 0);
|
|
691
|
+
});
|
|
692
|
+
this.innerPromise = promise;
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Creates an `HttpResponsePromise` from a function that returns a promise.
|
|
696
|
+
*
|
|
697
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
698
|
+
* @param args - Arguments to pass to the function.
|
|
699
|
+
* @returns An `HttpResponsePromise` instance.
|
|
700
|
+
*/
|
|
701
|
+
static fromFunction(fn, ...args) {
|
|
702
|
+
return new HttpResponsePromise(fn(...args));
|
|
703
|
+
}
|
|
704
|
+
/**
|
|
705
|
+
* Creates a function that returns an `HttpResponsePromise` from a function that returns a promise.
|
|
706
|
+
*
|
|
707
|
+
* @param fn - A function that returns a promise resolving to a `WithRawResponse` object.
|
|
708
|
+
* @returns A function that returns an `HttpResponsePromise` instance.
|
|
709
|
+
*/
|
|
710
|
+
static interceptFunction(fn) {
|
|
711
|
+
return (...args) => {
|
|
712
|
+
return HttpResponsePromise.fromPromise(fn(...args));
|
|
713
|
+
};
|
|
714
|
+
}
|
|
715
|
+
/**
|
|
716
|
+
* Creates an `HttpResponsePromise` from an existing promise.
|
|
717
|
+
*
|
|
718
|
+
* @param promise - A promise resolving to a `WithRawResponse` object.
|
|
719
|
+
* @returns An `HttpResponsePromise` instance.
|
|
720
|
+
*/
|
|
721
|
+
static fromPromise(promise) {
|
|
722
|
+
return new HttpResponsePromise(promise);
|
|
723
|
+
}
|
|
724
|
+
/**
|
|
725
|
+
* Creates an `HttpResponsePromise` from an executor function.
|
|
726
|
+
*
|
|
727
|
+
* @param executor - A function that takes resolve and reject callbacks to create a promise.
|
|
728
|
+
* @returns An `HttpResponsePromise` instance.
|
|
729
|
+
*/
|
|
730
|
+
static fromExecutor(executor) {
|
|
731
|
+
const promise = new Promise(executor);
|
|
732
|
+
return new HttpResponsePromise(promise);
|
|
733
|
+
}
|
|
734
|
+
/**
|
|
735
|
+
* Creates an `HttpResponsePromise` from a resolved result.
|
|
736
|
+
*
|
|
737
|
+
* @param result - A `WithRawResponse` object to resolve immediately.
|
|
738
|
+
* @returns An `HttpResponsePromise` instance.
|
|
739
|
+
*/
|
|
740
|
+
static fromResult(result) {
|
|
741
|
+
const promise = Promise.resolve(result);
|
|
742
|
+
return new HttpResponsePromise(promise);
|
|
743
|
+
}
|
|
744
|
+
unwrap() {
|
|
745
|
+
if (!this.unwrappedPromise) {
|
|
746
|
+
this.unwrappedPromise = this.innerPromise.then(({ data }) => data);
|
|
747
|
+
}
|
|
748
|
+
return this.unwrappedPromise;
|
|
749
|
+
}
|
|
750
|
+
/** @inheritdoc */
|
|
751
|
+
then(onfulfilled, onrejected) {
|
|
752
|
+
return this.unwrap().then(onfulfilled, onrejected);
|
|
753
|
+
}
|
|
754
|
+
/** @inheritdoc */
|
|
755
|
+
catch(onrejected) {
|
|
756
|
+
return this.unwrap().catch(onrejected);
|
|
757
|
+
}
|
|
758
|
+
/** @inheritdoc */
|
|
759
|
+
finally(onfinally) {
|
|
760
|
+
return this.unwrap().finally(onfinally);
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Retrieves the data and raw response.
|
|
764
|
+
*
|
|
765
|
+
* @returns A promise resolving to a `WithRawResponse` object.
|
|
766
|
+
*/
|
|
767
|
+
async withRawResponse() {
|
|
768
|
+
return await this.innerPromise;
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
|
|
772
|
+
// core/fetcher/Supplier.ts
|
|
773
|
+
var Supplier = {
|
|
774
|
+
get: async (supplier) => {
|
|
775
|
+
if (typeof supplier === "function") {
|
|
776
|
+
return supplier();
|
|
777
|
+
} else {
|
|
778
|
+
return supplier;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
};
|
|
782
|
+
|
|
783
|
+
// core/runtime/runtime.ts
|
|
784
|
+
var RUNTIME = evaluateRuntime();
|
|
785
|
+
function evaluateRuntime() {
|
|
786
|
+
const isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
787
|
+
if (isBrowser) {
|
|
788
|
+
return {
|
|
789
|
+
type: "browser",
|
|
790
|
+
version: window.navigator.userAgent
|
|
791
|
+
};
|
|
792
|
+
}
|
|
793
|
+
const isCloudflare = typeof globalThis !== "undefined" && globalThis?.navigator?.userAgent === "Cloudflare-Workers";
|
|
794
|
+
if (isCloudflare) {
|
|
795
|
+
return {
|
|
796
|
+
type: "workerd"
|
|
797
|
+
};
|
|
798
|
+
}
|
|
799
|
+
const isEdgeRuntime = typeof EdgeRuntime === "string";
|
|
800
|
+
if (isEdgeRuntime) {
|
|
801
|
+
return {
|
|
802
|
+
type: "edge-runtime"
|
|
803
|
+
};
|
|
804
|
+
}
|
|
805
|
+
const isWebWorker = typeof self === "object" && typeof self?.importScripts === "function" && (self.constructor?.name === "DedicatedWorkerGlobalScope" || self.constructor?.name === "ServiceWorkerGlobalScope" || self.constructor?.name === "SharedWorkerGlobalScope");
|
|
806
|
+
if (isWebWorker) {
|
|
807
|
+
return {
|
|
808
|
+
type: "web-worker"
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
const isDeno = typeof Deno !== "undefined" && typeof Deno.version !== "undefined" && typeof Deno.version.deno !== "undefined";
|
|
812
|
+
if (isDeno) {
|
|
813
|
+
return {
|
|
814
|
+
type: "deno",
|
|
815
|
+
version: Deno.version.deno
|
|
816
|
+
};
|
|
817
|
+
}
|
|
818
|
+
const isBun = typeof Bun !== "undefined" && typeof Bun.version !== "undefined";
|
|
819
|
+
if (isBun) {
|
|
820
|
+
return {
|
|
821
|
+
type: "bun",
|
|
822
|
+
version: Bun.version
|
|
823
|
+
};
|
|
824
|
+
}
|
|
825
|
+
const isNode = typeof process !== "undefined" && "version" in process && !!process.version && "versions" in process && !!process.versions?.node;
|
|
826
|
+
if (isNode) {
|
|
827
|
+
return {
|
|
828
|
+
type: "node",
|
|
829
|
+
version: process.versions.node,
|
|
830
|
+
parsedVersion: Number(process.versions.node.split(".")[0])
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
const isReactNative = typeof navigator !== "undefined" && navigator?.product === "ReactNative";
|
|
834
|
+
if (isReactNative) {
|
|
835
|
+
return {
|
|
836
|
+
type: "react-native"
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
return {
|
|
840
|
+
type: "unknown"
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
// core/url/index.ts
|
|
845
|
+
var url_exports = {};
|
|
846
|
+
__export(url_exports, {
|
|
847
|
+
join: () => join,
|
|
848
|
+
toQueryString: () => toQueryString
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
// core/url/join.ts
|
|
852
|
+
function join(base, ...segments) {
|
|
853
|
+
if (!base) {
|
|
854
|
+
return "";
|
|
855
|
+
}
|
|
856
|
+
if (segments.length === 0) {
|
|
857
|
+
return base;
|
|
858
|
+
}
|
|
859
|
+
if (base.includes("://")) {
|
|
860
|
+
let url;
|
|
861
|
+
try {
|
|
862
|
+
url = new URL(base);
|
|
863
|
+
} catch {
|
|
864
|
+
return joinPath(base, ...segments);
|
|
865
|
+
}
|
|
866
|
+
const lastSegment = segments[segments.length - 1];
|
|
867
|
+
const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
|
|
868
|
+
for (const segment of segments) {
|
|
869
|
+
const cleanSegment = trimSlashes(segment);
|
|
870
|
+
if (cleanSegment) {
|
|
871
|
+
url.pathname = joinPathSegments(url.pathname, cleanSegment);
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
if (shouldPreserveTrailingSlash && !url.pathname.endsWith("/")) {
|
|
875
|
+
url.pathname += "/";
|
|
876
|
+
}
|
|
877
|
+
return url.toString();
|
|
878
|
+
}
|
|
879
|
+
return joinPath(base, ...segments);
|
|
880
|
+
}
|
|
881
|
+
function joinPath(base, ...segments) {
|
|
882
|
+
if (segments.length === 0) {
|
|
883
|
+
return base;
|
|
884
|
+
}
|
|
885
|
+
let result = base;
|
|
886
|
+
const lastSegment = segments[segments.length - 1];
|
|
887
|
+
const shouldPreserveTrailingSlash = lastSegment && lastSegment.endsWith("/");
|
|
888
|
+
for (const segment of segments) {
|
|
889
|
+
const cleanSegment = trimSlashes(segment);
|
|
890
|
+
if (cleanSegment) {
|
|
891
|
+
result = joinPathSegments(result, cleanSegment);
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
if (shouldPreserveTrailingSlash && !result.endsWith("/")) {
|
|
895
|
+
result += "/";
|
|
896
|
+
}
|
|
897
|
+
return result;
|
|
898
|
+
}
|
|
899
|
+
function joinPathSegments(left, right) {
|
|
900
|
+
if (left.endsWith("/")) {
|
|
901
|
+
return left + right;
|
|
902
|
+
}
|
|
903
|
+
return left + "/" + right;
|
|
904
|
+
}
|
|
905
|
+
function trimSlashes(str) {
|
|
906
|
+
if (!str)
|
|
907
|
+
return str;
|
|
908
|
+
let start = 0;
|
|
909
|
+
let end = str.length;
|
|
910
|
+
if (str.startsWith("/"))
|
|
911
|
+
start = 1;
|
|
912
|
+
if (str.endsWith("/"))
|
|
913
|
+
end = str.length - 1;
|
|
914
|
+
return start === 0 && end === str.length ? str : str.slice(start, end);
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// core/headers.ts
|
|
918
|
+
function mergeHeaders(...headersArray) {
|
|
919
|
+
const result = {};
|
|
920
|
+
for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
|
|
921
|
+
if (value != null) {
|
|
922
|
+
result[key] = value;
|
|
923
|
+
} else if (key in result) {
|
|
924
|
+
delete result[key];
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
return result;
|
|
928
|
+
}
|
|
929
|
+
function mergeOnlyDefinedHeaders(...headersArray) {
|
|
930
|
+
const result = {};
|
|
931
|
+
for (const [key, value] of headersArray.filter((headers) => headers != null).flatMap((headers) => Object.entries(headers))) {
|
|
932
|
+
if (value != null) {
|
|
933
|
+
result[key] = value;
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
return result;
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
// environments.ts
|
|
940
|
+
var OumlaSdkApiEnvironment = {
|
|
941
|
+
Production: "https://api.oumla.com"
|
|
942
|
+
};
|
|
943
|
+
|
|
944
|
+
// api/resources/profiles/client/Client.ts
|
|
945
|
+
var Profiles = class {
|
|
946
|
+
constructor(_options) {
|
|
947
|
+
this._options = _options;
|
|
948
|
+
}
|
|
949
|
+
/**
|
|
950
|
+
* Retrieve a paginated list of profiles
|
|
951
|
+
*
|
|
952
|
+
* @param {OumlaSdkApi.GetProfilesRequest} request
|
|
953
|
+
* @param {Profiles.RequestOptions} requestOptions - Request-specific configuration.
|
|
954
|
+
*
|
|
955
|
+
* @example
|
|
956
|
+
* await client.profiles.getProfiles({
|
|
957
|
+
* skip: 1,
|
|
958
|
+
* take: 1
|
|
959
|
+
* })
|
|
960
|
+
*/
|
|
961
|
+
getProfiles(request = {}, requestOptions) {
|
|
962
|
+
return HttpResponsePromise.fromPromise(this.__getProfiles(request, requestOptions));
|
|
963
|
+
}
|
|
964
|
+
async __getProfiles(request = {}, requestOptions) {
|
|
965
|
+
const { skip, take } = request;
|
|
966
|
+
const _queryParams = {};
|
|
967
|
+
if (skip != null) {
|
|
968
|
+
_queryParams["skip"] = skip.toString();
|
|
969
|
+
}
|
|
970
|
+
if (take != null) {
|
|
971
|
+
_queryParams["take"] = take.toString();
|
|
972
|
+
}
|
|
973
|
+
let _headers = mergeHeaders(
|
|
974
|
+
this._options?.headers,
|
|
975
|
+
mergeOnlyDefinedHeaders({
|
|
976
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
977
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
978
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
979
|
+
}),
|
|
980
|
+
requestOptions?.headers
|
|
981
|
+
);
|
|
982
|
+
const _response = await fetcher({
|
|
983
|
+
url: url_exports.join(
|
|
984
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
985
|
+
"api/v1/profiles"
|
|
986
|
+
),
|
|
987
|
+
method: "GET",
|
|
988
|
+
headers: _headers,
|
|
989
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
990
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
991
|
+
maxRetries: requestOptions?.maxRetries,
|
|
992
|
+
abortSignal: requestOptions?.abortSignal
|
|
993
|
+
});
|
|
994
|
+
if (_response.ok) {
|
|
995
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
996
|
+
}
|
|
997
|
+
if (_response.error.reason === "status-code") {
|
|
998
|
+
throw new OumlaSdkApiError({
|
|
999
|
+
statusCode: _response.error.statusCode,
|
|
1000
|
+
body: _response.error.body,
|
|
1001
|
+
rawResponse: _response.rawResponse
|
|
1002
|
+
});
|
|
1003
|
+
}
|
|
1004
|
+
switch (_response.error.reason) {
|
|
1005
|
+
case "non-json":
|
|
1006
|
+
throw new OumlaSdkApiError({
|
|
1007
|
+
statusCode: _response.error.statusCode,
|
|
1008
|
+
body: _response.error.rawBody,
|
|
1009
|
+
rawResponse: _response.rawResponse
|
|
1010
|
+
});
|
|
1011
|
+
case "timeout":
|
|
1012
|
+
throw new OumlaSdkApiTimeoutError("Timeout exceeded when calling GET /api/v1/profiles.");
|
|
1013
|
+
case "unknown":
|
|
1014
|
+
throw new OumlaSdkApiError({
|
|
1015
|
+
message: _response.error.errorMessage,
|
|
1016
|
+
rawResponse: _response.rawResponse
|
|
1017
|
+
});
|
|
1018
|
+
}
|
|
1019
|
+
}
|
|
1020
|
+
/**
|
|
1021
|
+
* Create a new user profile
|
|
1022
|
+
*
|
|
1023
|
+
* @param {OumlaSdkApi.CreateProfileRequest} request
|
|
1024
|
+
* @param {Profiles.RequestOptions} requestOptions - Request-specific configuration.
|
|
1025
|
+
*
|
|
1026
|
+
* @throws {@link OumlaSdkApi.BadRequestError}
|
|
1027
|
+
*
|
|
1028
|
+
* @example
|
|
1029
|
+
* await client.profiles.createProfile({
|
|
1030
|
+
* reference: "reference",
|
|
1031
|
+
* type: "User"
|
|
1032
|
+
* })
|
|
1033
|
+
*/
|
|
1034
|
+
createProfile(request, requestOptions) {
|
|
1035
|
+
return HttpResponsePromise.fromPromise(this.__createProfile(request, requestOptions));
|
|
1036
|
+
}
|
|
1037
|
+
async __createProfile(request, requestOptions) {
|
|
1038
|
+
let _headers = mergeHeaders(
|
|
1039
|
+
this._options?.headers,
|
|
1040
|
+
mergeOnlyDefinedHeaders({
|
|
1041
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1042
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1043
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1044
|
+
}),
|
|
1045
|
+
requestOptions?.headers
|
|
1046
|
+
);
|
|
1047
|
+
const _response = await fetcher({
|
|
1048
|
+
url: url_exports.join(
|
|
1049
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1050
|
+
"api/v1/profiles"
|
|
1051
|
+
),
|
|
1052
|
+
method: "POST",
|
|
1053
|
+
headers: _headers,
|
|
1054
|
+
contentType: "application/json",
|
|
1055
|
+
queryParameters: requestOptions?.queryParams,
|
|
1056
|
+
requestType: "json",
|
|
1057
|
+
body: request,
|
|
1058
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1059
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1060
|
+
abortSignal: requestOptions?.abortSignal
|
|
1061
|
+
});
|
|
1062
|
+
if (_response.ok) {
|
|
1063
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1064
|
+
}
|
|
1065
|
+
if (_response.error.reason === "status-code") {
|
|
1066
|
+
switch (_response.error.statusCode) {
|
|
1067
|
+
case 400:
|
|
1068
|
+
throw new BadRequestError(
|
|
1069
|
+
_response.error.body,
|
|
1070
|
+
_response.rawResponse
|
|
1071
|
+
);
|
|
1072
|
+
default:
|
|
1073
|
+
throw new OumlaSdkApiError({
|
|
1074
|
+
statusCode: _response.error.statusCode,
|
|
1075
|
+
body: _response.error.body,
|
|
1076
|
+
rawResponse: _response.rawResponse
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
switch (_response.error.reason) {
|
|
1081
|
+
case "non-json":
|
|
1082
|
+
throw new OumlaSdkApiError({
|
|
1083
|
+
statusCode: _response.error.statusCode,
|
|
1084
|
+
body: _response.error.rawBody,
|
|
1085
|
+
rawResponse: _response.rawResponse
|
|
1086
|
+
});
|
|
1087
|
+
case "timeout":
|
|
1088
|
+
throw new OumlaSdkApiTimeoutError("Timeout exceeded when calling POST /api/v1/profiles.");
|
|
1089
|
+
case "unknown":
|
|
1090
|
+
throw new OumlaSdkApiError({
|
|
1091
|
+
message: _response.error.errorMessage,
|
|
1092
|
+
rawResponse: _response.rawResponse
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
async _getAuthorizationHeader() {
|
|
1097
|
+
const bearer = await Supplier.get(this._options.token);
|
|
1098
|
+
if (bearer != null) {
|
|
1099
|
+
return `Bearer ${bearer}`;
|
|
1100
|
+
}
|
|
1101
|
+
return void 0;
|
|
1102
|
+
}
|
|
1103
|
+
};
|
|
1104
|
+
|
|
1105
|
+
// api/resources/wallets/client/Client.ts
|
|
1106
|
+
var Wallets = class {
|
|
1107
|
+
constructor(_options) {
|
|
1108
|
+
this._options = _options;
|
|
1109
|
+
}
|
|
1110
|
+
/**
|
|
1111
|
+
* Retrieve wallets for the organization
|
|
1112
|
+
*
|
|
1113
|
+
* @param {OumlaSdkApi.GetOrganizationWalletsRequest} request
|
|
1114
|
+
* @param {Wallets.RequestOptions} requestOptions - Request-specific configuration.
|
|
1115
|
+
*
|
|
1116
|
+
* @example
|
|
1117
|
+
* await client.wallets.getOrganizationWallets({
|
|
1118
|
+
* skip: 1,
|
|
1119
|
+
* take: 1
|
|
1120
|
+
* })
|
|
1121
|
+
*/
|
|
1122
|
+
getOrganizationWallets(request = {}, requestOptions) {
|
|
1123
|
+
return HttpResponsePromise.fromPromise(this.__getOrganizationWallets(request, requestOptions));
|
|
1124
|
+
}
|
|
1125
|
+
async __getOrganizationWallets(request = {}, requestOptions) {
|
|
1126
|
+
const { skip, take } = request;
|
|
1127
|
+
const _queryParams = {};
|
|
1128
|
+
if (skip != null) {
|
|
1129
|
+
_queryParams["skip"] = skip.toString();
|
|
1130
|
+
}
|
|
1131
|
+
if (take != null) {
|
|
1132
|
+
_queryParams["take"] = take.toString();
|
|
1133
|
+
}
|
|
1134
|
+
let _headers = mergeHeaders(
|
|
1135
|
+
this._options?.headers,
|
|
1136
|
+
mergeOnlyDefinedHeaders({
|
|
1137
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1138
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1139
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1140
|
+
}),
|
|
1141
|
+
requestOptions?.headers
|
|
1142
|
+
);
|
|
1143
|
+
const _response = await fetcher({
|
|
1144
|
+
url: url_exports.join(
|
|
1145
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1146
|
+
"api/v1/wallets/organization"
|
|
1147
|
+
),
|
|
1148
|
+
method: "GET",
|
|
1149
|
+
headers: _headers,
|
|
1150
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1151
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1152
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1153
|
+
abortSignal: requestOptions?.abortSignal
|
|
1154
|
+
});
|
|
1155
|
+
if (_response.ok) {
|
|
1156
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1157
|
+
}
|
|
1158
|
+
if (_response.error.reason === "status-code") {
|
|
1159
|
+
throw new OumlaSdkApiError({
|
|
1160
|
+
statusCode: _response.error.statusCode,
|
|
1161
|
+
body: _response.error.body,
|
|
1162
|
+
rawResponse: _response.rawResponse
|
|
1163
|
+
});
|
|
1164
|
+
}
|
|
1165
|
+
switch (_response.error.reason) {
|
|
1166
|
+
case "non-json":
|
|
1167
|
+
throw new OumlaSdkApiError({
|
|
1168
|
+
statusCode: _response.error.statusCode,
|
|
1169
|
+
body: _response.error.rawBody,
|
|
1170
|
+
rawResponse: _response.rawResponse
|
|
1171
|
+
});
|
|
1172
|
+
case "timeout":
|
|
1173
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1174
|
+
"Timeout exceeded when calling GET /api/v1/wallets/organization."
|
|
1175
|
+
);
|
|
1176
|
+
case "unknown":
|
|
1177
|
+
throw new OumlaSdkApiError({
|
|
1178
|
+
message: _response.error.errorMessage,
|
|
1179
|
+
rawResponse: _response.rawResponse
|
|
1180
|
+
});
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* Retrieve wallets for a specific profile
|
|
1185
|
+
*
|
|
1186
|
+
* @param {string} reference - Profile reference
|
|
1187
|
+
* @param {OumlaSdkApi.GetProfileWalletsRequest} request
|
|
1188
|
+
* @param {Wallets.RequestOptions} requestOptions - Request-specific configuration.
|
|
1189
|
+
*
|
|
1190
|
+
* @example
|
|
1191
|
+
* await client.wallets.getProfileWallets("reference", {
|
|
1192
|
+
* skip: 1,
|
|
1193
|
+
* take: 1
|
|
1194
|
+
* })
|
|
1195
|
+
*/
|
|
1196
|
+
getProfileWallets(reference, request = {}, requestOptions) {
|
|
1197
|
+
return HttpResponsePromise.fromPromise(this.__getProfileWallets(reference, request, requestOptions));
|
|
1198
|
+
}
|
|
1199
|
+
async __getProfileWallets(reference, request = {}, requestOptions) {
|
|
1200
|
+
const { skip, take } = request;
|
|
1201
|
+
const _queryParams = {};
|
|
1202
|
+
if (skip != null) {
|
|
1203
|
+
_queryParams["skip"] = skip.toString();
|
|
1204
|
+
}
|
|
1205
|
+
if (take != null) {
|
|
1206
|
+
_queryParams["take"] = take.toString();
|
|
1207
|
+
}
|
|
1208
|
+
let _headers = mergeHeaders(
|
|
1209
|
+
this._options?.headers,
|
|
1210
|
+
mergeOnlyDefinedHeaders({
|
|
1211
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1212
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1213
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1214
|
+
}),
|
|
1215
|
+
requestOptions?.headers
|
|
1216
|
+
);
|
|
1217
|
+
const _response = await fetcher({
|
|
1218
|
+
url: url_exports.join(
|
|
1219
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1220
|
+
`api/v1/wallets/profile/${encodeURIComponent(reference)}`
|
|
1221
|
+
),
|
|
1222
|
+
method: "GET",
|
|
1223
|
+
headers: _headers,
|
|
1224
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1225
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1226
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1227
|
+
abortSignal: requestOptions?.abortSignal
|
|
1228
|
+
});
|
|
1229
|
+
if (_response.ok) {
|
|
1230
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1231
|
+
}
|
|
1232
|
+
if (_response.error.reason === "status-code") {
|
|
1233
|
+
throw new OumlaSdkApiError({
|
|
1234
|
+
statusCode: _response.error.statusCode,
|
|
1235
|
+
body: _response.error.body,
|
|
1236
|
+
rawResponse: _response.rawResponse
|
|
1237
|
+
});
|
|
1238
|
+
}
|
|
1239
|
+
switch (_response.error.reason) {
|
|
1240
|
+
case "non-json":
|
|
1241
|
+
throw new OumlaSdkApiError({
|
|
1242
|
+
statusCode: _response.error.statusCode,
|
|
1243
|
+
body: _response.error.rawBody,
|
|
1244
|
+
rawResponse: _response.rawResponse
|
|
1245
|
+
});
|
|
1246
|
+
case "timeout":
|
|
1247
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1248
|
+
"Timeout exceeded when calling GET /api/v1/wallets/profile/{reference}."
|
|
1249
|
+
);
|
|
1250
|
+
case "unknown":
|
|
1251
|
+
throw new OumlaSdkApiError({
|
|
1252
|
+
message: _response.error.errorMessage,
|
|
1253
|
+
rawResponse: _response.rawResponse
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* Generate a new wallet for a profile
|
|
1259
|
+
*
|
|
1260
|
+
* @param {OumlaSdkApi.CreateWalletRequest} request
|
|
1261
|
+
* @param {Wallets.RequestOptions} requestOptions - Request-specific configuration.
|
|
1262
|
+
*
|
|
1263
|
+
* @example
|
|
1264
|
+
* await client.wallets.generateWallet({
|
|
1265
|
+
* reference: "reference",
|
|
1266
|
+
* network: "BTC"
|
|
1267
|
+
* })
|
|
1268
|
+
*/
|
|
1269
|
+
generateWallet(request, requestOptions) {
|
|
1270
|
+
return HttpResponsePromise.fromPromise(this.__generateWallet(request, requestOptions));
|
|
1271
|
+
}
|
|
1272
|
+
async __generateWallet(request, requestOptions) {
|
|
1273
|
+
let _headers = mergeHeaders(
|
|
1274
|
+
this._options?.headers,
|
|
1275
|
+
mergeOnlyDefinedHeaders({
|
|
1276
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1277
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1278
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1279
|
+
}),
|
|
1280
|
+
requestOptions?.headers
|
|
1281
|
+
);
|
|
1282
|
+
const _response = await fetcher({
|
|
1283
|
+
url: url_exports.join(
|
|
1284
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1285
|
+
"api/v1/wallets/generate"
|
|
1286
|
+
),
|
|
1287
|
+
method: "POST",
|
|
1288
|
+
headers: _headers,
|
|
1289
|
+
contentType: "application/json",
|
|
1290
|
+
queryParameters: requestOptions?.queryParams,
|
|
1291
|
+
requestType: "json",
|
|
1292
|
+
body: request,
|
|
1293
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1294
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1295
|
+
abortSignal: requestOptions?.abortSignal
|
|
1296
|
+
});
|
|
1297
|
+
if (_response.ok) {
|
|
1298
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1299
|
+
}
|
|
1300
|
+
if (_response.error.reason === "status-code") {
|
|
1301
|
+
throw new OumlaSdkApiError({
|
|
1302
|
+
statusCode: _response.error.statusCode,
|
|
1303
|
+
body: _response.error.body,
|
|
1304
|
+
rawResponse: _response.rawResponse
|
|
1305
|
+
});
|
|
1306
|
+
}
|
|
1307
|
+
switch (_response.error.reason) {
|
|
1308
|
+
case "non-json":
|
|
1309
|
+
throw new OumlaSdkApiError({
|
|
1310
|
+
statusCode: _response.error.statusCode,
|
|
1311
|
+
body: _response.error.rawBody,
|
|
1312
|
+
rawResponse: _response.rawResponse
|
|
1313
|
+
});
|
|
1314
|
+
case "timeout":
|
|
1315
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1316
|
+
"Timeout exceeded when calling POST /api/v1/wallets/generate."
|
|
1317
|
+
);
|
|
1318
|
+
case "unknown":
|
|
1319
|
+
throw new OumlaSdkApiError({
|
|
1320
|
+
message: _response.error.errorMessage,
|
|
1321
|
+
rawResponse: _response.rawResponse
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
}
|
|
1325
|
+
async _getAuthorizationHeader() {
|
|
1326
|
+
const bearer = await Supplier.get(this._options.token);
|
|
1327
|
+
if (bearer != null) {
|
|
1328
|
+
return `Bearer ${bearer}`;
|
|
1329
|
+
}
|
|
1330
|
+
return void 0;
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1333
|
+
|
|
1334
|
+
// api/resources/addresses/client/Client.ts
|
|
1335
|
+
var Addresses = class {
|
|
1336
|
+
constructor(_options) {
|
|
1337
|
+
this._options = _options;
|
|
1338
|
+
}
|
|
1339
|
+
/**
|
|
1340
|
+
* Retrieve addresses for the organization
|
|
1341
|
+
*
|
|
1342
|
+
* @param {OumlaSdkApi.GetOrganizationAddressesRequest} request
|
|
1343
|
+
* @param {Addresses.RequestOptions} requestOptions - Request-specific configuration.
|
|
1344
|
+
*
|
|
1345
|
+
* @example
|
|
1346
|
+
* await client.addresses.getOrganizationAddresses({
|
|
1347
|
+
* skip: 1,
|
|
1348
|
+
* take: 1
|
|
1349
|
+
* })
|
|
1350
|
+
*/
|
|
1351
|
+
getOrganizationAddresses(request = {}, requestOptions) {
|
|
1352
|
+
return HttpResponsePromise.fromPromise(this.__getOrganizationAddresses(request, requestOptions));
|
|
1353
|
+
}
|
|
1354
|
+
async __getOrganizationAddresses(request = {}, requestOptions) {
|
|
1355
|
+
const { skip, take } = request;
|
|
1356
|
+
const _queryParams = {};
|
|
1357
|
+
if (skip != null) {
|
|
1358
|
+
_queryParams["skip"] = skip.toString();
|
|
1359
|
+
}
|
|
1360
|
+
if (take != null) {
|
|
1361
|
+
_queryParams["take"] = take.toString();
|
|
1362
|
+
}
|
|
1363
|
+
let _headers = mergeHeaders(
|
|
1364
|
+
this._options?.headers,
|
|
1365
|
+
mergeOnlyDefinedHeaders({
|
|
1366
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1367
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1368
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1369
|
+
}),
|
|
1370
|
+
requestOptions?.headers
|
|
1371
|
+
);
|
|
1372
|
+
const _response = await fetcher({
|
|
1373
|
+
url: url_exports.join(
|
|
1374
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1375
|
+
"api/v1/addresses/organization"
|
|
1376
|
+
),
|
|
1377
|
+
method: "GET",
|
|
1378
|
+
headers: _headers,
|
|
1379
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1380
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1381
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1382
|
+
abortSignal: requestOptions?.abortSignal
|
|
1383
|
+
});
|
|
1384
|
+
if (_response.ok) {
|
|
1385
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1386
|
+
}
|
|
1387
|
+
if (_response.error.reason === "status-code") {
|
|
1388
|
+
throw new OumlaSdkApiError({
|
|
1389
|
+
statusCode: _response.error.statusCode,
|
|
1390
|
+
body: _response.error.body,
|
|
1391
|
+
rawResponse: _response.rawResponse
|
|
1392
|
+
});
|
|
1393
|
+
}
|
|
1394
|
+
switch (_response.error.reason) {
|
|
1395
|
+
case "non-json":
|
|
1396
|
+
throw new OumlaSdkApiError({
|
|
1397
|
+
statusCode: _response.error.statusCode,
|
|
1398
|
+
body: _response.error.rawBody,
|
|
1399
|
+
rawResponse: _response.rawResponse
|
|
1400
|
+
});
|
|
1401
|
+
case "timeout":
|
|
1402
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1403
|
+
"Timeout exceeded when calling GET /api/v1/addresses/organization."
|
|
1404
|
+
);
|
|
1405
|
+
case "unknown":
|
|
1406
|
+
throw new OumlaSdkApiError({
|
|
1407
|
+
message: _response.error.errorMessage,
|
|
1408
|
+
rawResponse: _response.rawResponse
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
}
|
|
1412
|
+
/**
|
|
1413
|
+
* Retrieve addresses for a specific profile
|
|
1414
|
+
*
|
|
1415
|
+
* @param {string} reference - Profile reference
|
|
1416
|
+
* @param {OumlaSdkApi.GetProfileAddressesRequest} request
|
|
1417
|
+
* @param {Addresses.RequestOptions} requestOptions - Request-specific configuration.
|
|
1418
|
+
*
|
|
1419
|
+
* @example
|
|
1420
|
+
* await client.addresses.getProfileAddresses("reference", {
|
|
1421
|
+
* skip: 1,
|
|
1422
|
+
* take: 1
|
|
1423
|
+
* })
|
|
1424
|
+
*/
|
|
1425
|
+
getProfileAddresses(reference, request = {}, requestOptions) {
|
|
1426
|
+
return HttpResponsePromise.fromPromise(this.__getProfileAddresses(reference, request, requestOptions));
|
|
1427
|
+
}
|
|
1428
|
+
async __getProfileAddresses(reference, request = {}, requestOptions) {
|
|
1429
|
+
const { skip, take } = request;
|
|
1430
|
+
const _queryParams = {};
|
|
1431
|
+
if (skip != null) {
|
|
1432
|
+
_queryParams["skip"] = skip.toString();
|
|
1433
|
+
}
|
|
1434
|
+
if (take != null) {
|
|
1435
|
+
_queryParams["take"] = take.toString();
|
|
1436
|
+
}
|
|
1437
|
+
let _headers = mergeHeaders(
|
|
1438
|
+
this._options?.headers,
|
|
1439
|
+
mergeOnlyDefinedHeaders({
|
|
1440
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1441
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1442
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1443
|
+
}),
|
|
1444
|
+
requestOptions?.headers
|
|
1445
|
+
);
|
|
1446
|
+
const _response = await fetcher({
|
|
1447
|
+
url: url_exports.join(
|
|
1448
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1449
|
+
`api/v1/addresses/${encodeURIComponent(reference)}`
|
|
1450
|
+
),
|
|
1451
|
+
method: "GET",
|
|
1452
|
+
headers: _headers,
|
|
1453
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1454
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1455
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1456
|
+
abortSignal: requestOptions?.abortSignal
|
|
1457
|
+
});
|
|
1458
|
+
if (_response.ok) {
|
|
1459
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1460
|
+
}
|
|
1461
|
+
if (_response.error.reason === "status-code") {
|
|
1462
|
+
throw new OumlaSdkApiError({
|
|
1463
|
+
statusCode: _response.error.statusCode,
|
|
1464
|
+
body: _response.error.body,
|
|
1465
|
+
rawResponse: _response.rawResponse
|
|
1466
|
+
});
|
|
1467
|
+
}
|
|
1468
|
+
switch (_response.error.reason) {
|
|
1469
|
+
case "non-json":
|
|
1470
|
+
throw new OumlaSdkApiError({
|
|
1471
|
+
statusCode: _response.error.statusCode,
|
|
1472
|
+
body: _response.error.rawBody,
|
|
1473
|
+
rawResponse: _response.rawResponse
|
|
1474
|
+
});
|
|
1475
|
+
case "timeout":
|
|
1476
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1477
|
+
"Timeout exceeded when calling GET /api/v1/addresses/{reference}."
|
|
1478
|
+
);
|
|
1479
|
+
case "unknown":
|
|
1480
|
+
throw new OumlaSdkApiError({
|
|
1481
|
+
message: _response.error.errorMessage,
|
|
1482
|
+
rawResponse: _response.rawResponse
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
}
|
|
1486
|
+
/**
|
|
1487
|
+
* Generate a new address for a profile
|
|
1488
|
+
*
|
|
1489
|
+
* @param {OumlaSdkApi.CreateAddressRequest} request
|
|
1490
|
+
* @param {Addresses.RequestOptions} requestOptions - Request-specific configuration.
|
|
1491
|
+
*
|
|
1492
|
+
* @example
|
|
1493
|
+
* await client.addresses.generateAddress({
|
|
1494
|
+
* reference: "reference",
|
|
1495
|
+
* network: "BTC",
|
|
1496
|
+
* clientShare: "clientShare"
|
|
1497
|
+
* })
|
|
1498
|
+
*/
|
|
1499
|
+
generateAddress(request, requestOptions) {
|
|
1500
|
+
return HttpResponsePromise.fromPromise(this.__generateAddress(request, requestOptions));
|
|
1501
|
+
}
|
|
1502
|
+
async __generateAddress(request, requestOptions) {
|
|
1503
|
+
let _headers = mergeHeaders(
|
|
1504
|
+
this._options?.headers,
|
|
1505
|
+
mergeOnlyDefinedHeaders({
|
|
1506
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1507
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1508
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1509
|
+
}),
|
|
1510
|
+
requestOptions?.headers
|
|
1511
|
+
);
|
|
1512
|
+
const _response = await fetcher({
|
|
1513
|
+
url: url_exports.join(
|
|
1514
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1515
|
+
"api/v1/addresses/generate"
|
|
1516
|
+
),
|
|
1517
|
+
method: "POST",
|
|
1518
|
+
headers: _headers,
|
|
1519
|
+
contentType: "application/json",
|
|
1520
|
+
queryParameters: requestOptions?.queryParams,
|
|
1521
|
+
requestType: "json",
|
|
1522
|
+
body: request,
|
|
1523
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1524
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1525
|
+
abortSignal: requestOptions?.abortSignal
|
|
1526
|
+
});
|
|
1527
|
+
if (_response.ok) {
|
|
1528
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1529
|
+
}
|
|
1530
|
+
if (_response.error.reason === "status-code") {
|
|
1531
|
+
throw new OumlaSdkApiError({
|
|
1532
|
+
statusCode: _response.error.statusCode,
|
|
1533
|
+
body: _response.error.body,
|
|
1534
|
+
rawResponse: _response.rawResponse
|
|
1535
|
+
});
|
|
1536
|
+
}
|
|
1537
|
+
switch (_response.error.reason) {
|
|
1538
|
+
case "non-json":
|
|
1539
|
+
throw new OumlaSdkApiError({
|
|
1540
|
+
statusCode: _response.error.statusCode,
|
|
1541
|
+
body: _response.error.rawBody,
|
|
1542
|
+
rawResponse: _response.rawResponse
|
|
1543
|
+
});
|
|
1544
|
+
case "timeout":
|
|
1545
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1546
|
+
"Timeout exceeded when calling POST /api/v1/addresses/generate."
|
|
1547
|
+
);
|
|
1548
|
+
case "unknown":
|
|
1549
|
+
throw new OumlaSdkApiError({
|
|
1550
|
+
message: _response.error.errorMessage,
|
|
1551
|
+
rawResponse: _response.rawResponse
|
|
1552
|
+
});
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
async _getAuthorizationHeader() {
|
|
1556
|
+
const bearer = await Supplier.get(this._options.token);
|
|
1557
|
+
if (bearer != null) {
|
|
1558
|
+
return `Bearer ${bearer}`;
|
|
1559
|
+
}
|
|
1560
|
+
return void 0;
|
|
1561
|
+
}
|
|
1562
|
+
};
|
|
1563
|
+
|
|
1564
|
+
// api/resources/transactions/client/Client.ts
|
|
1565
|
+
var Transactions = class {
|
|
1566
|
+
constructor(_options) {
|
|
1567
|
+
this._options = _options;
|
|
1568
|
+
}
|
|
1569
|
+
/**
|
|
1570
|
+
* Retrieve transactions for a specific address
|
|
1571
|
+
*
|
|
1572
|
+
* @param {string} address - Blockchain address
|
|
1573
|
+
* @param {OumlaSdkApi.GetTransactionsByAddressRequest} request
|
|
1574
|
+
* @param {Transactions.RequestOptions} requestOptions - Request-specific configuration.
|
|
1575
|
+
*
|
|
1576
|
+
* @example
|
|
1577
|
+
* await client.transactions.getTransactionsByAddress("address", {
|
|
1578
|
+
* skip: 1,
|
|
1579
|
+
* take: 1
|
|
1580
|
+
* })
|
|
1581
|
+
*/
|
|
1582
|
+
getTransactionsByAddress(address, request = {}, requestOptions) {
|
|
1583
|
+
return HttpResponsePromise.fromPromise(this.__getTransactionsByAddress(address, request, requestOptions));
|
|
1584
|
+
}
|
|
1585
|
+
async __getTransactionsByAddress(address, request = {}, requestOptions) {
|
|
1586
|
+
const { skip, take } = request;
|
|
1587
|
+
const _queryParams = {};
|
|
1588
|
+
if (skip != null) {
|
|
1589
|
+
_queryParams["skip"] = skip.toString();
|
|
1590
|
+
}
|
|
1591
|
+
if (take != null) {
|
|
1592
|
+
_queryParams["take"] = take.toString();
|
|
1593
|
+
}
|
|
1594
|
+
let _headers = mergeHeaders(
|
|
1595
|
+
this._options?.headers,
|
|
1596
|
+
mergeOnlyDefinedHeaders({
|
|
1597
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1598
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1599
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1600
|
+
}),
|
|
1601
|
+
requestOptions?.headers
|
|
1602
|
+
);
|
|
1603
|
+
const _response = await fetcher({
|
|
1604
|
+
url: url_exports.join(
|
|
1605
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1606
|
+
`api/v1/transactions/address/${encodeURIComponent(address)}`
|
|
1607
|
+
),
|
|
1608
|
+
method: "GET",
|
|
1609
|
+
headers: _headers,
|
|
1610
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1611
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1612
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1613
|
+
abortSignal: requestOptions?.abortSignal
|
|
1614
|
+
});
|
|
1615
|
+
if (_response.ok) {
|
|
1616
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1617
|
+
}
|
|
1618
|
+
if (_response.error.reason === "status-code") {
|
|
1619
|
+
throw new OumlaSdkApiError({
|
|
1620
|
+
statusCode: _response.error.statusCode,
|
|
1621
|
+
body: _response.error.body,
|
|
1622
|
+
rawResponse: _response.rawResponse
|
|
1623
|
+
});
|
|
1624
|
+
}
|
|
1625
|
+
switch (_response.error.reason) {
|
|
1626
|
+
case "non-json":
|
|
1627
|
+
throw new OumlaSdkApiError({
|
|
1628
|
+
statusCode: _response.error.statusCode,
|
|
1629
|
+
body: _response.error.rawBody,
|
|
1630
|
+
rawResponse: _response.rawResponse
|
|
1631
|
+
});
|
|
1632
|
+
case "timeout":
|
|
1633
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1634
|
+
"Timeout exceeded when calling GET /api/v1/transactions/address/{address}."
|
|
1635
|
+
);
|
|
1636
|
+
case "unknown":
|
|
1637
|
+
throw new OumlaSdkApiError({
|
|
1638
|
+
message: _response.error.errorMessage,
|
|
1639
|
+
rawResponse: _response.rawResponse
|
|
1640
|
+
});
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* Retrieve transactions for a specific wallet
|
|
1645
|
+
*
|
|
1646
|
+
* @param {string} miniWalletId - Mini wallet ID
|
|
1647
|
+
* @param {OumlaSdkApi.GetTransactionsByWalletRequest} request
|
|
1648
|
+
* @param {Transactions.RequestOptions} requestOptions - Request-specific configuration.
|
|
1649
|
+
*
|
|
1650
|
+
* @example
|
|
1651
|
+
* await client.transactions.getTransactionsByWallet("miniWalletId", {
|
|
1652
|
+
* skip: 1,
|
|
1653
|
+
* take: 1
|
|
1654
|
+
* })
|
|
1655
|
+
*/
|
|
1656
|
+
getTransactionsByWallet(miniWalletId, request = {}, requestOptions) {
|
|
1657
|
+
return HttpResponsePromise.fromPromise(
|
|
1658
|
+
this.__getTransactionsByWallet(miniWalletId, request, requestOptions)
|
|
1659
|
+
);
|
|
1660
|
+
}
|
|
1661
|
+
async __getTransactionsByWallet(miniWalletId, request = {}, requestOptions) {
|
|
1662
|
+
const { skip, take } = request;
|
|
1663
|
+
const _queryParams = {};
|
|
1664
|
+
if (skip != null) {
|
|
1665
|
+
_queryParams["skip"] = skip.toString();
|
|
1666
|
+
}
|
|
1667
|
+
if (take != null) {
|
|
1668
|
+
_queryParams["take"] = take.toString();
|
|
1669
|
+
}
|
|
1670
|
+
let _headers = mergeHeaders(
|
|
1671
|
+
this._options?.headers,
|
|
1672
|
+
mergeOnlyDefinedHeaders({
|
|
1673
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1674
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1675
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1676
|
+
}),
|
|
1677
|
+
requestOptions?.headers
|
|
1678
|
+
);
|
|
1679
|
+
const _response = await fetcher({
|
|
1680
|
+
url: url_exports.join(
|
|
1681
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1682
|
+
`api/v1/transactions/wallet/${encodeURIComponent(miniWalletId)}`
|
|
1683
|
+
),
|
|
1684
|
+
method: "GET",
|
|
1685
|
+
headers: _headers,
|
|
1686
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1687
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1688
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1689
|
+
abortSignal: requestOptions?.abortSignal
|
|
1690
|
+
});
|
|
1691
|
+
if (_response.ok) {
|
|
1692
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1693
|
+
}
|
|
1694
|
+
if (_response.error.reason === "status-code") {
|
|
1695
|
+
throw new OumlaSdkApiError({
|
|
1696
|
+
statusCode: _response.error.statusCode,
|
|
1697
|
+
body: _response.error.body,
|
|
1698
|
+
rawResponse: _response.rawResponse
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
switch (_response.error.reason) {
|
|
1702
|
+
case "non-json":
|
|
1703
|
+
throw new OumlaSdkApiError({
|
|
1704
|
+
statusCode: _response.error.statusCode,
|
|
1705
|
+
body: _response.error.rawBody,
|
|
1706
|
+
rawResponse: _response.rawResponse
|
|
1707
|
+
});
|
|
1708
|
+
case "timeout":
|
|
1709
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1710
|
+
"Timeout exceeded when calling GET /api/v1/transactions/wallet/{miniWalletId}."
|
|
1711
|
+
);
|
|
1712
|
+
case "unknown":
|
|
1713
|
+
throw new OumlaSdkApiError({
|
|
1714
|
+
message: _response.error.errorMessage,
|
|
1715
|
+
rawResponse: _response.rawResponse
|
|
1716
|
+
});
|
|
1717
|
+
}
|
|
1718
|
+
}
|
|
1719
|
+
/**
|
|
1720
|
+
* Retrieve transactions for the organization
|
|
1721
|
+
*
|
|
1722
|
+
* @param {OumlaSdkApi.GetOrganizationTransactionsRequest} request
|
|
1723
|
+
* @param {Transactions.RequestOptions} requestOptions - Request-specific configuration.
|
|
1724
|
+
*
|
|
1725
|
+
* @example
|
|
1726
|
+
* await client.transactions.getOrganizationTransactions({
|
|
1727
|
+
* skip: 1,
|
|
1728
|
+
* take: 1
|
|
1729
|
+
* })
|
|
1730
|
+
*/
|
|
1731
|
+
getOrganizationTransactions(request = {}, requestOptions) {
|
|
1732
|
+
return HttpResponsePromise.fromPromise(this.__getOrganizationTransactions(request, requestOptions));
|
|
1733
|
+
}
|
|
1734
|
+
async __getOrganizationTransactions(request = {}, requestOptions) {
|
|
1735
|
+
const { skip, take } = request;
|
|
1736
|
+
const _queryParams = {};
|
|
1737
|
+
if (skip != null) {
|
|
1738
|
+
_queryParams["skip"] = skip.toString();
|
|
1739
|
+
}
|
|
1740
|
+
if (take != null) {
|
|
1741
|
+
_queryParams["take"] = take.toString();
|
|
1742
|
+
}
|
|
1743
|
+
let _headers = mergeHeaders(
|
|
1744
|
+
this._options?.headers,
|
|
1745
|
+
mergeOnlyDefinedHeaders({
|
|
1746
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1747
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1748
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1749
|
+
}),
|
|
1750
|
+
requestOptions?.headers
|
|
1751
|
+
);
|
|
1752
|
+
const _response = await fetcher({
|
|
1753
|
+
url: url_exports.join(
|
|
1754
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1755
|
+
"api/v1/transactions/organization"
|
|
1756
|
+
),
|
|
1757
|
+
method: "GET",
|
|
1758
|
+
headers: _headers,
|
|
1759
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1760
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1761
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1762
|
+
abortSignal: requestOptions?.abortSignal
|
|
1763
|
+
});
|
|
1764
|
+
if (_response.ok) {
|
|
1765
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1766
|
+
}
|
|
1767
|
+
if (_response.error.reason === "status-code") {
|
|
1768
|
+
throw new OumlaSdkApiError({
|
|
1769
|
+
statusCode: _response.error.statusCode,
|
|
1770
|
+
body: _response.error.body,
|
|
1771
|
+
rawResponse: _response.rawResponse
|
|
1772
|
+
});
|
|
1773
|
+
}
|
|
1774
|
+
switch (_response.error.reason) {
|
|
1775
|
+
case "non-json":
|
|
1776
|
+
throw new OumlaSdkApiError({
|
|
1777
|
+
statusCode: _response.error.statusCode,
|
|
1778
|
+
body: _response.error.rawBody,
|
|
1779
|
+
rawResponse: _response.rawResponse
|
|
1780
|
+
});
|
|
1781
|
+
case "timeout":
|
|
1782
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1783
|
+
"Timeout exceeded when calling GET /api/v1/transactions/organization."
|
|
1784
|
+
);
|
|
1785
|
+
case "unknown":
|
|
1786
|
+
throw new OumlaSdkApiError({
|
|
1787
|
+
message: _response.error.errorMessage,
|
|
1788
|
+
rawResponse: _response.rawResponse
|
|
1789
|
+
});
|
|
1790
|
+
}
|
|
1791
|
+
}
|
|
1792
|
+
/**
|
|
1793
|
+
* Retrieve transactions for a specific profile
|
|
1794
|
+
*
|
|
1795
|
+
* @param {string} reference - Profile reference
|
|
1796
|
+
* @param {OumlaSdkApi.GetProfileTransactionsRequest} request
|
|
1797
|
+
* @param {Transactions.RequestOptions} requestOptions - Request-specific configuration.
|
|
1798
|
+
*
|
|
1799
|
+
* @example
|
|
1800
|
+
* await client.transactions.getProfileTransactions("reference", {
|
|
1801
|
+
* skip: 1,
|
|
1802
|
+
* take: 1
|
|
1803
|
+
* })
|
|
1804
|
+
*/
|
|
1805
|
+
getProfileTransactions(reference, request = {}, requestOptions) {
|
|
1806
|
+
return HttpResponsePromise.fromPromise(this.__getProfileTransactions(reference, request, requestOptions));
|
|
1807
|
+
}
|
|
1808
|
+
async __getProfileTransactions(reference, request = {}, requestOptions) {
|
|
1809
|
+
const { skip, take } = request;
|
|
1810
|
+
const _queryParams = {};
|
|
1811
|
+
if (skip != null) {
|
|
1812
|
+
_queryParams["skip"] = skip.toString();
|
|
1813
|
+
}
|
|
1814
|
+
if (take != null) {
|
|
1815
|
+
_queryParams["take"] = take.toString();
|
|
1816
|
+
}
|
|
1817
|
+
let _headers = mergeHeaders(
|
|
1818
|
+
this._options?.headers,
|
|
1819
|
+
mergeOnlyDefinedHeaders({
|
|
1820
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1821
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1822
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1823
|
+
}),
|
|
1824
|
+
requestOptions?.headers
|
|
1825
|
+
);
|
|
1826
|
+
const _response = await fetcher({
|
|
1827
|
+
url: url_exports.join(
|
|
1828
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1829
|
+
`api/v1/transactions/profile/${encodeURIComponent(reference)}`
|
|
1830
|
+
),
|
|
1831
|
+
method: "GET",
|
|
1832
|
+
headers: _headers,
|
|
1833
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1834
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1835
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1836
|
+
abortSignal: requestOptions?.abortSignal
|
|
1837
|
+
});
|
|
1838
|
+
if (_response.ok) {
|
|
1839
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1840
|
+
}
|
|
1841
|
+
if (_response.error.reason === "status-code") {
|
|
1842
|
+
throw new OumlaSdkApiError({
|
|
1843
|
+
statusCode: _response.error.statusCode,
|
|
1844
|
+
body: _response.error.body,
|
|
1845
|
+
rawResponse: _response.rawResponse
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
switch (_response.error.reason) {
|
|
1849
|
+
case "non-json":
|
|
1850
|
+
throw new OumlaSdkApiError({
|
|
1851
|
+
statusCode: _response.error.statusCode,
|
|
1852
|
+
body: _response.error.rawBody,
|
|
1853
|
+
rawResponse: _response.rawResponse
|
|
1854
|
+
});
|
|
1855
|
+
case "timeout":
|
|
1856
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1857
|
+
"Timeout exceeded when calling GET /api/v1/transactions/profile/{reference}."
|
|
1858
|
+
);
|
|
1859
|
+
case "unknown":
|
|
1860
|
+
throw new OumlaSdkApiError({
|
|
1861
|
+
message: _response.error.errorMessage,
|
|
1862
|
+
rawResponse: _response.rawResponse
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
}
|
|
1866
|
+
async _getAuthorizationHeader() {
|
|
1867
|
+
const bearer = await Supplier.get(this._options.token);
|
|
1868
|
+
if (bearer != null) {
|
|
1869
|
+
return `Bearer ${bearer}`;
|
|
1870
|
+
}
|
|
1871
|
+
return void 0;
|
|
1872
|
+
}
|
|
1873
|
+
};
|
|
1874
|
+
|
|
1875
|
+
// api/resources/assets/client/Client.ts
|
|
1876
|
+
var Assets = class {
|
|
1877
|
+
constructor(_options) {
|
|
1878
|
+
this._options = _options;
|
|
1879
|
+
}
|
|
1880
|
+
/**
|
|
1881
|
+
* Retrieve assets for a specific address
|
|
1882
|
+
*
|
|
1883
|
+
* @param {string} address - Blockchain address
|
|
1884
|
+
* @param {OumlaSdkApi.GetAssetsByAddressRequest} request
|
|
1885
|
+
* @param {Assets.RequestOptions} requestOptions - Request-specific configuration.
|
|
1886
|
+
*
|
|
1887
|
+
* @example
|
|
1888
|
+
* await client.assets.getAssetsByAddress("address", {
|
|
1889
|
+
* skip: 1,
|
|
1890
|
+
* take: 1
|
|
1891
|
+
* })
|
|
1892
|
+
*/
|
|
1893
|
+
getAssetsByAddress(address, request = {}, requestOptions) {
|
|
1894
|
+
return HttpResponsePromise.fromPromise(this.__getAssetsByAddress(address, request, requestOptions));
|
|
1895
|
+
}
|
|
1896
|
+
async __getAssetsByAddress(address, request = {}, requestOptions) {
|
|
1897
|
+
const { skip, take } = request;
|
|
1898
|
+
const _queryParams = {};
|
|
1899
|
+
if (skip != null) {
|
|
1900
|
+
_queryParams["skip"] = skip.toString();
|
|
1901
|
+
}
|
|
1902
|
+
if (take != null) {
|
|
1903
|
+
_queryParams["take"] = take.toString();
|
|
1904
|
+
}
|
|
1905
|
+
let _headers = mergeHeaders(
|
|
1906
|
+
this._options?.headers,
|
|
1907
|
+
mergeOnlyDefinedHeaders({
|
|
1908
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1909
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1910
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1911
|
+
}),
|
|
1912
|
+
requestOptions?.headers
|
|
1913
|
+
);
|
|
1914
|
+
const _response = await fetcher({
|
|
1915
|
+
url: url_exports.join(
|
|
1916
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1917
|
+
`api/v1/assets/address/${encodeURIComponent(address)}`
|
|
1918
|
+
),
|
|
1919
|
+
method: "GET",
|
|
1920
|
+
headers: _headers,
|
|
1921
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1922
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1923
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1924
|
+
abortSignal: requestOptions?.abortSignal
|
|
1925
|
+
});
|
|
1926
|
+
if (_response.ok) {
|
|
1927
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
1928
|
+
}
|
|
1929
|
+
if (_response.error.reason === "status-code") {
|
|
1930
|
+
throw new OumlaSdkApiError({
|
|
1931
|
+
statusCode: _response.error.statusCode,
|
|
1932
|
+
body: _response.error.body,
|
|
1933
|
+
rawResponse: _response.rawResponse
|
|
1934
|
+
});
|
|
1935
|
+
}
|
|
1936
|
+
switch (_response.error.reason) {
|
|
1937
|
+
case "non-json":
|
|
1938
|
+
throw new OumlaSdkApiError({
|
|
1939
|
+
statusCode: _response.error.statusCode,
|
|
1940
|
+
body: _response.error.rawBody,
|
|
1941
|
+
rawResponse: _response.rawResponse
|
|
1942
|
+
});
|
|
1943
|
+
case "timeout":
|
|
1944
|
+
throw new OumlaSdkApiTimeoutError(
|
|
1945
|
+
"Timeout exceeded when calling GET /api/v1/assets/address/{address}."
|
|
1946
|
+
);
|
|
1947
|
+
case "unknown":
|
|
1948
|
+
throw new OumlaSdkApiError({
|
|
1949
|
+
message: _response.error.errorMessage,
|
|
1950
|
+
rawResponse: _response.rawResponse
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
}
|
|
1954
|
+
/**
|
|
1955
|
+
* Retrieve assets for a specific wallet
|
|
1956
|
+
*
|
|
1957
|
+
* @param {string} miniWalletId - Mini wallet ID
|
|
1958
|
+
* @param {OumlaSdkApi.GetAssetsByWalletRequest} request
|
|
1959
|
+
* @param {Assets.RequestOptions} requestOptions - Request-specific configuration.
|
|
1960
|
+
*
|
|
1961
|
+
* @example
|
|
1962
|
+
* await client.assets.getAssetsByWallet("miniWalletId", {
|
|
1963
|
+
* skip: 1,
|
|
1964
|
+
* take: 1
|
|
1965
|
+
* })
|
|
1966
|
+
*/
|
|
1967
|
+
getAssetsByWallet(miniWalletId, request = {}, requestOptions) {
|
|
1968
|
+
return HttpResponsePromise.fromPromise(this.__getAssetsByWallet(miniWalletId, request, requestOptions));
|
|
1969
|
+
}
|
|
1970
|
+
async __getAssetsByWallet(miniWalletId, request = {}, requestOptions) {
|
|
1971
|
+
const { skip, take } = request;
|
|
1972
|
+
const _queryParams = {};
|
|
1973
|
+
if (skip != null) {
|
|
1974
|
+
_queryParams["skip"] = skip.toString();
|
|
1975
|
+
}
|
|
1976
|
+
if (take != null) {
|
|
1977
|
+
_queryParams["take"] = take.toString();
|
|
1978
|
+
}
|
|
1979
|
+
let _headers = mergeHeaders(
|
|
1980
|
+
this._options?.headers,
|
|
1981
|
+
mergeOnlyDefinedHeaders({
|
|
1982
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
1983
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
1984
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
1985
|
+
}),
|
|
1986
|
+
requestOptions?.headers
|
|
1987
|
+
);
|
|
1988
|
+
const _response = await fetcher({
|
|
1989
|
+
url: url_exports.join(
|
|
1990
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
1991
|
+
`api/v1/assets/wallet/${encodeURIComponent(miniWalletId)}`
|
|
1992
|
+
),
|
|
1993
|
+
method: "GET",
|
|
1994
|
+
headers: _headers,
|
|
1995
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
1996
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
1997
|
+
maxRetries: requestOptions?.maxRetries,
|
|
1998
|
+
abortSignal: requestOptions?.abortSignal
|
|
1999
|
+
});
|
|
2000
|
+
if (_response.ok) {
|
|
2001
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2002
|
+
}
|
|
2003
|
+
if (_response.error.reason === "status-code") {
|
|
2004
|
+
throw new OumlaSdkApiError({
|
|
2005
|
+
statusCode: _response.error.statusCode,
|
|
2006
|
+
body: _response.error.body,
|
|
2007
|
+
rawResponse: _response.rawResponse
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
switch (_response.error.reason) {
|
|
2011
|
+
case "non-json":
|
|
2012
|
+
throw new OumlaSdkApiError({
|
|
2013
|
+
statusCode: _response.error.statusCode,
|
|
2014
|
+
body: _response.error.rawBody,
|
|
2015
|
+
rawResponse: _response.rawResponse
|
|
2016
|
+
});
|
|
2017
|
+
case "timeout":
|
|
2018
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2019
|
+
"Timeout exceeded when calling GET /api/v1/assets/wallet/{miniWalletId}."
|
|
2020
|
+
);
|
|
2021
|
+
case "unknown":
|
|
2022
|
+
throw new OumlaSdkApiError({
|
|
2023
|
+
message: _response.error.errorMessage,
|
|
2024
|
+
rawResponse: _response.rawResponse
|
|
2025
|
+
});
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
async _getAuthorizationHeader() {
|
|
2029
|
+
const bearer = await Supplier.get(this._options.token);
|
|
2030
|
+
if (bearer != null) {
|
|
2031
|
+
return `Bearer ${bearer}`;
|
|
2032
|
+
}
|
|
2033
|
+
return void 0;
|
|
2034
|
+
}
|
|
2035
|
+
};
|
|
2036
|
+
|
|
2037
|
+
// api/resources/withdrawals/client/Client.ts
|
|
2038
|
+
var Withdrawals = class {
|
|
2039
|
+
constructor(_options) {
|
|
2040
|
+
this._options = _options;
|
|
2041
|
+
}
|
|
2042
|
+
/**
|
|
2043
|
+
* Create a new withdrawal request
|
|
2044
|
+
*
|
|
2045
|
+
* @param {OumlaSdkApi.CreateWithdrawalRequest} request
|
|
2046
|
+
* @param {Withdrawals.RequestOptions} requestOptions - Request-specific configuration.
|
|
2047
|
+
*
|
|
2048
|
+
* @example
|
|
2049
|
+
* await client.withdrawals.createWithdrawal({
|
|
2050
|
+
* to: "to",
|
|
2051
|
+
* amount: "amount",
|
|
2052
|
+
* from: ["from"],
|
|
2053
|
+
* network: "BTC",
|
|
2054
|
+
* clientShare: "clientShare"
|
|
2055
|
+
* })
|
|
2056
|
+
*/
|
|
2057
|
+
createWithdrawal(request, requestOptions) {
|
|
2058
|
+
return HttpResponsePromise.fromPromise(this.__createWithdrawal(request, requestOptions));
|
|
2059
|
+
}
|
|
2060
|
+
async __createWithdrawal(request, requestOptions) {
|
|
2061
|
+
let _headers = mergeHeaders(
|
|
2062
|
+
this._options?.headers,
|
|
2063
|
+
mergeOnlyDefinedHeaders({
|
|
2064
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2065
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2066
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2067
|
+
}),
|
|
2068
|
+
requestOptions?.headers
|
|
2069
|
+
);
|
|
2070
|
+
const _response = await fetcher({
|
|
2071
|
+
url: url_exports.join(
|
|
2072
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2073
|
+
"api/v1/withdraw"
|
|
2074
|
+
),
|
|
2075
|
+
method: "POST",
|
|
2076
|
+
headers: _headers,
|
|
2077
|
+
contentType: "application/json",
|
|
2078
|
+
queryParameters: requestOptions?.queryParams,
|
|
2079
|
+
requestType: "json",
|
|
2080
|
+
body: request,
|
|
2081
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2082
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2083
|
+
abortSignal: requestOptions?.abortSignal
|
|
2084
|
+
});
|
|
2085
|
+
if (_response.ok) {
|
|
2086
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2087
|
+
}
|
|
2088
|
+
if (_response.error.reason === "status-code") {
|
|
2089
|
+
throw new OumlaSdkApiError({
|
|
2090
|
+
statusCode: _response.error.statusCode,
|
|
2091
|
+
body: _response.error.body,
|
|
2092
|
+
rawResponse: _response.rawResponse
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
switch (_response.error.reason) {
|
|
2096
|
+
case "non-json":
|
|
2097
|
+
throw new OumlaSdkApiError({
|
|
2098
|
+
statusCode: _response.error.statusCode,
|
|
2099
|
+
body: _response.error.rawBody,
|
|
2100
|
+
rawResponse: _response.rawResponse
|
|
2101
|
+
});
|
|
2102
|
+
case "timeout":
|
|
2103
|
+
throw new OumlaSdkApiTimeoutError("Timeout exceeded when calling POST /api/v1/withdraw.");
|
|
2104
|
+
case "unknown":
|
|
2105
|
+
throw new OumlaSdkApiError({
|
|
2106
|
+
message: _response.error.errorMessage,
|
|
2107
|
+
rawResponse: _response.rawResponse
|
|
2108
|
+
});
|
|
2109
|
+
}
|
|
2110
|
+
}
|
|
2111
|
+
async _getAuthorizationHeader() {
|
|
2112
|
+
const bearer = await Supplier.get(this._options.token);
|
|
2113
|
+
if (bearer != null) {
|
|
2114
|
+
return `Bearer ${bearer}`;
|
|
2115
|
+
}
|
|
2116
|
+
return void 0;
|
|
2117
|
+
}
|
|
2118
|
+
};
|
|
2119
|
+
|
|
2120
|
+
// api/resources/contractTemplates/client/Client.ts
|
|
2121
|
+
var ContractTemplates = class {
|
|
2122
|
+
constructor(_options) {
|
|
2123
|
+
this._options = _options;
|
|
2124
|
+
}
|
|
2125
|
+
/**
|
|
2126
|
+
* Retrieve a paginated list of contract templates
|
|
2127
|
+
*
|
|
2128
|
+
* @param {OumlaSdkApi.GetContractTemplatesRequest} request
|
|
2129
|
+
* @param {ContractTemplates.RequestOptions} requestOptions - Request-specific configuration.
|
|
2130
|
+
*
|
|
2131
|
+
* @example
|
|
2132
|
+
* await client.contractTemplates.getContractTemplates({
|
|
2133
|
+
* skip: 1,
|
|
2134
|
+
* take: 1
|
|
2135
|
+
* })
|
|
2136
|
+
*/
|
|
2137
|
+
getContractTemplates(request = {}, requestOptions) {
|
|
2138
|
+
return HttpResponsePromise.fromPromise(this.__getContractTemplates(request, requestOptions));
|
|
2139
|
+
}
|
|
2140
|
+
async __getContractTemplates(request = {}, requestOptions) {
|
|
2141
|
+
const { skip, take } = request;
|
|
2142
|
+
const _queryParams = {};
|
|
2143
|
+
if (skip != null) {
|
|
2144
|
+
_queryParams["skip"] = skip.toString();
|
|
2145
|
+
}
|
|
2146
|
+
if (take != null) {
|
|
2147
|
+
_queryParams["take"] = take.toString();
|
|
2148
|
+
}
|
|
2149
|
+
let _headers = mergeHeaders(
|
|
2150
|
+
this._options?.headers,
|
|
2151
|
+
mergeOnlyDefinedHeaders({
|
|
2152
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2153
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2154
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2155
|
+
}),
|
|
2156
|
+
requestOptions?.headers
|
|
2157
|
+
);
|
|
2158
|
+
const _response = await fetcher({
|
|
2159
|
+
url: url_exports.join(
|
|
2160
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2161
|
+
"api/v1/contract-templates"
|
|
2162
|
+
),
|
|
2163
|
+
method: "GET",
|
|
2164
|
+
headers: _headers,
|
|
2165
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
2166
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2167
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2168
|
+
abortSignal: requestOptions?.abortSignal
|
|
2169
|
+
});
|
|
2170
|
+
if (_response.ok) {
|
|
2171
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2172
|
+
}
|
|
2173
|
+
if (_response.error.reason === "status-code") {
|
|
2174
|
+
throw new OumlaSdkApiError({
|
|
2175
|
+
statusCode: _response.error.statusCode,
|
|
2176
|
+
body: _response.error.body,
|
|
2177
|
+
rawResponse: _response.rawResponse
|
|
2178
|
+
});
|
|
2179
|
+
}
|
|
2180
|
+
switch (_response.error.reason) {
|
|
2181
|
+
case "non-json":
|
|
2182
|
+
throw new OumlaSdkApiError({
|
|
2183
|
+
statusCode: _response.error.statusCode,
|
|
2184
|
+
body: _response.error.rawBody,
|
|
2185
|
+
rawResponse: _response.rawResponse
|
|
2186
|
+
});
|
|
2187
|
+
case "timeout":
|
|
2188
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2189
|
+
"Timeout exceeded when calling GET /api/v1/contract-templates."
|
|
2190
|
+
);
|
|
2191
|
+
case "unknown":
|
|
2192
|
+
throw new OumlaSdkApiError({
|
|
2193
|
+
message: _response.error.errorMessage,
|
|
2194
|
+
rawResponse: _response.rawResponse
|
|
2195
|
+
});
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
/**
|
|
2199
|
+
* Create a new contract template
|
|
2200
|
+
*
|
|
2201
|
+
* @param {OumlaSdkApi.CreateContractTemplateRequest} request
|
|
2202
|
+
* @param {ContractTemplates.RequestOptions} requestOptions - Request-specific configuration.
|
|
2203
|
+
*
|
|
2204
|
+
* @example
|
|
2205
|
+
* await client.contractTemplates.createContractTemplate({
|
|
2206
|
+
* name: "name",
|
|
2207
|
+
* description: "description",
|
|
2208
|
+
* abi: [{
|
|
2209
|
+
* "key": "value"
|
|
2210
|
+
* }],
|
|
2211
|
+
* bytecode: "bytecode"
|
|
2212
|
+
* })
|
|
2213
|
+
*/
|
|
2214
|
+
createContractTemplate(request, requestOptions) {
|
|
2215
|
+
return HttpResponsePromise.fromPromise(this.__createContractTemplate(request, requestOptions));
|
|
2216
|
+
}
|
|
2217
|
+
async __createContractTemplate(request, requestOptions) {
|
|
2218
|
+
let _headers = mergeHeaders(
|
|
2219
|
+
this._options?.headers,
|
|
2220
|
+
mergeOnlyDefinedHeaders({
|
|
2221
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2222
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2223
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2224
|
+
}),
|
|
2225
|
+
requestOptions?.headers
|
|
2226
|
+
);
|
|
2227
|
+
const _response = await fetcher({
|
|
2228
|
+
url: url_exports.join(
|
|
2229
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2230
|
+
"api/v1/contract-templates"
|
|
2231
|
+
),
|
|
2232
|
+
method: "POST",
|
|
2233
|
+
headers: _headers,
|
|
2234
|
+
contentType: "application/json",
|
|
2235
|
+
queryParameters: requestOptions?.queryParams,
|
|
2236
|
+
requestType: "json",
|
|
2237
|
+
body: request,
|
|
2238
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2239
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2240
|
+
abortSignal: requestOptions?.abortSignal
|
|
2241
|
+
});
|
|
2242
|
+
if (_response.ok) {
|
|
2243
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2244
|
+
}
|
|
2245
|
+
if (_response.error.reason === "status-code") {
|
|
2246
|
+
throw new OumlaSdkApiError({
|
|
2247
|
+
statusCode: _response.error.statusCode,
|
|
2248
|
+
body: _response.error.body,
|
|
2249
|
+
rawResponse: _response.rawResponse
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
switch (_response.error.reason) {
|
|
2253
|
+
case "non-json":
|
|
2254
|
+
throw new OumlaSdkApiError({
|
|
2255
|
+
statusCode: _response.error.statusCode,
|
|
2256
|
+
body: _response.error.rawBody,
|
|
2257
|
+
rawResponse: _response.rawResponse
|
|
2258
|
+
});
|
|
2259
|
+
case "timeout":
|
|
2260
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2261
|
+
"Timeout exceeded when calling POST /api/v1/contract-templates."
|
|
2262
|
+
);
|
|
2263
|
+
case "unknown":
|
|
2264
|
+
throw new OumlaSdkApiError({
|
|
2265
|
+
message: _response.error.errorMessage,
|
|
2266
|
+
rawResponse: _response.rawResponse
|
|
2267
|
+
});
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
/**
|
|
2271
|
+
* Retrieve a specific contract template
|
|
2272
|
+
*
|
|
2273
|
+
* @param {string} templateId - Contract template ID
|
|
2274
|
+
* @param {ContractTemplates.RequestOptions} requestOptions - Request-specific configuration.
|
|
2275
|
+
*
|
|
2276
|
+
* @example
|
|
2277
|
+
* await client.contractTemplates.getContractTemplate("templateId")
|
|
2278
|
+
*/
|
|
2279
|
+
getContractTemplate(templateId, requestOptions) {
|
|
2280
|
+
return HttpResponsePromise.fromPromise(this.__getContractTemplate(templateId, requestOptions));
|
|
2281
|
+
}
|
|
2282
|
+
async __getContractTemplate(templateId, requestOptions) {
|
|
2283
|
+
let _headers = mergeHeaders(
|
|
2284
|
+
this._options?.headers,
|
|
2285
|
+
mergeOnlyDefinedHeaders({
|
|
2286
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2287
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2288
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2289
|
+
}),
|
|
2290
|
+
requestOptions?.headers
|
|
2291
|
+
);
|
|
2292
|
+
const _response = await fetcher({
|
|
2293
|
+
url: url_exports.join(
|
|
2294
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2295
|
+
`api/v1/contract-templates/${encodeURIComponent(templateId)}`
|
|
2296
|
+
),
|
|
2297
|
+
method: "GET",
|
|
2298
|
+
headers: _headers,
|
|
2299
|
+
queryParameters: requestOptions?.queryParams,
|
|
2300
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2301
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2302
|
+
abortSignal: requestOptions?.abortSignal
|
|
2303
|
+
});
|
|
2304
|
+
if (_response.ok) {
|
|
2305
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2306
|
+
}
|
|
2307
|
+
if (_response.error.reason === "status-code") {
|
|
2308
|
+
throw new OumlaSdkApiError({
|
|
2309
|
+
statusCode: _response.error.statusCode,
|
|
2310
|
+
body: _response.error.body,
|
|
2311
|
+
rawResponse: _response.rawResponse
|
|
2312
|
+
});
|
|
2313
|
+
}
|
|
2314
|
+
switch (_response.error.reason) {
|
|
2315
|
+
case "non-json":
|
|
2316
|
+
throw new OumlaSdkApiError({
|
|
2317
|
+
statusCode: _response.error.statusCode,
|
|
2318
|
+
body: _response.error.rawBody,
|
|
2319
|
+
rawResponse: _response.rawResponse
|
|
2320
|
+
});
|
|
2321
|
+
case "timeout":
|
|
2322
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2323
|
+
"Timeout exceeded when calling GET /api/v1/contract-templates/{templateId}."
|
|
2324
|
+
);
|
|
2325
|
+
case "unknown":
|
|
2326
|
+
throw new OumlaSdkApiError({
|
|
2327
|
+
message: _response.error.errorMessage,
|
|
2328
|
+
rawResponse: _response.rawResponse
|
|
2329
|
+
});
|
|
2330
|
+
}
|
|
2331
|
+
}
|
|
2332
|
+
/**
|
|
2333
|
+
* Delete a contract template
|
|
2334
|
+
*
|
|
2335
|
+
* @param {string} templateId - Contract template ID
|
|
2336
|
+
* @param {ContractTemplates.RequestOptions} requestOptions - Request-specific configuration.
|
|
2337
|
+
*
|
|
2338
|
+
* @example
|
|
2339
|
+
* await client.contractTemplates.deleteContractTemplate("templateId")
|
|
2340
|
+
*/
|
|
2341
|
+
deleteContractTemplate(templateId, requestOptions) {
|
|
2342
|
+
return HttpResponsePromise.fromPromise(this.__deleteContractTemplate(templateId, requestOptions));
|
|
2343
|
+
}
|
|
2344
|
+
async __deleteContractTemplate(templateId, requestOptions) {
|
|
2345
|
+
let _headers = mergeHeaders(
|
|
2346
|
+
this._options?.headers,
|
|
2347
|
+
mergeOnlyDefinedHeaders({
|
|
2348
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2349
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2350
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2351
|
+
}),
|
|
2352
|
+
requestOptions?.headers
|
|
2353
|
+
);
|
|
2354
|
+
const _response = await fetcher({
|
|
2355
|
+
url: url_exports.join(
|
|
2356
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2357
|
+
`api/v1/contract-templates/${encodeURIComponent(templateId)}`
|
|
2358
|
+
),
|
|
2359
|
+
method: "DELETE",
|
|
2360
|
+
headers: _headers,
|
|
2361
|
+
queryParameters: requestOptions?.queryParams,
|
|
2362
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2363
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2364
|
+
abortSignal: requestOptions?.abortSignal
|
|
2365
|
+
});
|
|
2366
|
+
if (_response.ok) {
|
|
2367
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2368
|
+
}
|
|
2369
|
+
if (_response.error.reason === "status-code") {
|
|
2370
|
+
throw new OumlaSdkApiError({
|
|
2371
|
+
statusCode: _response.error.statusCode,
|
|
2372
|
+
body: _response.error.body,
|
|
2373
|
+
rawResponse: _response.rawResponse
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2376
|
+
switch (_response.error.reason) {
|
|
2377
|
+
case "non-json":
|
|
2378
|
+
throw new OumlaSdkApiError({
|
|
2379
|
+
statusCode: _response.error.statusCode,
|
|
2380
|
+
body: _response.error.rawBody,
|
|
2381
|
+
rawResponse: _response.rawResponse
|
|
2382
|
+
});
|
|
2383
|
+
case "timeout":
|
|
2384
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2385
|
+
"Timeout exceeded when calling DELETE /api/v1/contract-templates/{templateId}."
|
|
2386
|
+
);
|
|
2387
|
+
case "unknown":
|
|
2388
|
+
throw new OumlaSdkApiError({
|
|
2389
|
+
message: _response.error.errorMessage,
|
|
2390
|
+
rawResponse: _response.rawResponse
|
|
2391
|
+
});
|
|
2392
|
+
}
|
|
2393
|
+
}
|
|
2394
|
+
/**
|
|
2395
|
+
* Retrieve constructor information for a contract template
|
|
2396
|
+
*
|
|
2397
|
+
* @param {string} templateId - Contract template ID
|
|
2398
|
+
* @param {ContractTemplates.RequestOptions} requestOptions - Request-specific configuration.
|
|
2399
|
+
*
|
|
2400
|
+
* @example
|
|
2401
|
+
* await client.contractTemplates.getContractConstructor("templateId")
|
|
2402
|
+
*/
|
|
2403
|
+
getContractConstructor(templateId, requestOptions) {
|
|
2404
|
+
return HttpResponsePromise.fromPromise(this.__getContractConstructor(templateId, requestOptions));
|
|
2405
|
+
}
|
|
2406
|
+
async __getContractConstructor(templateId, requestOptions) {
|
|
2407
|
+
let _headers = mergeHeaders(
|
|
2408
|
+
this._options?.headers,
|
|
2409
|
+
mergeOnlyDefinedHeaders({
|
|
2410
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2411
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2412
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2413
|
+
}),
|
|
2414
|
+
requestOptions?.headers
|
|
2415
|
+
);
|
|
2416
|
+
const _response = await fetcher({
|
|
2417
|
+
url: url_exports.join(
|
|
2418
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2419
|
+
`api/v1/contract-templates/${encodeURIComponent(templateId)}/constructorInfo`
|
|
2420
|
+
),
|
|
2421
|
+
method: "GET",
|
|
2422
|
+
headers: _headers,
|
|
2423
|
+
queryParameters: requestOptions?.queryParams,
|
|
2424
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2425
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2426
|
+
abortSignal: requestOptions?.abortSignal
|
|
2427
|
+
});
|
|
2428
|
+
if (_response.ok) {
|
|
2429
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2430
|
+
}
|
|
2431
|
+
if (_response.error.reason === "status-code") {
|
|
2432
|
+
throw new OumlaSdkApiError({
|
|
2433
|
+
statusCode: _response.error.statusCode,
|
|
2434
|
+
body: _response.error.body,
|
|
2435
|
+
rawResponse: _response.rawResponse
|
|
2436
|
+
});
|
|
2437
|
+
}
|
|
2438
|
+
switch (_response.error.reason) {
|
|
2439
|
+
case "non-json":
|
|
2440
|
+
throw new OumlaSdkApiError({
|
|
2441
|
+
statusCode: _response.error.statusCode,
|
|
2442
|
+
body: _response.error.rawBody,
|
|
2443
|
+
rawResponse: _response.rawResponse
|
|
2444
|
+
});
|
|
2445
|
+
case "timeout":
|
|
2446
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2447
|
+
"Timeout exceeded when calling GET /api/v1/contract-templates/{templateId}/constructorInfo."
|
|
2448
|
+
);
|
|
2449
|
+
case "unknown":
|
|
2450
|
+
throw new OumlaSdkApiError({
|
|
2451
|
+
message: _response.error.errorMessage,
|
|
2452
|
+
rawResponse: _response.rawResponse
|
|
2453
|
+
});
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
/**
|
|
2457
|
+
* Retrieve function information for a contract template
|
|
2458
|
+
*
|
|
2459
|
+
* @param {string} templateId - Contract template ID
|
|
2460
|
+
* @param {OumlaSdkApi.GetTemplateFunctionsRequest} request
|
|
2461
|
+
* @param {ContractTemplates.RequestOptions} requestOptions - Request-specific configuration.
|
|
2462
|
+
*
|
|
2463
|
+
* @example
|
|
2464
|
+
* await client.contractTemplates.getTemplateFunctions("templateId", {
|
|
2465
|
+
* functionSignature: "functionSignature"
|
|
2466
|
+
* })
|
|
2467
|
+
*/
|
|
2468
|
+
getTemplateFunctions(templateId, request = {}, requestOptions) {
|
|
2469
|
+
return HttpResponsePromise.fromPromise(this.__getTemplateFunctions(templateId, request, requestOptions));
|
|
2470
|
+
}
|
|
2471
|
+
async __getTemplateFunctions(templateId, request = {}, requestOptions) {
|
|
2472
|
+
const { functionSignature } = request;
|
|
2473
|
+
const _queryParams = {};
|
|
2474
|
+
if (functionSignature != null) {
|
|
2475
|
+
_queryParams["functionSignature"] = functionSignature;
|
|
2476
|
+
}
|
|
2477
|
+
let _headers = mergeHeaders(
|
|
2478
|
+
this._options?.headers,
|
|
2479
|
+
mergeOnlyDefinedHeaders({
|
|
2480
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2481
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2482
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2483
|
+
}),
|
|
2484
|
+
requestOptions?.headers
|
|
2485
|
+
);
|
|
2486
|
+
const _response = await fetcher({
|
|
2487
|
+
url: url_exports.join(
|
|
2488
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2489
|
+
`api/v1/contract-templates/${encodeURIComponent(templateId)}/function`
|
|
2490
|
+
),
|
|
2491
|
+
method: "GET",
|
|
2492
|
+
headers: _headers,
|
|
2493
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
2494
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2495
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2496
|
+
abortSignal: requestOptions?.abortSignal
|
|
2497
|
+
});
|
|
2498
|
+
if (_response.ok) {
|
|
2499
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2500
|
+
}
|
|
2501
|
+
if (_response.error.reason === "status-code") {
|
|
2502
|
+
throw new OumlaSdkApiError({
|
|
2503
|
+
statusCode: _response.error.statusCode,
|
|
2504
|
+
body: _response.error.body,
|
|
2505
|
+
rawResponse: _response.rawResponse
|
|
2506
|
+
});
|
|
2507
|
+
}
|
|
2508
|
+
switch (_response.error.reason) {
|
|
2509
|
+
case "non-json":
|
|
2510
|
+
throw new OumlaSdkApiError({
|
|
2511
|
+
statusCode: _response.error.statusCode,
|
|
2512
|
+
body: _response.error.rawBody,
|
|
2513
|
+
rawResponse: _response.rawResponse
|
|
2514
|
+
});
|
|
2515
|
+
case "timeout":
|
|
2516
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2517
|
+
"Timeout exceeded when calling GET /api/v1/contract-templates/{templateId}/function."
|
|
2518
|
+
);
|
|
2519
|
+
case "unknown":
|
|
2520
|
+
throw new OumlaSdkApiError({
|
|
2521
|
+
message: _response.error.errorMessage,
|
|
2522
|
+
rawResponse: _response.rawResponse
|
|
2523
|
+
});
|
|
2524
|
+
}
|
|
2525
|
+
}
|
|
2526
|
+
/**
|
|
2527
|
+
* Deploy a contract from a template
|
|
2528
|
+
*
|
|
2529
|
+
* @param {string} templateId - Contract template ID
|
|
2530
|
+
* @param {OumlaSdkApi.DeployContractRequest} request
|
|
2531
|
+
* @param {ContractTemplates.RequestOptions} requestOptions - Request-specific configuration.
|
|
2532
|
+
*
|
|
2533
|
+
* @example
|
|
2534
|
+
* await client.contractTemplates.deployContract("templateId", {
|
|
2535
|
+
* network: "network",
|
|
2536
|
+
* addressId: "addressId",
|
|
2537
|
+
* clientShare: "clientShare"
|
|
2538
|
+
* })
|
|
2539
|
+
*/
|
|
2540
|
+
deployContract(templateId, request, requestOptions) {
|
|
2541
|
+
return HttpResponsePromise.fromPromise(this.__deployContract(templateId, request, requestOptions));
|
|
2542
|
+
}
|
|
2543
|
+
async __deployContract(templateId, request, requestOptions) {
|
|
2544
|
+
let _headers = mergeHeaders(
|
|
2545
|
+
this._options?.headers,
|
|
2546
|
+
mergeOnlyDefinedHeaders({
|
|
2547
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2548
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2549
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2550
|
+
}),
|
|
2551
|
+
requestOptions?.headers
|
|
2552
|
+
);
|
|
2553
|
+
const _response = await fetcher({
|
|
2554
|
+
url: url_exports.join(
|
|
2555
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2556
|
+
`api/v1/contract-templates/${encodeURIComponent(templateId)}/deploy`
|
|
2557
|
+
),
|
|
2558
|
+
method: "POST",
|
|
2559
|
+
headers: _headers,
|
|
2560
|
+
contentType: "application/json",
|
|
2561
|
+
queryParameters: requestOptions?.queryParams,
|
|
2562
|
+
requestType: "json",
|
|
2563
|
+
body: request,
|
|
2564
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2565
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2566
|
+
abortSignal: requestOptions?.abortSignal
|
|
2567
|
+
});
|
|
2568
|
+
if (_response.ok) {
|
|
2569
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2570
|
+
}
|
|
2571
|
+
if (_response.error.reason === "status-code") {
|
|
2572
|
+
throw new OumlaSdkApiError({
|
|
2573
|
+
statusCode: _response.error.statusCode,
|
|
2574
|
+
body: _response.error.body,
|
|
2575
|
+
rawResponse: _response.rawResponse
|
|
2576
|
+
});
|
|
2577
|
+
}
|
|
2578
|
+
switch (_response.error.reason) {
|
|
2579
|
+
case "non-json":
|
|
2580
|
+
throw new OumlaSdkApiError({
|
|
2581
|
+
statusCode: _response.error.statusCode,
|
|
2582
|
+
body: _response.error.rawBody,
|
|
2583
|
+
rawResponse: _response.rawResponse
|
|
2584
|
+
});
|
|
2585
|
+
case "timeout":
|
|
2586
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2587
|
+
"Timeout exceeded when calling POST /api/v1/contract-templates/{templateId}/deploy."
|
|
2588
|
+
);
|
|
2589
|
+
case "unknown":
|
|
2590
|
+
throw new OumlaSdkApiError({
|
|
2591
|
+
message: _response.error.errorMessage,
|
|
2592
|
+
rawResponse: _response.rawResponse
|
|
2593
|
+
});
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
async _getAuthorizationHeader() {
|
|
2597
|
+
const bearer = await Supplier.get(this._options.token);
|
|
2598
|
+
if (bearer != null) {
|
|
2599
|
+
return `Bearer ${bearer}`;
|
|
2600
|
+
}
|
|
2601
|
+
return void 0;
|
|
2602
|
+
}
|
|
2603
|
+
};
|
|
2604
|
+
|
|
2605
|
+
// api/resources/deployedContracts/client/Client.ts
|
|
2606
|
+
var DeployedContracts = class {
|
|
2607
|
+
constructor(_options) {
|
|
2608
|
+
this._options = _options;
|
|
2609
|
+
}
|
|
2610
|
+
/**
|
|
2611
|
+
* Retrieve a paginated list of deployed contracts
|
|
2612
|
+
*
|
|
2613
|
+
* @param {OumlaSdkApi.GetDeployedContractsRequest} request
|
|
2614
|
+
* @param {DeployedContracts.RequestOptions} requestOptions - Request-specific configuration.
|
|
2615
|
+
*
|
|
2616
|
+
* @example
|
|
2617
|
+
* await client.deployedContracts.getDeployedContracts({
|
|
2618
|
+
* skip: 1,
|
|
2619
|
+
* take: 1,
|
|
2620
|
+
* contractAddress: "contractAddress",
|
|
2621
|
+
* network: "BTC",
|
|
2622
|
+
* contractTemplateId: "contractTemplateId"
|
|
2623
|
+
* })
|
|
2624
|
+
*/
|
|
2625
|
+
getDeployedContracts(request = {}, requestOptions) {
|
|
2626
|
+
return HttpResponsePromise.fromPromise(this.__getDeployedContracts(request, requestOptions));
|
|
2627
|
+
}
|
|
2628
|
+
async __getDeployedContracts(request = {}, requestOptions) {
|
|
2629
|
+
const { skip, take, contractAddress, network, contractTemplateId } = request;
|
|
2630
|
+
const _queryParams = {};
|
|
2631
|
+
if (skip != null) {
|
|
2632
|
+
_queryParams["skip"] = skip.toString();
|
|
2633
|
+
}
|
|
2634
|
+
if (take != null) {
|
|
2635
|
+
_queryParams["take"] = take.toString();
|
|
2636
|
+
}
|
|
2637
|
+
if (contractAddress != null) {
|
|
2638
|
+
_queryParams["contractAddress"] = contractAddress;
|
|
2639
|
+
}
|
|
2640
|
+
if (network != null) {
|
|
2641
|
+
_queryParams["network"] = network;
|
|
2642
|
+
}
|
|
2643
|
+
if (contractTemplateId != null) {
|
|
2644
|
+
_queryParams["contractTemplateId"] = contractTemplateId;
|
|
2645
|
+
}
|
|
2646
|
+
let _headers = mergeHeaders(
|
|
2647
|
+
this._options?.headers,
|
|
2648
|
+
mergeOnlyDefinedHeaders({
|
|
2649
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2650
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2651
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2652
|
+
}),
|
|
2653
|
+
requestOptions?.headers
|
|
2654
|
+
);
|
|
2655
|
+
const _response = await fetcher({
|
|
2656
|
+
url: url_exports.join(
|
|
2657
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2658
|
+
"api/v1/deployed-contracts"
|
|
2659
|
+
),
|
|
2660
|
+
method: "GET",
|
|
2661
|
+
headers: _headers,
|
|
2662
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
2663
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2664
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2665
|
+
abortSignal: requestOptions?.abortSignal
|
|
2666
|
+
});
|
|
2667
|
+
if (_response.ok) {
|
|
2668
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2669
|
+
}
|
|
2670
|
+
if (_response.error.reason === "status-code") {
|
|
2671
|
+
throw new OumlaSdkApiError({
|
|
2672
|
+
statusCode: _response.error.statusCode,
|
|
2673
|
+
body: _response.error.body,
|
|
2674
|
+
rawResponse: _response.rawResponse
|
|
2675
|
+
});
|
|
2676
|
+
}
|
|
2677
|
+
switch (_response.error.reason) {
|
|
2678
|
+
case "non-json":
|
|
2679
|
+
throw new OumlaSdkApiError({
|
|
2680
|
+
statusCode: _response.error.statusCode,
|
|
2681
|
+
body: _response.error.rawBody,
|
|
2682
|
+
rawResponse: _response.rawResponse
|
|
2683
|
+
});
|
|
2684
|
+
case "timeout":
|
|
2685
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2686
|
+
"Timeout exceeded when calling GET /api/v1/deployed-contracts."
|
|
2687
|
+
);
|
|
2688
|
+
case "unknown":
|
|
2689
|
+
throw new OumlaSdkApiError({
|
|
2690
|
+
message: _response.error.errorMessage,
|
|
2691
|
+
rawResponse: _response.rawResponse
|
|
2692
|
+
});
|
|
2693
|
+
}
|
|
2694
|
+
}
|
|
2695
|
+
/**
|
|
2696
|
+
* Retrieve a specific deployed contract
|
|
2697
|
+
*
|
|
2698
|
+
* @param {string} contractId - Deployed contract ID
|
|
2699
|
+
* @param {DeployedContracts.RequestOptions} requestOptions - Request-specific configuration.
|
|
2700
|
+
*
|
|
2701
|
+
* @example
|
|
2702
|
+
* await client.deployedContracts.getDeployedContract("contractId")
|
|
2703
|
+
*/
|
|
2704
|
+
getDeployedContract(contractId, requestOptions) {
|
|
2705
|
+
return HttpResponsePromise.fromPromise(this.__getDeployedContract(contractId, requestOptions));
|
|
2706
|
+
}
|
|
2707
|
+
async __getDeployedContract(contractId, requestOptions) {
|
|
2708
|
+
let _headers = mergeHeaders(
|
|
2709
|
+
this._options?.headers,
|
|
2710
|
+
mergeOnlyDefinedHeaders({
|
|
2711
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2712
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2713
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2714
|
+
}),
|
|
2715
|
+
requestOptions?.headers
|
|
2716
|
+
);
|
|
2717
|
+
const _response = await fetcher({
|
|
2718
|
+
url: url_exports.join(
|
|
2719
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2720
|
+
`api/v1/deployed-contracts/${encodeURIComponent(contractId)}`
|
|
2721
|
+
),
|
|
2722
|
+
method: "GET",
|
|
2723
|
+
headers: _headers,
|
|
2724
|
+
queryParameters: requestOptions?.queryParams,
|
|
2725
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2726
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2727
|
+
abortSignal: requestOptions?.abortSignal
|
|
2728
|
+
});
|
|
2729
|
+
if (_response.ok) {
|
|
2730
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2731
|
+
}
|
|
2732
|
+
if (_response.error.reason === "status-code") {
|
|
2733
|
+
throw new OumlaSdkApiError({
|
|
2734
|
+
statusCode: _response.error.statusCode,
|
|
2735
|
+
body: _response.error.body,
|
|
2736
|
+
rawResponse: _response.rawResponse
|
|
2737
|
+
});
|
|
2738
|
+
}
|
|
2739
|
+
switch (_response.error.reason) {
|
|
2740
|
+
case "non-json":
|
|
2741
|
+
throw new OumlaSdkApiError({
|
|
2742
|
+
statusCode: _response.error.statusCode,
|
|
2743
|
+
body: _response.error.rawBody,
|
|
2744
|
+
rawResponse: _response.rawResponse
|
|
2745
|
+
});
|
|
2746
|
+
case "timeout":
|
|
2747
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2748
|
+
"Timeout exceeded when calling GET /api/v1/deployed-contracts/{contractId}."
|
|
2749
|
+
);
|
|
2750
|
+
case "unknown":
|
|
2751
|
+
throw new OumlaSdkApiError({
|
|
2752
|
+
message: _response.error.errorMessage,
|
|
2753
|
+
rawResponse: _response.rawResponse
|
|
2754
|
+
});
|
|
2755
|
+
}
|
|
2756
|
+
}
|
|
2757
|
+
/**
|
|
2758
|
+
* Retrieve a deployed contract by network and address
|
|
2759
|
+
*
|
|
2760
|
+
* @param {string} network - Blockchain network
|
|
2761
|
+
* @param {string} contractAddress - Contract address
|
|
2762
|
+
* @param {DeployedContracts.RequestOptions} requestOptions - Request-specific configuration.
|
|
2763
|
+
*
|
|
2764
|
+
* @example
|
|
2765
|
+
* await client.deployedContracts.getDeployedContractByAddress("network", "contractAddress")
|
|
2766
|
+
*/
|
|
2767
|
+
getDeployedContractByAddress(network, contractAddress, requestOptions) {
|
|
2768
|
+
return HttpResponsePromise.fromPromise(
|
|
2769
|
+
this.__getDeployedContractByAddress(network, contractAddress, requestOptions)
|
|
2770
|
+
);
|
|
2771
|
+
}
|
|
2772
|
+
async __getDeployedContractByAddress(network, contractAddress, requestOptions) {
|
|
2773
|
+
let _headers = mergeHeaders(
|
|
2774
|
+
this._options?.headers,
|
|
2775
|
+
mergeOnlyDefinedHeaders({
|
|
2776
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2777
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2778
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2779
|
+
}),
|
|
2780
|
+
requestOptions?.headers
|
|
2781
|
+
);
|
|
2782
|
+
const _response = await fetcher({
|
|
2783
|
+
url: url_exports.join(
|
|
2784
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2785
|
+
`api/v1/deployed-contracts/${encodeURIComponent(network)}/${encodeURIComponent(contractAddress)}`
|
|
2786
|
+
),
|
|
2787
|
+
method: "GET",
|
|
2788
|
+
headers: _headers,
|
|
2789
|
+
queryParameters: requestOptions?.queryParams,
|
|
2790
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2791
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2792
|
+
abortSignal: requestOptions?.abortSignal
|
|
2793
|
+
});
|
|
2794
|
+
if (_response.ok) {
|
|
2795
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2796
|
+
}
|
|
2797
|
+
if (_response.error.reason === "status-code") {
|
|
2798
|
+
throw new OumlaSdkApiError({
|
|
2799
|
+
statusCode: _response.error.statusCode,
|
|
2800
|
+
body: _response.error.body,
|
|
2801
|
+
rawResponse: _response.rawResponse
|
|
2802
|
+
});
|
|
2803
|
+
}
|
|
2804
|
+
switch (_response.error.reason) {
|
|
2805
|
+
case "non-json":
|
|
2806
|
+
throw new OumlaSdkApiError({
|
|
2807
|
+
statusCode: _response.error.statusCode,
|
|
2808
|
+
body: _response.error.rawBody,
|
|
2809
|
+
rawResponse: _response.rawResponse
|
|
2810
|
+
});
|
|
2811
|
+
case "timeout":
|
|
2812
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2813
|
+
"Timeout exceeded when calling GET /api/v1/deployed-contracts/{network}/{contractAddress}."
|
|
2814
|
+
);
|
|
2815
|
+
case "unknown":
|
|
2816
|
+
throw new OumlaSdkApiError({
|
|
2817
|
+
message: _response.error.errorMessage,
|
|
2818
|
+
rawResponse: _response.rawResponse
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
/**
|
|
2823
|
+
* Fetch ABI for a deployed contract
|
|
2824
|
+
*
|
|
2825
|
+
* @param {OumlaSdkApi.FetchContractAbiRequest} request
|
|
2826
|
+
* @param {DeployedContracts.RequestOptions} requestOptions - Request-specific configuration.
|
|
2827
|
+
*
|
|
2828
|
+
* @example
|
|
2829
|
+
* await client.deployedContracts.fetchContractAbi({
|
|
2830
|
+
* network: "network",
|
|
2831
|
+
* contractAddress: "contractAddress"
|
|
2832
|
+
* })
|
|
2833
|
+
*/
|
|
2834
|
+
fetchContractAbi(request, requestOptions) {
|
|
2835
|
+
return HttpResponsePromise.fromPromise(this.__fetchContractAbi(request, requestOptions));
|
|
2836
|
+
}
|
|
2837
|
+
async __fetchContractAbi(request, requestOptions) {
|
|
2838
|
+
let _headers = mergeHeaders(
|
|
2839
|
+
this._options?.headers,
|
|
2840
|
+
mergeOnlyDefinedHeaders({
|
|
2841
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2842
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2843
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2844
|
+
}),
|
|
2845
|
+
requestOptions?.headers
|
|
2846
|
+
);
|
|
2847
|
+
const _response = await fetcher({
|
|
2848
|
+
url: url_exports.join(
|
|
2849
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2850
|
+
"api/v1/deployed-contracts/fetch-abi"
|
|
2851
|
+
),
|
|
2852
|
+
method: "POST",
|
|
2853
|
+
headers: _headers,
|
|
2854
|
+
contentType: "application/json",
|
|
2855
|
+
queryParameters: requestOptions?.queryParams,
|
|
2856
|
+
requestType: "json",
|
|
2857
|
+
body: request,
|
|
2858
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2859
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2860
|
+
abortSignal: requestOptions?.abortSignal
|
|
2861
|
+
});
|
|
2862
|
+
if (_response.ok) {
|
|
2863
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2864
|
+
}
|
|
2865
|
+
if (_response.error.reason === "status-code") {
|
|
2866
|
+
throw new OumlaSdkApiError({
|
|
2867
|
+
statusCode: _response.error.statusCode,
|
|
2868
|
+
body: _response.error.body,
|
|
2869
|
+
rawResponse: _response.rawResponse
|
|
2870
|
+
});
|
|
2871
|
+
}
|
|
2872
|
+
switch (_response.error.reason) {
|
|
2873
|
+
case "non-json":
|
|
2874
|
+
throw new OumlaSdkApiError({
|
|
2875
|
+
statusCode: _response.error.statusCode,
|
|
2876
|
+
body: _response.error.rawBody,
|
|
2877
|
+
rawResponse: _response.rawResponse
|
|
2878
|
+
});
|
|
2879
|
+
case "timeout":
|
|
2880
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2881
|
+
"Timeout exceeded when calling POST /api/v1/deployed-contracts/fetch-abi."
|
|
2882
|
+
);
|
|
2883
|
+
case "unknown":
|
|
2884
|
+
throw new OumlaSdkApiError({
|
|
2885
|
+
message: _response.error.errorMessage,
|
|
2886
|
+
rawResponse: _response.rawResponse
|
|
2887
|
+
});
|
|
2888
|
+
}
|
|
2889
|
+
}
|
|
2890
|
+
/**
|
|
2891
|
+
* Add ABI for a deployed contract
|
|
2892
|
+
*
|
|
2893
|
+
* @param {OumlaSdkApi.AddContractAbiRequest} request
|
|
2894
|
+
* @param {DeployedContracts.RequestOptions} requestOptions - Request-specific configuration.
|
|
2895
|
+
*
|
|
2896
|
+
* @example
|
|
2897
|
+
* await client.deployedContracts.addContractAbi({
|
|
2898
|
+
* network: "network",
|
|
2899
|
+
* contractAddress: "contractAddress",
|
|
2900
|
+
* name: "name",
|
|
2901
|
+
* abi: [{
|
|
2902
|
+
* "key": "value"
|
|
2903
|
+
* }]
|
|
2904
|
+
* })
|
|
2905
|
+
*/
|
|
2906
|
+
addContractAbi(request, requestOptions) {
|
|
2907
|
+
return HttpResponsePromise.fromPromise(this.__addContractAbi(request, requestOptions));
|
|
2908
|
+
}
|
|
2909
|
+
async __addContractAbi(request, requestOptions) {
|
|
2910
|
+
let _headers = mergeHeaders(
|
|
2911
|
+
this._options?.headers,
|
|
2912
|
+
mergeOnlyDefinedHeaders({
|
|
2913
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2914
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2915
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2916
|
+
}),
|
|
2917
|
+
requestOptions?.headers
|
|
2918
|
+
);
|
|
2919
|
+
const _response = await fetcher({
|
|
2920
|
+
url: url_exports.join(
|
|
2921
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
2922
|
+
"api/v1/deployed-contracts/add-abi"
|
|
2923
|
+
),
|
|
2924
|
+
method: "POST",
|
|
2925
|
+
headers: _headers,
|
|
2926
|
+
contentType: "application/json",
|
|
2927
|
+
queryParameters: requestOptions?.queryParams,
|
|
2928
|
+
requestType: "json",
|
|
2929
|
+
body: request,
|
|
2930
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
2931
|
+
maxRetries: requestOptions?.maxRetries,
|
|
2932
|
+
abortSignal: requestOptions?.abortSignal
|
|
2933
|
+
});
|
|
2934
|
+
if (_response.ok) {
|
|
2935
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
2936
|
+
}
|
|
2937
|
+
if (_response.error.reason === "status-code") {
|
|
2938
|
+
throw new OumlaSdkApiError({
|
|
2939
|
+
statusCode: _response.error.statusCode,
|
|
2940
|
+
body: _response.error.body,
|
|
2941
|
+
rawResponse: _response.rawResponse
|
|
2942
|
+
});
|
|
2943
|
+
}
|
|
2944
|
+
switch (_response.error.reason) {
|
|
2945
|
+
case "non-json":
|
|
2946
|
+
throw new OumlaSdkApiError({
|
|
2947
|
+
statusCode: _response.error.statusCode,
|
|
2948
|
+
body: _response.error.rawBody,
|
|
2949
|
+
rawResponse: _response.rawResponse
|
|
2950
|
+
});
|
|
2951
|
+
case "timeout":
|
|
2952
|
+
throw new OumlaSdkApiTimeoutError(
|
|
2953
|
+
"Timeout exceeded when calling POST /api/v1/deployed-contracts/add-abi."
|
|
2954
|
+
);
|
|
2955
|
+
case "unknown":
|
|
2956
|
+
throw new OumlaSdkApiError({
|
|
2957
|
+
message: _response.error.errorMessage,
|
|
2958
|
+
rawResponse: _response.rawResponse
|
|
2959
|
+
});
|
|
2960
|
+
}
|
|
2961
|
+
}
|
|
2962
|
+
async _getAuthorizationHeader() {
|
|
2963
|
+
const bearer = await Supplier.get(this._options.token);
|
|
2964
|
+
if (bearer != null) {
|
|
2965
|
+
return `Bearer ${bearer}`;
|
|
2966
|
+
}
|
|
2967
|
+
return void 0;
|
|
2968
|
+
}
|
|
2969
|
+
};
|
|
2970
|
+
|
|
2971
|
+
// api/resources/contractInteractions/client/Client.ts
|
|
2972
|
+
var ContractInteractions = class {
|
|
2973
|
+
constructor(_options) {
|
|
2974
|
+
this._options = _options;
|
|
2975
|
+
}
|
|
2976
|
+
/**
|
|
2977
|
+
* Retrieve available functions for a deployed contract
|
|
2978
|
+
*
|
|
2979
|
+
* @param {string} network - Blockchain network
|
|
2980
|
+
* @param {string} contractAddress - Contract address
|
|
2981
|
+
* @param {ContractInteractions.RequestOptions} requestOptions - Request-specific configuration.
|
|
2982
|
+
*
|
|
2983
|
+
* @example
|
|
2984
|
+
* await client.contractInteractions.getContractFunctions("network", "contractAddress")
|
|
2985
|
+
*/
|
|
2986
|
+
getContractFunctions(network, contractAddress, requestOptions) {
|
|
2987
|
+
return HttpResponsePromise.fromPromise(
|
|
2988
|
+
this.__getContractFunctions(network, contractAddress, requestOptions)
|
|
2989
|
+
);
|
|
2990
|
+
}
|
|
2991
|
+
async __getContractFunctions(network, contractAddress, requestOptions) {
|
|
2992
|
+
let _headers = mergeHeaders(
|
|
2993
|
+
this._options?.headers,
|
|
2994
|
+
mergeOnlyDefinedHeaders({
|
|
2995
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
2996
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
2997
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
2998
|
+
}),
|
|
2999
|
+
requestOptions?.headers
|
|
3000
|
+
);
|
|
3001
|
+
const _response = await fetcher({
|
|
3002
|
+
url: url_exports.join(
|
|
3003
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3004
|
+
`api/v1/contract-interactions/network/${encodeURIComponent(network)}/contract-address/${encodeURIComponent(contractAddress)}/functions`
|
|
3005
|
+
),
|
|
3006
|
+
method: "GET",
|
|
3007
|
+
headers: _headers,
|
|
3008
|
+
queryParameters: requestOptions?.queryParams,
|
|
3009
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3010
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3011
|
+
abortSignal: requestOptions?.abortSignal
|
|
3012
|
+
});
|
|
3013
|
+
if (_response.ok) {
|
|
3014
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3015
|
+
}
|
|
3016
|
+
if (_response.error.reason === "status-code") {
|
|
3017
|
+
throw new OumlaSdkApiError({
|
|
3018
|
+
statusCode: _response.error.statusCode,
|
|
3019
|
+
body: _response.error.body,
|
|
3020
|
+
rawResponse: _response.rawResponse
|
|
3021
|
+
});
|
|
3022
|
+
}
|
|
3023
|
+
switch (_response.error.reason) {
|
|
3024
|
+
case "non-json":
|
|
3025
|
+
throw new OumlaSdkApiError({
|
|
3026
|
+
statusCode: _response.error.statusCode,
|
|
3027
|
+
body: _response.error.rawBody,
|
|
3028
|
+
rawResponse: _response.rawResponse
|
|
3029
|
+
});
|
|
3030
|
+
case "timeout":
|
|
3031
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3032
|
+
"Timeout exceeded when calling GET /api/v1/contract-interactions/network/{network}/contract-address/{contractAddress}/functions."
|
|
3033
|
+
);
|
|
3034
|
+
case "unknown":
|
|
3035
|
+
throw new OumlaSdkApiError({
|
|
3036
|
+
message: _response.error.errorMessage,
|
|
3037
|
+
rawResponse: _response.rawResponse
|
|
3038
|
+
});
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
3041
|
+
/**
|
|
3042
|
+
* Call a read function on a deployed contract
|
|
3043
|
+
*
|
|
3044
|
+
* @param {string} network - Blockchain network
|
|
3045
|
+
* @param {string} contractAddress - Contract address
|
|
3046
|
+
* @param {OumlaSdkApi.ReadFunctionRequest} request
|
|
3047
|
+
* @param {ContractInteractions.RequestOptions} requestOptions - Request-specific configuration.
|
|
3048
|
+
*
|
|
3049
|
+
* @example
|
|
3050
|
+
* await client.contractInteractions.callReadFunction("network", "contractAddress", {
|
|
3051
|
+
* abiFunction: {
|
|
3052
|
+
* name: "name",
|
|
3053
|
+
* inputs: [{}],
|
|
3054
|
+
* outputs: [{}],
|
|
3055
|
+
* type: "type"
|
|
3056
|
+
* }
|
|
3057
|
+
* })
|
|
3058
|
+
*/
|
|
3059
|
+
callReadFunction(network, contractAddress, request, requestOptions) {
|
|
3060
|
+
return HttpResponsePromise.fromPromise(
|
|
3061
|
+
this.__callReadFunction(network, contractAddress, request, requestOptions)
|
|
3062
|
+
);
|
|
3063
|
+
}
|
|
3064
|
+
async __callReadFunction(network, contractAddress, request, requestOptions) {
|
|
3065
|
+
let _headers = mergeHeaders(
|
|
3066
|
+
this._options?.headers,
|
|
3067
|
+
mergeOnlyDefinedHeaders({
|
|
3068
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3069
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3070
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3071
|
+
}),
|
|
3072
|
+
requestOptions?.headers
|
|
3073
|
+
);
|
|
3074
|
+
const _response = await fetcher({
|
|
3075
|
+
url: url_exports.join(
|
|
3076
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3077
|
+
`api/v1/contract-interactions/network/${encodeURIComponent(network)}/contract-address/${encodeURIComponent(contractAddress)}/functions/read`
|
|
3078
|
+
),
|
|
3079
|
+
method: "POST",
|
|
3080
|
+
headers: _headers,
|
|
3081
|
+
contentType: "application/json",
|
|
3082
|
+
queryParameters: requestOptions?.queryParams,
|
|
3083
|
+
requestType: "json",
|
|
3084
|
+
body: request,
|
|
3085
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3086
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3087
|
+
abortSignal: requestOptions?.abortSignal
|
|
3088
|
+
});
|
|
3089
|
+
if (_response.ok) {
|
|
3090
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3091
|
+
}
|
|
3092
|
+
if (_response.error.reason === "status-code") {
|
|
3093
|
+
throw new OumlaSdkApiError({
|
|
3094
|
+
statusCode: _response.error.statusCode,
|
|
3095
|
+
body: _response.error.body,
|
|
3096
|
+
rawResponse: _response.rawResponse
|
|
3097
|
+
});
|
|
3098
|
+
}
|
|
3099
|
+
switch (_response.error.reason) {
|
|
3100
|
+
case "non-json":
|
|
3101
|
+
throw new OumlaSdkApiError({
|
|
3102
|
+
statusCode: _response.error.statusCode,
|
|
3103
|
+
body: _response.error.rawBody,
|
|
3104
|
+
rawResponse: _response.rawResponse
|
|
3105
|
+
});
|
|
3106
|
+
case "timeout":
|
|
3107
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3108
|
+
"Timeout exceeded when calling POST /api/v1/contract-interactions/network/{network}/contract-address/{contractAddress}/functions/read."
|
|
3109
|
+
);
|
|
3110
|
+
case "unknown":
|
|
3111
|
+
throw new OumlaSdkApiError({
|
|
3112
|
+
message: _response.error.errorMessage,
|
|
3113
|
+
rawResponse: _response.rawResponse
|
|
3114
|
+
});
|
|
3115
|
+
}
|
|
3116
|
+
}
|
|
3117
|
+
/**
|
|
3118
|
+
* Call a write function on a deployed contract
|
|
3119
|
+
*
|
|
3120
|
+
* @param {string} network - Blockchain network
|
|
3121
|
+
* @param {string} contractAddress - Contract address
|
|
3122
|
+
* @param {OumlaSdkApi.WriteFunctionRequest} request
|
|
3123
|
+
* @param {ContractInteractions.RequestOptions} requestOptions - Request-specific configuration.
|
|
3124
|
+
*
|
|
3125
|
+
* @example
|
|
3126
|
+
* await client.contractInteractions.callWriteFunction("network", "contractAddress", {
|
|
3127
|
+
* addressId: "addressId",
|
|
3128
|
+
* clientShare: "clientShare",
|
|
3129
|
+
* abiFunction: {
|
|
3130
|
+
* name: "name",
|
|
3131
|
+
* inputs: [{}],
|
|
3132
|
+
* outputs: [{}],
|
|
3133
|
+
* type: "type"
|
|
3134
|
+
* }
|
|
3135
|
+
* })
|
|
3136
|
+
*/
|
|
3137
|
+
callWriteFunction(network, contractAddress, request, requestOptions) {
|
|
3138
|
+
return HttpResponsePromise.fromPromise(
|
|
3139
|
+
this.__callWriteFunction(network, contractAddress, request, requestOptions)
|
|
3140
|
+
);
|
|
3141
|
+
}
|
|
3142
|
+
async __callWriteFunction(network, contractAddress, request, requestOptions) {
|
|
3143
|
+
let _headers = mergeHeaders(
|
|
3144
|
+
this._options?.headers,
|
|
3145
|
+
mergeOnlyDefinedHeaders({
|
|
3146
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3147
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3148
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3149
|
+
}),
|
|
3150
|
+
requestOptions?.headers
|
|
3151
|
+
);
|
|
3152
|
+
const _response = await fetcher({
|
|
3153
|
+
url: url_exports.join(
|
|
3154
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3155
|
+
`api/v1/contract-interactions/network/${encodeURIComponent(network)}/contract-address/${encodeURIComponent(contractAddress)}/functions/write`
|
|
3156
|
+
),
|
|
3157
|
+
method: "POST",
|
|
3158
|
+
headers: _headers,
|
|
3159
|
+
contentType: "application/json",
|
|
3160
|
+
queryParameters: requestOptions?.queryParams,
|
|
3161
|
+
requestType: "json",
|
|
3162
|
+
body: request,
|
|
3163
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3164
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3165
|
+
abortSignal: requestOptions?.abortSignal
|
|
3166
|
+
});
|
|
3167
|
+
if (_response.ok) {
|
|
3168
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3169
|
+
}
|
|
3170
|
+
if (_response.error.reason === "status-code") {
|
|
3171
|
+
throw new OumlaSdkApiError({
|
|
3172
|
+
statusCode: _response.error.statusCode,
|
|
3173
|
+
body: _response.error.body,
|
|
3174
|
+
rawResponse: _response.rawResponse
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
switch (_response.error.reason) {
|
|
3178
|
+
case "non-json":
|
|
3179
|
+
throw new OumlaSdkApiError({
|
|
3180
|
+
statusCode: _response.error.statusCode,
|
|
3181
|
+
body: _response.error.rawBody,
|
|
3182
|
+
rawResponse: _response.rawResponse
|
|
3183
|
+
});
|
|
3184
|
+
case "timeout":
|
|
3185
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3186
|
+
"Timeout exceeded when calling POST /api/v1/contract-interactions/network/{network}/contract-address/{contractAddress}/functions/write."
|
|
3187
|
+
);
|
|
3188
|
+
case "unknown":
|
|
3189
|
+
throw new OumlaSdkApiError({
|
|
3190
|
+
message: _response.error.errorMessage,
|
|
3191
|
+
rawResponse: _response.rawResponse
|
|
3192
|
+
});
|
|
3193
|
+
}
|
|
3194
|
+
}
|
|
3195
|
+
/**
|
|
3196
|
+
* Retrieve transaction receipt for a specific transaction
|
|
3197
|
+
*
|
|
3198
|
+
* @param {string} network - Blockchain network
|
|
3199
|
+
* @param {string} txId - Transaction ID
|
|
3200
|
+
* @param {ContractInteractions.RequestOptions} requestOptions - Request-specific configuration.
|
|
3201
|
+
*
|
|
3202
|
+
* @example
|
|
3203
|
+
* await client.contractInteractions.getTransactionReceipt("network", "txId")
|
|
3204
|
+
*/
|
|
3205
|
+
getTransactionReceipt(network, txId, requestOptions) {
|
|
3206
|
+
return HttpResponsePromise.fromPromise(this.__getTransactionReceipt(network, txId, requestOptions));
|
|
3207
|
+
}
|
|
3208
|
+
async __getTransactionReceipt(network, txId, requestOptions) {
|
|
3209
|
+
let _headers = mergeHeaders(
|
|
3210
|
+
this._options?.headers,
|
|
3211
|
+
mergeOnlyDefinedHeaders({
|
|
3212
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3213
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3214
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3215
|
+
}),
|
|
3216
|
+
requestOptions?.headers
|
|
3217
|
+
);
|
|
3218
|
+
const _response = await fetcher({
|
|
3219
|
+
url: url_exports.join(
|
|
3220
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3221
|
+
`api/v1/contract-interactions/network/${encodeURIComponent(network)}/tx/${encodeURIComponent(txId)}`
|
|
3222
|
+
),
|
|
3223
|
+
method: "GET",
|
|
3224
|
+
headers: _headers,
|
|
3225
|
+
queryParameters: requestOptions?.queryParams,
|
|
3226
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3227
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3228
|
+
abortSignal: requestOptions?.abortSignal
|
|
3229
|
+
});
|
|
3230
|
+
if (_response.ok) {
|
|
3231
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3232
|
+
}
|
|
3233
|
+
if (_response.error.reason === "status-code") {
|
|
3234
|
+
throw new OumlaSdkApiError({
|
|
3235
|
+
statusCode: _response.error.statusCode,
|
|
3236
|
+
body: _response.error.body,
|
|
3237
|
+
rawResponse: _response.rawResponse
|
|
3238
|
+
});
|
|
3239
|
+
}
|
|
3240
|
+
switch (_response.error.reason) {
|
|
3241
|
+
case "non-json":
|
|
3242
|
+
throw new OumlaSdkApiError({
|
|
3243
|
+
statusCode: _response.error.statusCode,
|
|
3244
|
+
body: _response.error.rawBody,
|
|
3245
|
+
rawResponse: _response.rawResponse
|
|
3246
|
+
});
|
|
3247
|
+
case "timeout":
|
|
3248
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3249
|
+
"Timeout exceeded when calling GET /api/v1/contract-interactions/network/{network}/tx/{txId}."
|
|
3250
|
+
);
|
|
3251
|
+
case "unknown":
|
|
3252
|
+
throw new OumlaSdkApiError({
|
|
3253
|
+
message: _response.error.errorMessage,
|
|
3254
|
+
rawResponse: _response.rawResponse
|
|
3255
|
+
});
|
|
3256
|
+
}
|
|
3257
|
+
}
|
|
3258
|
+
async _getAuthorizationHeader() {
|
|
3259
|
+
const bearer = await Supplier.get(this._options.token);
|
|
3260
|
+
if (bearer != null) {
|
|
3261
|
+
return `Bearer ${bearer}`;
|
|
3262
|
+
}
|
|
3263
|
+
return void 0;
|
|
3264
|
+
}
|
|
3265
|
+
};
|
|
3266
|
+
|
|
3267
|
+
// api/resources/tokenization/client/Client.ts
|
|
3268
|
+
var Tokenization = class {
|
|
3269
|
+
constructor(_options) {
|
|
3270
|
+
this._options = _options;
|
|
3271
|
+
}
|
|
3272
|
+
/**
|
|
3273
|
+
* Retrieve a paginated list of tokens
|
|
3274
|
+
*
|
|
3275
|
+
* @param {OumlaSdkApi.GetTokensRequest} request
|
|
3276
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3277
|
+
*
|
|
3278
|
+
* @example
|
|
3279
|
+
* await client.tokenization.getTokens({
|
|
3280
|
+
* skip: 1,
|
|
3281
|
+
* take: 1
|
|
3282
|
+
* })
|
|
3283
|
+
*/
|
|
3284
|
+
getTokens(request = {}, requestOptions) {
|
|
3285
|
+
return HttpResponsePromise.fromPromise(this.__getTokens(request, requestOptions));
|
|
3286
|
+
}
|
|
3287
|
+
async __getTokens(request = {}, requestOptions) {
|
|
3288
|
+
const { skip, take } = request;
|
|
3289
|
+
const _queryParams = {};
|
|
3290
|
+
if (skip != null) {
|
|
3291
|
+
_queryParams["skip"] = skip.toString();
|
|
3292
|
+
}
|
|
3293
|
+
if (take != null) {
|
|
3294
|
+
_queryParams["take"] = take.toString();
|
|
3295
|
+
}
|
|
3296
|
+
let _headers = mergeHeaders(
|
|
3297
|
+
this._options?.headers,
|
|
3298
|
+
mergeOnlyDefinedHeaders({
|
|
3299
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3300
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3301
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3302
|
+
}),
|
|
3303
|
+
requestOptions?.headers
|
|
3304
|
+
);
|
|
3305
|
+
const _response = await fetcher({
|
|
3306
|
+
url: url_exports.join(
|
|
3307
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3308
|
+
"api/v1/tokenization/tokens"
|
|
3309
|
+
),
|
|
3310
|
+
method: "GET",
|
|
3311
|
+
headers: _headers,
|
|
3312
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
3313
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3314
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3315
|
+
abortSignal: requestOptions?.abortSignal
|
|
3316
|
+
});
|
|
3317
|
+
if (_response.ok) {
|
|
3318
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3319
|
+
}
|
|
3320
|
+
if (_response.error.reason === "status-code") {
|
|
3321
|
+
throw new OumlaSdkApiError({
|
|
3322
|
+
statusCode: _response.error.statusCode,
|
|
3323
|
+
body: _response.error.body,
|
|
3324
|
+
rawResponse: _response.rawResponse
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
switch (_response.error.reason) {
|
|
3328
|
+
case "non-json":
|
|
3329
|
+
throw new OumlaSdkApiError({
|
|
3330
|
+
statusCode: _response.error.statusCode,
|
|
3331
|
+
body: _response.error.rawBody,
|
|
3332
|
+
rawResponse: _response.rawResponse
|
|
3333
|
+
});
|
|
3334
|
+
case "timeout":
|
|
3335
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3336
|
+
"Timeout exceeded when calling GET /api/v1/tokenization/tokens."
|
|
3337
|
+
);
|
|
3338
|
+
case "unknown":
|
|
3339
|
+
throw new OumlaSdkApiError({
|
|
3340
|
+
message: _response.error.errorMessage,
|
|
3341
|
+
rawResponse: _response.rawResponse
|
|
3342
|
+
});
|
|
3343
|
+
}
|
|
3344
|
+
}
|
|
3345
|
+
/**
|
|
3346
|
+
* Issue a new token using a contract template
|
|
3347
|
+
*
|
|
3348
|
+
* @param {OumlaSdkApi.IssueNewTokenRequest} request
|
|
3349
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3350
|
+
*
|
|
3351
|
+
* @example
|
|
3352
|
+
* await client.tokenization.issueNewToken({
|
|
3353
|
+
* addressId: "addressId",
|
|
3354
|
+
* clientShare: "clientShare",
|
|
3355
|
+
* deploymentId: "deploymentId",
|
|
3356
|
+
* createParams: {
|
|
3357
|
+
* initializeParams: [{
|
|
3358
|
+
* name: "name",
|
|
3359
|
+
* type: "type",
|
|
3360
|
+
* value: "value"
|
|
3361
|
+
* }]
|
|
3362
|
+
* }
|
|
3363
|
+
* })
|
|
3364
|
+
*/
|
|
3365
|
+
issueNewToken(request, requestOptions) {
|
|
3366
|
+
return HttpResponsePromise.fromPromise(this.__issueNewToken(request, requestOptions));
|
|
3367
|
+
}
|
|
3368
|
+
async __issueNewToken(request, requestOptions) {
|
|
3369
|
+
let _headers = mergeHeaders(
|
|
3370
|
+
this._options?.headers,
|
|
3371
|
+
mergeOnlyDefinedHeaders({
|
|
3372
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3373
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3374
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3375
|
+
}),
|
|
3376
|
+
requestOptions?.headers
|
|
3377
|
+
);
|
|
3378
|
+
const _response = await fetcher({
|
|
3379
|
+
url: url_exports.join(
|
|
3380
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3381
|
+
"api/v1/tokenization/tokens"
|
|
3382
|
+
),
|
|
3383
|
+
method: "POST",
|
|
3384
|
+
headers: _headers,
|
|
3385
|
+
contentType: "application/json",
|
|
3386
|
+
queryParameters: requestOptions?.queryParams,
|
|
3387
|
+
requestType: "json",
|
|
3388
|
+
body: request,
|
|
3389
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3390
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3391
|
+
abortSignal: requestOptions?.abortSignal
|
|
3392
|
+
});
|
|
3393
|
+
if (_response.ok) {
|
|
3394
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3395
|
+
}
|
|
3396
|
+
if (_response.error.reason === "status-code") {
|
|
3397
|
+
throw new OumlaSdkApiError({
|
|
3398
|
+
statusCode: _response.error.statusCode,
|
|
3399
|
+
body: _response.error.body,
|
|
3400
|
+
rawResponse: _response.rawResponse
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
switch (_response.error.reason) {
|
|
3404
|
+
case "non-json":
|
|
3405
|
+
throw new OumlaSdkApiError({
|
|
3406
|
+
statusCode: _response.error.statusCode,
|
|
3407
|
+
body: _response.error.rawBody,
|
|
3408
|
+
rawResponse: _response.rawResponse
|
|
3409
|
+
});
|
|
3410
|
+
case "timeout":
|
|
3411
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3412
|
+
"Timeout exceeded when calling POST /api/v1/tokenization/tokens."
|
|
3413
|
+
);
|
|
3414
|
+
case "unknown":
|
|
3415
|
+
throw new OumlaSdkApiError({
|
|
3416
|
+
message: _response.error.errorMessage,
|
|
3417
|
+
rawResponse: _response.rawResponse
|
|
3418
|
+
});
|
|
3419
|
+
}
|
|
3420
|
+
}
|
|
3421
|
+
/**
|
|
3422
|
+
* Link an existing contract to the platform
|
|
3423
|
+
*
|
|
3424
|
+
* @param {OumlaSdkApi.LinkContractRequest} request
|
|
3425
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3426
|
+
*
|
|
3427
|
+
* @example
|
|
3428
|
+
* await client.tokenization.linkContract({
|
|
3429
|
+
* contractAddress: "contractAddress"
|
|
3430
|
+
* })
|
|
3431
|
+
*/
|
|
3432
|
+
linkContract(request, requestOptions) {
|
|
3433
|
+
return HttpResponsePromise.fromPromise(this.__linkContract(request, requestOptions));
|
|
3434
|
+
}
|
|
3435
|
+
async __linkContract(request, requestOptions) {
|
|
3436
|
+
let _headers = mergeHeaders(
|
|
3437
|
+
this._options?.headers,
|
|
3438
|
+
mergeOnlyDefinedHeaders({
|
|
3439
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3440
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3441
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3442
|
+
}),
|
|
3443
|
+
requestOptions?.headers
|
|
3444
|
+
);
|
|
3445
|
+
const _response = await fetcher({
|
|
3446
|
+
url: url_exports.join(
|
|
3447
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3448
|
+
"api/v1/tokenization/tokens/link"
|
|
3449
|
+
),
|
|
3450
|
+
method: "POST",
|
|
3451
|
+
headers: _headers,
|
|
3452
|
+
contentType: "application/json",
|
|
3453
|
+
queryParameters: requestOptions?.queryParams,
|
|
3454
|
+
requestType: "json",
|
|
3455
|
+
body: request,
|
|
3456
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3457
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3458
|
+
abortSignal: requestOptions?.abortSignal
|
|
3459
|
+
});
|
|
3460
|
+
if (_response.ok) {
|
|
3461
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3462
|
+
}
|
|
3463
|
+
if (_response.error.reason === "status-code") {
|
|
3464
|
+
throw new OumlaSdkApiError({
|
|
3465
|
+
statusCode: _response.error.statusCode,
|
|
3466
|
+
body: _response.error.body,
|
|
3467
|
+
rawResponse: _response.rawResponse
|
|
3468
|
+
});
|
|
3469
|
+
}
|
|
3470
|
+
switch (_response.error.reason) {
|
|
3471
|
+
case "non-json":
|
|
3472
|
+
throw new OumlaSdkApiError({
|
|
3473
|
+
statusCode: _response.error.statusCode,
|
|
3474
|
+
body: _response.error.rawBody,
|
|
3475
|
+
rawResponse: _response.rawResponse
|
|
3476
|
+
});
|
|
3477
|
+
case "timeout":
|
|
3478
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3479
|
+
"Timeout exceeded when calling POST /api/v1/tokenization/tokens/link."
|
|
3480
|
+
);
|
|
3481
|
+
case "unknown":
|
|
3482
|
+
throw new OumlaSdkApiError({
|
|
3483
|
+
message: _response.error.errorMessage,
|
|
3484
|
+
rawResponse: _response.rawResponse
|
|
3485
|
+
});
|
|
3486
|
+
}
|
|
3487
|
+
}
|
|
3488
|
+
/**
|
|
3489
|
+
* Retrieve a paginated list of collections
|
|
3490
|
+
*
|
|
3491
|
+
* @param {OumlaSdkApi.GetCollectionsRequest} request
|
|
3492
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3493
|
+
*
|
|
3494
|
+
* @example
|
|
3495
|
+
* await client.tokenization.getCollections({
|
|
3496
|
+
* skip: 1,
|
|
3497
|
+
* take: 1
|
|
3498
|
+
* })
|
|
3499
|
+
*/
|
|
3500
|
+
getCollections(request = {}, requestOptions) {
|
|
3501
|
+
return HttpResponsePromise.fromPromise(this.__getCollections(request, requestOptions));
|
|
3502
|
+
}
|
|
3503
|
+
async __getCollections(request = {}, requestOptions) {
|
|
3504
|
+
const { skip, take } = request;
|
|
3505
|
+
const _queryParams = {};
|
|
3506
|
+
if (skip != null) {
|
|
3507
|
+
_queryParams["skip"] = skip.toString();
|
|
3508
|
+
}
|
|
3509
|
+
if (take != null) {
|
|
3510
|
+
_queryParams["take"] = take.toString();
|
|
3511
|
+
}
|
|
3512
|
+
let _headers = mergeHeaders(
|
|
3513
|
+
this._options?.headers,
|
|
3514
|
+
mergeOnlyDefinedHeaders({
|
|
3515
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3516
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3517
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3518
|
+
}),
|
|
3519
|
+
requestOptions?.headers
|
|
3520
|
+
);
|
|
3521
|
+
const _response = await fetcher({
|
|
3522
|
+
url: url_exports.join(
|
|
3523
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3524
|
+
"api/v1/tokenization/collections"
|
|
3525
|
+
),
|
|
3526
|
+
method: "GET",
|
|
3527
|
+
headers: _headers,
|
|
3528
|
+
queryParameters: { ..._queryParams, ...requestOptions?.queryParams },
|
|
3529
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3530
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3531
|
+
abortSignal: requestOptions?.abortSignal
|
|
3532
|
+
});
|
|
3533
|
+
if (_response.ok) {
|
|
3534
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3535
|
+
}
|
|
3536
|
+
if (_response.error.reason === "status-code") {
|
|
3537
|
+
throw new OumlaSdkApiError({
|
|
3538
|
+
statusCode: _response.error.statusCode,
|
|
3539
|
+
body: _response.error.body,
|
|
3540
|
+
rawResponse: _response.rawResponse
|
|
3541
|
+
});
|
|
3542
|
+
}
|
|
3543
|
+
switch (_response.error.reason) {
|
|
3544
|
+
case "non-json":
|
|
3545
|
+
throw new OumlaSdkApiError({
|
|
3546
|
+
statusCode: _response.error.statusCode,
|
|
3547
|
+
body: _response.error.rawBody,
|
|
3548
|
+
rawResponse: _response.rawResponse
|
|
3549
|
+
});
|
|
3550
|
+
case "timeout":
|
|
3551
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3552
|
+
"Timeout exceeded when calling GET /api/v1/tokenization/collections."
|
|
3553
|
+
);
|
|
3554
|
+
case "unknown":
|
|
3555
|
+
throw new OumlaSdkApiError({
|
|
3556
|
+
message: _response.error.errorMessage,
|
|
3557
|
+
rawResponse: _response.rawResponse
|
|
3558
|
+
});
|
|
3559
|
+
}
|
|
3560
|
+
}
|
|
3561
|
+
/**
|
|
3562
|
+
* Create a new token collection
|
|
3563
|
+
*
|
|
3564
|
+
* @param {OumlaSdkApi.CreateCollectionRequest} request
|
|
3565
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3566
|
+
*
|
|
3567
|
+
* @example
|
|
3568
|
+
* await client.tokenization.createCollection({
|
|
3569
|
+
* type: "NON_FUNGIBLE_TOKEN",
|
|
3570
|
+
* addressId: "addressId",
|
|
3571
|
+
* clientShare: "clientShare",
|
|
3572
|
+
* createParams: {
|
|
3573
|
+
* initializeParams: [{
|
|
3574
|
+
* name: "name",
|
|
3575
|
+
* type: "type",
|
|
3576
|
+
* value: "value"
|
|
3577
|
+
* }]
|
|
3578
|
+
* }
|
|
3579
|
+
* })
|
|
3580
|
+
*/
|
|
3581
|
+
createCollection(request, requestOptions) {
|
|
3582
|
+
return HttpResponsePromise.fromPromise(this.__createCollection(request, requestOptions));
|
|
3583
|
+
}
|
|
3584
|
+
async __createCollection(request, requestOptions) {
|
|
3585
|
+
let _headers = mergeHeaders(
|
|
3586
|
+
this._options?.headers,
|
|
3587
|
+
mergeOnlyDefinedHeaders({
|
|
3588
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3589
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3590
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3591
|
+
}),
|
|
3592
|
+
requestOptions?.headers
|
|
3593
|
+
);
|
|
3594
|
+
const _response = await fetcher({
|
|
3595
|
+
url: url_exports.join(
|
|
3596
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3597
|
+
"api/v1/tokenization/collections"
|
|
3598
|
+
),
|
|
3599
|
+
method: "POST",
|
|
3600
|
+
headers: _headers,
|
|
3601
|
+
contentType: "application/json",
|
|
3602
|
+
queryParameters: requestOptions?.queryParams,
|
|
3603
|
+
requestType: "json",
|
|
3604
|
+
body: request,
|
|
3605
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3606
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3607
|
+
abortSignal: requestOptions?.abortSignal
|
|
3608
|
+
});
|
|
3609
|
+
if (_response.ok) {
|
|
3610
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3611
|
+
}
|
|
3612
|
+
if (_response.error.reason === "status-code") {
|
|
3613
|
+
throw new OumlaSdkApiError({
|
|
3614
|
+
statusCode: _response.error.statusCode,
|
|
3615
|
+
body: _response.error.body,
|
|
3616
|
+
rawResponse: _response.rawResponse
|
|
3617
|
+
});
|
|
3618
|
+
}
|
|
3619
|
+
switch (_response.error.reason) {
|
|
3620
|
+
case "non-json":
|
|
3621
|
+
throw new OumlaSdkApiError({
|
|
3622
|
+
statusCode: _response.error.statusCode,
|
|
3623
|
+
body: _response.error.rawBody,
|
|
3624
|
+
rawResponse: _response.rawResponse
|
|
3625
|
+
});
|
|
3626
|
+
case "timeout":
|
|
3627
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3628
|
+
"Timeout exceeded when calling POST /api/v1/tokenization/collections."
|
|
3629
|
+
);
|
|
3630
|
+
case "unknown":
|
|
3631
|
+
throw new OumlaSdkApiError({
|
|
3632
|
+
message: _response.error.errorMessage,
|
|
3633
|
+
rawResponse: _response.rawResponse
|
|
3634
|
+
});
|
|
3635
|
+
}
|
|
3636
|
+
}
|
|
3637
|
+
/**
|
|
3638
|
+
* Retrieve a specific collection
|
|
3639
|
+
*
|
|
3640
|
+
* @param {string} id - Collection ID
|
|
3641
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3642
|
+
*
|
|
3643
|
+
* @example
|
|
3644
|
+
* await client.tokenization.getCollection("id")
|
|
3645
|
+
*/
|
|
3646
|
+
getCollection(id, requestOptions) {
|
|
3647
|
+
return HttpResponsePromise.fromPromise(this.__getCollection(id, requestOptions));
|
|
3648
|
+
}
|
|
3649
|
+
async __getCollection(id, requestOptions) {
|
|
3650
|
+
let _headers = mergeHeaders(
|
|
3651
|
+
this._options?.headers,
|
|
3652
|
+
mergeOnlyDefinedHeaders({
|
|
3653
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3654
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3655
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3656
|
+
}),
|
|
3657
|
+
requestOptions?.headers
|
|
3658
|
+
);
|
|
3659
|
+
const _response = await fetcher({
|
|
3660
|
+
url: url_exports.join(
|
|
3661
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3662
|
+
`api/v1/tokenization/collections/${encodeURIComponent(id)}`
|
|
3663
|
+
),
|
|
3664
|
+
method: "GET",
|
|
3665
|
+
headers: _headers,
|
|
3666
|
+
queryParameters: requestOptions?.queryParams,
|
|
3667
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3668
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3669
|
+
abortSignal: requestOptions?.abortSignal
|
|
3670
|
+
});
|
|
3671
|
+
if (_response.ok) {
|
|
3672
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3673
|
+
}
|
|
3674
|
+
if (_response.error.reason === "status-code") {
|
|
3675
|
+
throw new OumlaSdkApiError({
|
|
3676
|
+
statusCode: _response.error.statusCode,
|
|
3677
|
+
body: _response.error.body,
|
|
3678
|
+
rawResponse: _response.rawResponse
|
|
3679
|
+
});
|
|
3680
|
+
}
|
|
3681
|
+
switch (_response.error.reason) {
|
|
3682
|
+
case "non-json":
|
|
3683
|
+
throw new OumlaSdkApiError({
|
|
3684
|
+
statusCode: _response.error.statusCode,
|
|
3685
|
+
body: _response.error.rawBody,
|
|
3686
|
+
rawResponse: _response.rawResponse
|
|
3687
|
+
});
|
|
3688
|
+
case "timeout":
|
|
3689
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3690
|
+
"Timeout exceeded when calling GET /api/v1/tokenization/collections/{id}."
|
|
3691
|
+
);
|
|
3692
|
+
case "unknown":
|
|
3693
|
+
throw new OumlaSdkApiError({
|
|
3694
|
+
message: _response.error.errorMessage,
|
|
3695
|
+
rawResponse: _response.rawResponse
|
|
3696
|
+
});
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
/**
|
|
3700
|
+
* Delete a collection
|
|
3701
|
+
*
|
|
3702
|
+
* @param {string} id - Collection ID
|
|
3703
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3704
|
+
*
|
|
3705
|
+
* @example
|
|
3706
|
+
* await client.tokenization.deleteCollection("id")
|
|
3707
|
+
*/
|
|
3708
|
+
deleteCollection(id, requestOptions) {
|
|
3709
|
+
return HttpResponsePromise.fromPromise(this.__deleteCollection(id, requestOptions));
|
|
3710
|
+
}
|
|
3711
|
+
async __deleteCollection(id, requestOptions) {
|
|
3712
|
+
let _headers = mergeHeaders(
|
|
3713
|
+
this._options?.headers,
|
|
3714
|
+
mergeOnlyDefinedHeaders({
|
|
3715
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3716
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3717
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3718
|
+
}),
|
|
3719
|
+
requestOptions?.headers
|
|
3720
|
+
);
|
|
3721
|
+
const _response = await fetcher({
|
|
3722
|
+
url: url_exports.join(
|
|
3723
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3724
|
+
`api/v1/tokenization/collections/${encodeURIComponent(id)}`
|
|
3725
|
+
),
|
|
3726
|
+
method: "DELETE",
|
|
3727
|
+
headers: _headers,
|
|
3728
|
+
queryParameters: requestOptions?.queryParams,
|
|
3729
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3730
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3731
|
+
abortSignal: requestOptions?.abortSignal
|
|
3732
|
+
});
|
|
3733
|
+
if (_response.ok) {
|
|
3734
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3735
|
+
}
|
|
3736
|
+
if (_response.error.reason === "status-code") {
|
|
3737
|
+
throw new OumlaSdkApiError({
|
|
3738
|
+
statusCode: _response.error.statusCode,
|
|
3739
|
+
body: _response.error.body,
|
|
3740
|
+
rawResponse: _response.rawResponse
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
switch (_response.error.reason) {
|
|
3744
|
+
case "non-json":
|
|
3745
|
+
throw new OumlaSdkApiError({
|
|
3746
|
+
statusCode: _response.error.statusCode,
|
|
3747
|
+
body: _response.error.rawBody,
|
|
3748
|
+
rawResponse: _response.rawResponse
|
|
3749
|
+
});
|
|
3750
|
+
case "timeout":
|
|
3751
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3752
|
+
"Timeout exceeded when calling DELETE /api/v1/tokenization/collections/{id}."
|
|
3753
|
+
);
|
|
3754
|
+
case "unknown":
|
|
3755
|
+
throw new OumlaSdkApiError({
|
|
3756
|
+
message: _response.error.errorMessage,
|
|
3757
|
+
rawResponse: _response.rawResponse
|
|
3758
|
+
});
|
|
3759
|
+
}
|
|
3760
|
+
}
|
|
3761
|
+
/**
|
|
3762
|
+
* Retrieve details for a specific token in a collection
|
|
3763
|
+
*
|
|
3764
|
+
* @param {string} id - Collection ID
|
|
3765
|
+
* @param {string} tokenId - Token ID
|
|
3766
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3767
|
+
*
|
|
3768
|
+
* @example
|
|
3769
|
+
* await client.tokenization.getCollectionTokenDetails("id", "tokenId")
|
|
3770
|
+
*/
|
|
3771
|
+
getCollectionTokenDetails(id, tokenId, requestOptions) {
|
|
3772
|
+
return HttpResponsePromise.fromPromise(this.__getCollectionTokenDetails(id, tokenId, requestOptions));
|
|
3773
|
+
}
|
|
3774
|
+
async __getCollectionTokenDetails(id, tokenId, requestOptions) {
|
|
3775
|
+
let _headers = mergeHeaders(
|
|
3776
|
+
this._options?.headers,
|
|
3777
|
+
mergeOnlyDefinedHeaders({
|
|
3778
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3779
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3780
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3781
|
+
}),
|
|
3782
|
+
requestOptions?.headers
|
|
3783
|
+
);
|
|
3784
|
+
const _response = await fetcher({
|
|
3785
|
+
url: url_exports.join(
|
|
3786
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3787
|
+
`api/v1/tokenization/collections/${encodeURIComponent(id)}/tokens/${encodeURIComponent(tokenId)}`
|
|
3788
|
+
),
|
|
3789
|
+
method: "GET",
|
|
3790
|
+
headers: _headers,
|
|
3791
|
+
queryParameters: requestOptions?.queryParams,
|
|
3792
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3793
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3794
|
+
abortSignal: requestOptions?.abortSignal
|
|
3795
|
+
});
|
|
3796
|
+
if (_response.ok) {
|
|
3797
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3798
|
+
}
|
|
3799
|
+
if (_response.error.reason === "status-code") {
|
|
3800
|
+
throw new OumlaSdkApiError({
|
|
3801
|
+
statusCode: _response.error.statusCode,
|
|
3802
|
+
body: _response.error.body,
|
|
3803
|
+
rawResponse: _response.rawResponse
|
|
3804
|
+
});
|
|
3805
|
+
}
|
|
3806
|
+
switch (_response.error.reason) {
|
|
3807
|
+
case "non-json":
|
|
3808
|
+
throw new OumlaSdkApiError({
|
|
3809
|
+
statusCode: _response.error.statusCode,
|
|
3810
|
+
body: _response.error.rawBody,
|
|
3811
|
+
rawResponse: _response.rawResponse
|
|
3812
|
+
});
|
|
3813
|
+
case "timeout":
|
|
3814
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3815
|
+
"Timeout exceeded when calling GET /api/v1/tokenization/collections/{id}/tokens/{tokenId}."
|
|
3816
|
+
);
|
|
3817
|
+
case "unknown":
|
|
3818
|
+
throw new OumlaSdkApiError({
|
|
3819
|
+
message: _response.error.errorMessage,
|
|
3820
|
+
rawResponse: _response.rawResponse
|
|
3821
|
+
});
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
/**
|
|
3825
|
+
* Mint a new token in a collection
|
|
3826
|
+
*
|
|
3827
|
+
* @param {string} id - Collection ID
|
|
3828
|
+
* @param {OumlaSdkApi.MintTokenRequest} request
|
|
3829
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3830
|
+
*
|
|
3831
|
+
* @example
|
|
3832
|
+
* await client.tokenization.mintToken("id", {
|
|
3833
|
+
* addressId: "addressId",
|
|
3834
|
+
* clientShare: "clientShare",
|
|
3835
|
+
* to: "to",
|
|
3836
|
+
* tokenId: "tokenId"
|
|
3837
|
+
* })
|
|
3838
|
+
*/
|
|
3839
|
+
mintToken(id, request, requestOptions) {
|
|
3840
|
+
return HttpResponsePromise.fromPromise(this.__mintToken(id, request, requestOptions));
|
|
3841
|
+
}
|
|
3842
|
+
async __mintToken(id, request, requestOptions) {
|
|
3843
|
+
let _headers = mergeHeaders(
|
|
3844
|
+
this._options?.headers,
|
|
3845
|
+
mergeOnlyDefinedHeaders({
|
|
3846
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3847
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3848
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3849
|
+
}),
|
|
3850
|
+
requestOptions?.headers
|
|
3851
|
+
);
|
|
3852
|
+
const _response = await fetcher({
|
|
3853
|
+
url: url_exports.join(
|
|
3854
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3855
|
+
`api/v1/tokenization/collections/${encodeURIComponent(id)}/tokens/mint`
|
|
3856
|
+
),
|
|
3857
|
+
method: "POST",
|
|
3858
|
+
headers: _headers,
|
|
3859
|
+
contentType: "application/json",
|
|
3860
|
+
queryParameters: requestOptions?.queryParams,
|
|
3861
|
+
requestType: "json",
|
|
3862
|
+
body: request,
|
|
3863
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3864
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3865
|
+
abortSignal: requestOptions?.abortSignal
|
|
3866
|
+
});
|
|
3867
|
+
if (_response.ok) {
|
|
3868
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3869
|
+
}
|
|
3870
|
+
if (_response.error.reason === "status-code") {
|
|
3871
|
+
throw new OumlaSdkApiError({
|
|
3872
|
+
statusCode: _response.error.statusCode,
|
|
3873
|
+
body: _response.error.body,
|
|
3874
|
+
rawResponse: _response.rawResponse
|
|
3875
|
+
});
|
|
3876
|
+
}
|
|
3877
|
+
switch (_response.error.reason) {
|
|
3878
|
+
case "non-json":
|
|
3879
|
+
throw new OumlaSdkApiError({
|
|
3880
|
+
statusCode: _response.error.statusCode,
|
|
3881
|
+
body: _response.error.rawBody,
|
|
3882
|
+
rawResponse: _response.rawResponse
|
|
3883
|
+
});
|
|
3884
|
+
case "timeout":
|
|
3885
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3886
|
+
"Timeout exceeded when calling POST /api/v1/tokenization/collections/{id}/tokens/mint."
|
|
3887
|
+
);
|
|
3888
|
+
case "unknown":
|
|
3889
|
+
throw new OumlaSdkApiError({
|
|
3890
|
+
message: _response.error.errorMessage,
|
|
3891
|
+
rawResponse: _response.rawResponse
|
|
3892
|
+
});
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
/**
|
|
3896
|
+
* Burn a token
|
|
3897
|
+
*
|
|
3898
|
+
* @param {string} id - Collection ID
|
|
3899
|
+
* @param {OumlaSdkApi.BurnTokenRequest} request
|
|
3900
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3901
|
+
*
|
|
3902
|
+
* @example
|
|
3903
|
+
* await client.tokenization.burnToken("id", {
|
|
3904
|
+
* addressId: "addressId",
|
|
3905
|
+
* clientShare: "clientShare",
|
|
3906
|
+
* tokenId: "tokenId"
|
|
3907
|
+
* })
|
|
3908
|
+
*/
|
|
3909
|
+
burnToken(id, request, requestOptions) {
|
|
3910
|
+
return HttpResponsePromise.fromPromise(this.__burnToken(id, request, requestOptions));
|
|
3911
|
+
}
|
|
3912
|
+
async __burnToken(id, request, requestOptions) {
|
|
3913
|
+
let _headers = mergeHeaders(
|
|
3914
|
+
this._options?.headers,
|
|
3915
|
+
mergeOnlyDefinedHeaders({
|
|
3916
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3917
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3918
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3919
|
+
}),
|
|
3920
|
+
requestOptions?.headers
|
|
3921
|
+
);
|
|
3922
|
+
const _response = await fetcher({
|
|
3923
|
+
url: url_exports.join(
|
|
3924
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3925
|
+
`api/v1/tokenization/collections/${encodeURIComponent(id)}/tokens/burn`
|
|
3926
|
+
),
|
|
3927
|
+
method: "POST",
|
|
3928
|
+
headers: _headers,
|
|
3929
|
+
contentType: "application/json",
|
|
3930
|
+
queryParameters: requestOptions?.queryParams,
|
|
3931
|
+
requestType: "json",
|
|
3932
|
+
body: request,
|
|
3933
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3934
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3935
|
+
abortSignal: requestOptions?.abortSignal
|
|
3936
|
+
});
|
|
3937
|
+
if (_response.ok) {
|
|
3938
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
3939
|
+
}
|
|
3940
|
+
if (_response.error.reason === "status-code") {
|
|
3941
|
+
throw new OumlaSdkApiError({
|
|
3942
|
+
statusCode: _response.error.statusCode,
|
|
3943
|
+
body: _response.error.body,
|
|
3944
|
+
rawResponse: _response.rawResponse
|
|
3945
|
+
});
|
|
3946
|
+
}
|
|
3947
|
+
switch (_response.error.reason) {
|
|
3948
|
+
case "non-json":
|
|
3949
|
+
throw new OumlaSdkApiError({
|
|
3950
|
+
statusCode: _response.error.statusCode,
|
|
3951
|
+
body: _response.error.rawBody,
|
|
3952
|
+
rawResponse: _response.rawResponse
|
|
3953
|
+
});
|
|
3954
|
+
case "timeout":
|
|
3955
|
+
throw new OumlaSdkApiTimeoutError(
|
|
3956
|
+
"Timeout exceeded when calling POST /api/v1/tokenization/collections/{id}/tokens/burn."
|
|
3957
|
+
);
|
|
3958
|
+
case "unknown":
|
|
3959
|
+
throw new OumlaSdkApiError({
|
|
3960
|
+
message: _response.error.errorMessage,
|
|
3961
|
+
rawResponse: _response.rawResponse
|
|
3962
|
+
});
|
|
3963
|
+
}
|
|
3964
|
+
}
|
|
3965
|
+
/**
|
|
3966
|
+
* Unlink a token from the platform
|
|
3967
|
+
*
|
|
3968
|
+
* @param {string} id - Token ID
|
|
3969
|
+
* @param {Tokenization.RequestOptions} requestOptions - Request-specific configuration.
|
|
3970
|
+
*
|
|
3971
|
+
* @example
|
|
3972
|
+
* await client.tokenization.unlinkToken("id")
|
|
3973
|
+
*/
|
|
3974
|
+
unlinkToken(id, requestOptions) {
|
|
3975
|
+
return HttpResponsePromise.fromPromise(this.__unlinkToken(id, requestOptions));
|
|
3976
|
+
}
|
|
3977
|
+
async __unlinkToken(id, requestOptions) {
|
|
3978
|
+
let _headers = mergeHeaders(
|
|
3979
|
+
this._options?.headers,
|
|
3980
|
+
mergeOnlyDefinedHeaders({
|
|
3981
|
+
Authorization: await this._getAuthorizationHeader(),
|
|
3982
|
+
"x-sdk-version": requestOptions?.sdkVersion ?? "1.0.0",
|
|
3983
|
+
"x-api-key": requestOptions?.apiKey ?? this._options?.apiKey
|
|
3984
|
+
}),
|
|
3985
|
+
requestOptions?.headers
|
|
3986
|
+
);
|
|
3987
|
+
const _response = await fetcher({
|
|
3988
|
+
url: url_exports.join(
|
|
3989
|
+
await Supplier.get(this._options.baseUrl) ?? await Supplier.get(this._options.environment) ?? OumlaSdkApiEnvironment.Production,
|
|
3990
|
+
`api/v1/tokenization/tokens/${encodeURIComponent(id)}`
|
|
3991
|
+
),
|
|
3992
|
+
method: "DELETE",
|
|
3993
|
+
headers: _headers,
|
|
3994
|
+
queryParameters: requestOptions?.queryParams,
|
|
3995
|
+
timeoutMs: requestOptions?.timeoutInSeconds != null ? requestOptions.timeoutInSeconds * 1e3 : 6e4,
|
|
3996
|
+
maxRetries: requestOptions?.maxRetries,
|
|
3997
|
+
abortSignal: requestOptions?.abortSignal
|
|
3998
|
+
});
|
|
3999
|
+
if (_response.ok) {
|
|
4000
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
4001
|
+
}
|
|
4002
|
+
if (_response.error.reason === "status-code") {
|
|
4003
|
+
throw new OumlaSdkApiError({
|
|
4004
|
+
statusCode: _response.error.statusCode,
|
|
4005
|
+
body: _response.error.body,
|
|
4006
|
+
rawResponse: _response.rawResponse
|
|
4007
|
+
});
|
|
4008
|
+
}
|
|
4009
|
+
switch (_response.error.reason) {
|
|
4010
|
+
case "non-json":
|
|
4011
|
+
throw new OumlaSdkApiError({
|
|
4012
|
+
statusCode: _response.error.statusCode,
|
|
4013
|
+
body: _response.error.rawBody,
|
|
4014
|
+
rawResponse: _response.rawResponse
|
|
4015
|
+
});
|
|
4016
|
+
case "timeout":
|
|
4017
|
+
throw new OumlaSdkApiTimeoutError(
|
|
4018
|
+
"Timeout exceeded when calling DELETE /api/v1/tokenization/tokens/{id}."
|
|
4019
|
+
);
|
|
4020
|
+
case "unknown":
|
|
4021
|
+
throw new OumlaSdkApiError({
|
|
4022
|
+
message: _response.error.errorMessage,
|
|
4023
|
+
rawResponse: _response.rawResponse
|
|
4024
|
+
});
|
|
4025
|
+
}
|
|
4026
|
+
}
|
|
4027
|
+
async _getAuthorizationHeader() {
|
|
4028
|
+
const bearer = await Supplier.get(this._options.token);
|
|
4029
|
+
if (bearer != null) {
|
|
4030
|
+
return `Bearer ${bearer}`;
|
|
4031
|
+
}
|
|
4032
|
+
return void 0;
|
|
4033
|
+
}
|
|
4034
|
+
};
|
|
4035
|
+
|
|
4036
|
+
// Client.ts
|
|
4037
|
+
var OumlaSdkApiClient = class {
|
|
4038
|
+
constructor(_options) {
|
|
4039
|
+
this._options = {
|
|
4040
|
+
..._options,
|
|
4041
|
+
headers: mergeHeaders(
|
|
4042
|
+
{
|
|
4043
|
+
"x-sdk-version": _options?.sdkVersion ?? "1.0.0",
|
|
4044
|
+
"x-api-key": _options?.apiKey,
|
|
4045
|
+
"X-Fern-Language": "JavaScript",
|
|
4046
|
+
"X-Fern-Runtime": RUNTIME.type,
|
|
4047
|
+
"X-Fern-Runtime-Version": RUNTIME.version
|
|
4048
|
+
},
|
|
4049
|
+
_options?.headers
|
|
4050
|
+
)
|
|
4051
|
+
};
|
|
4052
|
+
}
|
|
4053
|
+
get profiles() {
|
|
4054
|
+
return this._profiles ?? (this._profiles = new Profiles(this._options));
|
|
4055
|
+
}
|
|
4056
|
+
get wallets() {
|
|
4057
|
+
return this._wallets ?? (this._wallets = new Wallets(this._options));
|
|
4058
|
+
}
|
|
4059
|
+
get addresses() {
|
|
4060
|
+
return this._addresses ?? (this._addresses = new Addresses(this._options));
|
|
4061
|
+
}
|
|
4062
|
+
get transactions() {
|
|
4063
|
+
return this._transactions ?? (this._transactions = new Transactions(this._options));
|
|
4064
|
+
}
|
|
4065
|
+
get assets() {
|
|
4066
|
+
return this._assets ?? (this._assets = new Assets(this._options));
|
|
4067
|
+
}
|
|
4068
|
+
get withdrawals() {
|
|
4069
|
+
return this._withdrawals ?? (this._withdrawals = new Withdrawals(this._options));
|
|
4070
|
+
}
|
|
4071
|
+
get contractTemplates() {
|
|
4072
|
+
return this._contractTemplates ?? (this._contractTemplates = new ContractTemplates(this._options));
|
|
4073
|
+
}
|
|
4074
|
+
get deployedContracts() {
|
|
4075
|
+
return this._deployedContracts ?? (this._deployedContracts = new DeployedContracts(this._options));
|
|
4076
|
+
}
|
|
4077
|
+
get contractInteractions() {
|
|
4078
|
+
return this._contractInteractions ?? (this._contractInteractions = new ContractInteractions(this._options));
|
|
4079
|
+
}
|
|
4080
|
+
get tokenization() {
|
|
4081
|
+
return this._tokenization ?? (this._tokenization = new Tokenization(this._options));
|
|
4082
|
+
}
|
|
4083
|
+
};
|
|
4084
|
+
|
|
4085
|
+
exports.OumlaSdkApi = api_exports;
|
|
4086
|
+
exports.OumlaSdkApiClient = OumlaSdkApiClient;
|
|
4087
|
+
exports.OumlaSdkApiEnvironment = OumlaSdkApiEnvironment;
|
|
4088
|
+
exports.OumlaSdkApiError = OumlaSdkApiError;
|
|
4089
|
+
exports.OumlaSdkApiTimeoutError = OumlaSdkApiTimeoutError;
|
|
4090
|
+
//# sourceMappingURL=out.js.map
|
|
4091
|
+
//# sourceMappingURL=index.cjs.map
|