// tslint:disable
// @ts-nocheck
/**
 * Custom Address
 * Service responsible for saving custom address that are not presented in FIAS database
 *
 * The version of the OpenAPI document: 1.2.7-SNAPSHOT (195)
 * Contact: akurako@inpromconsult.ru
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */


import * as globalImportUrl from 'url';
import { Configuration } from './configuration';
import globalAxios, { AxiosPromise, AxiosInstance } from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, RequestArgs, BaseAPI, RequiredError } from './base';

/**
 *
 * @export
 * @enum {string}
 */
export enum AddressLevel {
    REGION = 'REGION',
    DISTRICT = 'DISTRICT',
    CITY = 'CITY',
    SETTLEMENT = 'SETTLEMENT',
    LOCALITY = 'LOCALITY',
    STREET = 'STREET',
    UNKNOWN = 'UNKNOWN'
}

/**
 *
 * @export
 * @interface AddressPartTO
 */
export interface AddressPartTO {
    /**
     *
     * @type {string}
     * @memberof AddressPartTO
     */
    id?: string;
    /**
     *
     * @type {string}
     * @memberof AddressPartTO
     */
    name?: string;
    /**
     *
     * @type {string}
     * @memberof AddressPartTO
     */
    type?: string;
}
/**
 * Beta API model
 * @export
 * @interface AddressTO
 */
export interface AddressTO {
    /**
     *
     * @type {string}
     * @memberof AddressTO
     */
    id?: string;
    /**
     *
     * @type {string}
     * @memberof AddressTO
     */
    parent?: string;
    /**
     *
     * @type {string}
     * @memberof AddressTO
     */
    fullname?: string;
    /**
     *
     * @type {string}
     * @memberof AddressTO
     */
    name?: string;
    /**
     *
     * @type {AddressLevel}
     * @memberof AddressTO
     */
    level?: AddressLevel;
    /**
     *
     * @type {string}
     * @memberof AddressTO
     */
    postal?: string;
    /**
     *
     * @type {string}
     * @memberof AddressTO
     */
    plaincode?: string;
    /**
     *
     * @type {AddressType}
     * @memberof AddressTO
     */
    type?: AddressType;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTO
     */
    region?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTO
     */
    district?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTO
     */
    settlement?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTO
     */
    locality?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTO
     */
    city?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTO
     */
    street?: AddressPartTO;
    /**
     *
     * @type {SteadTO}
     * @memberof AddressTO
     */
    stead?: SteadTO;
    /**
     *
     * @type {HouseTO}
     * @memberof AddressTO
     */
    house?: HouseTO;
    /**
     *
     * @type {RoomTO}
     * @memberof AddressTO
     */
    room?: RoomTO;
    /**
     *
     * @type {SysInfoTO}
     * @memberof AddressTO
     */
    info?: SysInfoTO;
}
/**
 *
 * @export
 * @interface AddressTOAllOf
 */
export interface AddressTOAllOf {
    /**
     *
     * @type {string}
     * @memberof AddressTOAllOf
     */
    parent?: string;
    /**
     *
     * @type {string}
     * @memberof AddressTOAllOf
     */
    fullname?: string;
    /**
     *
     * @type {string}
     * @memberof AddressTOAllOf
     */
    name?: string;
    /**
     *
     * @type {AddressLevel}
     * @memberof AddressTOAllOf
     */
    level?: AddressLevel;
    /**
     *
     * @type {string}
     * @memberof AddressTOAllOf
     */
    postal?: string;
    /**
     *
     * @type {string}
     * @memberof AddressTOAllOf
     */
    plaincode?: string;
    /**
     *
     * @type {AddressType}
     * @memberof AddressTOAllOf
     */
    type?: AddressType;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTOAllOf
     */
    region?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTOAllOf
     */
    district?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTOAllOf
     */
    settlement?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTOAllOf
     */
    locality?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTOAllOf
     */
    city?: AddressPartTO;
    /**
     *
     * @type {AddressPartTO}
     * @memberof AddressTOAllOf
     */
    street?: AddressPartTO;
    /**
     *
     * @type {SteadTO}
     * @memberof AddressTOAllOf
     */
    stead?: SteadTO;
    /**
     *
     * @type {HouseTO}
     * @memberof AddressTOAllOf
     */
    house?: HouseTO;
    /**
     *
     * @type {RoomTO}
     * @memberof AddressTOAllOf
     */
    room?: RoomTO;
    /**
     *
     * @type {SysInfoTO}
     * @memberof AddressTOAllOf
     */
    info?: SysInfoTO;
}
/**
 *
 * @export
 * @enum {string}
 */
