diff --git a/package-lock.json b/package-lock.json index 4097faa1..bc22b75e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -58,6 +58,10 @@ "resolved": "packages/client-iam", "link": true }, + "node_modules/@affinidi/test-sdk-client-cwe": { + "resolved": "packages/sdk-client-cwe", + "link": true + }, "node_modules/@affinidi/test-sdk-client-kms": { "resolved": "packages/sdk-client-kms", "link": true @@ -14847,6 +14851,36 @@ "tslib": "^2.3.0" } }, + "packages/sdk-client-cwe": { + "version": "1.0.0", + "license": "Unlicense", + "dependencies": { + "axios": "^1.6.1" + }, + "devDependencies": { + "@types/node": "^12.11.5", + "typescript": "^4.0" + } + }, + "packages/sdk-client-cwe/node_modules/@types/node": { + "version": "12.20.55", + "resolved": "https://registry.npmjs.org/@types/node/-/node-12.20.55.tgz", + "integrity": "sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==", + "dev": true + }, + "packages/sdk-client-cwe/node_modules/typescript": { + "version": "4.9.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", + "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, "packages/sdk-client-kms": { "name": "@affinidi/test-sdk-client-kms", "version": "1.0.0", diff --git a/packages/sdk-client-cwe/.gitignore b/packages/sdk-client-cwe/.gitignore new file mode 100644 index 00000000..eb42e83e --- /dev/null +++ b/packages/sdk-client-cwe/.gitignore @@ -0,0 +1,37 @@ +# dependencies +node_modules + +# IDEs and editors +/.idea +.project +.classpath +.c9/ +*.launch +.settings/ +*.sublime-workspace + +# IDE - VSCode +.vscode/* + +# misc +/.sass-cache +/connect.lock +/coverage +/libpeerconnection.log +npm-debug.log +yarn-error.log +testem.log +/typings +wwwroot/*.js +dist + +# System Files +.DS_Store +Thumbs.db + +# other +.env +.env.production +.npmrc +.nyc_output +coverage diff --git a/packages/sdk-client-cwe/.npmignore b/packages/sdk-client-cwe/.npmignore new file mode 100644 index 00000000..40886a38 --- /dev/null +++ b/packages/sdk-client-cwe/.npmignore @@ -0,0 +1,10 @@ +# empty npmignore to ensure all required files (e.g., in the dist folder) are published by npm + +node_modules +coverage +.vscode +.DS_Store +.nyc_output +.history +.idea +Thumbs.db diff --git a/packages/sdk-client-cwe/.openapi-generator-ignore b/packages/sdk-client-cwe/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/packages/sdk-client-cwe/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/packages/sdk-client-cwe/.openapi-generator/FILES b/packages/sdk-client-cwe/.openapi-generator/FILES new file mode 100644 index 00000000..b616f87e --- /dev/null +++ b/packages/sdk-client-cwe/.openapi-generator/FILES @@ -0,0 +1,13 @@ +.gitignore +.npmignore +.openapi-generator-ignore +README.md +api.ts +base.ts +common.ts +configuration.ts +git_push.sh +index.ts +package.json +tsconfig.esm.json +tsconfig.json diff --git a/packages/sdk-client-cwe/.openapi-generator/VERSION b/packages/sdk-client-cwe/.openapi-generator/VERSION new file mode 100644 index 00000000..4b49d9bb --- /dev/null +++ b/packages/sdk-client-cwe/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.2.0 \ No newline at end of file diff --git a/packages/sdk-client-cwe/README.md b/packages/sdk-client-cwe/README.md new file mode 100644 index 00000000..ef7c09da --- /dev/null +++ b/packages/sdk-client-cwe/README.md @@ -0,0 +1,53 @@ +## @affinidi/test-sdk-client-cwe + +### Usage + +```bash +npm install @affinidi/test-sdk-client-cwe --save +``` + +#### With PAT + +To call service methods with personal access token, you need to get a getProjectScopedToken for the machine user: + +```ts +import { SomeClassApi, Configuration } from '@affinidi/test-sdk-client-cwe'; +import { authProvider } from '@affinidi/test-auth-provider'; + +const projectScopedToken = await authProvider.getProjectScopedToken({ + apiGatewayUrl, + projectId, + machineUserId, + tokenEndpoint, + privateKey, + passphrase, + keyId, + publicKey, +}); + +const api = new SomeClassApi( + new Configuration({ + apiKey: projectScopedToken, + basePath: `${apiGatewayUrl}/cwe`, + }) +); + +await api.oneOfMethods(); +``` + +#### With session ID via BFF + +```ts +import { SomeClassApi, Configuration } from '@affinidi/test-sdk-client-cwe'; +import { getBffHeaders } from '@affinidi/test-auth-provider'; + +const headers = getBffHeaders(cookieName, sessionId); + +const baseOptions = { headers }; + +const api = new SomeClassApi( + new Configuration({ basePath: `${bffHost}/cwe`, baseOptions }) +); + +await api.oneOfMethods(); +``` diff --git a/packages/sdk-client-cwe/api.ts b/packages/sdk-client-cwe/api.ts new file mode 100644 index 00000000..6e6448f7 --- /dev/null +++ b/packages/sdk-client-cwe/api.ts @@ -0,0 +1,1525 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * CloudWalletEssentials + * Cloud Wallet For Enterprise Structure + * + * The version of the OpenAPI document: 1.0.0 + * Contact: nucleus.team@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. + */ + +import type { Configuration } from './configuration'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; +// URLSearchParams not necessarily used +// @ts-ignore +import { URL, URLSearchParams } from 'url'; +// Some imports not used depending on template conditions +// @ts-ignore +import { + DUMMY_BASE_URL, + assertParamExists, + setApiKeyToObject, + setBasicAuthToObject, + setBearerAuthToObject, + setOAuthToObject, + setSearchParams, + serializeDataIfNeeded, + toPathString, + createRequestFunction, +} from './common'; +import type { RequestArgs } from './base'; +// @ts-ignore +import { + BASE_PATH, + COLLECTION_FORMATS, + BaseAPI, + RequiredError, + operationServerMap, +} from './base'; + +/** + * wallet dto + * @export + * @interface CreateWalletResponse + */ +export interface CreateWalletResponse { + /** + * + * @type {WalletDto} + * @memberof CreateWalletResponse + */ + wallet?: WalletDto; +} +/** + * + * @export + * @interface EntityNotFoundError + */ +export interface EntityNotFoundError { + /** + * + * @type {string} + * @memberof EntityNotFoundError + */ + name: EntityNotFoundErrorNameEnum; + /** + * + * @type {string} + * @memberof EntityNotFoundError + */ + message: EntityNotFoundErrorMessageEnum; + /** + * + * @type {number} + * @memberof EntityNotFoundError + */ + httpStatusCode: EntityNotFoundErrorHttpStatusCodeEnum; + /** + * + * @type {string} + * @memberof EntityNotFoundError + */ + traceId: string; + /** + * + * @type {Array} + * @memberof EntityNotFoundError + */ + details?: Array; +} + +export const EntityNotFoundErrorNameEnum = { + EntityNotFoundError: 'EntityNotFoundError', +} as const; + +export type EntityNotFoundErrorNameEnum = + (typeof EntityNotFoundErrorNameEnum)[keyof typeof EntityNotFoundErrorNameEnum]; +export const EntityNotFoundErrorMessageEnum = { + EntityNotFound: 'Entity not found', +} as const; + +export type EntityNotFoundErrorMessageEnum = + (typeof EntityNotFoundErrorMessageEnum)[keyof typeof EntityNotFoundErrorMessageEnum]; +export const EntityNotFoundErrorHttpStatusCodeEnum = { + NUMBER_404: 404, +} as const; + +export type EntityNotFoundErrorHttpStatusCodeEnum = + (typeof EntityNotFoundErrorHttpStatusCodeEnum)[keyof typeof EntityNotFoundErrorHttpStatusCodeEnum]; + +/** + * DTO contains revocation list credential + * @export + * @interface GetRevocationListCredentialResultDto + */ +export interface GetRevocationListCredentialResultDto { + /** + * + * @type {object} + * @memberof GetRevocationListCredentialResultDto + */ + revocationListCredential: object; +} +/** + * + * @export + * @interface InvalidDidParameterError + */ +export interface InvalidDidParameterError { + /** + * + * @type {string} + * @memberof InvalidDidParameterError + */ + name: InvalidDidParameterErrorNameEnum; + /** + * + * @type {string} + * @memberof InvalidDidParameterError + */ + message: InvalidDidParameterErrorMessageEnum; + /** + * + * @type {number} + * @memberof InvalidDidParameterError + */ + httpStatusCode: InvalidDidParameterErrorHttpStatusCodeEnum; + /** + * + * @type {string} + * @memberof InvalidDidParameterError + */ + traceId: string; + /** + * + * @type {Array} + * @memberof InvalidDidParameterError + */ + details?: Array; +} + +export const InvalidDidParameterErrorNameEnum = { + InvalidDidParameterError: 'InvalidDidParameterError', +} as const; + +export type InvalidDidParameterErrorNameEnum = + (typeof InvalidDidParameterErrorNameEnum)[keyof typeof InvalidDidParameterErrorNameEnum]; +export const InvalidDidParameterErrorMessageEnum = { + GivenDidInFieldToDidIsInvalidUseOnlyResolvableFormOfDid: + 'Given did in field "toDid" is invalid. Use only resolvable form of did.', +} as const; + +export type InvalidDidParameterErrorMessageEnum = + (typeof InvalidDidParameterErrorMessageEnum)[keyof typeof InvalidDidParameterErrorMessageEnum]; +export const InvalidDidParameterErrorHttpStatusCodeEnum = { + NUMBER_400: 400, +} as const; + +export type InvalidDidParameterErrorHttpStatusCodeEnum = + (typeof InvalidDidParameterErrorHttpStatusCodeEnum)[keyof typeof InvalidDidParameterErrorHttpStatusCodeEnum]; + +/** + * + * @export + * @interface InvalidParameterError + */ +export interface InvalidParameterError { + /** + * + * @type {string} + * @memberof InvalidParameterError + */ + name: InvalidParameterErrorNameEnum; + /** + * + * @type {string} + * @memberof InvalidParameterError + */ + message: InvalidParameterErrorMessageEnum; + /** + * + * @type {number} + * @memberof InvalidParameterError + */ + httpStatusCode: InvalidParameterErrorHttpStatusCodeEnum; + /** + * + * @type {string} + * @memberof InvalidParameterError + */ + traceId: string; + /** + * + * @type {Array} + * @memberof InvalidParameterError + */ + details?: Array; +} + +export const InvalidParameterErrorNameEnum = { + InvalidParameterError: 'InvalidParameterError', +} as const; + +export type InvalidParameterErrorNameEnum = + (typeof InvalidParameterErrorNameEnum)[keyof typeof InvalidParameterErrorNameEnum]; +export const InvalidParameterErrorMessageEnum = { + InvalidParameterParam: 'Invalid parameter: ${param}.', +} as const; + +export type InvalidParameterErrorMessageEnum = + (typeof InvalidParameterErrorMessageEnum)[keyof typeof InvalidParameterErrorMessageEnum]; +export const InvalidParameterErrorHttpStatusCodeEnum = { + NUMBER_400: 400, +} as const; + +export type InvalidParameterErrorHttpStatusCodeEnum = + (typeof InvalidParameterErrorHttpStatusCodeEnum)[keyof typeof InvalidParameterErrorHttpStatusCodeEnum]; + +/** + * + * @export + * @interface KeyNotFoundError + */ +export interface KeyNotFoundError { + /** + * + * @type {string} + * @memberof KeyNotFoundError + */ + name: KeyNotFoundErrorNameEnum; + /** + * + * @type {string} + * @memberof KeyNotFoundError + */ + message: KeyNotFoundErrorMessageEnum; + /** + * + * @type {number} + * @memberof KeyNotFoundError + */ + httpStatusCode: KeyNotFoundErrorHttpStatusCodeEnum; + /** + * + * @type {string} + * @memberof KeyNotFoundError + */ + traceId: string; + /** + * + * @type {Array} + * @memberof KeyNotFoundError + */ + details?: Array; +} + +export const KeyNotFoundErrorNameEnum = { + KeyNotFoundError: 'KeyNotFoundError', +} as const; + +export type KeyNotFoundErrorNameEnum = + (typeof KeyNotFoundErrorNameEnum)[keyof typeof KeyNotFoundErrorNameEnum]; +export const KeyNotFoundErrorMessageEnum = { + KeyNotFound: 'Key not found', +} as const; + +export type KeyNotFoundErrorMessageEnum = + (typeof KeyNotFoundErrorMessageEnum)[keyof typeof KeyNotFoundErrorMessageEnum]; +export const KeyNotFoundErrorHttpStatusCodeEnum = { + NUMBER_500: 500, +} as const; + +export type KeyNotFoundErrorHttpStatusCodeEnum = + (typeof KeyNotFoundErrorHttpStatusCodeEnum)[keyof typeof KeyNotFoundErrorHttpStatusCodeEnum]; + +/** + * + * @export + * @interface NotFoundError + */ +export interface NotFoundError { + /** + * + * @type {string} + * @memberof NotFoundError + */ + name: NotFoundErrorNameEnum; + /** + * + * @type {string} + * @memberof NotFoundError + */ + message: NotFoundErrorMessageEnum; + /** + * + * @type {number} + * @memberof NotFoundError + */ + httpStatusCode: NotFoundErrorHttpStatusCodeEnum; + /** + * + * @type {string} + * @memberof NotFoundError + */ + traceId: string; + /** + * + * @type {Array} + * @memberof NotFoundError + */ + details?: Array; +} + +export const NotFoundErrorNameEnum = { + NotFoundError: 'NotFoundError', +} as const; + +export type NotFoundErrorNameEnum = + (typeof NotFoundErrorNameEnum)[keyof typeof NotFoundErrorNameEnum]; +export const NotFoundErrorMessageEnum = { + NotFoundParam: 'Not found: ${param}.', +} as const; + +export type NotFoundErrorMessageEnum = + (typeof NotFoundErrorMessageEnum)[keyof typeof NotFoundErrorMessageEnum]; +export const NotFoundErrorHttpStatusCodeEnum = { + NUMBER_404: 404, +} as const; + +export type NotFoundErrorHttpStatusCodeEnum = + (typeof NotFoundErrorHttpStatusCodeEnum)[keyof typeof NotFoundErrorHttpStatusCodeEnum]; + +/** + * + * @export + * @interface OperationForbiddenError + */ +export interface OperationForbiddenError { + /** + * + * @type {string} + * @memberof OperationForbiddenError + */ + name: OperationForbiddenErrorNameEnum; + /** + * + * @type {string} + * @memberof OperationForbiddenError + */ + message: OperationForbiddenErrorMessageEnum; + /** + * + * @type {number} + * @memberof OperationForbiddenError + */ + httpStatusCode: OperationForbiddenErrorHttpStatusCodeEnum; + /** + * + * @type {string} + * @memberof OperationForbiddenError + */ + traceId: string; + /** + * + * @type {Array} + * @memberof OperationForbiddenError + */ + details?: Array; +} + +export const OperationForbiddenErrorNameEnum = { + OperationForbiddenError: 'OperationForbiddenError', +} as const; + +export type OperationForbiddenErrorNameEnum = + (typeof OperationForbiddenErrorNameEnum)[keyof typeof OperationForbiddenErrorNameEnum]; +export const OperationForbiddenErrorMessageEnum = { + OperationForbiddenParam: 'Operation forbidden: ${param}.', +} as const; + +export type OperationForbiddenErrorMessageEnum = + (typeof OperationForbiddenErrorMessageEnum)[keyof typeof OperationForbiddenErrorMessageEnum]; +export const OperationForbiddenErrorHttpStatusCodeEnum = { + NUMBER_403: 403, +} as const; + +export type OperationForbiddenErrorHttpStatusCodeEnum = + (typeof OperationForbiddenErrorHttpStatusCodeEnum)[keyof typeof OperationForbiddenErrorHttpStatusCodeEnum]; + +/** + * + * @export + * @interface RevokeCredentialInput + */ +export interface RevokeCredentialInput { + /** + * + * @type {string} + * @memberof RevokeCredentialInput + */ + revocationReason?: string | null; + /** + * + * @type {string} + * @memberof RevokeCredentialInput + */ + credentialId?: string; +} +/** + * + * @export + * @interface ServiceErrorResponse + */ +export interface ServiceErrorResponse { + /** + * unique id for correlating this specific error to logs + * @type {string} + * @memberof ServiceErrorResponse + */ + debugId: string; + /** + * name of the error + * @type {string} + * @memberof ServiceErrorResponse + */ + name: string; + /** + * backwards compatible Affinidi error code + * @type {string} + * @memberof ServiceErrorResponse + */ + code: string; + /** + * + * @type {Array} + * @memberof ServiceErrorResponse + */ + details?: Array; +} +/** + * + * @export + * @interface ServiceErrorResponseDetailsInner + */ +export interface ServiceErrorResponseDetailsInner { + /** + * + * @type {string} + * @memberof ServiceErrorResponseDetailsInner + */ + issue: string; + /** + * + * @type {string} + * @memberof ServiceErrorResponseDetailsInner + */ + field?: string; + /** + * + * @type {string} + * @memberof ServiceErrorResponseDetailsInner + */ + value?: string; + /** + * + * @type {string} + * @memberof ServiceErrorResponseDetailsInner + */ + location?: string; +} +/** + * DTO contains params to sign credential + * @export + * @interface SignCredentialInputDto + */ +export interface SignCredentialInputDto { + /** + * + * @type {object} + * @memberof SignCredentialInputDto + */ + unsignedCredential: object; + /** + * + * @type {boolean} + * @memberof SignCredentialInputDto + */ + revocable?: boolean; +} +/** + * DTO contains signed credential + * @export + * @interface SignCredentialResultDto + */ +export interface SignCredentialResultDto { + /** + * + * @type {object} + * @memberof SignCredentialResultDto + */ + signedCredential: object; +} +/** + * wallet dto + * @export + * @interface WalletDto + */ +export interface WalletDto { + /** + * id of the wallet in uuidV4 format + * @type {string} + * @memberof WalletDto + */ + id?: string; + /** + * did of the wallet + * @type {string} + * @memberof WalletDto + */ + did?: string; + /** + * ARI of the wallet + * @type {string} + * @memberof WalletDto + */ + ari?: string; + /** + * + * @type {Array} + * @memberof WalletDto + */ + keys?: Array; +} +/** + * + * @export + * @interface WalletDtoKeysInner + */ +export interface WalletDtoKeysInner { + /** + * id of linked key + * @type {string} + * @memberof WalletDtoKeysInner + */ + id?: string; + /** + * ari of linked key + * @type {string} + * @memberof WalletDtoKeysInner + */ + ari?: string; +} +/** + * list of wallets + * @export + * @interface WalletsListDto + */ +export interface WalletsListDto { + /** + * + * @type {Array} + * @memberof WalletsListDto + */ + wallets?: Array; +} + +/** + * DefaultApi - axios parameter creator + * @export + */ +export const DefaultApiAxiosParamCreator = function ( + configuration?: Configuration +) { + return { + /** + * delete wallet by walletId + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWallet: async ( + walletId: string, + options: RawAxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'walletId' is not null or undefined + assertParamExists('deleteWallet', 'walletId', walletId); + const localVarPath = `/v1/wallets/{walletId}`.replace( + `{${'walletId'}}`, + encodeURIComponent(String(walletId)) + ); + // 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 = { + method: 'DELETE', + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ProjectTokenAuth required + await setApiKeyToObject( + localVarHeaderParameter, + 'authorization', + configuration + ); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * DefaultApi - functional programming interface + * @export + */ +export const DefaultApiFp = function (configuration?: Configuration) { + const localVarAxiosParamCreator = DefaultApiAxiosParamCreator(configuration); + return { + /** + * delete wallet by walletId + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async deleteWallet( + walletId: string, + options?: RawAxiosRequestConfig + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.deleteWallet( + walletId, + options + ); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = + operationServerMap['DefaultApi.deleteWallet']?.[index]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + )(axios, operationBasePath || basePath); + }, + }; +}; + +/** + * DefaultApi - factory interface + * @export + */ +export const DefaultApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance +) { + const localVarFp = DefaultApiFp(configuration); + return { + /** + * delete wallet by walletId + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + deleteWallet(walletId: string, options?: any): AxiosPromise { + return localVarFp + .deleteWallet(walletId, options) + .then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * DefaultApi - object-oriented interface + * @export + * @class DefaultApi + * @extends {BaseAPI} + */ +export class DefaultApi extends BaseAPI { + /** + * delete wallet by walletId + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof DefaultApi + */ + public deleteWallet(walletId: string, options?: RawAxiosRequestConfig) { + return DefaultApiFp(this.configuration) + .deleteWallet(walletId, options) + .then((request) => request(this.axios, this.basePath)); + } +} + +/** + * RevocationApi - axios parameter creator + * @export + */ +export const RevocationApiAxiosParamCreator = function ( + configuration?: Configuration +) { + return { + /** + * Get revocation list 2020 Credential (required to check if VC revoked). + * @summary Return revocation list credential. + * @param {string} listId + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRevocationListCredential: async ( + listId: string, + walletId: string, + options: RawAxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'listId' is not null or undefined + assertParamExists('getRevocationListCredential', 'listId', listId); + // verify required parameter 'walletId' is not null or undefined + assertParamExists('getRevocationListCredential', 'walletId', walletId); + const localVarPath = `/v1/wallets/{walletId}/revocation-list/{listId}` + .replace(`{${'listId'}}`, encodeURIComponent(String(listId))) + .replace(`{${'walletId'}}`, encodeURIComponent(String(walletId))); + // 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 = { + method: 'GET', + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ProjectTokenAuth required + await setApiKeyToObject( + localVarHeaderParameter, + 'authorization', + configuration + ); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * Update index/credetial at appropriate revocation list (set revoken is true). + * @summary Revoke Credential. + * @param {string} walletId id of the wallet + * @param {RevokeCredentialInput} revokeCredentialInput RevokeCredential + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + revokeCredential: async ( + walletId: string, + revokeCredentialInput: RevokeCredentialInput, + options: RawAxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'walletId' is not null or undefined + assertParamExists('revokeCredential', 'walletId', walletId); + // verify required parameter 'revokeCredentialInput' is not null or undefined + assertParamExists( + 'revokeCredential', + 'revokeCredentialInput', + revokeCredentialInput + ); + const localVarPath = `/v1/wallets/{walletId}/revoke`.replace( + `{${'walletId'}}`, + encodeURIComponent(String(walletId)) + ); + // 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 = { + method: 'POST', + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ProjectTokenAuth required + await setApiKeyToObject( + localVarHeaderParameter, + 'authorization', + configuration + ); + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + revokeCredentialInput, + localVarRequestOptions, + configuration + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * RevocationApi - functional programming interface + * @export + */ +export const RevocationApiFp = function (configuration?: Configuration) { + const localVarAxiosParamCreator = + RevocationApiAxiosParamCreator(configuration); + return { + /** + * Get revocation list 2020 Credential (required to check if VC revoked). + * @summary Return revocation list credential. + * @param {string} listId + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getRevocationListCredential( + listId: string, + walletId: string, + options?: RawAxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.getRevocationListCredential( + listId, + walletId, + options + ); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = + operationServerMap['RevocationApi.getRevocationListCredential']?.[index] + ?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + )(axios, operationBasePath || basePath); + }, + /** + * Update index/credetial at appropriate revocation list (set revoken is true). + * @summary Revoke Credential. + * @param {string} walletId id of the wallet + * @param {RevokeCredentialInput} revokeCredentialInput RevokeCredential + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async revokeCredential( + walletId: string, + revokeCredentialInput: RevokeCredentialInput, + options?: RawAxiosRequestConfig + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.revokeCredential( + walletId, + revokeCredentialInput, + options + ); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = + operationServerMap['RevocationApi.revokeCredential']?.[index]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + )(axios, operationBasePath || basePath); + }, + }; +}; + +/** + * RevocationApi - factory interface + * @export + */ +export const RevocationApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance +) { + const localVarFp = RevocationApiFp(configuration); + return { + /** + * Get revocation list 2020 Credential (required to check if VC revoked). + * @summary Return revocation list credential. + * @param {string} listId + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getRevocationListCredential( + listId: string, + walletId: string, + options?: any + ): AxiosPromise { + return localVarFp + .getRevocationListCredential(listId, walletId, options) + .then((request) => request(axios, basePath)); + }, + /** + * Update index/credetial at appropriate revocation list (set revoken is true). + * @summary Revoke Credential. + * @param {string} walletId id of the wallet + * @param {RevokeCredentialInput} revokeCredentialInput RevokeCredential + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + revokeCredential( + walletId: string, + revokeCredentialInput: RevokeCredentialInput, + options?: any + ): AxiosPromise { + return localVarFp + .revokeCredential(walletId, revokeCredentialInput, options) + .then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * RevocationApi - object-oriented interface + * @export + * @class RevocationApi + * @extends {BaseAPI} + */ +export class RevocationApi extends BaseAPI { + /** + * Get revocation list 2020 Credential (required to check if VC revoked). + * @summary Return revocation list credential. + * @param {string} listId + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof RevocationApi + */ + public getRevocationListCredential( + listId: string, + walletId: string, + options?: RawAxiosRequestConfig + ) { + return RevocationApiFp(this.configuration) + .getRevocationListCredential(listId, walletId, options) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * Update index/credetial at appropriate revocation list (set revoken is true). + * @summary Revoke Credential. + * @param {string} walletId id of the wallet + * @param {RevokeCredentialInput} revokeCredentialInput RevokeCredential + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof RevocationApi + */ + public revokeCredential( + walletId: string, + revokeCredentialInput: RevokeCredentialInput, + options?: RawAxiosRequestConfig + ) { + return RevocationApiFp(this.configuration) + .revokeCredential(walletId, revokeCredentialInput, options) + .then((request) => request(this.axios, this.basePath)); + } +} + +/** + * WalletApi - axios parameter creator + * @export + */ +export const WalletApiAxiosParamCreator = function ( + configuration?: Configuration +) { + return { + /** + * creates a wallet + * @param {object} [body] CreateWallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createWallet: async ( + body?: object, + options: RawAxiosRequestConfig = {} + ): Promise => { + const localVarPath = `/v1/wallets`; + // 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 = { + method: 'POST', + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ProjectTokenAuth required + await setApiKeyToObject( + localVarHeaderParameter, + 'authorization', + configuration + ); + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + body, + localVarRequestOptions, + configuration + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * get wallet details using wallet Id. + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWallet: async ( + walletId: string, + options: RawAxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'walletId' is not null or undefined + assertParamExists('getWallet', 'walletId', walletId); + const localVarPath = `/v1/wallets/{walletId}`.replace( + `{${'walletId'}}`, + encodeURIComponent(String(walletId)) + ); + // 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 = { + method: 'GET', + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ProjectTokenAuth required + await setApiKeyToObject( + localVarHeaderParameter, + 'authorization', + configuration + ); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * lists all wallets + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listWallets: async ( + options: RawAxiosRequestConfig = {} + ): Promise => { + const localVarPath = `/v1/wallets`; + // 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 = { + method: 'GET', + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ProjectTokenAuth required + await setApiKeyToObject( + localVarHeaderParameter, + 'authorization', + configuration + ); + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + /** + * signs credential with the wallet + * @param {string} walletId id of the wallet + * @param {SignCredentialInputDto} signCredentialInputDto SignCredential + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signCredential: async ( + walletId: string, + signCredentialInputDto: SignCredentialInputDto, + options: RawAxiosRequestConfig = {} + ): Promise => { + // verify required parameter 'walletId' is not null or undefined + assertParamExists('signCredential', 'walletId', walletId); + // verify required parameter 'signCredentialInputDto' is not null or undefined + assertParamExists( + 'signCredential', + 'signCredentialInputDto', + signCredentialInputDto + ); + const localVarPath = `/v1/wallets/{walletId}/sign-credential`.replace( + `{${'walletId'}}`, + encodeURIComponent(String(walletId)) + ); + // 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 = { + method: 'POST', + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; + + // authentication ProjectTokenAuth required + await setApiKeyToObject( + localVarHeaderParameter, + 'authorization', + configuration + ); + + localVarHeaderParameter['Content-Type'] = 'application/json'; + + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + signCredentialInputDto, + localVarRequestOptions, + configuration + ); + + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; +}; + +/** + * WalletApi - functional programming interface + * @export + */ +export const WalletApiFp = function (configuration?: Configuration) { + const localVarAxiosParamCreator = WalletApiAxiosParamCreator(configuration); + return { + /** + * creates a wallet + * @param {object} [body] CreateWallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async createWallet( + body?: object, + options?: RawAxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.createWallet( + body, + options + ); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = + operationServerMap['WalletApi.createWallet']?.[index]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + )(axios, operationBasePath || basePath); + }, + /** + * get wallet details using wallet Id. + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getWallet( + walletId: string, + options?: RawAxiosRequestConfig + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.getWallet( + walletId, + options + ); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = + operationServerMap['WalletApi.getWallet']?.[index]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + )(axios, operationBasePath || basePath); + }, + /** + * lists all wallets + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async listWallets( + options?: RawAxiosRequestConfig + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.listWallets( + options + ); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = + operationServerMap['WalletApi.listWallets']?.[index]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + )(axios, operationBasePath || basePath); + }, + /** + * signs credential with the wallet + * @param {string} walletId id of the wallet + * @param {SignCredentialInputDto} signCredentialInputDto SignCredential + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async signCredential( + walletId: string, + signCredentialInputDto: SignCredentialInputDto, + options?: RawAxiosRequestConfig + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string + ) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.signCredential( + walletId, + signCredentialInputDto, + options + ); + const index = configuration?.serverIndex ?? 0; + const operationBasePath = + operationServerMap['WalletApi.signCredential']?.[index]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration + )(axios, operationBasePath || basePath); + }, + }; +}; + +/** + * WalletApi - factory interface + * @export + */ +export const WalletApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance +) { + const localVarFp = WalletApiFp(configuration); + return { + /** + * creates a wallet + * @param {object} [body] CreateWallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + createWallet( + body?: object, + options?: any + ): AxiosPromise { + return localVarFp + .createWallet(body, options) + .then((request) => request(axios, basePath)); + }, + /** + * get wallet details using wallet Id. + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getWallet(walletId: string, options?: any): AxiosPromise { + return localVarFp + .getWallet(walletId, options) + .then((request) => request(axios, basePath)); + }, + /** + * lists all wallets + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + listWallets(options?: any): AxiosPromise { + return localVarFp + .listWallets(options) + .then((request) => request(axios, basePath)); + }, + /** + * signs credential with the wallet + * @param {string} walletId id of the wallet + * @param {SignCredentialInputDto} signCredentialInputDto SignCredential + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + signCredential( + walletId: string, + signCredentialInputDto: SignCredentialInputDto, + options?: any + ): AxiosPromise { + return localVarFp + .signCredential(walletId, signCredentialInputDto, options) + .then((request) => request(axios, basePath)); + }, + }; +}; + +/** + * WalletApi - object-oriented interface + * @export + * @class WalletApi + * @extends {BaseAPI} + */ +export class WalletApi extends BaseAPI { + /** + * creates a wallet + * @param {object} [body] CreateWallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public createWallet(body?: object, options?: RawAxiosRequestConfig) { + return WalletApiFp(this.configuration) + .createWallet(body, options) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * get wallet details using wallet Id. + * @param {string} walletId id of the wallet + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public getWallet(walletId: string, options?: RawAxiosRequestConfig) { + return WalletApiFp(this.configuration) + .getWallet(walletId, options) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * lists all wallets + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public listWallets(options?: RawAxiosRequestConfig) { + return WalletApiFp(this.configuration) + .listWallets(options) + .then((request) => request(this.axios, this.basePath)); + } + + /** + * signs credential with the wallet + * @param {string} walletId id of the wallet + * @param {SignCredentialInputDto} signCredentialInputDto SignCredential + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof WalletApi + */ + public signCredential( + walletId: string, + signCredentialInputDto: SignCredentialInputDto, + options?: RawAxiosRequestConfig + ) { + return WalletApiFp(this.configuration) + .signCredential(walletId, signCredentialInputDto, options) + .then((request) => request(this.axios, this.basePath)); + } +} diff --git a/packages/sdk-client-cwe/base.ts b/packages/sdk-client-cwe/base.ts new file mode 100644 index 00000000..c0c1f7dd --- /dev/null +++ b/packages/sdk-client-cwe/base.ts @@ -0,0 +1,88 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * CloudWalletEssentials + * Cloud Wallet For Enterprise Structure + * + * The version of the OpenAPI document: 1.0.0 + * Contact: nucleus.team@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. + */ + +import type { Configuration } from './configuration'; +// Some imports not used depending on template conditions +// @ts-ignore +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; +import globalAxios from 'axios'; + +export const BASE_PATH = 'http://localhost'.replace(/\/+$/, ''); + +/** + * + * @export + */ +export const COLLECTION_FORMATS = { + csv: ',', + ssv: ' ', + tsv: '\t', + pipes: '|', +}; + +/** + * + * @export + * @interface RequestArgs + */ +export interface RequestArgs { + url: string; + options: RawAxiosRequestConfig; +} + +/** + * + * @export + * @class BaseAPI + */ +export class BaseAPI { + protected configuration: Configuration | undefined; + + constructor( + configuration?: Configuration, + protected basePath: string = BASE_PATH, + protected axios: AxiosInstance = globalAxios + ) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath ?? basePath; + } + } +} + +/** + * + * @export + * @class RequiredError + * @extends {Error} + */ +export class RequiredError extends Error { + constructor(public field: string, msg?: string) { + super(msg); + this.name = 'RequiredError'; + } +} + +interface ServerMap { + [key: string]: { + url: string; + description: string; + }[]; +} + +/** + * + * @export + */ +export const operationServerMap: ServerMap = {}; diff --git a/packages/sdk-client-cwe/common.ts b/packages/sdk-client-cwe/common.ts new file mode 100644 index 00000000..1f48c597 --- /dev/null +++ b/packages/sdk-client-cwe/common.ts @@ -0,0 +1,203 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * CloudWalletEssentials + * Cloud Wallet For Enterprise Structure + * + * The version of the OpenAPI document: 1.0.0 + * Contact: nucleus.team@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. + */ + +import type { Configuration } from './configuration'; +import type { RequestArgs } from './base'; +import type { AxiosInstance, AxiosResponse } from 'axios'; +import { RequiredError } from './base'; +import { URL, URLSearchParams } from 'url'; + +/** + * + * @export + */ +export const DUMMY_BASE_URL = 'https://example.com'; + +/** + * + * @throws {RequiredError} + * @export + */ +export const assertParamExists = function ( + functionName: string, + paramName: string, + paramValue: unknown +) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError( + paramName, + `Required parameter ${paramName} was null or undefined when calling ${functionName}.` + ); + } +}; + +/** + * + * @export + */ +export const setApiKeyToObject = async function ( + object: any, + keyParamName: string, + configuration?: Configuration +) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = + typeof configuration.apiKey === 'function' + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +}; + +/** + * + * @export + */ +export const setBasicAuthToObject = function ( + object: any, + configuration?: Configuration +) { + if (configuration && (configuration.username || configuration.password)) { + object['auth'] = { + username: configuration.username, + password: configuration.password, + }; + } +}; + +/** + * + * @export + */ +export const setBearerAuthToObject = async function ( + object: any, + configuration?: Configuration +) { + if (configuration && configuration.accessToken) { + const accessToken = + typeof configuration.accessToken === 'function' + ? await configuration.accessToken() + : await configuration.accessToken; + object['Authorization'] = 'Bearer ' + accessToken; + } +}; + +/** + * + * @export + */ +export const setOAuthToObject = async function ( + object: any, + name: string, + scopes: string[], + configuration?: Configuration +) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = + typeof configuration.accessToken === 'function' + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object['Authorization'] = 'Bearer ' + localVarAccessTokenValue; + } +}; + +function setFlattenedQueryParams( + urlSearchParams: URLSearchParams, + parameter: any, + key: string = '' +): void { + if (parameter == null) return; + if (typeof parameter === 'object') { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach((item) => + setFlattenedQueryParams(urlSearchParams, item, key) + ); + } else { + Object.keys(parameter).forEach((currentKey) => + setFlattenedQueryParams( + urlSearchParams, + parameter[currentKey], + `${key}${key !== '' ? '.' : ''}${currentKey}` + ) + ); + } + } else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } else { + urlSearchParams.set(key, parameter); + } + } +} + +/** + * + * @export + */ +export const setSearchParams = function (url: URL, ...objects: any[]) { + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +}; + +/** + * + * @export + */ +export const serializeDataIfNeeded = function ( + value: any, + requestOptions: any, + configuration?: Configuration +) { + const nonString = typeof value !== 'string'; + const needsSerialization = + nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers['Content-Type']) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : value || ''; +}; + +/** + * + * @export + */ +export const toPathString = function (url: URL) { + return url.pathname + url.search + url.hash; +}; + +/** + * + * @export + */ +export const createRequestFunction = function ( + axiosArgs: RequestArgs, + globalAxios: AxiosInstance, + BASE_PATH: string, + configuration?: Configuration +) { + return >( + axios: AxiosInstance = globalAxios, + basePath: string = BASE_PATH + ) => { + const axiosRequestArgs = { + ...axiosArgs.options, + url: + (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + + axiosArgs.url, + }; + return axios.request(axiosRequestArgs); + }; +}; diff --git a/packages/sdk-client-cwe/configuration.ts b/packages/sdk-client-cwe/configuration.ts new file mode 100644 index 00000000..349847c3 --- /dev/null +++ b/packages/sdk-client-cwe/configuration.ts @@ -0,0 +1,132 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * CloudWalletEssentials + * Cloud Wallet For Enterprise Structure + * + * The version of the OpenAPI document: 1.0.0 + * Contact: nucleus.team@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. + */ + +export interface ConfigurationParameters { + apiKey?: + | string + | Promise + | ((name: string) => string) + | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: + | string + | Promise + | ((name?: string, scopes?: string[]) => string) + | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + serverIndex?: number; + baseOptions?: any; + formDataCtor?: new () => any; +} + +export class Configuration { + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: + | string + | Promise + | ((name: string) => string) + | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: + | string + | Promise + | ((name?: string, scopes?: string[]) => string) + | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * override server index + * + * @type {number} + * @memberof Configuration + */ + serverIndex?: number; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; + + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.serverIndex = param.serverIndex; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } + + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp( + '^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$', + 'i' + ); + return ( + mime !== null && + (jsonMime.test(mime) || + mime.toLowerCase() === 'application/json-patch+json') + ); + } +} diff --git a/packages/sdk-client-cwe/git_push.sh b/packages/sdk-client-cwe/git_push.sh new file mode 100644 index 00000000..f53a75d4 --- /dev/null +++ b/packages/sdk-client-cwe/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/packages/sdk-client-cwe/index.ts b/packages/sdk-client-cwe/index.ts new file mode 100644 index 00000000..1d4f53c3 --- /dev/null +++ b/packages/sdk-client-cwe/index.ts @@ -0,0 +1,16 @@ +/* tslint:disable */ +/* eslint-disable */ +/** + * CloudWalletEssentials + * Cloud Wallet For Enterprise Structure + * + * The version of the OpenAPI document: 1.0.0 + * Contact: nucleus.team@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. + */ + +export * from './api'; +export * from './configuration'; diff --git a/packages/sdk-client-cwe/package.json b/packages/sdk-client-cwe/package.json new file mode 100644 index 00000000..f209fbbf --- /dev/null +++ b/packages/sdk-client-cwe/package.json @@ -0,0 +1,33 @@ +{ + "name": "@affinidi/test-sdk-client-cwe", + "version": "1.0.0", + "description": "OpenAPI client for @affinidi/test-sdk-client-cwe", + "author": "OpenAPI-Generator Contributors", + "repository": { + "type": "git", + "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" + }, + "keywords": [ + "axios", + "typescript", + "openapi-client", + "openapi-generator", + "@affinidi/test-sdk-client-cwe" + ], + "license": "Unlicense", + "main": "./dist/index.js", + "typings": "./dist/index.d.ts", + "module": "./dist/esm/index.js", + "sideEffects": false, + "scripts": { + "build": "tsc && tsc -p tsconfig.esm.json", + "prepare": "npm run build" + }, + "dependencies": { + "axios": "^1.6.1" + }, + "devDependencies": { + "@types/node": "^12.11.5", + "typescript": "^4.0" + } +} diff --git a/packages/sdk-client-cwe/tsconfig.esm.json b/packages/sdk-client-cwe/tsconfig.esm.json new file mode 100644 index 00000000..2c0331cc --- /dev/null +++ b/packages/sdk-client-cwe/tsconfig.esm.json @@ -0,0 +1,7 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "module": "esnext", + "outDir": "dist/esm" + } +} diff --git a/packages/sdk-client-cwe/tsconfig.json b/packages/sdk-client-cwe/tsconfig.json new file mode 100644 index 00000000..bab039be --- /dev/null +++ b/packages/sdk-client-cwe/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "declaration": true, + "target": "ES6", + "module": "commonjs", + "noImplicitAny": true, + "esModuleInterop": true, + "outDir": "dist", + "rootDir": ".", + "moduleResolution": "node" + }, + "exclude": ["dist", "node_modules"] +}