/* tslint:disable */
/* eslint-disable */
/**
 * Halo Next API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 2.0.0
 *
 *
 * 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, AxiosRequestConfig } 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,
  RequestArgs,
  BaseAPI,
  RequiredError,
} from "../base";
// @ts-ignore
import { Content } from "../models";
// @ts-ignore
import { ContentWrapper } from "../models";
// @ts-ignore
import { ListedPostList } from "../models";
// @ts-ignore
import { Post } from "../models";
// @ts-ignore
import { PostRequest } from "../models";
/**
 * ApiConsoleHaloRunV1alpha1PostApi - axios parameter creator
 * @export
 */
export const ApiConsoleHaloRunV1alpha1PostApiAxiosParamCreator = function (
  configuration?: Configuration
) {
  return {
    /**
     * Draft a post.
     * @param {PostRequest} postRequest
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    draftPost: async (
      postRequest: PostRequest,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'postRequest' is not null or undefined
      assertParamExists("draftPost", "postRequest", postRequest);
      const localVarPath = `/apis/api.console.halo.run/v1alpha1/posts`;
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // 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(
        postRequest,
        localVarRequestOptions,
        configuration
      );

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Fetch head content of post.
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    fetchPostHeadContent: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("fetchPostHeadContent", "name", name);
      const localVarPath =
        `/apis/api.console.halo.run/v1alpha1/posts/{name}/head-content`.replace(
          `{${"name"}}`,
          encodeURIComponent(String(name))
        );
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // 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,
      };
    },
    /**
     * Fetch release content of post.
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    fetchPostReleaseContent: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("fetchPostReleaseContent", "name", name);
      const localVarPath =
        `/apis/api.console.halo.run/v1alpha1/posts/{name}/release-content`.replace(
          `{${"name"}}`,
          encodeURIComponent(String(name))
        );
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // 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,
      };
    },
    /**
     * List posts.
     * @param {Array<string>} [category]
     * @param {Array<string>} [contributor]
     * @param {Array<string>} [fieldSelector] Field selector for filtering.
     * @param {string} [keyword] Posts filtered by keyword.
     * @param {Array<string>} [labelSelector] Label selector for filtering.
     * @param {number} [page] The page number. Zero indicates no page.
     * @param {'DRAFT' | 'PENDING_APPROVAL' | 'PUBLISHED' | 'FAILED'} [publishPhase]
     * @param {number} [size] Size of one page. Zero indicates no limit.
     * @param {Array<string>} [sort] Sort property and direction of the list result. Supported fields: creationTimestamp,publishTime
     * @param {Array<string>} [tag]
     * @param {'PUBLIC' | 'INTERNAL' | 'PRIVATE'} [visible]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listPosts: async (
      category?: Array<string>,
      contributor?: Array<string>,
      fieldSelector?: Array<string>,
      keyword?: string,
      labelSelector?: Array<string>,
      page?: number,
      publishPhase?: "DRAFT" | "PENDING_APPROVAL" | "PUBLISHED" | "FAILED",
      size?: number,
      sort?: Array<string>,
      tag?: Array<string>,
      visible?: "PUBLIC" | "INTERNAL" | "PRIVATE",
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      const localVarPath = `/apis/api.console.halo.run/v1alpha1/posts`;
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // authentication BearerAuth required
      // http bearer authentication required
      await setBearerAuthToObject(localVarHeaderParameter, configuration);

      if (category) {
        localVarQueryParameter["category"] = Array.from(category);
      }

      if (contributor) {
        localVarQueryParameter["contributor"] = Array.from(contributor);
      }

      if (fieldSelector) {
        localVarQueryParameter["fieldSelector"] = fieldSelector;
      }

      if (keyword !== undefined) {
        localVarQueryParameter["keyword"] = keyword;
      }

      if (labelSelector) {
        localVarQueryParameter["labelSelector"] = labelSelector;
      }

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

      if (publishPhase !== undefined) {
        localVarQueryParameter["publishPhase"] = publishPhase;
      }

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

      if (sort) {
        localVarQueryParameter["sort"] = Array.from(sort);
      }

      if (tag) {
        localVarQueryParameter["tag"] = Array.from(tag);
      }

      if (visible !== undefined) {
        localVarQueryParameter["visible"] = visible;
      }

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

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Publish a post.
     * @param {string} name
     * @param {string} [headSnapshot] Head snapshot name of content.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    publishPost: async (
      name: string,
      headSnapshot?: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("publishPost", "name", name);
      const localVarPath =
        `/apis/api.console.halo.run/v1alpha1/posts/{name}/publish`.replace(
          `{${"name"}}`,
          encodeURIComponent(String(name))
        );
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // authentication BearerAuth required
      // http bearer authentication required
      await setBearerAuthToObject(localVarHeaderParameter, configuration);

      if (headSnapshot !== undefined) {
        localVarQueryParameter["headSnapshot"] = headSnapshot;
      }

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

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Recycle a post.
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    recyclePost: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("recyclePost", "name", name);
      const localVarPath =
        `/apis/api.console.halo.run/v1alpha1/posts/{name}/recycle`.replace(
          `{${"name"}}`,
          encodeURIComponent(String(name))
        );
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // 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,
      };
    },
    /**
     * Publish a post.
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    unpublishPost: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("unpublishPost", "name", name);
      const localVarPath =
        `/apis/api.console.halo.run/v1alpha1/posts/{name}/unpublish`.replace(
          `{${"name"}}`,
          encodeURIComponent(String(name))
        );
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // 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,
      };
    },
    /**
     * Update a post.
     * @param {string} name
     * @param {PostRequest} postRequest
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    updateDraftPost: async (
      name: string,
      postRequest: PostRequest,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("updateDraftPost", "name", name);
      // verify required parameter 'postRequest' is not null or undefined
      assertParamExists("updateDraftPost", "postRequest", postRequest);
      const localVarPath =
        `/apis/api.console.halo.run/v1alpha1/posts/{name}`.replace(
          `{${"name"}}`,
          encodeURIComponent(String(name))
        );
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // 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(
        postRequest,
        localVarRequestOptions,
        configuration
      );

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Update a post\'s content.
     * @param {string} name
     * @param {Content} content
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    updatePostContent: async (
      name: string,
      content: Content,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("updatePostContent", "name", name);
      // verify required parameter 'content' is not null or undefined
      assertParamExists("updatePostContent", "content", content);
      const localVarPath =
        `/apis/api.console.halo.run/v1alpha1/posts/{name}/content`.replace(
          `{${"name"}}`,
          encodeURIComponent(String(name))
        );
      // 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 BasicAuth required
      // http basic authentication required
      setBasicAuthToObject(localVarRequestOptions, configuration);

      // 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(
        content,
        localVarRequestOptions,
        configuration
      );

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

/**
 * ApiConsoleHaloRunV1alpha1PostApi - functional programming interface
 * @export
 */
export const ApiConsoleHaloRunV1alpha1PostApiFp = function (
  configuration?: Configuration
) {
  const localVarAxiosParamCreator =
    ApiConsoleHaloRunV1alpha1PostApiAxiosParamCreator(configuration);
  return {
    /**
     * Draft a post.
     * @param {PostRequest} postRequest
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async draftPost(
      postRequest: PostRequest,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.draftPost(
        postRequest,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Fetch head content of post.
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async fetchPostHeadContent(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<ContentWrapper>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.fetchPostHeadContent(name, options);
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Fetch release content of post.
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async fetchPostReleaseContent(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<ContentWrapper>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.fetchPostReleaseContent(name, options);
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * List posts.
     * @param {Array<string>} [category]
     * @param {Array<string>} [contributor]
     * @param {Array<string>} [fieldSelector] Field selector for filtering.
     * @param {string} [keyword] Posts filtered by keyword.
     * @param {Array<string>} [labelSelector] Label selector for filtering.
     * @param {number} [page] The page number. Zero indicates no page.
     * @param {'DRAFT' | 'PENDING_APPROVAL' | 'PUBLISHED' | 'FAILED'} [publishPhase]
     * @param {number} [size] Size of one page. Zero indicates no limit.
     * @param {Array<string>} [sort] Sort property and direction of the list result. Supported fields: creationTimestamp,publishTime
     * @param {Array<string>} [tag]
     * @param {'PUBLIC' | 'INTERNAL' | 'PRIVATE'} [visible]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async listPosts(
      category?: Array<string>,
      contributor?: Array<string>,
      fieldSelector?: Array<string>,
      keyword?: string,
      labelSelector?: Array<string>,
      page?: number,
      publishPhase?: "DRAFT" | "PENDING_APPROVAL" | "PUBLISHED" | "FAILED",
      size?: number,
      sort?: Array<string>,
      tag?: Array<string>,
      visible?: "PUBLIC" | "INTERNAL" | "PRIVATE",
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<ListedPostList>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.listPosts(
        category,
        contributor,
        fieldSelector,
        keyword,
        labelSelector,
        page,
        publishPhase,
        size,
        sort,
        tag,
        visible,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Publish a post.
     * @param {string} name
     * @param {string} [headSnapshot] Head snapshot name of content.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async publishPost(
      name: string,
      headSnapshot?: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.publishPost(
        name,
        headSnapshot,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Recycle a post.
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async recyclePost(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.recyclePost(
        name,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Publish a post.
     * @param {string} name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async unpublishPost(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.unpublishPost(
        name,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Update a post.
     * @param {string} name
     * @param {PostRequest} postRequest
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async updateDraftPost(
      name: string,
      postRequest: PostRequest,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.updateDraftPost(
        name,
        postRequest,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Update a post\'s content.
     * @param {string} name
     * @param {Content} content
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async updatePostContent(
      name: string,
      content: Content,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.updatePostContent(
          name,
          content,
          options
        );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
  };
};

/**
 * ApiConsoleHaloRunV1alpha1PostApi - factory interface
 * @export
 */
export const ApiConsoleHaloRunV1alpha1PostApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = ApiConsoleHaloRunV1alpha1PostApiFp(configuration);
  return {
    /**
     * Draft a post.
     * @param {ApiConsoleHaloRunV1alpha1PostApiDraftPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    draftPost(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiDraftPostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .draftPost(requestParameters.postRequest, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Fetch head content of post.
     * @param {ApiConsoleHaloRunV1alpha1PostApiFetchPostHeadContentRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    fetchPostHeadContent(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiFetchPostHeadContentRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<ContentWrapper> {
      return localVarFp
        .fetchPostHeadContent(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Fetch release content of post.
     * @param {ApiConsoleHaloRunV1alpha1PostApiFetchPostReleaseContentRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    fetchPostReleaseContent(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiFetchPostReleaseContentRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<ContentWrapper> {
      return localVarFp
        .fetchPostReleaseContent(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * List posts.
     * @param {ApiConsoleHaloRunV1alpha1PostApiListPostsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listPosts(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiListPostsRequest = {},
      options?: AxiosRequestConfig
    ): AxiosPromise<ListedPostList> {
      return localVarFp
        .listPosts(
          requestParameters.category,
          requestParameters.contributor,
          requestParameters.fieldSelector,
          requestParameters.keyword,
          requestParameters.labelSelector,
          requestParameters.page,
          requestParameters.publishPhase,
          requestParameters.size,
          requestParameters.sort,
          requestParameters.tag,
          requestParameters.visible,
          options
        )
        .then((request) => request(axios, basePath));
    },
    /**
     * Publish a post.
     * @param {ApiConsoleHaloRunV1alpha1PostApiPublishPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    publishPost(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiPublishPostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .publishPost(
          requestParameters.name,
          requestParameters.headSnapshot,
          options
        )
        .then((request) => request(axios, basePath));
    },
    /**
     * Recycle a post.
     * @param {ApiConsoleHaloRunV1alpha1PostApiRecyclePostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    recyclePost(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiRecyclePostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<void> {
      return localVarFp
        .recyclePost(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Publish a post.
     * @param {ApiConsoleHaloRunV1alpha1PostApiUnpublishPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    unpublishPost(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiUnpublishPostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .unpublishPost(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Update a post.
     * @param {ApiConsoleHaloRunV1alpha1PostApiUpdateDraftPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    updateDraftPost(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiUpdateDraftPostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .updateDraftPost(
          requestParameters.name,
          requestParameters.postRequest,
          options
        )
        .then((request) => request(axios, basePath));
    },
    /**
     * Update a post\'s content.
     * @param {ApiConsoleHaloRunV1alpha1PostApiUpdatePostContentRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    updatePostContent(
      requestParameters: ApiConsoleHaloRunV1alpha1PostApiUpdatePostContentRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .updatePostContent(
          requestParameters.name,
          requestParameters.content,
          options
        )
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for draftPost operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiDraftPostRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiDraftPostRequest {
  /**
   *
   * @type {PostRequest}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiDraftPost
   */
  readonly postRequest: PostRequest;
}

/**
 * Request parameters for fetchPostHeadContent operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiFetchPostHeadContentRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiFetchPostHeadContentRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiFetchPostHeadContent
   */
  readonly name: string;
}

/**
 * Request parameters for fetchPostReleaseContent operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiFetchPostReleaseContentRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiFetchPostReleaseContentRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiFetchPostReleaseContent
   */
  readonly name: string;
}

/**
 * Request parameters for listPosts operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiListPostsRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiListPostsRequest {
  /**
   *
   * @type {Array<string>}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly category?: Array<string>;

  /**
   *
   * @type {Array<string>}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly contributor?: Array<string>;

  /**
   * Field selector for filtering.
   * @type {Array<string>}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly fieldSelector?: Array<string>;

  /**
   * Posts filtered by keyword.
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly keyword?: string;

  /**
   * Label selector for filtering.
   * @type {Array<string>}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly labelSelector?: Array<string>;

  /**
   * The page number. Zero indicates no page.
   * @type {number}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly page?: number;

  /**
   *
   * @type {'DRAFT' | 'PENDING_APPROVAL' | 'PUBLISHED' | 'FAILED'}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly publishPhase?: "DRAFT" | "PENDING_APPROVAL" | "PUBLISHED" | "FAILED";

  /**
   * Size of one page. Zero indicates no limit.
   * @type {number}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly size?: number;

  /**
   * Sort property and direction of the list result. Supported fields: creationTimestamp,publishTime
   * @type {Array<string>}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly sort?: Array<string>;

  /**
   *
   * @type {Array<string>}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly tag?: Array<string>;

  /**
   *
   * @type {'PUBLIC' | 'INTERNAL' | 'PRIVATE'}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiListPosts
   */
  readonly visible?: "PUBLIC" | "INTERNAL" | "PRIVATE";
}

/**
 * Request parameters for publishPost operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiPublishPostRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiPublishPostRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiPublishPost
   */
  readonly name: string;

  /**
   * Head snapshot name of content.
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiPublishPost
   */
  readonly headSnapshot?: string;
}