export enum AddressType {
    ADDRESS = 'ADDRESS',
    HOUSE = 'HOUSE',
    ROOM = 'ROOM',
    STEAD = 'STEAD'
}

/**
 *
 * @export
 * @interface BaseModel
 */
export interface BaseModel {
    /**
     *
     * @type {string}
     * @memberof BaseModel
     */
    id?: string;
}
/**
 *
 * @export
 * @enum {string}
 */
export enum DeprecatedAddressType {
    ADDRESSOBJECT = 'ADDRESS_OBJECT',
    HOUSE = 'HOUSE',
    STEAD = 'STEAD',
    ROOM = 'ROOM'
}

/**
 *
 * @export
 * @interface DeprecatedBaseAddress
 */
export interface DeprecatedBaseAddress {
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    id?: string;
    /**
     *
     * @type {DeprecatedAddressType}
     * @memberof DeprecatedBaseAddress
     */
    type: DeprecatedAddressType;
    /**
     *
     * @type {SysInfoTO}
     * @memberof DeprecatedBaseAddress
     */
    sysInfo: SysInfoTO;
    /**
     *
     * @type {DeprecatedFiasTO}
     * @memberof DeprecatedBaseAddress
     */
    fias: DeprecatedFiasTO;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    region?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    district?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    city?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    settlement?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    locality?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    street?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    postalCode?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddress
     */
    plainCode?: string;
}
/**
 *
 * @export
 * @interface DeprecatedBaseAddressAllOf
 */
export interface DeprecatedBaseAddressAllOf {
    /**
     *
     * @type {DeprecatedAddressType}
     * @memberof DeprecatedBaseAddressAllOf
     */
    type: DeprecatedAddressType;
    /**
     *
     * @type {SysInfoTO}
     * @memberof DeprecatedBaseAddressAllOf
     */
    sysInfo: SysInfoTO;
    /**
     *
     * @type {DeprecatedFiasTO}
     * @memberof DeprecatedBaseAddressAllOf
     */
    fias: DeprecatedFiasTO;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddressAllOf
     */
    region?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddressAllOf
     */
    district?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddressAllOf
     */
    city?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddressAllOf
     */
    settlement?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddressAllOf
     */
    locality?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddressAllOf
     */
    street?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddressAllOf
     */
    postalCode?: string;
    /**
     *
     * @type {string}
     * @memberof DeprecatedBaseAddressAllOf
     */
    plainCode?: string;
}
/**
 *
 * @export
 * @interface DeprecatedFiasTO
 */
export interface DeprecatedFiasTO {
    /**
     *
     * @type {string}
     * @memberof DeprecatedFiasTO
     */
    guid: string;
    /**
     *
     * @type {DeprecatedFiasType}
     * @memberof DeprecatedFiasTO
     */
    type: DeprecatedFiasType;
}
/**
 *
 * @export
 * @enum {string}
 */
export enum DeprecatedFiasType {
    ADDRESSOBJECT = 'ADDRESS_OBJECT',
    HOUSE = 'HOUSE'
}

/**
 *
 * @export
 * @interface HouseTO
 */
export interface HouseTO {
    /**
     *
     * @type {string}
     * @memberof HouseTO
     */
    id?: string;
    /**
     *
     * @type {string}
     * @memberof HouseTO
     */
    number?: string;
    /**
     *
     * @type {string}
     * @memberof HouseTO
     */
    block?: string;
    /**
     *
     * @type {string}
     * @memberof HouseTO
     */
    structure?: string;
    /**
     *
     * @type {string}
     * @memberof HouseTO
     */
    parent?: string;
    /**
     *
     * @type {string}
     * @memberof HouseTO
     */
    cadastral?: string;
}
/**
 *
 * @export
 * @interface Response
 */
export interface Response {
    /**
     *
     * @type {boolean}
     * @memberof Response
     */
    success?: boolean;
    /**
     *
     * @type {string}
     * @memberof Response
     */
    message?: string;
    /**
     *
     * @type {string}
     * @memberof Response
     */
    modelId?: string;
}
/**
 *
 * @export
 * @interface RoomTO
 */
