/* 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 { GetApiTokensResponse } from '../schemas/GetApiTokensResponse';
import type { ErrorModel } from '../schemas/ErrorModel';
import { fetcher, FetcherOptions } from 'services/fetcher';

export interface GetApiTokensQueryPathParams {
  user_id: string;
}

export type GetApiTokensOkResponse = GetApiTokensResponse;

export type GetApiTokensErrorResponse = ErrorModel;

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

export function getApiTokens(props: GetApiTokensProps): Promise<GetApiTokensOkResponse> {
  return fetcher<GetApiTokensOkResponse, unknown, unknown>({
    url: `/auth/token/${props.user_id}`,
    method: 'GET',
    ...props
  });
}

/**
 * This API is used to get the api-tokens of a user by passing uid
 */
export function useGetApiTokensQuery(
  props: GetApiTokensProps,
  options?: Omit<UseQueryOptions<GetApiTokensOkResponse, GetApiTokensErrorResponse>, 'queryKey' | 'queryFn'>
) {
  return useQuery<GetApiTokensOkResponse, GetApiTokensErrorResponse>(
    ['getApiTokens', props.user_id],
    ({ signal }) => getApiTokens({ ...props, signal }),
    options
  );
}