/**
 * Request parameters for recyclePost operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiRecyclePostRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiRecyclePostRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiRecyclePost
   */
  readonly name: string;
}

/**
 * Request parameters for unpublishPost operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiUnpublishPostRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiUnpublishPostRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiUnpublishPost
   */
  readonly name: string;
}

/**
 * Request parameters for updateDraftPost operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiUpdateDraftPostRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiUpdateDraftPostRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiUpdateDraftPost
   */
  readonly name: string;

  /**
   *
   * @type {PostRequest}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiUpdateDraftPost
   */
  readonly postRequest: PostRequest;
}

/**
 * Request parameters for updatePostContent operation in ApiConsoleHaloRunV1alpha1PostApi.
 * @export
 * @interface ApiConsoleHaloRunV1alpha1PostApiUpdatePostContentRequest
 */
export interface ApiConsoleHaloRunV1alpha1PostApiUpdatePostContentRequest {
  /**
   *
   * @type {string}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiUpdatePostContent
   */
  readonly name: string;

  /**
   *
   * @type {Content}
   * @memberof ApiConsoleHaloRunV1alpha1PostApiUpdatePostContent
   */
  readonly content: Content;
}

/**
 * ApiConsoleHaloRunV1alpha1PostApi - object-oriented interface
 * @export
 * @class ApiConsoleHaloRunV1alpha1PostApi
 * @extends {BaseAPI}
 */
