/* tslint:disable */ /* eslint-disable */ /** * Credify API doc version 2 * API documentations version 2. * * 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 { GetRegionList200Response } from '../model'; /** * CommonApi - axios parameter creator * @export */ export const CommonApiAxiosParamCreator = function (configuration?: Configuration) { return { /** * This returns localities of a locality in a country based region ID and country code. * @summary Fetch localities * @param {string} countryCode * @param {number} regionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLocalityList: async (countryCode: string, regionId: number, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'countryCode' is not null or undefined assertParamExists('getLocalityList', 'countryCode', countryCode) // verify required parameter 'regionId' is not null or undefined assertParamExists('getLocalityList', 'regionId', regionId) const localVarPath = `/v2/public/address/countries/{country_code}/regions/{region_id}/localities`; // 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 (countryCode !== undefined) { localVarQueryParameter['country_code'] = countryCode; } if (regionId !== undefined) { localVarQueryParameter['region_id'] = regionId; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This returns regions of a country based on country code. * @summary Fetch regions * @param {string} countryCode * @param {*} [options] Override http request option. * @throws {RequiredError} */ getRegionList: async (countryCode: string, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'countryCode' is not null or undefined assertParamExists('getRegionList', 'countryCode', countryCode) const localVarPath = `/v2/public/address/countries/{country_code}/regions`; // 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 (countryCode !== undefined) { localVarQueryParameter['country_code'] = countryCode; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * This returns sublocalities of a region in a country based on locality ID, region ID and country code. * @summary Fetch sublocalities * @param {string} countryCode * @param {number} regionId * @param {number} localityId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getSublocalityList: async (countryCode: string, regionId: number, localityId: number, options: AxiosRequestConfig = {}): Promise => { // verify required parameter 'countryCode' is not null or undefined assertParamExists('getSublocalityList', 'countryCode', countryCode) // verify required parameter 'regionId' is not null or undefined assertParamExists('getSublocalityList', 'regionId', regionId) // verify required parameter 'localityId' is not null or undefined assertParamExists('getSublocalityList', 'localityId', localityId) const localVarPath = `/v2/public/address/countries/{country_code}/regions/{region_id}/localities/{locality_id}/sublocalities`; // 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 (countryCode !== undefined) { localVarQueryParameter['country_code'] = countryCode; } if (regionId !== undefined) { localVarQueryParameter['region_id'] = regionId; } if (localityId !== undefined) { localVarQueryParameter['locality_id'] = localityId; } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, } }; /** * CommonApi - functional programming interface * @export */ export const CommonApiFp = function(configuration?: Configuration) { const localVarAxiosParamCreator = CommonApiAxiosParamCreator(configuration) return { /** * This returns localities of a locality in a country based region ID and country code. * @summary Fetch localities * @param {string} countryCode * @param {number} regionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getLocalityList(countryCode: string, regionId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getLocalityList(countryCode, regionId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This returns regions of a country based on country code. * @summary Fetch regions * @param {string} countryCode * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getRegionList(countryCode: string, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getRegionList(countryCode, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, /** * This returns sublocalities of a region in a country based on locality ID, region ID and country code. * @summary Fetch sublocalities * @param {string} countryCode * @param {number} regionId * @param {number} localityId * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getSublocalityList(countryCode: string, regionId: number, localityId: number, options?: AxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { const localVarAxiosArgs = await localVarAxiosParamCreator.getSublocalityList(countryCode, regionId, localityId, options); return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration); }, } }; /** * CommonApi - factory interface * @export */ export const CommonApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { const localVarFp = CommonApiFp(configuration) return { /** * This returns localities of a locality in a country based region ID and country code. * @summary Fetch localities * @param {string} countryCode * @param {number} regionId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getLocalityList(countryCode: string, regionId: number, options?: any): AxiosPromise { return localVarFp.getLocalityList(countryCode, regionId, options).then((request) => request(axios, basePath)); }, /** * This returns regions of a country based on country code. * @summary Fetch regions * @param {string} countryCode * @param {*} [options] Override http request option. * @throws {RequiredError} */ getRegionList(countryCode: string, options?: any): AxiosPromise { return localVarFp.getRegionList(countryCode, options).then((request) => request(axios, basePath)); }, /** * This returns sublocalities of a region in a country based on locality ID, region ID and country code. * @summary Fetch sublocalities * @param {string} countryCode * @param {number} regionId * @param {number} localityId * @param {*} [options] Override http request option. * @throws {RequiredError} */ getSublocalityList(countryCode: string, regionId: number, localityId: number, options?: any): AxiosPromise { return localVarFp.getSublocalityList(countryCode, regionId, localityId, options).then((request) => request(axios, basePath)); }, }; }; /** * CommonApi - interface * @export * @interface CommonApi */ export interface CommonApiInterface { /** * This returns localities of a locality in a country based region ID and country code. * @summary Fetch localities * @param {string} countryCode * @param {number} regionId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApiInterface */ getLocalityList(countryCode: string, regionId: number, options?: AxiosRequestConfig): AxiosPromise; /** * This returns regions of a country based on country code. * @summary Fetch regions * @param {string} countryCode * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApiInterface */ getRegionList(countryCode: string, options?: AxiosRequestConfig): AxiosPromise; /** * This returns sublocalities of a region in a country based on locality ID, region ID and country code. * @summary Fetch sublocalities * @param {string} countryCode * @param {number} regionId * @param {number} localityId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApiInterface */ getSublocalityList(countryCode: string, regionId: number, localityId: number, options?: AxiosRequestConfig): AxiosPromise; } /** * CommonApi - object-oriented interface * @export * @class CommonApi * @extends {BaseAPI} */ export class CommonApi extends BaseAPI implements CommonApiInterface { /** * This returns localities of a locality in a country based region ID and country code. * @summary Fetch localities * @param {string} countryCode * @param {number} regionId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApi */ public getLocalityList(countryCode: string, regionId: number, options?: AxiosRequestConfig) { return CommonApiFp(this.configuration).getLocalityList(countryCode, regionId, options).then((request) => request(this.axios, this.basePath)); } /** * This returns regions of a country based on country code. * @summary Fetch regions * @param {string} countryCode * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApi */ public getRegionList(countryCode: string, options?: AxiosRequestConfig) { return CommonApiFp(this.configuration).getRegionList(countryCode, options).then((request) => request(this.axios, this.basePath)); } /** * This returns sublocalities of a region in a country based on locality ID, region ID and country code. * @summary Fetch sublocalities * @param {string} countryCode * @param {number} regionId * @param {number} localityId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof CommonApi */ public getSublocalityList(countryCode: string, regionId: number, localityId: number, options?: AxiosRequestConfig) { return CommonApiFp(this.configuration).getSublocalityList(countryCode, regionId, localityId, options).then((request) => request(this.axios, this.basePath)); } }