UNPKG

@affinidi-tdk/credential-verification-client

Version:

Affinidi TDK typescript client for Affinidi CREDENTIAL VERIFICATION

128 lines (127 loc) 5.08 kB
"use strict"; /* tslint:disable */ /* eslint-disable */ /** * VerificationService * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: 1.0.0 * Contact: info@affinidi.com * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.operationServerMap = exports.RequiredError = exports.BaseAPI = exports.COLLECTION_FORMATS = exports.BASE_PATH = exports.SdkError = void 0; const axios_1 = __importStar(require("axios")); const axios_retry_1 = __importDefault(require("axios-retry")); class SdkError extends Error { constructor(originalError = {}) { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l; const isAxiosError = originalError instanceof axios_1.AxiosError; if (!isAxiosError) { throw originalError; } super((_b = (_a = originalError.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.message); this.name = (_d = (_c = originalError.response) === null || _c === void 0 ? void 0 : _c.data) === null || _d === void 0 ? void 0 : _d.name; this.details = (_f = (_e = originalError.response) === null || _e === void 0 ? void 0 : _e.data) === null || _f === void 0 ? void 0 : _f.details; this.message = (_h = (_g = originalError.response) === null || _g === void 0 ? void 0 : _g.data) === null || _h === void 0 ? void 0 : _h.message; this.traceId = (_k = (_j = originalError.response) === null || _j === void 0 ? void 0 : _j.data) === null || _k === void 0 ? void 0 : _k.traceId; this.httpStatusCode = (_l = originalError.response) === null || _l === void 0 ? void 0 : _l.status; } } exports.SdkError = SdkError; exports.BASE_PATH = 'https://apse1.api.affinidi.io/ver'.replace(/\/+$/, ''); const DEFAULT_REQUEST_RETRIES = 3; /** * * @export */ exports.COLLECTION_FORMATS = { csv: ',', ssv: ' ', tsv: '\t', pipes: '|', }; /** * * @export * @class BaseAPI */ class BaseAPI { constructor(configuration, retryConfig, basePath = exports.BASE_PATH, axios = axios_1.default) { var _a; this.basePath = basePath; this.axios = axios; if (configuration) { this.configuration = configuration; this.basePath = (_a = configuration.basePath) !== null && _a !== void 0 ? _a : basePath; } this.retryConfig = { retries: (retryConfig === null || retryConfig === void 0 ? void 0 : retryConfig.retries) >= 0 && (retryConfig === null || retryConfig === void 0 ? void 0 : retryConfig.retries) <= DEFAULT_REQUEST_RETRIES ? retryConfig.retries : DEFAULT_REQUEST_RETRIES, retryDelay: (retryConfig === null || retryConfig === void 0 ? void 0 : retryConfig.isExponentialDelay) ? axios_retry_1.default.exponentialDelay : () => { return 0; }, retryCondition: (error) => { if (axios_retry_1.default.isNetworkOrIdempotentRequestError(error) || axios_retry_1.default.isNetworkError(error)) { return true; } throw new SdkError(error); }, }; (0, axios_retry_1.default)(axios_1.default, this.retryConfig); } } exports.BaseAPI = BaseAPI; /** * * @export * @class RequiredError * @extends {Error} */ class RequiredError extends Error { constructor(field, msg) { super(msg); this.field = field; this.name = 'RequiredError'; } } exports.RequiredError = RequiredError; /** * * @export */ exports.operationServerMap = {};