/**
 * Generated by orval v8.3.0 🍺
 * Do not edit manually.
 * Mission Control API
 * OpenAPI spec version: 0.1.0
 */
import { useMutation, useQuery } from "@tanstack/react-query";
import type {
  DataTag,
  DefinedInitialDataOptions,
  DefinedUseQueryResult,
  MutationFunction,
  QueryClient,
  QueryFunction,
  QueryKey,
  UndefinedInitialDataOptions,
  UseMutationOptions,
  UseMutationResult,
  UseQueryOptions,
  UseQueryResult,
} from "@tanstack/react-query";

import type {
  BoardWebhookCreate,
  BoardWebhookIngestResponse,
  BoardWebhookPayloadRead,
  BoardWebhookRead,
  BoardWebhookUpdate,
  HTTPValidationError,
  LimitOffsetPageTypeVarCustomizedBoardWebhookPayloadRead,
  LimitOffsetPageTypeVarCustomizedBoardWebhookRead,
  ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
  ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
  OkResponse,
} from ".././model";

import { customFetch } from "../../mutator";

type SecondParameter<T extends (...args: never) => unknown> = Parameters<T>[1];

/**
 * List configured webhooks for a board.
 * @summary List Board Webhooks
 */
export type listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponse200 = {
  data: LimitOffsetPageTypeVarCustomizedBoardWebhookRead;
  status: 200;
};

export type listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponseSuccess =
  listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponse200 & {
    headers: Headers;
  };
export type listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponseError =
  listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponse422 & {
    headers: Headers;
  };

export type listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponse =
  | listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponseSuccess
  | listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponseError;

export const getListBoardWebhooksApiV1BoardsBoardIdWebhooksGetUrl = (
  boardId: string,
  params?: ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
) => {
  const normalizedParams = new URLSearchParams();

  Object.entries(params || {}).forEach(([key, value]) => {
    if (value !== undefined) {
      normalizedParams.append(key, value === null ? "null" : value.toString());
    }
  });

  const stringifiedParams = normalizedParams.toString();

  return stringifiedParams.length > 0
    ? `/api/v1/boards/${boardId}/webhooks?${stringifiedParams}`
    : `/api/v1/boards/${boardId}/webhooks`;
};

export const listBoardWebhooksApiV1BoardsBoardIdWebhooksGet = async (
  boardId: string,
  params?: ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
  options?: RequestInit,
): Promise<listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponse> => {
  return customFetch<listBoardWebhooksApiV1BoardsBoardIdWebhooksGetResponse>(
    getListBoardWebhooksApiV1BoardsBoardIdWebhooksGetUrl(boardId, params),
    {
      ...options,
      method: "GET",
    },
  );
};

export const getListBoardWebhooksApiV1BoardsBoardIdWebhooksGetQueryKey = (
  boardId: string,
  params?: ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
) => {
  return [
    `/api/v1/boards/${boardId}/webhooks`,
    ...(params ? [params] : []),
  ] as const;
};

export const getListBoardWebhooksApiV1BoardsBoardIdWebhooksGetQueryOptions = <
  TData = Awaited<
    ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params?: ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
) => {
  const { query: queryOptions, request: requestOptions } = options ?? {};

  const queryKey =
    queryOptions?.queryKey ??
    getListBoardWebhooksApiV1BoardsBoardIdWebhooksGetQueryKey(boardId, params);

  const queryFn: QueryFunction<
    Awaited<ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>>
  > = ({ signal }) =>
    listBoardWebhooksApiV1BoardsBoardIdWebhooksGet(boardId, params, {
      signal,
      ...requestOptions,
    });

  return {
    queryKey,
    queryFn,
    enabled: !!boardId,
    ...queryOptions,
  } as UseQueryOptions<
    Awaited<ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>>,
    TError,
    TData
  > & { queryKey: DataTag<QueryKey, TData, TError> };
};

export type ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetQueryResult =
  NonNullable<
    Awaited<ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>>
  >;
export type ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetQueryError =
  HTTPValidationError;

export function useListBoardWebhooksApiV1BoardsBoardIdWebhooksGet<
  TData = Awaited<
    ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params: undefined | ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
        >,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<
            ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
          >,
          TError,
          Awaited<
            ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListBoardWebhooksApiV1BoardsBoardIdWebhooksGet<
  TData = Awaited<
    ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params?: ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
        >,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<
            ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
          >,
          TError,
          Awaited<
            ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListBoardWebhooksApiV1BoardsBoardIdWebhooksGet<
  TData = Awaited<
    ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params?: ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary List Board Webhooks
 */

