/* eslint-disable */
// This code is autogenerated using @harnessio/oats-cli.
// Please do not modify this code directly.
import { useQuery, UseQueryOptions } from '@tanstack/react-query';

import type { Project } from '../schemas/Project';
import { fetcher, FetcherOptions } from 'services/fetcher';

export type ListProjectsOkResponse = {
  data?: Project[];
};

export type ListProjectsErrorResponse = unknown;

export interface ListProjectsProps extends Omit<FetcherOptions<unknown, unknown>, 'url'> {}

export function listProjects(props: ListProjectsProps): Promise<ListProjectsOkResponse> {
  return fetcher<ListProjectsOkResponse, unknown, unknown>({
    url: `/auth/list_projects`,
    method: 'GET',
    ...props
  });
}

/**
 * This API is used to get project details of logged in user
 *
 */
export function useListProjectsQuery(
  props: ListProjectsProps,
  options?: Omit<UseQueryOptions<ListProjectsOkResponse, ListProjectsErrorResponse>, 'queryKey' | 'queryFn'>
) {
  return useQuery<ListProjectsOkResponse, ListProjectsErrorResponse>(
    ['listProjects'],
    ({ signal }) => listProjects({ ...props, signal }),
    options
  );
}