export interface RoomTO {
    /**
     *
     * @type {string}
     * @memberof RoomTO
     */
    id?: string;
    /**
     *
     * @type {string}
     * @memberof RoomTO
     */
    flat?: string;
    /**
     *
     * @type {string}
     * @memberof RoomTO
     */
    room?: string;
    /**
     *
     * @type {string}
     * @memberof RoomTO
     */
    parent?: string;
    /**
     *
     * @type {string}
     * @memberof RoomTO
     */
    flatCadastral?: string;
    /**
     *
     * @type {string}
     * @memberof RoomTO
     */
    roomCadastral?: string;
    /**
     *
     * @type {string}
     * @memberof RoomTO
     */
    postal?: string;
}
/**
 *
 * @export
 * @interface SteadTO
 */
export interface SteadTO {
    /**
     *
     * @type {string}
     * @memberof SteadTO
     */
    id?: string;
    /**
     *
     * @type {string}
     * @memberof SteadTO
     */
    number?: string;
    /**
     *
     * @type {string}
     * @memberof SteadTO
     */
    parent?: string;
    /**
     *
     * @type {string}
     * @memberof SteadTO
     */
    cadastral?: string;
}
/**
 *
 * @export
 * @interface SysInfoTO
 */
export interface SysInfoTO {
    /**
     *
     * @type {string}
     * @memberof SysInfoTO
     */
    serviceCode: string;
    /**
     *
     * @type {string}
     * @memberof SysInfoTO
     */
    ownerId?: string;
}

/**
 * APIV1DeprecatedApi - axios parameter creator
 * @export
 */