export function useListBoardWebhooksApiV1BoardsBoardIdWebhooksGet<
  TData = Awaited<
    ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  params?: ListBoardWebhooksApiV1BoardsBoardIdWebhooksGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<typeof listBoardWebhooksApiV1BoardsBoardIdWebhooksGet>
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions =
    getListBoardWebhooksApiV1BoardsBoardIdWebhooksGetQueryOptions(
      boardId,
      params,
      options,
    );

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}

/**
 * Create a new board webhook with a generated UUID endpoint.
 * @summary Create Board Webhook
 */
export type createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponse200 = {
  data: BoardWebhookRead;
  status: 200;
};

export type createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponseSuccess =
  createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponse200 & {
    headers: Headers;
  };
export type createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponseError =
  createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponse422 & {
    headers: Headers;
  };

export type createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponse =
  | createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponseSuccess
  | createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponseError;

export const getCreateBoardWebhookApiV1BoardsBoardIdWebhooksPostUrl = (
  boardId: string,
) => {
  return `/api/v1/boards/${boardId}/webhooks`;
};

export const createBoardWebhookApiV1BoardsBoardIdWebhooksPost = async (
  boardId: string,
  boardWebhookCreate: BoardWebhookCreate,
  options?: RequestInit,
): Promise<createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponse> => {
  return customFetch<createBoardWebhookApiV1BoardsBoardIdWebhooksPostResponse>(
    getCreateBoardWebhookApiV1BoardsBoardIdWebhooksPostUrl(boardId),
    {
      ...options,
      method: "POST",
      headers: { "Content-Type": "application/json", ...options?.headers },
      body: JSON.stringify(boardWebhookCreate),
    },
  );
};

export const getCreateBoardWebhookApiV1BoardsBoardIdWebhooksPostMutationOptions =
  <TError = HTTPValidationError, TContext = unknown>(options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<typeof createBoardWebhookApiV1BoardsBoardIdWebhooksPost>
      >,
      TError,
      { boardId: string; data: BoardWebhookCreate },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  }): UseMutationOptions<
    Awaited<
      ReturnType<typeof createBoardWebhookApiV1BoardsBoardIdWebhooksPost>
    >,
    TError,
    { boardId: string; data: BoardWebhookCreate },
    TContext
  > => {
    const mutationKey = ["createBoardWebhookApiV1BoardsBoardIdWebhooksPost"];
    const { mutation: mutationOptions, request: requestOptions } = options
      ? options.mutation &&
        "mutationKey" in options.mutation &&
        options.mutation.mutationKey
        ? options
        : { ...options, mutation: { ...options.mutation, mutationKey } }
      : { mutation: { mutationKey }, request: undefined };

    const mutationFn: MutationFunction<
      Awaited<
        ReturnType<typeof createBoardWebhookApiV1BoardsBoardIdWebhooksPost>
      >,
      { boardId: string; data: BoardWebhookCreate }
    > = (props) => {
      const { boardId, data } = props ?? {};

      return createBoardWebhookApiV1BoardsBoardIdWebhooksPost(
        boardId,
        data,
        requestOptions,
      );
    };

    return { mutationFn, ...mutationOptions };
  };

export type CreateBoardWebhookApiV1BoardsBoardIdWebhooksPostMutationResult =
  NonNullable<
    Awaited<ReturnType<typeof createBoardWebhookApiV1BoardsBoardIdWebhooksPost>>
  >;
export type CreateBoardWebhookApiV1BoardsBoardIdWebhooksPostMutationBody =
  BoardWebhookCreate;
export type CreateBoardWebhookApiV1BoardsBoardIdWebhooksPostMutationError =
  HTTPValidationError;

/**
 * @summary Create Board Webhook
 */
export const useCreateBoardWebhookApiV1BoardsBoardIdWebhooksPost = <
  TError = HTTPValidationError,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<typeof createBoardWebhookApiV1BoardsBoardIdWebhooksPost>
      >,
      TError,
      { boardId: string; data: BoardWebhookCreate },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<ReturnType<typeof createBoardWebhookApiV1BoardsBoardIdWebhooksPost>>,
  TError,
  { boardId: string; data: BoardWebhookCreate },
  TContext
