/* 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 { ListedPostList } from "../models";
// @ts-ignore
import { Post } from "../models";
// @ts-ignore
import { Snapshot } from "../models";
/**
 * UcApiContentHaloRunV1alpha1PostApi - axios parameter creator
 * @export
 */
export const UcApiContentHaloRunV1alpha1PostApiAxiosParamCreator = function (
  configuration?: Configuration
) {
  return {
    /**
     * Create my post. If you want to create a post with content, please set  annotation: \"content.halo.run/content-json\" into annotations and refer  to Content for corresponding data type.
     * @param {Post} [post]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    createMyPost: async (
      post?: Post,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      const localVarPath = `/apis/uc.api.content.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(
        post,
        localVarRequestOptions,
        configuration
      );

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Get post that belongs to the current user.
     * @param {string} name Post name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getMyPost: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("getMyPost", "name", name);
      const localVarPath =
        `/apis/uc.api.content.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: "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,
      };
    },
    /**
     * Get my post draft.
     * @param {string} name Post name
     * @param {boolean} [patched] Should include patched content and raw or not.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getMyPostDraft: async (
      name: string,
      patched?: boolean,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("getMyPostDraft", "name", name);
      const localVarPath =
        `/apis/uc.api.content.halo.run/v1alpha1/posts/{name}/draft`.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);

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

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

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * List posts owned by the current user.
     * @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}
     */
    listMyPosts: 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/uc.api.content.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 my post.
     * @param {string} name Post name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    publishMyPost: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("publishMyPost", "name", name);
      const localVarPath =
        `/apis/uc.api.content.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);

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

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Unpublish my post.
     * @param {string} name Post name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    unpublishMyPost: async (
      name: string,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("unpublishMyPost", "name", name);
      const localVarPath =
        `/apis/uc.api.content.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 my post.
     * @param {string} name Post name
     * @param {Post} [post]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    updateMyPost: async (
      name: string,
      post?: Post,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("updateMyPost", "name", name);
      const localVarPath =
        `/apis/uc.api.content.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(
        post,
        localVarRequestOptions,
        configuration
      );

      return {
        url: toPathString(localVarUrlObj),
        options: localVarRequestOptions,
      };
    },
    /**
     * Update draft of my post. Please make sure set annotation: \"content.halo.run/content-json\" into annotations and refer to Content for corresponding data type.
     * @param {string} name Post name
     * @param {Snapshot} [snapshot]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    updateMyPostDraft: async (
      name: string,
      snapshot?: Snapshot,
      options: AxiosRequestConfig = {}
    ): Promise<RequestArgs> => {
      // verify required parameter 'name' is not null or undefined
      assertParamExists("updateMyPostDraft", "name", name);
      const localVarPath =
        `/apis/uc.api.content.halo.run/v1alpha1/posts/{name}/draft`.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(
        snapshot,
        localVarRequestOptions,
        configuration
      );

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

/**
 * UcApiContentHaloRunV1alpha1PostApi - functional programming interface
 * @export
 */
export const UcApiContentHaloRunV1alpha1PostApiFp = function (
  configuration?: Configuration
) {
  const localVarAxiosParamCreator =
    UcApiContentHaloRunV1alpha1PostApiAxiosParamCreator(configuration);
  return {
    /**
     * Create my post. If you want to create a post with content, please set  annotation: \"content.halo.run/content-json\" into annotations and refer  to Content for corresponding data type.
     * @param {Post} [post]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async createMyPost(
      post?: Post,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.createMyPost(
        post,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Get post that belongs to the current user.
     * @param {string} name Post name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async getMyPost(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.getMyPost(
        name,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Get my post draft.
     * @param {string} name Post name
     * @param {boolean} [patched] Should include patched content and raw or not.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async getMyPostDraft(
      name: string,
      patched?: boolean,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Snapshot>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.getMyPostDraft(
        name,
        patched,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * List posts owned by the current user.
     * @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 listMyPosts(
      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.listMyPosts(
        category,
        contributor,
        fieldSelector,
        keyword,
        labelSelector,
        page,
        publishPhase,
        size,
        sort,
        tag,
        visible,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Publish my post.
     * @param {string} name Post name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async publishMyPost(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.publishMyPost(
        name,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Unpublish my post.
     * @param {string} name Post name
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async unpublishMyPost(
      name: string,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.unpublishMyPost(
        name,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Update my post.
     * @param {string} name Post name
     * @param {Post} [post]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async updateMyPost(
      name: string,
      post?: Post,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Post>
    > {
      const localVarAxiosArgs = await localVarAxiosParamCreator.updateMyPost(
        name,
        post,
        options
      );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
    /**
     * Update draft of my post. Please make sure set annotation: \"content.halo.run/content-json\" into annotations and refer to Content for corresponding data type.
     * @param {string} name Post name
     * @param {Snapshot} [snapshot]
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    async updateMyPostDraft(
      name: string,
      snapshot?: Snapshot,
      options?: AxiosRequestConfig
    ): Promise<
      (axios?: AxiosInstance, basePath?: string) => AxiosPromise<Snapshot>
    > {
      const localVarAxiosArgs =
        await localVarAxiosParamCreator.updateMyPostDraft(
          name,
          snapshot,
          options
        );
      return createRequestFunction(
        localVarAxiosArgs,
        globalAxios,
        BASE_PATH,
        configuration
      );
    },
  };
};

/**
 * UcApiContentHaloRunV1alpha1PostApi - factory interface
 * @export
 */
export const UcApiContentHaloRunV1alpha1PostApiFactory = function (
  configuration?: Configuration,
  basePath?: string,
  axios?: AxiosInstance
) {
  const localVarFp = UcApiContentHaloRunV1alpha1PostApiFp(configuration);
  return {
    /**
     * Create my post. If you want to create a post with content, please set  annotation: \"content.halo.run/content-json\" into annotations and refer  to Content for corresponding data type.
     * @param {UcApiContentHaloRunV1alpha1PostApiCreateMyPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    createMyPost(
      requestParameters: UcApiContentHaloRunV1alpha1PostApiCreateMyPostRequest = {},
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .createMyPost(requestParameters.post, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Get post that belongs to the current user.
     * @param {UcApiContentHaloRunV1alpha1PostApiGetMyPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getMyPost(
      requestParameters: UcApiContentHaloRunV1alpha1PostApiGetMyPostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .getMyPost(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Get my post draft.
     * @param {UcApiContentHaloRunV1alpha1PostApiGetMyPostDraftRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    getMyPostDraft(
      requestParameters: UcApiContentHaloRunV1alpha1PostApiGetMyPostDraftRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Snapshot> {
      return localVarFp
        .getMyPostDraft(
          requestParameters.name,
          requestParameters.patched,
          options
        )
        .then((request) => request(axios, basePath));
    },
    /**
     * List posts owned by the current user.
     * @param {UcApiContentHaloRunV1alpha1PostApiListMyPostsRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    listMyPosts(
      requestParameters: UcApiContentHaloRunV1alpha1PostApiListMyPostsRequest = {},
      options?: AxiosRequestConfig
    ): AxiosPromise<ListedPostList> {
      return localVarFp
        .listMyPosts(
          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 my post.
     * @param {UcApiContentHaloRunV1alpha1PostApiPublishMyPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    publishMyPost(
      requestParameters: UcApiContentHaloRunV1alpha1PostApiPublishMyPostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .publishMyPost(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Unpublish my post.
     * @param {UcApiContentHaloRunV1alpha1PostApiUnpublishMyPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    unpublishMyPost(
      requestParameters: UcApiContentHaloRunV1alpha1PostApiUnpublishMyPostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .unpublishMyPost(requestParameters.name, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Update my post.
     * @param {UcApiContentHaloRunV1alpha1PostApiUpdateMyPostRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    updateMyPost(
      requestParameters: UcApiContentHaloRunV1alpha1PostApiUpdateMyPostRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Post> {
      return localVarFp
        .updateMyPost(requestParameters.name, requestParameters.post, options)
        .then((request) => request(axios, basePath));
    },
    /**
     * Update draft of my post. Please make sure set annotation: \"content.halo.run/content-json\" into annotations and refer to Content for corresponding data type.
     * @param {UcApiContentHaloRunV1alpha1PostApiUpdateMyPostDraftRequest} requestParameters Request parameters.
     * @param {*} [options] Override http request option.
     * @throws {RequiredError}
     */
    updateMyPostDraft(
      requestParameters: UcApiContentHaloRunV1alpha1PostApiUpdateMyPostDraftRequest,
      options?: AxiosRequestConfig
    ): AxiosPromise<Snapshot> {
      return localVarFp
        .updateMyPostDraft(
          requestParameters.name,
          requestParameters.snapshot,
          options
        )
        .then((request) => request(axios, basePath));
    },
  };
};

/**
 * Request parameters for createMyPost operation in UcApiContentHaloRunV1alpha1PostApi.
 * @export
 * @interface UcApiContentHaloRunV1alpha1PostApiCreateMyPostRequest
 */
export interface UcApiContentHaloRunV1alpha1PostApiCreateMyPostRequest {
  /**
   *
   * @type {Post}
   * @memberof UcApiContentHaloRunV1alpha1PostApiCreateMyPost
   */
  readonly post?: Post;
}

/**
 * Request parameters for getMyPost operation in UcApiContentHaloRunV1alpha1PostApi.
 * @export
 * @interface UcApiContentHaloRunV1alpha1PostApiGetMyPostRequest
 */
export interface UcApiContentHaloRunV1alpha1PostApiGetMyPostRequest {
  /**
   * Post name
   * @type {string}
   * @memberof UcApiContentHaloRunV1alpha1PostApiGetMyPost
   */
  readonly name: string;
}

/**
 * Request parameters for getMyPostDraft operation in UcApiContentHaloRunV1alpha1PostApi.
 * @export
 * @interface UcApiContentHaloRunV1alpha1PostApiGetMyPostDraftRequest
 */
export interface UcApiContentHaloRunV1alpha1PostApiGetMyPostDraftRequest {
  /**
   * Post name
   * @type {string}
   * @memberof UcApiContentHaloRunV1alpha1PostApiGetMyPostDraft
   */
  readonly name: string;

  /**
   * Should include patched content and raw or not.
   * @type {boolean}
   * @memberof UcApiContentHaloRunV1alpha1PostApiGetMyPostDraft
   */
  readonly patched?: boolean;
}

/**
 * Request parameters for listMyPosts operation in UcApiContentHaloRunV1alpha1PostApi.
 * @export
 * @interface UcApiContentHaloRunV1alpha1PostApiListMyPostsRequest
 */
export interface UcApiContentHaloRunV1alpha1PostApiListMyPostsRequest {
  /**
   *
   * @type {Array<string>}
   * @memberof UcApiContentHaloRunV1alpha1PostApiListMyPosts
   */
  readonly category?: Array<string>;

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

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

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

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

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

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

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

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

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

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

/**
 * Request parameters for publishMyPost operation in UcApiContentHaloRunV1alpha1PostApi.
 * @export
 * @interface UcApiContentHaloRunV1alpha1PostApiPublishMyPostRequest
 */
export interface UcApiContentHaloRunV1alpha1PostApiPublishMyPostRequest {
  /**
   * Post name
   * @type {string}
   * @memberof UcApiContentHaloRunV1alpha1PostApiPublishMyPost
   */
  readonly name: string;
}

/**
 * Request parameters for unpublishMyPost operation in UcApiContentHaloRunV1alpha1PostApi.
 * @export
 * @interface UcApiContentHaloRunV1alpha1PostApiUnpublishMyPostRequest
 */
export interface UcApiContentHaloRunV1alpha1PostApiUnpublishMyPostRequest {
  /**
   * Post name
   * @type {string}
   * @memberof UcApiContentHaloRunV1alpha1PostApiUnpublishMyPost
   */
  readonly name: string;
}

/**
 * Request parameters for updateMyPost operation in UcApiContentHaloRunV1alpha1PostApi.
 * @export
 * @interface UcApiContentHaloRunV1alpha1PostApiUpdateMyPostRequest
 */
export interface UcApiContentHaloRunV1alpha1PostApiUpdateMyPostRequest {
  /**
   * Post name
   * @type {string}
   * @memberof UcApiContentHaloRunV1alpha1PostApiUpdateMyPost
   */
  readonly name: string;

  /**
   *
   * @type {Post}
   * @memberof UcApiContentHaloRunV1alpha1PostApiUpdateMyPost
   */
  readonly post?: Post;
}

/**
 * Request parameters for updateMyPostDraft operation in UcApiContentHaloRunV1alpha1PostApi.
 * @export
 * @interface UcApiContentHaloRunV1alpha1PostApiUpdateMyPostDraftRequest
 */
export interface UcApiContentHaloRunV1alpha1PostApiUpdateMyPostDraftRequest {
  /**
   * Post name
   * @type {string}
   * @memberof UcApiContentHaloRunV1alpha1PostApiUpdateMyPostDraft
   */
  readonly name: string;

  /**
   *
   * @type {Snapshot}
   * @memberof UcApiContentHaloRunV1alpha1PostApiUpdateMyPostDraft
   */
  readonly snapshot?: Snapshot;
}

/**
 * UcApiContentHaloRunV1alpha1PostApi - object-oriented interface
 * @export
 * @class UcApiContentHaloRunV1alpha1PostApi
 * @extends {BaseAPI}
 */
export class UcApiContentHaloRunV1alpha1PostApi extends BaseAPI {
  /**
   * Create my post. If you want to create a post with content, please set  annotation: \"content.halo.run/content-json\" into annotations and refer  to Content for corresponding data type.
   * @param {UcApiContentHaloRunV1alpha1PostApiCreateMyPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof UcApiContentHaloRunV1alpha1PostApi
   */
  public createMyPost(
    requestParameters: UcApiContentHaloRunV1alpha1PostApiCreateMyPostRequest = {},
    options?: AxiosRequestConfig
  ) {
    return UcApiContentHaloRunV1alpha1PostApiFp(this.configuration)
      .createMyPost(requestParameters.post, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Get post that belongs to the current user.
   * @param {UcApiContentHaloRunV1alpha1PostApiGetMyPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof UcApiContentHaloRunV1alpha1PostApi
   */
  public getMyPost(
    requestParameters: UcApiContentHaloRunV1alpha1PostApiGetMyPostRequest,
    options?: AxiosRequestConfig
  ) {
    return UcApiContentHaloRunV1alpha1PostApiFp(this.configuration)
      .getMyPost(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Get my post draft.
   * @param {UcApiContentHaloRunV1alpha1PostApiGetMyPostDraftRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof UcApiContentHaloRunV1alpha1PostApi
   */
  public getMyPostDraft(
    requestParameters: UcApiContentHaloRunV1alpha1PostApiGetMyPostDraftRequest,
    options?: AxiosRequestConfig
  ) {
    return UcApiContentHaloRunV1alpha1PostApiFp(this.configuration)
      .getMyPostDraft(
        requestParameters.name,
        requestParameters.patched,
        options
      )
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * List posts owned by the current user.
   * @param {UcApiContentHaloRunV1alpha1PostApiListMyPostsRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof UcApiContentHaloRunV1alpha1PostApi
   */
  public listMyPosts(
    requestParameters: UcApiContentHaloRunV1alpha1PostApiListMyPostsRequest = {},
    options?: AxiosRequestConfig
  ) {
    return UcApiContentHaloRunV1alpha1PostApiFp(this.configuration)
      .listMyPosts(
        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 my post.
   * @param {UcApiContentHaloRunV1alpha1PostApiPublishMyPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof UcApiContentHaloRunV1alpha1PostApi
   */
  public publishMyPost(
    requestParameters: UcApiContentHaloRunV1alpha1PostApiPublishMyPostRequest,
    options?: AxiosRequestConfig
  ) {
    return UcApiContentHaloRunV1alpha1PostApiFp(this.configuration)
      .publishMyPost(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Unpublish my post.
   * @param {UcApiContentHaloRunV1alpha1PostApiUnpublishMyPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof UcApiContentHaloRunV1alpha1PostApi
   */
  public unpublishMyPost(
    requestParameters: UcApiContentHaloRunV1alpha1PostApiUnpublishMyPostRequest,
    options?: AxiosRequestConfig
  ) {
    return UcApiContentHaloRunV1alpha1PostApiFp(this.configuration)
      .unpublishMyPost(requestParameters.name, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Update my post.
   * @param {UcApiContentHaloRunV1alpha1PostApiUpdateMyPostRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof UcApiContentHaloRunV1alpha1PostApi
   */
  public updateMyPost(
    requestParameters: UcApiContentHaloRunV1alpha1PostApiUpdateMyPostRequest,
    options?: AxiosRequestConfig
  ) {
    return UcApiContentHaloRunV1alpha1PostApiFp(this.configuration)
      .updateMyPost(requestParameters.name, requestParameters.post, options)
      .then((request) => request(this.axios, this.basePath));
  }

  /**
   * Update draft of my post. Please make sure set annotation: \"content.halo.run/content-json\" into annotations and refer to Content for corresponding data type.
   * @param {UcApiContentHaloRunV1alpha1PostApiUpdateMyPostDraftRequest} requestParameters Request parameters.
   * @param {*} [options] Override http request option.
   * @throws {RequiredError}
   * @memberof UcApiContentHaloRunV1alpha1PostApi
   */
  public updateMyPostDraft(
    requestParameters: UcApiContentHaloRunV1alpha1PostApiUpdateMyPostDraftRequest,
    options?: AxiosRequestConfig
  ) {
    return UcApiContentHaloRunV1alpha1PostApiFp(this.configuration)
      .updateMyPostDraft(
        requestParameters.name,
        requestParameters.snapshot,
        options
      )
      .then((request) => request(this.axios, this.basePath));
  }
}
