@affinidi-tdk/credential-verification-client
Version:
Affinidi TDK typescript client for Affinidi CREDENTIAL VERIFICATION
252 lines (251 loc) • 12.6 kB
JavaScript
/* 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 __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());
});
};
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction, } from './common';
// @ts-ignore
import { BASE_PATH, BaseAPI, operationServerMap, } from './base';
export const ConstraintsLimitDisclosureEnum = {
Required: 'required',
Preferred: 'preferred',
};
export const ConstraintsSubjectIsIssuerEnum = {
Required: 'required',
Preferred: 'preferred',
};
export const FieldPredicateEnum = {
Required: 'required',
Preferred: 'preferred',
};
export const HolderSubjectDirectiveEnum = {
Required: 'required',
Preferred: 'preferred',
};
export const InvalidParameterErrorNameEnum = {
InvalidParameterError: 'InvalidParameterError',
};
export const InvalidParameterErrorMessageEnum = {
InvalidParameterParam: 'Invalid parameter: ${param}.',
};
export const InvalidParameterErrorHttpStatusCodeEnum = {
NUMBER_400: 400,
};
export const NotFoundErrorNameEnum = {
NotFoundError: 'NotFoundError',
};
export const NotFoundErrorMessageEnum = {
NotFoundParam: 'Not found: ${param}.',
};
export const NotFoundErrorHttpStatusCodeEnum = {
NUMBER_404: 404,
};
export const PdStatusDirectiveEnum = {
Required: 'required',
Allowed: 'allowed',
Disallowed: 'disallowed',
};
export const SubmissionRequirementRuleEnum = {
All: 'all',
Pick: 'pick',
};
/**
* DefaultApi - axios parameter creator
* @export
*/
export const DefaultApiAxiosParamCreator = function (configuration) {
return {
/**
* Verifying Verifiable Credentials (signatures) `isValid` - true if all credentials verified `errors` contains list of error messages for invalid credentials.
* @summary Verifying VC
* @param {VerifyCredentialInput} verifyCredentialInput VerifyCredentials
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
verifyCredentials: (verifyCredentialInput, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'verifyCredentialInput' is not null or undefined
assertParamExists('verifyCredentials', 'verifyCredentialInput', verifyCredentialInput);
const localVarPath = `/v1/verifier/verify-vcs`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ProjectTokenAuth required
yield setApiKeyToObject(localVarHeaderParameter, 'authorization', configuration);
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
localVarRequestOptions.data = serializeDataIfNeeded(verifyCredentialInput, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
/**
* Verifying Verifiable Presentation (signatures) `isValid` - true if presentation verified `error` verificaction error.
* @summary Verifying VP
* @param {VerifyPresentationInput} verifyPresentationInput VerifyPresentation
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
verifyPresentation: (verifyPresentationInput, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'verifyPresentationInput' is not null or undefined
assertParamExists('verifyPresentation', 'verifyPresentationInput', verifyPresentationInput);
const localVarPath = `/v1/verifier/verify-vp`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
// authentication ProjectTokenAuth required
yield setApiKeyToObject(localVarHeaderParameter, 'authorization', configuration);
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
localVarRequestOptions.data = serializeDataIfNeeded(verifyPresentationInput, localVarRequestOptions, configuration);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
}),
};
};
/**
* DefaultApi - functional programming interface
* @export
*/
export const DefaultApiFp = function (configuration) {
const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration);
return {
/**
* Verifying Verifiable Credentials (signatures) `isValid` - true if all credentials verified `errors` contains list of error messages for invalid credentials.
* @summary Verifying VC
* @param {VerifyCredentialInput} verifyCredentialInput VerifyCredentials
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
verifyCredentials(verifyCredentialInput, options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.verifyCredentials(verifyCredentialInput, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.verifyCredentials']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
/**
* Verifying Verifiable Presentation (signatures) `isValid` - true if presentation verified `error` verificaction error.
* @summary Verifying VP
* @param {VerifyPresentationInput} verifyPresentationInput VerifyPresentation
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
verifyPresentation(verifyPresentationInput, options) {
var _a, _b, _c;
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield localVarAxiosParamCreator.verifyPresentation(verifyPresentationInput, options);
const localVarOperationServerIndex = (_a = configuration === null || configuration === void 0 ? void 0 : configuration.serverIndex) !== null && _a !== void 0 ? _a : 0;
const localVarOperationServerBasePath = (_c = (_b = operationServerMap['DefaultApi.verifyPresentation']) === null || _b === void 0 ? void 0 : _b[localVarOperationServerIndex]) === null || _c === void 0 ? void 0 : _c.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
});
},
};
};
/**
* DefaultApi - factory interface
* @export
*/
export const DefaultApiFactory = function (configuration, basePath, axios) {
const localVarFp = DefaultApiFp(configuration);
return {
/**
* Verifying Verifiable Credentials (signatures) `isValid` - true if all credentials verified `errors` contains list of error messages for invalid credentials.
* @summary Verifying VC
* @param {VerifyCredentialInput} verifyCredentialInput VerifyCredentials
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
verifyCredentials(verifyCredentialInput, options) {
return localVarFp
.verifyCredentials(verifyCredentialInput, options)
.then((request) => request(axios, basePath));
},
/**
* Verifying Verifiable Presentation (signatures) `isValid` - true if presentation verified `error` verificaction error.
* @summary Verifying VP
* @param {VerifyPresentationInput} verifyPresentationInput VerifyPresentation
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
verifyPresentation(verifyPresentationInput, options) {
return localVarFp
.verifyPresentation(verifyPresentationInput, options)
.then((request) => request(axios, basePath));
},
};
};
/**
* DefaultApi - object-oriented interface
* @export
* @class DefaultApi
* @extends {BaseAPI}
*/
export class DefaultApi extends BaseAPI {
/**
* Verifying Verifiable Credentials (signatures) `isValid` - true if all credentials verified `errors` contains list of error messages for invalid credentials.
* @summary Verifying VC
* @param {VerifyCredentialInput} verifyCredentialInput VerifyCredentials
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
verifyCredentials(verifyCredentialInput, options) {
return DefaultApiFp(this.configuration)
.verifyCredentials(verifyCredentialInput, options)
.then((request) => request(this.axios, this.basePath));
}
/**
* Verifying Verifiable Presentation (signatures) `isValid` - true if presentation verified `error` verificaction error.
* @summary Verifying VP
* @param {VerifyPresentationInput} verifyPresentationInput VerifyPresentation
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DefaultApi
*/
verifyPresentation(verifyPresentationInput, options) {
return DefaultApiFp(this.configuration)
.verifyPresentation(verifyPresentationInput, options)
.then((request) => request(this.axios, this.basePath));
}
}