> => {
  return useMutation(
    getCreateBoardWebhookApiV1BoardsBoardIdWebhooksPostMutationOptions(options),
    queryClient,
  );
};
/**
 * Get one board webhook configuration.
 * @summary Get Board Webhook
 */
export type getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponse200 = {
  data: BoardWebhookRead;
  status: 200;
};

export type getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponse422 = {
  data: HTTPValidationError;
  status: 422;
};

export type getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponseSuccess =
  getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponse200 & {
    headers: Headers;
  };
export type getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponseError =
  getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponse422 & {
    headers: Headers;
  };

export type getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponse =
  | getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponseSuccess
  | getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponseError;

export const getGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetUrl = (
  boardId: string,
  webhookId: string,
) => {
  return `/api/v1/boards/${boardId}/webhooks/${webhookId}`;
};

export const getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet = async (
  boardId: string,
  webhookId: string,
  options?: RequestInit,
): Promise<getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponse> => {
  return customFetch<getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetResponse>(
    getGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetUrl(
      boardId,
      webhookId,
    ),
    {
      ...options,
      method: "GET",
    },
  );
};

export const getGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetQueryKey =
  (boardId: string, webhookId: string) => {
    return [`/api/v1/boards/${boardId}/webhooks/${webhookId}`] as const;
  };

export const getGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetQueryOptions =
  <
    TData = Awaited<
      ReturnType<typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet>
    >,
    TError = HTTPValidationError,
  >(
    boardId: string,
    webhookId: string,
    options?: {
      query?: Partial<
        UseQueryOptions<
          Awaited<
            ReturnType<
              typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
            >
          >,
          TError,
          TData
        >
      >;
      request?: SecondParameter<typeof customFetch>;
    },
  ) => {
    const { query: queryOptions, request: requestOptions } = options ?? {};

    const queryKey =
      queryOptions?.queryKey ??
      getGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetQueryKey(
        boardId,
        webhookId,
      );

    const queryFn: QueryFunction<
      Awaited<
        ReturnType<typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet>
      >
    > = ({ signal }) =>
      getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet(
        boardId,
        webhookId,
        { signal, ...requestOptions },
      );

    return {
      queryKey,
      queryFn,
      enabled: !!(boardId && webhookId),
      ...queryOptions,
    } as UseQueryOptions<
      Awaited<
        ReturnType<typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet>
      >,
      TError,
      TData
    > & { queryKey: DataTag<QueryKey, TData, TError> };
  };

export type GetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetQueryResult =
  NonNullable<
    Awaited<
      ReturnType<typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet>
    >
  >;
export type GetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetQueryError =
  HTTPValidationError;

export function useGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet<
  TData = Awaited<
    ReturnType<typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
          >
        >,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<
            ReturnType<
              typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
            >
          >,
          TError,
          Awaited<
            ReturnType<
              typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
            >
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet<
  TData = Awaited<
    ReturnType<typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
          >
        >,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<
            ReturnType<
              typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
            >
          >,
          TError,
          Awaited<
            ReturnType<
              typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
            >
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet<
  TData = Awaited<
    ReturnType<typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
          >
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get Board Webhook
 */

export function useGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet<
  TData = Awaited<
    ReturnType<typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet>
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGet
          >
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions =
    getGetBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdGetQueryOptions(
      boardId,
      webhookId,
      options,
    );

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}

/**
 * Update board webhook description or enabled state.
 * @summary Update Board Webhook
 */
export type updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponse200 =
  {
    data: BoardWebhookRead;
    status: 200;
  };

export type updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponse422 =
  {
    data: HTTPValidationError;
    status: 422;
  };

export type updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponseSuccess =
  updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponse200 & {
    headers: Headers;
  };
export type updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponseError =
  updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponse422 & {
    headers: Headers;
  };

export type updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponse =
  | updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponseSuccess
  | updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponseError;

export const getUpdateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchUrl =
  (boardId: string, webhookId: string) => {
    return `/api/v1/boards/${boardId}/webhooks/${webhookId}`;
  };

