@circle-fin/circle-sdk
Version:
Node.js SDK for Circle API
197 lines (187 loc) • 5.66 kB
text/typescript
/* tslint:disable */
/* eslint-disable */
/**
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import globalAxios, {
AxiosPromise,
AxiosInstance,
AxiosRequestConfig
} from "axios";
import { Configuration } from "../configuration";
// Some imports not used depending on template conditions
// @ts-ignore
import {
DUMMY_BASE_URL,
assertParamExists,
setBearerAuthToObject,
setSearchParams,
serializeDataIfNeeded,
toPathString,
createRequestFunction
} from "../common";
// @ts-ignore
import {
BASE_PATH,
COLLECTION_FORMATS,
RequestArgs,
BaseAPI,
RequiredError
} from "../base";
// @ts-ignore
import { BadRequest } from "../models";
// @ts-ignore
import { CreatePaymentTokenResponse } from "../models";
// @ts-ignore
import { NotAuthorized } from "../models";
// @ts-ignore
import { PaymentTokenRequest } from "../models";
/**
* PaymentTokensApi - axios parameter creator
* @export
*/
export const PaymentTokensApiAxiosParamCreator = function (
configuration?: Configuration
) {
return {
/**
* Convert a digital wallet (Apple Pay, Google Pay) token to a single-use payment token.
* @summary Create a payment token
* @param {PaymentTokenRequest} [paymentTokenRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createPaymentToken: async (
paymentTokenRequest?: PaymentTokenRequest,
options: AxiosRequestConfig = {}
): Promise<RequestArgs> => {
const localVarPath = `/v1/paymentTokens`;
// 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 bearerAuth required
// http bearer authentication required
await setBearerAuthToObject(localVarHeaderParameter, 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(
paymentTokenRequest,
localVarRequestOptions,
configuration
);
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions
};
}
};
};
/**
* PaymentTokensApi - functional programming interface
* @export
*/
export const PaymentTokensApiFp = function (configuration?: Configuration) {
const localVarAxiosParamCreator =
PaymentTokensApiAxiosParamCreator(configuration);
return {
/**
* Convert a digital wallet (Apple Pay, Google Pay) token to a single-use payment token.
* @summary Create a payment token
* @param {PaymentTokenRequest} [paymentTokenRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createPaymentToken(
paymentTokenRequest?: PaymentTokenRequest,
options?: AxiosRequestConfig
): Promise<
(
axios?: AxiosInstance,
basePath?: string
) => AxiosPromise<CreatePaymentTokenResponse>
> {
const localVarAxiosArgs =
await localVarAxiosParamCreator.createPaymentToken(
paymentTokenRequest,
options
);
return createRequestFunction(
localVarAxiosArgs,
globalAxios,
BASE_PATH,
configuration
);
}
};
};
/**
* PaymentTokensApi - factory interface
* @export
*/
export const PaymentTokensApiFactory = function (
configuration?: Configuration,
basePath?: string,
axios?: AxiosInstance
) {
const localVarFp = PaymentTokensApiFp(configuration);
return {
/**
* Convert a digital wallet (Apple Pay, Google Pay) token to a single-use payment token.
* @summary Create a payment token
* @param {PaymentTokenRequest} [paymentTokenRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createPaymentToken(
paymentTokenRequest?: PaymentTokenRequest,
options?: any
): AxiosPromise<CreatePaymentTokenResponse> {
return localVarFp
.createPaymentToken(paymentTokenRequest, options)
.then((request) => request(axios, basePath));
}
};
};
/**
* PaymentTokensApi - object-oriented interface
* @export
* @class PaymentTokensApi
* @extends {BaseAPI}
*/
export class PaymentTokensApi extends BaseAPI {
/**
* Convert a digital wallet (Apple Pay, Google Pay) token to a single-use payment token.
* @summary Create a payment token
* @param {PaymentTokenRequest} [paymentTokenRequest]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof PaymentTokensApi
*/
public createPaymentToken(
paymentTokenRequest?: PaymentTokenRequest,
options?: AxiosRequestConfig
) {
return PaymentTokensApiFp(this.configuration)
.createPaymentToken(paymentTokenRequest, options)
.then((request) => request(this.axios, this.basePath));
}
}