/* tslint:disable */
/* eslint-disable */
/**
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document:
 *
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// 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,
  type RequestArgs,
  BaseAPI,
  RequiredError,
  operationServerMap
} from '../base';
// @ts-ignore
import type { KamiApiJdCookieV1CookieHistoryRes } from '../models';
// @ts-ignore
import type { KamiApiJdCookieV1OrderHistoryRes } from '../models';
/**
 * JDHistoryApi - axios parameter creator
 */
export const JDHistoryApiAxiosParamCreator = function (
  configuration?: Configuration
) {
  return {
    /**
     *
     * @summary Cookie Change History
     * @param {string} cookieId Cookie ID
     * @param {number} [page] 页码
     * @param {number} [size] 每页大小
     * @param {ApiJdCookieHistoryCookieGetChangeTypeEnum} [changeType] 变更类型筛选
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    apiJdCookieHistoryCookieGet: async (
      cookieId: string,
      page?: number,
      size?: number,
      changeType?: ApiJdCookieHistoryCookieGetChangeTypeEnum,
      options: RawAxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'cookieId' is not null or undefined
      assertParamExists('apiJdCookieHistoryCookieGet', 'cookieId', cookieId);
      const localVarPath = `/api/jd-cookie/history/cookie`;
      // 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;

      if (cookieId !== undefined) {
        localVarQueryParameter['cookieId'] = cookieId;
      }

      if (page !== undefined) {
        localVarQueryParameter['page'] = page;
      }

      if (size !== undefined) {
        localVarQueryParameter['size'] = size;
      }

      if (changeType !== undefined) {
        localVarQueryParameter['changeType'] = changeType;
      }

      setSearchParams(localVarUrlObj, localVarQueryParameter);
      let headersFromBaseOptions =
        baseOptions && baseOptions.headers ? baseOptions.headers : {};
      localVarRequestOptions.headers = {
        ...localVarHeaderParameter,
        ...headersFromBaseOptions,
        ...options.headers
      };

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions
      };
    },
    /**
     *
     * @summary Order Change History
     * @param {string} orderId 订单号
     * @param {number} [page] 页码
     * @param {number} [size] 每页大小
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    apiJdCookieHistoryOrderGet: async (
      orderId: string,
      page?: number,
      size?: number,
      options: RawAxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'orderId' is not null or undefined
      assertParamExists('apiJdCookieHistoryOrderGet', 'orderId', orderId);
      const localVarPath = `/api/jd-cookie/history/order`;
      // 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;

      if (orderId !== undefined) {
        localVarQueryParameter['orderId'] = orderId;
      }

      if (page !== undefined) {
        localVarQueryParameter['page'] = page;
      }

      if (size !== undefined) {
        localVarQueryParameter['size'] = size;
      }

      setSearchParams(localVarUrlObj, localVarQueryParameter);
      let headersFromBaseOptions =
        baseOptions && baseOptions.headers ? baseOptions.headers : {};
      localVarRequestOptions.headers = {
        ...localVarHeaderParameter,
        ...headersFromBaseOptions,
        ...options.headers
      };

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions
      };
    }
  };
};

/**
 * JDHistoryApi - functional programming interface
 */
export const JDHistoryApiFp = function (configuration?: Configuration) {
  const localVarAxiosParamCreator =
    JDHistoryApiAxiosParamCreator(configuration);
  return {
    /**
     *
     * @summary Cookie Change History
     * @param {string} cookieId Cookie ID
     * @param {number} [page] 页码
     * @param {number} [size] 每页大小
     * @param {ApiJdCookieHistoryCookieGetChangeTypeEnum} [changeType] 变更类型筛选
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async apiJdCookieHistoryCookieGet(
      cookieId: string,
      page?: number,
      size?: number,
      changeType?: ApiJdCookieHistoryCookieGetChangeTypeEnum,
      options?: RawAxiosRequestConfig
    ): Promise<
      (
        axios?: AxiosInstance,
        basePath?: string
      ) => AxiosPromise<KamiApiJdCookieV1CookieHistoryRes>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.apiJdCookieHistoryCookieGet(
          cookieId,
          page,
          size,
          changeType,
          options
        );
      const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
      const localVarOperationServerBasePath =
        operationServerMap['JDHistoryApi.apiJdCookieHistoryCookieGet']?.[
          localVarOperationServerIndex
        ]?.url;
      return (axios, basePath) =>
        createRequestFunction(
          localVarAxiosArgs,
          globalAxios,
          BASE_PATH,
          configuration
        )(axios, localVarOperationServerBasePath || basePath);
    },
    /**
     *
     * @summary Order Change History
     * @param {string} orderId 订单号
     * @param {number} [page] 页码
     * @param {number} [size] 每页大小
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async apiJdCookieHistoryOrderGet(
      orderId: string,
      page?: number,
      size?: number,
      options?: RawAxiosRequestConfig
    ): Promise<
      (
        axios?: AxiosInstance,
        basePath?: string
      ) => AxiosPromise<KamiApiJdCookieV1OrderHistoryRes>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.apiJdCookieHistoryOrderGet(
          orderId,
          page,
          size,
          options
        );
      const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
      const localVarOperationServerBasePath =
        operationServerMap['JDHistoryApi.apiJdCookieHistoryOrderGet']?.[
          localVarOperationServerIndex
        ]?.url;
      return (axios, basePath) =>
        createRequestFunction(
          localVarAxiosArgs,
          globalAxios,
          BASE_PATH,
          configuration
        )(axios, localVarOperationServerBasePath || basePath);
    }
  };
};

/**
 * JDHistoryApi - factory interface
 */
export const JDHistoryApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = JDHistoryApiFp(configuration);
  return {
    /**
     *
     * @summary Cookie Change History
     * @param {JDHistoryApiApiJdCookieHistoryCookieGetRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    apiJdCookieHistoryCookieGet(
      requestParameters: JDHistoryApiApiJdCookieHistoryCookieGetRequest,
      options?: RawAxiosRequestConfig
    ): AxiosPromise<KamiApiJdCookieV1CookieHistoryRes> {
      return localVarFp
        .apiJdCookieHistoryCookieGet(
          requestParameters.cookieId,
          requestParameters.page,
          requestParameters.size,
          requestParameters.changeType,
          options
        )
        .then(request => request(axios, basePath));
    },
    /**
     *
     * @summary Order Change History
     * @param {JDHistoryApiApiJdCookieHistoryOrderGetRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    apiJdCookieHistoryOrderGet(
      requestParameters: JDHistoryApiApiJdCookieHistoryOrderGetRequest,
      options?: RawAxiosRequestConfig
    ): AxiosPromise<KamiApiJdCookieV1OrderHistoryRes> {
      return localVarFp
        .apiJdCookieHistoryOrderGet(
          requestParameters.orderId,
          requestParameters.page,
          requestParameters.size,
          options
        )
        .then(request => request(axios, basePath));
    }
  };
};

/**
 * JDHistoryApi - interface
 */
export interface JDHistoryApiInterface {
  /**
   *
   * @summary Cookie Change History
   * @param {JDHistoryApiApiJdCookieHistoryCookieGetRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   */
  apiJdCookieHistoryCookieGet(
    requestParameters: JDHistoryApiApiJdCookieHistoryCookieGetRequest,
    options?: RawAxiosRequestConfig
  ): AxiosPromise<KamiApiJdCookieV1CookieHistoryRes>;

  /**
   *
   * @summary Order Change History
   * @param {JDHistoryApiApiJdCookieHistoryOrderGetRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   */
  apiJdCookieHistoryOrderGet(
    requestParameters: JDHistoryApiApiJdCookieHistoryOrderGetRequest,
    options?: RawAxiosRequestConfig
  ): AxiosPromise<KamiApiJdCookieV1OrderHistoryRes>;
}

/**
 * Request parameters for apiJdCookieHistoryCookieGet operation in JDHistoryApi.
 */
export interface JDHistoryApiApiJdCookieHistoryCookieGetRequest {
  /**
   * Cookie ID
   */
  readonly cookieId: string;

  /**
   * 页码
   */
  readonly page?: number;

  /**
   * 每页大小
   */
  readonly size?: number;

  /**
   * 变更类型筛选
   */
  readonly changeType?: ApiJdCookieHistoryCookieGetChangeTypeEnum;
}

/**
 * Request parameters for apiJdCookieHistoryOrderGet operation in JDHistoryApi.
 */
export interface JDHistoryApiApiJdCookieHistoryOrderGetRequest {
  /**
   * 订单号
   */
  readonly orderId: string;

  /**
   * 页码
   */
  readonly page?: number;

  /**
   * 每页大小
   */
  readonly size?: number;
}

/**
 * JDHistoryApi - object-oriented interface
 */
export class JDHistoryApi extends BaseAPI implements JDHistoryApiInterface {
  /**
   *
   * @summary Cookie Change History
   * @param {JDHistoryApiApiJdCookieHistoryCookieGetRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   */
  public apiJdCookieHistoryCookieGet(
    requestParameters: JDHistoryApiApiJdCookieHistoryCookieGetRequest,
    options?: RawAxiosRequestConfig
  ) {
    return JDHistoryApiFp(this.configuration)
      .apiJdCookieHistoryCookieGet(
        requestParameters.cookieId,
        requestParameters.page,
        requestParameters.size,
        requestParameters.changeType,
        options
      )
      .then(request => request(this.axios, this.basePath));
  }

  /**
   *
   * @summary Order Change History
   * @param {JDHistoryApiApiJdCookieHistoryOrderGetRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   */
  public apiJdCookieHistoryOrderGet(
    requestParameters: JDHistoryApiApiJdCookieHistoryOrderGetRequest,
    options?: RawAxiosRequestConfig
  ) {
    return JDHistoryApiFp(this.configuration)
      .apiJdCookieHistoryOrderGet(
        requestParameters.orderId,
        requestParameters.page,
        requestParameters.size,
        options
      )
      .then(request => request(this.axios, this.basePath));
  }
}

export enum ApiJdCookieHistoryCookieGetChangeTypeEnum {
  BatchDelete = 'batch delete',
  Create = 'create',
  Delete = 'delete',
  Fail = 'fail',
  RefreshFail = 'refresh fail',
  Replaced = 'replaced',
  Resume = 'resume',
  Suspend = 'suspend',
  Update = 'update',
  Use = 'use'
}