export const updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch =
  async (
    boardId: string,
    webhookId: string,
    boardWebhookUpdate: BoardWebhookUpdate,
    options?: RequestInit,
  ): Promise<updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponse> => {
    return customFetch<updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchResponse>(
      getUpdateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchUrl(
        boardId,
        webhookId,
      ),
      {
        ...options,
        method: "PATCH",
        headers: { "Content-Type": "application/json", ...options?.headers },
        body: JSON.stringify(boardWebhookUpdate),
      },
    );
  };

export const getUpdateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchMutationOptions =
  <TError = HTTPValidationError, TContext = unknown>(options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<
          typeof updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch
        >
      >,
      TError,
      { boardId: string; webhookId: string; data: BoardWebhookUpdate },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  }): UseMutationOptions<
    Awaited<
      ReturnType<
        typeof updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch
      >
    >,
    TError,
    { boardId: string; webhookId: string; data: BoardWebhookUpdate },
    TContext
  > => {
    const mutationKey = [
      "updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch",
    ];
    const { mutation: mutationOptions, request: requestOptions } = options
      ? options.mutation &&
        "mutationKey" in options.mutation &&
        options.mutation.mutationKey
        ? options
        : { ...options, mutation: { ...options.mutation, mutationKey } }
      : { mutation: { mutationKey }, request: undefined };

    const mutationFn: MutationFunction<
      Awaited<
        ReturnType<
          typeof updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch
        >
      >,
      { boardId: string; webhookId: string; data: BoardWebhookUpdate }
    > = (props) => {
      const { boardId, webhookId, data } = props ?? {};

      return updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch(
        boardId,
        webhookId,
        data,
        requestOptions,
      );
    };

    return { mutationFn, ...mutationOptions };
  };

export type UpdateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchMutationResult =
  NonNullable<
    Awaited<
      ReturnType<
        typeof updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch
      >
    >
  >;
export type UpdateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchMutationBody =
  BoardWebhookUpdate;
export type UpdateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchMutationError =
  HTTPValidationError;

/**
 * @summary Update Board Webhook
 */
export const useUpdateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch = <
  TError = HTTPValidationError,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<
          typeof updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch
        >
      >,
      TError,
      { boardId: string; webhookId: string; data: BoardWebhookUpdate },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<
    ReturnType<
      typeof updateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatch
    >
  >,
  TError,
  { boardId: string; webhookId: string; data: BoardWebhookUpdate },
  TContext
> => {
  return useMutation(
    getUpdateBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPatchMutationOptions(
      options,
    ),
    queryClient,
  );
};
/**
 * Delete a webhook and its stored payload rows.
 * @summary Delete Board Webhook
 */
export type deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponse200 =
  {
    data: OkResponse;
    status: 200;
  };

export type deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponse422 =
  {
    data: HTTPValidationError;
    status: 422;
  };

export type deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponseSuccess =
  deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponse200 & {
    headers: Headers;
  };
export type deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponseError =
  deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponse422 & {
    headers: Headers;
  };

export type deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponse =

    | deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponseSuccess
    | deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponseError;

export const getDeleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteUrl =
  (boardId: string, webhookId: string) => {
    return `/api/v1/boards/${boardId}/webhooks/${webhookId}`;
  };

export const deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete =
  async (
    boardId: string,
    webhookId: string,
    options?: RequestInit,
  ): Promise<deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponse> => {
    return customFetch<deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteResponse>(
      getDeleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteUrl(
        boardId,
        webhookId,
      ),
      {
        ...options,
        method: "DELETE",
      },
    );
  };

export const getDeleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteMutationOptions =
  <TError = HTTPValidationError, TContext = unknown>(options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<
          typeof deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete
        >
      >,
      TError,
      { boardId: string; webhookId: string },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  }): UseMutationOptions<
    Awaited<
      ReturnType<
        typeof deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete
      >
    >,
    TError,
    { boardId: string; webhookId: string },
    TContext
  > => {
    const mutationKey = [
      "deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete",
    ];
    const { mutation: mutationOptions, request: requestOptions } = options
      ? options.mutation &&
        "mutationKey" in options.mutation &&
        options.mutation.mutationKey
        ? options
        : { ...options, mutation: { ...options.mutation, mutationKey } }
      : { mutation: { mutationKey }, request: undefined };

    const mutationFn: MutationFunction<
      Awaited<
        ReturnType<
          typeof deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete
        >
      >,
      { boardId: string; webhookId: string }
    > = (props) => {
      const { boardId, webhookId } = props ?? {};

      return deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete(
        boardId,
        webhookId,
        requestOptions,
      );
    };

    return { mutationFn, ...mutationOptions };
  };