export class ApiConsoleHaloRunV1alpha1PostApi extends BaseAPI {
  /**
   * Draft a post.
   * @param {ApiConsoleHaloRunV1alpha1PostApiDraftPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public draftPost(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiDraftPostRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .draftPost(requestParameters.postRequest, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Fetch head content of post.
   * @param {ApiConsoleHaloRunV1alpha1PostApiFetchPostHeadContentRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public fetchPostHeadContent(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiFetchPostHeadContentRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .fetchPostHeadContent(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Fetch release content of post.
   * @param {ApiConsoleHaloRunV1alpha1PostApiFetchPostReleaseContentRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public fetchPostReleaseContent(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiFetchPostReleaseContentRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .fetchPostReleaseContent(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * List posts.
   * @param {ApiConsoleHaloRunV1alpha1PostApiListPostsRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public listPosts(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiListPostsRequest = {},
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .listPosts(
        requestParameters.category,
        requestParameters.contributor,
        requestParameters.fieldSelector,
        requestParameters.keyword,
        requestParameters.labelSelector,
        requestParameters.page,
        requestParameters.publishPhase,
        requestParameters.size,
        requestParameters.sort,
        requestParameters.tag,
        requestParameters.visible,
        options
      )
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Publish a post.
   * @param {ApiConsoleHaloRunV1alpha1PostApiPublishPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public publishPost(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiPublishPostRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .publishPost(
        requestParameters.name,
        requestParameters.headSnapshot,
        options
      )
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Recycle a post.
   * @param {ApiConsoleHaloRunV1alpha1PostApiRecyclePostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public recyclePost(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiRecyclePostRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .recyclePost(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Publish a post.
   * @param {ApiConsoleHaloRunV1alpha1PostApiUnpublishPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public unpublishPost(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiUnpublishPostRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .unpublishPost(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Update a post.
   * @param {ApiConsoleHaloRunV1alpha1PostApiUpdateDraftPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public updateDraftPost(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiUpdateDraftPostRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .updateDraftPost(
        requestParameters.name,
        requestParameters.postRequest,
        options
      )
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Update a post\'s content.
   * @param {ApiConsoleHaloRunV1alpha1PostApiUpdatePostContentRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof ApiConsoleHaloRunV1alpha1PostApi
   */
  public updatePostContent(
    requestParameters: ApiConsoleHaloRunV1alpha1PostApiUpdatePostContentRequest,
    options?: AxiosRequestConfig
  ) {
    return ApiConsoleHaloRunV1alpha1PostApiFp(this.configuration)
      .updatePostContent(
        requestParameters.name,
        requestParameters.content,
        options
      )
      .then((request) => request(this.axios, this.basePath));
  }
}