export const APIV1DeprecatedApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Удаляет объект адреса по его ID
         * @summary Удаляет объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAddress: async (id: string, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            if (id === null || id === undefined) {
                throw new RequiredError('id','Required parameter id was null or undefined when calling deleteAddress.');
            }
            const localVarPath = `/custom/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication addressAuth required
            // http bearer authentication required
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? configuration.accessToken()
                    : configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
            }



            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Возвращает объект адреса по его ID
         * @summary Возвращает объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAddress: async (id: string, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            if (id === null || id === undefined) {
                throw new RequiredError('id','Required parameter id was null or undefined when calling getAddress.');
            }
            const localVarPath = `/custom/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication addressAuth required
            // http bearer authentication required
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? configuration.accessToken()
                    : configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
            }



            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Создает новый объект адреса или обновляет если адрес с таким ID уже существует
         * @summary Создает или обновляет объект адреса
         * @param {DeprecatedBaseAddress} deprecatedBaseAddress Объект BaseAddress для сохранения
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAddress: async (deprecatedBaseAddress: DeprecatedBaseAddress, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'deprecatedBaseAddress' is not null or undefined
            if (deprecatedBaseAddress === null || deprecatedBaseAddress === undefined) {
                throw new RequiredError('deprecatedBaseAddress','Required parameter deprecatedBaseAddress was null or undefined when calling updateAddress.');
            }
            const localVarPath = `/custom`;
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication addressAuth required
            // http bearer authentication required
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? configuration.accessToken()
                    : configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
            }



            localVarHeaderParameter['Content-Type'] = 'application/json';

            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            const needsSerialization = (typeof deprecatedBaseAddress !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(deprecatedBaseAddress !== undefined ? deprecatedBaseAddress : {}) : (deprecatedBaseAddress || "");

            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * APIV1DeprecatedApi - functional programming interface
 * @export
 */
export const APIV1DeprecatedApiFp = function(configuration?: Configuration) {
    return {
        /**
         * Удаляет объект адреса по его ID
         * @summary Удаляет объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteAddress(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response>> {
            const localVarAxiosArgs = await APIV1DeprecatedApiAxiosParamCreator(configuration).deleteAddress(id, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         * Возвращает объект адреса по его ID
         * @summary Возвращает объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAddress(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<DeprecatedBaseAddress>> {
            const localVarAxiosArgs = await APIV1DeprecatedApiAxiosParamCreator(configuration).getAddress(id, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         * Создает новый объект адреса или обновляет если адрес с таким ID уже существует
         * @summary Создает или обновляет объект адреса
         * @param {DeprecatedBaseAddress} deprecatedBaseAddress Объект BaseAddress для сохранения
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async updateAddress(deprecatedBaseAddress: DeprecatedBaseAddress, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response>> {
            const localVarAxiosArgs = await APIV1DeprecatedApiAxiosParamCreator(configuration).updateAddress(deprecatedBaseAddress, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
    }
};

/**
 * APIV1DeprecatedApi - factory interface
 * @export
 */
export const APIV1DeprecatedApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    return {
        /**
         * Удаляет объект адреса по его ID
         * @summary Удаляет объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAddress(id: string, options?: any): AxiosPromise<Response> {
            return APIV1DeprecatedApiFp(configuration).deleteAddress(id, options).then((request) => request(axios, basePath));
        },
        /**
         * Возвращает объект адреса по его ID
         * @summary Возвращает объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAddress(id: string, options?: any): AxiosPromise<DeprecatedBaseAddress> {
            return APIV1DeprecatedApiFp(configuration).getAddress(id, options).then((request) => request(axios, basePath));
        },
        /**
         * Создает новый объект адреса или обновляет если адрес с таким ID уже существует
         * @summary Создает или обновляет объект адреса
         * @param {DeprecatedBaseAddress} deprecatedBaseAddress Объект BaseAddress для сохранения
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        updateAddress(deprecatedBaseAddress: DeprecatedBaseAddress, options?: any): AxiosPromise<Response> {
            return APIV1DeprecatedApiFp(configuration).updateAddress(deprecatedBaseAddress, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * APIV1DeprecatedApi - object-oriented interface
 * @export
 * @class APIV1DeprecatedApi
 * @extends {BaseAPI}
 */
export class APIV1DeprecatedApi extends BaseAPI {
    /**
     * Удаляет объект адреса по его ID
     * @summary Удаляет объект адреса
     * @param {string} id
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof APIV1DeprecatedApi
     */
    public deleteAddress(id: string, options?: any) {
        return APIV1DeprecatedApiFp(this.configuration).deleteAddress(id, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Возвращает объект адреса по его ID
     * @summary Возвращает объект адреса
     * @param {string} id
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof APIV1DeprecatedApi
     */
    public getAddress(id: string, options?: any) {
        return APIV1DeprecatedApiFp(this.configuration).getAddress(id, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Создает новый объект адреса или обновляет если адрес с таким ID уже существует
     * @summary Создает или обновляет объект адреса
     * @param {DeprecatedBaseAddress} deprecatedBaseAddress Объект BaseAddress для сохранения
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof APIV1DeprecatedApi
     */
    public updateAddress(deprecatedBaseAddress: DeprecatedBaseAddress, options?: any) {
        return APIV1DeprecatedApiFp(this.configuration).updateAddress(deprecatedBaseAddress, options).then((request) => request(this.axios, this.basePath));
    }

}


/**
 * APIV2Api - axios parameter creator
 * @export
 */
export const APIV2ApiAxiosParamCreator = function (configuration?: Configuration) {
    return {
        /**
         * Создает новый объект адреса или обновляет если адресс с таким ID уже существует
         * @summary Создает или обновляет объект адреса
         * @param {AddressTO} addressTO Объект BaseAddress для сохранения
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAddress: async (addressTO: AddressTO, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'addressTO' is not null or undefined
            if (addressTO === null || addressTO === undefined) {
                throw new RequiredError('addressTO','Required parameter addressTO was null or undefined when calling createAddress.');
            }
            const localVarPath = `/v2`;
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication addressAuth required
            // http bearer authentication required
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? configuration.accessToken()
                    : configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
            }



            localVarHeaderParameter['Content-Type'] = 'application/json';

            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
            const needsSerialization = (typeof addressTO !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json';
            localVarRequestOptions.data =  needsSerialization ? JSON.stringify(addressTO !== undefined ? addressTO : {}) : (addressTO || "");

            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Удаляет объект адреса по его ID
         * @summary Удаляет объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAddress: async (id: string, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            if (id === null || id === undefined) {
                throw new RequiredError('id','Required parameter id was null or undefined when calling deleteAddress.');
            }
            const localVarPath = `/v2/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication addressAuth required
            // http bearer authentication required
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? configuration.accessToken()
                    : configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
            }



            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
        /**
         * Возвращает объект адреса по его ID
         * @summary Возвращает объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAddress: async (id: string, options: any = {}): Promise<RequestArgs> => {
            // verify required parameter 'id' is not null or undefined
            if (id === null || id === undefined) {
                throw new RequiredError('id','Required parameter id was null or undefined when calling getAddress.');
            }
            const localVarPath = `/v2/{id}`
                .replace(`{${"id"}}`, encodeURIComponent(String(id)));
            const localVarUrlObj = globalImportUrl.parse(localVarPath, true);
            let baseOptions;
            if (configuration) {
                baseOptions = configuration.baseOptions;
            }
            const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
            const localVarHeaderParameter = {} as any;
            const localVarQueryParameter = {} as any;

            // authentication addressAuth required
            // http bearer authentication required
            if (configuration && configuration.accessToken) {
                const accessToken = typeof configuration.accessToken === 'function'
                    ? configuration.accessToken()
                    : configuration.accessToken;
                localVarHeaderParameter["Authorization"] = "Bearer " + accessToken;
            }



            localVarUrlObj.query = {...localVarUrlObj.query, ...localVarQueryParameter, ...options.query};
            // fix override query string Detail: https://stackoverflow.com/a/7517673/1077943
            delete localVarUrlObj.search;
            let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
            localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};

            return {
                url: globalImportUrl.format(localVarUrlObj),
                options: localVarRequestOptions,
            };
        },
    }
};

/**
 * APIV2Api - functional programming interface
 * @export
 */
export const APIV2ApiFp = function(configuration?: Configuration) {
    return {
        /**
         * Создает новый объект адреса или обновляет если адресс с таким ID уже существует
         * @summary Создает или обновляет объект адреса
         * @param {AddressTO} addressTO Объект BaseAddress для сохранения
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async createAddress(addressTO: AddressTO, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response>> {
            const localVarAxiosArgs = await APIV2ApiAxiosParamCreator(configuration).createAddress(addressTO, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         * Удаляет объект адреса по его ID
         * @summary Удаляет объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async deleteAddress(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Response>> {
            const localVarAxiosArgs = await APIV2ApiAxiosParamCreator(configuration).deleteAddress(id, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
        /**
         * Возвращает объект адреса по его ID
         * @summary Возвращает объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        async getAddress(id: string, options?: any): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<AddressTO>> {
            const localVarAxiosArgs = await APIV2ApiAxiosParamCreator(configuration).getAddress(id, options);
            return (axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => {
                const axiosRequestArgs = {...localVarAxiosArgs.options, url: basePath + localVarAxiosArgs.url};
                return axios.request(axiosRequestArgs);
            };
        },
    }
};

/**
 * APIV2Api - factory interface
 * @export
 */
export const APIV2ApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
    return {
        /**
         * Создает новый объект адреса или обновляет если адресс с таким ID уже существует
         * @summary Создает или обновляет объект адреса
         * @param {AddressTO} addressTO Объект BaseAddress для сохранения
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        createAddress(addressTO: AddressTO, options?: any): AxiosPromise<Response> {
            return APIV2ApiFp(configuration).createAddress(addressTO, options).then((request) => request(axios, basePath));
        },
        /**
         * Удаляет объект адреса по его ID
         * @summary Удаляет объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        deleteAddress(id: string, options?: any): AxiosPromise<Response> {
            return APIV2ApiFp(configuration).deleteAddress(id, options).then((request) => request(axios, basePath));
        },
        /**
         * Возвращает объект адреса по его ID
         * @summary Возвращает объект адреса
         * @param {string} id
         * @param {*} [options] Override http request option.
         * @throws {RequiredError}
         */
        getAddress(id: string, options?: any): AxiosPromise<AddressTO> {
            return APIV2ApiFp(configuration).getAddress(id, options).then((request) => request(axios, basePath));
        },
    };
};

/**
 * APIV2Api - object-oriented interface
 * @export
 * @class APIV2Api
 * @extends {BaseAPI}
 */
export class APIV2Api extends BaseAPI {
    /**
     * Создает новый объект адреса или обновляет если адресс с таким ID уже существует
     * @summary Создает или обновляет объект адреса
     * @param {AddressTO} addressTO Объект BaseAddress для сохранения
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof APIV2Api
     */
    public createAddress(addressTO: AddressTO, options?: any) {
        return APIV2ApiFp(this.configuration).createAddress(addressTO, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Удаляет объект адреса по его ID
     * @summary Удаляет объект адреса
     * @param {string} id
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof APIV2Api
     */
    public deleteAddress(id: string, options?: any) {
        return APIV2ApiFp(this.configuration).deleteAddress(id, options).then((request) => request(this.axios, this.basePath));
    }

    /**
     * Возвращает объект адреса по его ID
     * @summary Возвращает объект адреса
     * @param {string} id
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     * @memberof APIV2Api
     */
    public getAddress(id: string, options?: any) {
        return APIV2ApiFp(this.configuration).getAddress(id, options).then((request) => request(this.axios, this.basePath));
    }

}


