/* tslint:disable */ /* eslint-disable */ /** * Credify API doc version 1 * API documentations version 1. * * The version of the OpenAPI document: 1.0.0-oas3 * Contact: dev@credify.one * * 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, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from '../base'; // @ts-ignore import { CommonResponse } from '../model'; // @ts-ignore import { ProductCreateRequest } from '../model'; // @ts-ignore import { ProductResponse } from '../model'; // @ts-ignore import { ProductTypesListResponse } from '../model'; // @ts-ignore import { ProductUpdateRequest } from '../model'; // @ts-ignore import { ProductsListResponse } from '../model'; /** * ProductsApi - axios parameter creator * @export */ export const ProductsApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * This retrieves products list provided by this calling organization. * @summary Products list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getProductList: async (page?: number, limit?: number, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/v1/products`; // 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 (page !== undefined) { localVarQueryParameter['page'] = page; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This retrieves product types list * @summary Product types list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getProductTypeList: async (page?: number, limit?: number, options: AxiosRequestConfig = {}): Promise => { const localVarPath = `/v1/product-types`; // 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 (page !== undefined) { localVarQueryParameter['page'] = page; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This registers a new product * @summary Register Product * @param {ProductCreateRequest} productCreateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ registerProduct: async (productCreateRequest: ProductCreateRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'productCreateRequest' is not null or undefined assertParamExists('registerProduct', 'productCreateRequest', productCreateRequest) const localVarPath = `/v1/products`; // 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 = productCreateRequest return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This operation deletes a specified product. If there is any campaign using this specified product, this request will return an error. * @summary Removes a specified product * @param {string} code Product Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ removeProduct: async (code: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'code' is not null or undefined assertParamExists('removeProduct', 'code', code) const localVarPath = `/v1/products/{code}` .replace(`{${"code"}}`, encodeURIComponent(String(code))); // 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 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, }; }, /** * This operation updates a specified product. If there is any campaign using this product, this API will return an error. Although this API allows change about display name, the `code` will not be updated. * @summary Updates a product * @param {string} code Product Code * @param {ProductUpdateRequest} productUpdateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateProduct: async (code: string, productUpdateRequest: ProductUpdateRequest, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'code' is not null or undefined assertParamExists('updateProduct', 'code', code) // verify required parameter 'productUpdateRequest' is not null or undefined assertParamExists('updateProduct', 'productUpdateRequest', productUpdateRequest) const localVarPath = `/v1/products/{code}` .replace(`{${"code"}}`, encodeURIComponent(String(code))); // 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 = productUpdateRequest return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * ProductsApi - functional programming interface * @export */ export const ProductsApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = ProductsApiAxiosParamCreator(configuration) return { /** * This retrieves products list provided by this calling organization. * @summary Products list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getProductList(page?: number, limit?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getProductList(page, limit, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This retrieves product types list * @summary Product types list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getProductTypeList(page?: number, limit?: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getProductTypeList(page, limit, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This registers a new product * @summary Register Product * @param {ProductCreateRequest} productCreateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async registerProduct(productCreateRequest: ProductCreateRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.registerProduct(productCreateRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This operation deletes a specified product. If there is any campaign using this specified product, this request will return an error. * @summary Removes a specified product * @param {string} code Product Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ async removeProduct(code: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.removeProduct(code, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This operation updates a specified product. If there is any campaign using this product, this API will return an error. Although this API allows change about display name, the `code` will not be updated. * @summary Updates a product * @param {string} code Product Code * @param {ProductUpdateRequest} productUpdateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ async updateProduct(code: string, productUpdateRequest: ProductUpdateRequest, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.updateProduct(code, productUpdateRequest, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * ProductsApi - factory interface * @export */ export const ProductsApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = ProductsApiFp(configuration) return { /** * This retrieves products list provided by this calling organization. * @summary Products list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getProductList(page?: number, limit?: number, options?: any): AxiosPromise { return localVarFp.getProductList(page, limit, options).then((request) => request(axios, basePath)); }, /** * This retrieves product types list * @summary Product types list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getProductTypeList(page?: number, limit?: number, options?: any): AxiosPromise { return localVarFp.getProductTypeList(page, limit, options).then((request) => request(axios, basePath)); }, /** * This registers a new product * @summary Register Product * @param {ProductCreateRequest} productCreateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ registerProduct(productCreateRequest: ProductCreateRequest, options?: any): AxiosPromise { return localVarFp.registerProduct(productCreateRequest, options).then((request) => request(axios, basePath)); }, /** * This operation deletes a specified product. If there is any campaign using this specified product, this request will return an error. * @summary Removes a specified product * @param {string} code Product Code * @param {*} [options] Override http request option. * @throws {RequiredError} */ removeProduct(code: string, options?: any): AxiosPromise { return localVarFp.removeProduct(code, options).then((request) => request(axios, basePath)); }, /** * This operation updates a specified product. If there is any campaign using this product, this API will return an error. Although this API allows change about display name, the `code` will not be updated. * @summary Updates a product * @param {string} code Product Code * @param {ProductUpdateRequest} productUpdateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} */ updateProduct(code: string, productUpdateRequest: ProductUpdateRequest, options?: any): AxiosPromise { return localVarFp.updateProduct(code, productUpdateRequest, options).then((request) => request(axios, basePath)); }, }; }; /** * ProductsApi - interface * @export * @interface ProductsApi */ export interface ProductsApiInterface { /** * This retrieves products list provided by this calling organization. * @summary Products list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApiInterface */ getProductList(page?: number, limit?: number, options?: AxiosRequestConfig): AxiosPromise; /** * This retrieves product types list * @summary Product types list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApiInterface */ getProductTypeList(page?: number, limit?: number, options?: AxiosRequestConfig): AxiosPromise; /** * This registers a new product * @summary Register Product * @param {ProductCreateRequest} productCreateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApiInterface */ registerProduct(productCreateRequest: ProductCreateRequest, options?: AxiosRequestConfig): AxiosPromise; /** * This operation deletes a specified product. If there is any campaign using this specified product, this request will return an error. * @summary Removes a specified product * @param {string} code Product Code * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApiInterface */ removeProduct(code: string, options?: AxiosRequestConfig): AxiosPromise; /** * This operation updates a specified product. If there is any campaign using this product, this API will return an error. Although this API allows change about display name, the `code` will not be updated. * @summary Updates a product * @param {string} code Product Code * @param {ProductUpdateRequest} productUpdateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApiInterface */ updateProduct(code: string, productUpdateRequest: ProductUpdateRequest, options?: AxiosRequestConfig): AxiosPromise; } /** * ProductsApi - object-oriented interface * @export * @class ProductsApi * @extends {BaseAPI} */ export class ProductsApi extends BaseAPI implements ProductsApiInterface { /** * This retrieves products list provided by this calling organization. * @summary Products list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApi */ public getProductList(page?: number, limit?: number, options?: AxiosRequestConfig) { return ProductsApiFp(this.configuration).getProductList(page, limit, options).then((request) => request(this.axios, this.basePath)); } /** * This retrieves product types list * @summary Product types list * @param {number} [page] * @param {number} [limit] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApi */ public getProductTypeList(page?: number, limit?: number, options?: AxiosRequestConfig) { return ProductsApiFp(this.configuration).getProductTypeList(page, limit, options).then((request) => request(this.axios, this.basePath)); } /** * This registers a new product * @summary Register Product * @param {ProductCreateRequest} productCreateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApi */ public registerProduct(productCreateRequest: ProductCreateRequest, options?: AxiosRequestConfig) { return ProductsApiFp(this.configuration).registerProduct(productCreateRequest, options).then((request) => request(this.axios, this.basePath)); } /** * This operation deletes a specified product. If there is any campaign using this specified product, this request will return an error. * @summary Removes a specified product * @param {string} code Product Code * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApi */ public removeProduct(code: string, options?: AxiosRequestConfig) { return ProductsApiFp(this.configuration).removeProduct(code, options).then((request) => request(this.axios, this.basePath)); } /** * This operation updates a specified product. If there is any campaign using this product, this API will return an error. Although this API allows change about display name, the `code` will not be updated. * @summary Updates a product * @param {string} code Product Code * @param {ProductUpdateRequest} productUpdateRequest * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof ProductsApi */ public updateProduct(code: string, productUpdateRequest: ProductUpdateRequest, options?: AxiosRequestConfig) { return ProductsApiFp(this.configuration).updateProduct(code, productUpdateRequest, options).then((request) => request(this.axios, this.basePath)); } }