@openweb3-io/waas
Version:
WaaS API client and WaaS verification library
335 lines • 26 kB
JavaScript
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AddressesApiResponseProcessor = exports.AddressesApiRequestFactory = void 0;
const baseapi_1 = require("./baseapi");
const http_1 = require("../http/http");
const ObjectSerializer_1 = require("../models/ObjectSerializer");
const exception_1 = require("./exception");
const util_1 = require("../util");
class AddressesApiRequestFactory extends baseapi_1.BaseAPIRequestFactory {
v1AddressesList(walletIds, chainIds, cursor, limit, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
const localVarPath = '/api/v1/addresses';
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (walletIds !== undefined) {
const serializedParams = ObjectSerializer_1.ObjectSerializer.serialize(walletIds, "Array<string>", "");
for (const serializedParam of serializedParams) {
requestContext.appendQueryParam("wallet_ids", serializedParam);
}
}
if (chainIds !== undefined) {
const serializedParams = ObjectSerializer_1.ObjectSerializer.serialize(chainIds, "Array<string>", "");
for (const serializedParam of serializedParams) {
requestContext.appendQueryParam("chain_ids", serializedParam);
}
}
if (cursor !== undefined) {
requestContext.setQueryParam("cursor", ObjectSerializer_1.ObjectSerializer.serialize(cursor, "string", ""));
}
if (limit !== undefined) {
requestContext.setQueryParam("limit", ObjectSerializer_1.ObjectSerializer.serialize(limit, "number", ""));
}
let authMethod;
authMethod = _config.authMethods["ApiKeyAuth"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
v1AddressesValidate(chainId, addresses, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (chainId === null || chainId === undefined) {
throw new baseapi_1.RequiredError("AddressesApi", "v1AddressesValidate", "chainId");
}
if (addresses === null || addresses === undefined) {
throw new baseapi_1.RequiredError("AddressesApi", "v1AddressesValidate", "addresses");
}
const localVarPath = '/api/v1/addresses/validate';
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (chainId !== undefined) {
requestContext.setQueryParam("chain_id", ObjectSerializer_1.ObjectSerializer.serialize(chainId, "string", ""));
}
if (addresses !== undefined) {
const serializedParams = ObjectSerializer_1.ObjectSerializer.serialize(addresses, "Array<string>", "");
for (const serializedParam of serializedParams) {
requestContext.appendQueryParam("addresses", serializedParam);
}
}
let authMethod;
authMethod = _config.authMethods["ApiKeyAuth"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
v1WalletsCreateAddress(walletId, createAddressRequest, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (walletId === null || walletId === undefined) {
throw new baseapi_1.RequiredError("AddressesApi", "v1WalletsCreateAddress", "walletId");
}
if (createAddressRequest === null || createAddressRequest === undefined) {
throw new baseapi_1.RequiredError("AddressesApi", "v1WalletsCreateAddress", "createAddressRequest");
}
const localVarPath = '/api/v1/wallets/{walletId}/addresses'
.replace('{' + 'walletId' + '}', encodeURIComponent(String(walletId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.POST);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
const contentType = ObjectSerializer_1.ObjectSerializer.getPreferredMediaType([
"application/json"
]);
requestContext.setHeaderParam("Content-Type", contentType);
const serializedBody = ObjectSerializer_1.ObjectSerializer.stringify(ObjectSerializer_1.ObjectSerializer.serialize(createAddressRequest, "CreateAddressRequest", ""), contentType);
requestContext.setBody(serializedBody);
let authMethod;
authMethod = _config.authMethods["ApiKeyAuth"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
v1WalletsGetAddress(walletId, address, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (walletId === null || walletId === undefined) {
throw new baseapi_1.RequiredError("AddressesApi", "v1WalletsGetAddress", "walletId");
}
if (address === null || address === undefined) {
throw new baseapi_1.RequiredError("AddressesApi", "v1WalletsGetAddress", "address");
}
const localVarPath = '/api/v1/wallets/{walletId}/addresses/{address}'
.replace('{' + 'walletId' + '}', encodeURIComponent(String(walletId)))
.replace('{' + 'address' + '}', encodeURIComponent(String(address)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
let authMethod;
authMethod = _config.authMethods["ApiKeyAuth"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
v1WalletsListAddresses(walletId, chainIds, cursor, limit, _options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
let _config = _options || this.configuration;
if (walletId === null || walletId === undefined) {
throw new baseapi_1.RequiredError("AddressesApi", "v1WalletsListAddresses", "walletId");
}
const localVarPath = '/api/v1/wallets/{walletId}/addresses'
.replace('{' + 'walletId' + '}', encodeURIComponent(String(walletId)));
const requestContext = _config.baseServer.makeRequestContext(localVarPath, http_1.HttpMethod.GET);
requestContext.setHeaderParam("Accept", "application/json, */*;q=0.8");
if (chainIds !== undefined) {
const serializedParams = ObjectSerializer_1.ObjectSerializer.serialize(chainIds, "Array<string>", "");
for (const serializedParam of serializedParams) {
requestContext.appendQueryParam("chain_ids", serializedParam);
}
}
if (cursor !== undefined) {
requestContext.setQueryParam("cursor", ObjectSerializer_1.ObjectSerializer.serialize(cursor, "string", ""));
}
if (limit !== undefined) {
requestContext.setQueryParam("limit", ObjectSerializer_1.ObjectSerializer.serialize(limit, "number", ""));
}
let authMethod;
authMethod = _config.authMethods["ApiKeyAuth"];
if (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication) {
yield (authMethod === null || authMethod === void 0 ? void 0 : authMethod.applySecurityAuthentication(requestContext));
}
const defaultAuth = ((_a = _options === null || _options === void 0 ? void 0 : _options.authMethods) === null || _a === void 0 ? void 0 : _a.default) || ((_c = (_b = this.configuration) === null || _b === void 0 ? void 0 : _b.authMethods) === null || _c === void 0 ? void 0 : _c.default);
if (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication) {
yield (defaultAuth === null || defaultAuth === void 0 ? void 0 : defaultAuth.applySecurityAuthentication(requestContext));
}
return requestContext;
});
}
}
exports.AddressesApiRequestFactory = AddressesApiRequestFactory;
class AddressesApiResponseProcessor {
v1AddressesListWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (util_1.isCodeInRange("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "CursorPageAddress", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (util_1.isCodeInRange("400", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", body, response.headers);
}
if (util_1.isCodeInRange("401", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers);
}
if (util_1.isCodeInRange("404", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Not Found", body, response.headers);
}
if (util_1.isCodeInRange("500", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "CursorPageAddress", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
v1AddressesValidateWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (util_1.isCodeInRange("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "ValidateAddressesReply", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (util_1.isCodeInRange("400", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", body, response.headers);
}
if (util_1.isCodeInRange("401", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers);
}
if (util_1.isCodeInRange("500", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "ValidateAddressesReply", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
v1WalletsCreateAddressWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (util_1.isCodeInRange("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Address", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (util_1.isCodeInRange("400", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", body, response.headers);
}
if (util_1.isCodeInRange("401", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers);
}
if (util_1.isCodeInRange("404", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Not Found", body, response.headers);
}
if (util_1.isCodeInRange("500", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Address", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
v1WalletsGetAddressWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (util_1.isCodeInRange("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Address", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (util_1.isCodeInRange("400", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", body, response.headers);
}
if (util_1.isCodeInRange("401", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers);
}
if (util_1.isCodeInRange("404", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Not Found", body, response.headers);
}
if (util_1.isCodeInRange("500", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Address", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
v1WalletsListAddressesWithHttpInfo(response) {
return __awaiter(this, void 0, void 0, function* () {
const contentType = ObjectSerializer_1.ObjectSerializer.normalizeMediaType(response.headers["content-type"]);
if (util_1.isCodeInRange("200", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "CursorPageAddress", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
if (util_1.isCodeInRange("400", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Bad Request", body, response.headers);
}
if (util_1.isCodeInRange("401", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Unauthorized", body, response.headers);
}
if (util_1.isCodeInRange("404", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Not Found", body, response.headers);
}
if (util_1.isCodeInRange("500", response.httpStatusCode)) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "Error", "");
throw new exception_1.ApiException(response.httpStatusCode, "Internal Server Error", body, response.headers);
}
if (response.httpStatusCode >= 200 && response.httpStatusCode <= 299) {
const body = ObjectSerializer_1.ObjectSerializer.deserialize(ObjectSerializer_1.ObjectSerializer.parse(yield response.body.text(), contentType), "CursorPageAddress", "");
return new http_1.HttpInfo(response.httpStatusCode, response.headers, response.body, body);
}
throw new exception_1.ApiException(response.httpStatusCode, "Unknown API Status Code!", yield response.getBodyAsAny(), response.headers);
});
}
}
exports.AddressesApiResponseProcessor = AddressesApiResponseProcessor;
//# sourceMappingURL=AddressesApi.js.map