UNPKG

@circle-fin/circle-sdk

Version:
502 lines (476 loc) 21.9 kB
/* 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 { Conflict } from "../models"; // @ts-ignore import { CreateMockChargebackResponse } from "../models"; // @ts-ignore import { GetChargebackResponse } from "../models"; // @ts-ignore import { ListChargebacksResponse } from "../models"; // @ts-ignore import { MockChargebackCreationRequest } from "../models"; // @ts-ignore import { NotAuthorized } from "../models"; // @ts-ignore import { NotFound } from "../models"; /** * ChargebacksApi - axios parameter creator * @export */ export const ChargebacksApiAxiosParamCreator = function ( configuration?: Configuration ) { return { /** * In the sandbox environment, initiate a mock chargeback of a specified payment. The entire payment will be charged back for its full value. The payment must be in the `paid` state (otherwise the endpoint will return a `404`), and each payment can only be charged back once (otherwise the endpoint will return a `409`). This endpoint is only available in the sandbox environment. * @summary Create a mock chargeback * @param {MockChargebackCreationRequest} [mockChargebackCreationRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ createMockChargeback: async ( mockChargebackCreationRequest?: MockChargebackCreationRequest, options: AxiosRequestConfig = {} ): Promise<RequestArgs> => { const localVarPath = `/v1/mocks/cards/chargebacks`; // 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( mockChargebackCreationRequest, localVarRequestOptions, configuration ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions }; }, /** * * @summary Get a chargeback * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChargeback: async ( id: string, options: AxiosRequestConfig = {} ): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists("getChargeback", "id", id); const localVarPath = `/v1/chargebacks/{id}`.replace( `{${"id"}}`, encodeURIComponent(String(id)) ); // 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 bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration); setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions }; }, /** * Retrieve list of chargebacks. Results will be sorted by create date descending: more recent chargebacks will be at the beginning of the list. * @summary List all chargebacks * @param {string} [paymentId] The payment ID associated with the chargeback. * @param {string} [from] Queries items created since the specified date-time (inclusive). * @param {string} [to] Queries items created before the specified date-time (inclusive). * @param {string} [pageBefore] A collection ID value used for pagination. It marks the exclusive end of a page. When provided, the collection resource will return the next &#x60;n&#x60; items before the id, with &#x60;n&#x60; being specified by &#x60;pageSize&#x60;. The items will be returned in the natural order of the collection. The resource will return the first page if neither &#x60;pageAfter&#x60; nor &#x60;pageBefore&#x60; are specified. SHOULD NOT be used in conjuction with pageAfter. * @param {string} [pageAfter] A collection ID value used for pagination. It marks the exclusive begin of a page. When provided, the collection resource will return the next &#x60;n&#x60; items after the id, with &#x60;n&#x60; being specified by &#x60;pageSize&#x60;. The items will be returned in the natural order of the collection. The resource will return the first page if neither &#x60;pageAfter&#x60; nor &#x60;pageBefore&#x60; are specified. SHOULD NOT be used in conjuction with pageBefore. * @param {number} [pageSize] Limits the number of items to be returned. Some collections have a strict upper bound that will disregard this value. In case the specified value is higher than the allowed limit, the collection limit will be used. If avoided, the collection will determine the page size itself. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listChargebacks: async ( paymentId?: string, from?: string, to?: string, pageBefore?: string, pageAfter?: string, pageSize?: number, options: AxiosRequestConfig = {} ): Promise<RequestArgs> => { const localVarPath = `/v1/chargebacks`; // 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 bearerAuth required // http bearer authentication required await setBearerAuthToObject(localVarHeaderParameter, configuration); if (paymentId !== undefined) { localVarQueryParameter["paymentId"] = paymentId; } if (from !== undefined) { localVarQueryParameter["from"] = (from as any) instanceof Date ? (from as any).toISOString() : from; } if (to !== undefined) { localVarQueryParameter["to"] = (to as any) instanceof Date ? (to as any).toISOString() : to; } if (pageBefore !== undefined) { localVarQueryParameter["pageBefore"] = pageBefore; } if (pageAfter !== undefined) { localVarQueryParameter["pageAfter"] = pageAfter; } if (pageSize !== undefined) { localVarQueryParameter["pageSize"] = pageSize; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions }; } }; }; /** * ChargebacksApi - functional programming interface * @export */ export const ChargebacksApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = ChargebacksApiAxiosParamCreator(configuration); return { /** * In the sandbox environment, initiate a mock chargeback of a specified payment. The entire payment will be charged back for its full value. The payment must be in the `paid` state (otherwise the endpoint will return a `404`), and each payment can only be charged back once (otherwise the endpoint will return a `409`). This endpoint is only available in the sandbox environment. * @summary Create a mock chargeback * @param {MockChargebackCreationRequest} [mockChargebackCreationRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createMockChargeback( mockChargebackCreationRequest?: MockChargebackCreationRequest, options?: AxiosRequestConfig ): Promise< ( axios?: AxiosInstance, basePath?: string ) => AxiosPromise<CreateMockChargebackResponse> > { const localVarAxiosArgs = await localVarAxiosParamCreator.createMockChargeback( mockChargebackCreationRequest, options ); return createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration ); }, /** * * @summary Get a chargeback * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getChargeback( id: string, options?: AxiosRequestConfig ): Promise< ( axios?: AxiosInstance, basePath?: string ) => AxiosPromise<GetChargebackResponse> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getChargeback( id, options ); return createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration ); }, /** * Retrieve list of chargebacks. Results will be sorted by create date descending: more recent chargebacks will be at the beginning of the list. * @summary List all chargebacks * @param {string} [paymentId] The payment ID associated with the chargeback. * @param {string} [from] Queries items created since the specified date-time (inclusive). * @param {string} [to] Queries items created before the specified date-time (inclusive). * @param {string} [pageBefore] A collection ID value used for pagination. It marks the exclusive end of a page. When provided, the collection resource will return the next &#x60;n&#x60; items before the id, with &#x60;n&#x60; being specified by &#x60;pageSize&#x60;. The items will be returned in the natural order of the collection. The resource will return the first page if neither &#x60;pageAfter&#x60; nor &#x60;pageBefore&#x60; are specified. SHOULD NOT be used in conjuction with pageAfter. * @param {string} [pageAfter] A collection ID value used for pagination. It marks the exclusive begin of a page. When provided, the collection resource will return the next &#x60;n&#x60; items after the id, with &#x60;n&#x60; being specified by &#x60;pageSize&#x60;. The items will be returned in the natural order of the collection. The resource will return the first page if neither &#x60;pageAfter&#x60; nor &#x60;pageBefore&#x60; are specified. SHOULD NOT be used in conjuction with pageBefore. * @param {number} [pageSize] Limits the number of items to be returned. Some collections have a strict upper bound that will disregard this value. In case the specified value is higher than the allowed limit, the collection limit will be used. If avoided, the collection will determine the page size itself. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async listChargebacks( paymentId?: string, from?: string, to?: string, pageBefore?: string, pageAfter?: string, pageSize?: number, options?: AxiosRequestConfig ): Promise< ( axios?: AxiosInstance, basePath?: string ) => AxiosPromise<ListChargebacksResponse> > { const localVarAxiosArgs = await localVarAxiosParamCreator.listChargebacks( paymentId, from, to, pageBefore, pageAfter, pageSize, options ); return createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration ); } }; }; /** * ChargebacksApi - factory interface * @export */ export const ChargebacksApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance ) { const localVarFp = ChargebacksApiFp(configuration); return { /** * In the sandbox environment, initiate a mock chargeback of a specified payment. The entire payment will be charged back for its full value. The payment must be in the `paid` state (otherwise the endpoint will return a `404`), and each payment can only be charged back once (otherwise the endpoint will return a `409`). This endpoint is only available in the sandbox environment. * @summary Create a mock chargeback * @param {MockChargebackCreationRequest} [mockChargebackCreationRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ createMockChargeback( mockChargebackCreationRequest?: MockChargebackCreationRequest, options?: any ): AxiosPromise<CreateMockChargebackResponse> { return localVarFp .createMockChargeback(mockChargebackCreationRequest, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get a chargeback * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getChargeback( id: string, options?: any ): AxiosPromise<GetChargebackResponse> { return localVarFp .getChargeback(id, options) .then((request) => request(axios, basePath)); }, /** * Retrieve list of chargebacks. Results will be sorted by create date descending: more recent chargebacks will be at the beginning of the list. * @summary List all chargebacks * @param {string} [paymentId] The payment ID associated with the chargeback. * @param {string} [from] Queries items created since the specified date-time (inclusive). * @param {string} [to] Queries items created before the specified date-time (inclusive). * @param {string} [pageBefore] A collection ID value used for pagination. It marks the exclusive end of a page. When provided, the collection resource will return the next &#x60;n&#x60; items before the id, with &#x60;n&#x60; being specified by &#x60;pageSize&#x60;. The items will be returned in the natural order of the collection. The resource will return the first page if neither &#x60;pageAfter&#x60; nor &#x60;pageBefore&#x60; are specified. SHOULD NOT be used in conjuction with pageAfter. * @param {string} [pageAfter] A collection ID value used for pagination. It marks the exclusive begin of a page. When provided, the collection resource will return the next &#x60;n&#x60; items after the id, with &#x60;n&#x60; being specified by &#x60;pageSize&#x60;. The items will be returned in the natural order of the collection. The resource will return the first page if neither &#x60;pageAfter&#x60; nor &#x60;pageBefore&#x60; are specified. SHOULD NOT be used in conjuction with pageBefore. * @param {number} [pageSize] Limits the number of items to be returned. Some collections have a strict upper bound that will disregard this value. In case the specified value is higher than the allowed limit, the collection limit will be used. If avoided, the collection will determine the page size itself. * @param {*} [options] Override http request option. * @throws {RequiredError} */ listChargebacks( paymentId?: string, from?: string, to?: string, pageBefore?: string, pageAfter?: string, pageSize?: number, options?: any ): AxiosPromise<ListChargebacksResponse> { return localVarFp .listChargebacks( paymentId, from, to, pageBefore, pageAfter, pageSize, options ) .then((request) => request(axios, basePath)); } }; }; /** * ChargebacksApi - object-oriented interface * @export * @class ChargebacksApi * @extends {BaseAPI} */ export class ChargebacksApi extends BaseAPI { /** * In the sandbox environment, initiate a mock chargeback of a specified payment. The entire payment will be charged back for its full value. The payment must be in the `paid` state (otherwise the endpoint will return a `404`), and each payment can only be charged back once (otherwise the endpoint will return a `409`). This endpoint is only available in the sandbox environment. * @summary Create a mock chargeback * @param {MockChargebackCreationRequest} [mockChargebackCreationRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChargebacksApi */ public createMockChargeback( mockChargebackCreationRequest?: MockChargebackCreationRequest, options?: AxiosRequestConfig ) { return ChargebacksApiFp(this.configuration) .createMockChargeback(mockChargebackCreationRequest, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get a chargeback * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChargebacksApi */ public getChargeback(id: string, options?: AxiosRequestConfig) { return ChargebacksApiFp(this.configuration) .getChargeback(id, options) .then((request) => request(this.axios, this.basePath)); } /** * Retrieve list of chargebacks. Results will be sorted by create date descending: more recent chargebacks will be at the beginning of the list. * @summary List all chargebacks * @param {string} [paymentId] The payment ID associated with the chargeback. * @param {string} [from] Queries items created since the specified date-time (inclusive). * @param {string} [to] Queries items created before the specified date-time (inclusive). * @param {string} [pageBefore] A collection ID value used for pagination. It marks the exclusive end of a page. When provided, the collection resource will return the next &#x60;n&#x60; items before the id, with &#x60;n&#x60; being specified by &#x60;pageSize&#x60;. The items will be returned in the natural order of the collection. The resource will return the first page if neither &#x60;pageAfter&#x60; nor &#x60;pageBefore&#x60; are specified. SHOULD NOT be used in conjuction with pageAfter. * @param {string} [pageAfter] A collection ID value used for pagination. It marks the exclusive begin of a page. When provided, the collection resource will return the next &#x60;n&#x60; items after the id, with &#x60;n&#x60; being specified by &#x60;pageSize&#x60;. The items will be returned in the natural order of the collection. The resource will return the first page if neither &#x60;pageAfter&#x60; nor &#x60;pageBefore&#x60; are specified. SHOULD NOT be used in conjuction with pageBefore. * @param {number} [pageSize] Limits the number of items to be returned. Some collections have a strict upper bound that will disregard this value. In case the specified value is higher than the allowed limit, the collection limit will be used. If avoided, the collection will determine the page size itself. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ChargebacksApi */ public listChargebacks( paymentId?: string, from?: string, to?: string, pageBefore?: string, pageAfter?: string, pageSize?: number, options?: AxiosRequestConfig ) { return ChargebacksApiFp(this.configuration) .listChargebacks( paymentId, from, to, pageBefore, pageAfter, pageSize, options ) .then((request) => request(this.axios, this.basePath)); } }