export type DeleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteMutationResult =
  NonNullable<
    Awaited<
      ReturnType<
        typeof deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete
      >
    >
  >;

export type DeleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteMutationError =
  HTTPValidationError;

/**
 * @summary Delete Board Webhook
 */
export const useDeleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete = <
  TError = HTTPValidationError,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<
          typeof deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete
        >
      >,
      TError,
      { boardId: string; webhookId: string },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<
    ReturnType<
      typeof deleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDelete
    >
  >,
  TError,
  { boardId: string; webhookId: string },
  TContext
> => {
  return useMutation(
    getDeleteBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdDeleteMutationOptions(
      options,
    ),
    queryClient,
  );
};
/**
 * Open inbound webhook endpoint that stores payloads and nudges the board lead.
 * @summary Ingest Board Webhook
 */
export type ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponse202 =
  {
    data: BoardWebhookIngestResponse;
    status: 202;
  };

export type ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponse422 =
  {
    data: HTTPValidationError;
    status: 422;
  };

export type ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponseSuccess =
  ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponse202 & {
    headers: Headers;
  };
export type ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponseError =
  ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponse422 & {
    headers: Headers;
  };

export type ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponse =
  | ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponseSuccess
  | ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponseError;

export const getIngestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostUrl = (
  boardId: string,
  webhookId: string,
) => {
  return `/api/v1/boards/${boardId}/webhooks/${webhookId}`;
};

export const ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost = async (
  boardId: string,
  webhookId: string,
  options?: RequestInit,
): Promise<ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponse> => {
  return customFetch<ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostResponse>(
    getIngestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostUrl(
      boardId,
      webhookId,
    ),
    {
      ...options,
      method: "POST",
    },
  );
};

export const getIngestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostMutationOptions =
  <TError = HTTPValidationError, TContext = unknown>(options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<
          typeof ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost
        >
      >,
      TError,
      { boardId: string; webhookId: string },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  }): UseMutationOptions<
    Awaited<
      ReturnType<
        typeof ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost
      >
    >,
    TError,
    { boardId: string; webhookId: string },
    TContext
  > => {
    const mutationKey = [
      "ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost",
    ];
    const { mutation: mutationOptions, request: requestOptions } = options
      ? options.mutation &&
        "mutationKey" in options.mutation &&
        options.mutation.mutationKey
        ? options
        : { ...options, mutation: { ...options.mutation, mutationKey } }
      : { mutation: { mutationKey }, request: undefined };

    const mutationFn: MutationFunction<
      Awaited<
        ReturnType<
          typeof ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost
        >
      >,
      { boardId: string; webhookId: string }
    > = (props) => {
      const { boardId, webhookId } = props ?? {};

      return ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost(
        boardId,
        webhookId,
        requestOptions,
      );
    };

    return { mutationFn, ...mutationOptions };
  };

export type IngestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostMutationResult =
  NonNullable<
    Awaited<
      ReturnType<
        typeof ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost
      >
    >
  >;

export type IngestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostMutationError =
  HTTPValidationError;

/**
 * @summary Ingest Board Webhook
 */
export const useIngestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost = <
  TError = HTTPValidationError,
  TContext = unknown,
