UNPKG

@circle-fin/circle-sdk

Version:
567 lines (538 loc) 20.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 { CardCreationRequest } from "../models"; // @ts-ignore import { CardUpdate } from "../models"; // @ts-ignore import { CreateCardResponse } from "../models"; // @ts-ignore import { GetCardResponse } from "../models"; // @ts-ignore import { ListCardsResponse } from "../models"; // @ts-ignore import { NotAuthorized } from "../models"; // @ts-ignore import { NotFound } from "../models"; // @ts-ignore import { UpdateCardResponse } from "../models"; /** * CardsApi - axios parameter creator * @export */ export const CardsApiAxiosParamCreator = function ( configuration?: Configuration ) { return { /** * * @summary Create a card * @param {CardCreationRequest} [cardCreationRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ createCard: async ( cardCreationRequest?: CardCreationRequest, options: AxiosRequestConfig = {} ): Promise<RequestArgs> => { const localVarPath = `/v1/cards`; // 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( cardCreationRequest, localVarRequestOptions, configuration ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions }; }, /** * * @summary Get a card * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getCard: async ( id: string, options: AxiosRequestConfig = {} ): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists("getCard", "id", id); const localVarPath = `/v1/cards/{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 }; }, /** * * @summary List all cards * @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} */ listCards: async ( pageBefore?: string, pageAfter?: string, pageSize?: number, options: AxiosRequestConfig = {} ): Promise<RequestArgs> => { const localVarPath = `/v1/cards`; // 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 (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 }; }, /** * * @summary Update a card * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {CardUpdate} [cardUpdate] * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateCard: async ( id: string, cardUpdate?: CardUpdate, options: AxiosRequestConfig = {} ): Promise<RequestArgs> => { // verify required parameter 'id' is not null or undefined assertParamExists("updateCard", "id", id); const localVarPath = `/v1/cards/{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: "PUT", ...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( cardUpdate, localVarRequestOptions, configuration ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions }; } }; }; /** * CardsApi - functional programming interface * @export */ export const CardsApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = CardsApiAxiosParamCreator(configuration); return { /** * * @summary Create a card * @param {CardCreationRequest} [cardCreationRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createCard( cardCreationRequest?: CardCreationRequest, options?: AxiosRequestConfig ): Promise< ( axios?: AxiosInstance, basePath?: string ) => AxiosPromise<CreateCardResponse> > { const localVarAxiosArgs = await localVarAxiosParamCreator.createCard( cardCreationRequest, options ); return createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration ); }, /** * * @summary Get a card * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getCard( id: string, options?: AxiosRequestConfig ): Promise< ( axios?: AxiosInstance, basePath?: string ) => AxiosPromise<GetCardResponse> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getCard( id, options ); return createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration ); }, /** * * @summary List all cards * @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 listCards( pageBefore?: string, pageAfter?: string, pageSize?: number, options?: AxiosRequestConfig ): Promise< ( axios?: AxiosInstance, basePath?: string ) => AxiosPromise<ListCardsResponse> > { const localVarAxiosArgs = await localVarAxiosParamCreator.listCards( pageBefore, pageAfter, pageSize, options ); return createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration ); }, /** * * @summary Update a card * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {CardUpdate} [cardUpdate] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateCard( id: string, cardUpdate?: CardUpdate, options?: AxiosRequestConfig ): Promise< ( axios?: AxiosInstance, basePath?: string ) => AxiosPromise<UpdateCardResponse> > { const localVarAxiosArgs = await localVarAxiosParamCreator.updateCard( id, cardUpdate, options ); return createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration ); } }; }; /** * CardsApi - factory interface * @export */ export const CardsApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance ) { const localVarFp = CardsApiFp(configuration); return { /** * * @summary Create a card * @param {CardCreationRequest} [cardCreationRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} */ createCard( cardCreationRequest?: CardCreationRequest, options?: any ): AxiosPromise<CreateCardResponse> { return localVarFp .createCard(cardCreationRequest, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get a card * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getCard(id: string, options?: any): AxiosPromise<GetCardResponse> { return localVarFp .getCard(id, options) .then((request) => request(axios, basePath)); }, /** * * @summary List all cards * @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} */ listCards( pageBefore?: string, pageAfter?: string, pageSize?: number, options?: any ): AxiosPromise<ListCardsResponse> { return localVarFp .listCards(pageBefore, pageAfter, pageSize, options) .then((request) => request(axios, basePath)); }, /** * * @summary Update a card * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {CardUpdate} [cardUpdate] * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateCard( id: string, cardUpdate?: CardUpdate, options?: any ): AxiosPromise<UpdateCardResponse> { return localVarFp .updateCard(id, cardUpdate, options) .then((request) => request(axios, basePath)); } }; }; /** * CardsApi - object-oriented interface * @export * @class CardsApi * @extends {BaseAPI} */ export class CardsApi extends BaseAPI { /** * * @summary Create a card * @param {CardCreationRequest} [cardCreationRequest] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CardsApi */ public createCard( cardCreationRequest?: CardCreationRequest, options?: AxiosRequestConfig ) { return CardsApiFp(this.configuration) .createCard(cardCreationRequest, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get a card * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CardsApi */ public getCard(id: string, options?: AxiosRequestConfig) { return CardsApiFp(this.configuration) .getCard(id, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary List all cards * @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 CardsApi */ public listCards( pageBefore?: string, pageAfter?: string, pageSize?: number, options?: AxiosRequestConfig ) { return CardsApiFp(this.configuration) .listCards(pageBefore, pageAfter, pageSize, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Update a card * @param {string} id Universally unique identifier (UUID v4) of a resource. * @param {CardUpdate} [cardUpdate] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CardsApi */ public updateCard( id: string, cardUpdate?: CardUpdate, options?: AxiosRequestConfig ) { return CardsApiFp(this.configuration) .updateCard(id, cardUpdate, options) .then((request) => request(this.axios, this.basePath)); } }