>(
  options?: {
    mutation?: UseMutationOptions<
      Awaited<
        ReturnType<
          typeof ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost
        >
      >,
      TError,
      { boardId: string; webhookId: string },
      TContext
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseMutationResult<
  Awaited<
    ReturnType<typeof ingestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPost>
  >,
  TError,
  { boardId: string; webhookId: string },
  TContext
> => {
  return useMutation(
    getIngestBoardWebhookApiV1BoardsBoardIdWebhooksWebhookIdPostMutationOptions(
      options,
    ),
    queryClient,
  );
};
/**
 * List stored payloads for one board webhook.
 * @summary List Board Webhook Payloads
 */
export type listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponse200 =
  {
    data: LimitOffsetPageTypeVarCustomizedBoardWebhookPayloadRead;
    status: 200;
  };

export type listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponse422 =
  {
    data: HTTPValidationError;
    status: 422;
  };

export type listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponseSuccess =
  listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponse200 & {
    headers: Headers;
  };
export type listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponseError =
  listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponse422 & {
    headers: Headers;
  };

export type listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponse =

    | listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponseSuccess
    | listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponseError;

export const getListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetUrl =
  (
    boardId: string,
    webhookId: string,
    params?: ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
  ) => {
    const normalizedParams = new URLSearchParams();

    Object.entries(params || {}).forEach(([key, value]) => {
      if (value !== undefined) {
        normalizedParams.append(
          key,
          value === null ? "null" : value.toString(),
        );
      }
    });

    const stringifiedParams = normalizedParams.toString();

    return stringifiedParams.length > 0
      ? `/api/v1/boards/${boardId}/webhooks/${webhookId}/payloads?${stringifiedParams}`
      : `/api/v1/boards/${boardId}/webhooks/${webhookId}/payloads`;
  };

export const listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet =
  async (
    boardId: string,
    webhookId: string,
    params?: ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
    options?: RequestInit,
  ): Promise<listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponse> => {
    return customFetch<listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetResponse>(
      getListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetUrl(
        boardId,
        webhookId,
        params,
      ),
      {
        ...options,
        method: "GET",
      },
    );
  };

export const getListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetQueryKey =
  (
    boardId: string,
    webhookId: string,
    params?: ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
  ) => {
    return [
      `/api/v1/boards/${boardId}/webhooks/${webhookId}/payloads`,
      ...(params ? [params] : []),
    ] as const;
  };

export const getListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetQueryOptions =
  <
    TData = Awaited<
      ReturnType<
        typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
      >
    >,
    TError = HTTPValidationError,
  >(
    boardId: string,
    webhookId: string,
    params?: ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
    options?: {
      query?: Partial<
        UseQueryOptions<
          Awaited<
            ReturnType<
              typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
            >
          >,
          TError,
          TData
        >
      >;
      request?: SecondParameter<typeof customFetch>;
    },
  ) => {
    const { query: queryOptions, request: requestOptions } = options ?? {};

    const queryKey =
      queryOptions?.queryKey ??
      getListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetQueryKey(
        boardId,
        webhookId,
        params,
      );

    const queryFn: QueryFunction<
      Awaited<
        ReturnType<
          typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
        >
      >
    > = ({ signal }) =>
      listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet(
        boardId,
        webhookId,
        params,
        { signal, ...requestOptions },
      );

    return {
      queryKey,
      queryFn,
      enabled: !!(boardId && webhookId),
      ...queryOptions,
    } as UseQueryOptions<
      Awaited<
        ReturnType<
          typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
        >
      >,
      TError,
      TData
    > & { queryKey: DataTag<QueryKey, TData, TError> };
  };

export type ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetQueryResult =
  NonNullable<
    Awaited<
      ReturnType<
        typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
      >
    >
  >;
export type ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetQueryError =
  HTTPValidationError;

export function useListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet<
  TData = Awaited<
    ReturnType<
      typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
    >
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  params:
    | undefined
    | ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
          >
        >,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<
            ReturnType<
              typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
            >
          >,
          TError,
          Awaited<
            ReturnType<
              typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
            >
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet<
  TData = Awaited<
    ReturnType<
      typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
    >
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  params?: ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
          >
        >,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<
            ReturnType<
              typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
            >
          >,
          TError,
          Awaited<
            ReturnType<
              typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
            >
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet<
  TData = Awaited<
    ReturnType<
      typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
    >
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  params?: ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
          >
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary List Board Webhook Payloads
 */

export function useListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet<
  TData = Awaited<
    ReturnType<
      typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
    >
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  params?: ListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetParams,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof listBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGet
          >
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions =
    getListBoardWebhookPayloadsApiV1BoardsBoardIdWebhooksWebhookIdPayloadsGetQueryOptions(
      boardId,
      webhookId,
      params,
      options,
    );

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}

/**
 * Get a single stored payload for one board webhook.
 * @summary Get Board Webhook Payload
 */
export type getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponse200 =
  {
    data: BoardWebhookPayloadRead;
    status: 200;
  };

export type getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponse422 =
  {
    data: HTTPValidationError;
    status: 422;
  };

export type getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponseSuccess =
  getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponse200 & {
    headers: Headers;
  };
export type getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponseError =
  getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponse422 & {
    headers: Headers;
  };

export type getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponse =

    | getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponseSuccess
    | getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponseError;

export const getGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetUrl =
  (boardId: string, webhookId: string, payloadId: string) => {
    return `/api/v1/boards/${boardId}/webhooks/${webhookId}/payloads/${payloadId}`;
  };

export const getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet =
  async (
    boardId: string,
    webhookId: string,
    payloadId: string,
    options?: RequestInit,
  ): Promise<getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponse> => {
    return customFetch<getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetResponse>(
      getGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetUrl(
        boardId,
        webhookId,
        payloadId,
      ),
      {
        ...options,
        method: "GET",
      },
    );
  };

export const getGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetQueryKey =
  (boardId: string, webhookId: string, payloadId: string) => {
    return [
      `/api/v1/boards/${boardId}/webhooks/${webhookId}/payloads/${payloadId}`,
    ] as const;
  };

export const getGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetQueryOptions =
  <
    TData = Awaited<
      ReturnType<
        typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
      >
    >,
    TError = HTTPValidationError,
  >(
    boardId: string,
    webhookId: string,
    payloadId: string,
    options?: {
      query?: Partial<
        UseQueryOptions<
          Awaited<
            ReturnType<
              typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
            >
          >,
          TError,
          TData
        >
      >;
      request?: SecondParameter<typeof customFetch>;
    },
  ) => {
    const { query: queryOptions, request: requestOptions } = options ?? {};

    const queryKey =
      queryOptions?.queryKey ??
      getGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetQueryKey(
        boardId,
        webhookId,
        payloadId,
      );

    const queryFn: QueryFunction<
      Awaited<
        ReturnType<
          typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
        >
      >
    > = ({ signal }) =>
      getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet(
        boardId,
        webhookId,
        payloadId,
        { signal, ...requestOptions },
      );

    return {
      queryKey,
      queryFn,
      enabled: !!(boardId && webhookId && payloadId),
      ...queryOptions,
    } as UseQueryOptions<
      Awaited<
        ReturnType<
          typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
        >
      >,
      TError,
      TData
    > & { queryKey: DataTag<QueryKey, TData, TError> };
  };

export type GetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetQueryResult =
  NonNullable<
    Awaited<
      ReturnType<
        typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
      >
    >
  >;
export type GetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetQueryError =
  HTTPValidationError;

export function useGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet<
  TData = Awaited<
    ReturnType<
      typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
    >
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  payloadId: string,
  options: {
    query: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
          >
        >,
        TError,
        TData
      >
    > &
      Pick<
        DefinedInitialDataOptions<
          Awaited<
            ReturnType<
              typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
            >
          >,
          TError,
          Awaited<
            ReturnType<
              typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
            >
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): DefinedUseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet<
  TData = Awaited<
    ReturnType<
      typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
    >
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  payloadId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
          >
        >,
        TError,
        TData
      >
    > &
      Pick<
        UndefinedInitialDataOptions<
          Awaited<
            ReturnType<
              typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
            >
          >,
          TError,
          Awaited<
            ReturnType<
              typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
            >
          >
        >,
        "initialData"
      >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
export function useGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet<
  TData = Awaited<
    ReturnType<
      typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
    >
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  payloadId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
          >
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
};
/**
 * @summary Get Board Webhook Payload
 */

export function useGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet<
  TData = Awaited<
    ReturnType<
      typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
    >
  >,
  TError = HTTPValidationError,
>(
  boardId: string,
  webhookId: string,
  payloadId: string,
  options?: {
    query?: Partial<
      UseQueryOptions<
        Awaited<
          ReturnType<
            typeof getBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGet
          >
        >,
        TError,
        TData
      >
    >;
    request?: SecondParameter<typeof customFetch>;
  },
  queryClient?: QueryClient,
): UseQueryResult<TData, TError> & {
  queryKey: DataTag<QueryKey, TData, TError>;
} {
  const queryOptions =
    getGetBoardWebhookPayloadApiV1BoardsBoardIdWebhooksWebhookIdPayloadsPayloadIdGetQueryOptions(
      boardId,
      webhookId,
      payloadId,
      options,
    );

  const query = useQuery(queryOptions, queryClient) as UseQueryResult<
    TData,
    TError
  > & { queryKey: DataTag<QueryKey, TData, TError> };

  return { ...query, queryKey: queryOptions.queryKey };
}
