import type { SWRConfiguration, SWRResponse } from "swr"; import useSWR from "swr"; import client from "../../client"; import type { GetCategoriesQueryResponse } from "../models/GetCategories"; export function getCategoriesQueryOptions< TData = GetCategoriesQueryResponse, TError = unknown, >( options: Partial[0]> = {} ): SWRConfiguration { return { fetcher: () => { return client({ method: "get", url: `/categories`, ...options, }); }, }; } /** * @description A list of all methodology categories used to delineate every project in the marketplace. A project may belong to one or more of these categories. * @summary Categories * @link /categories */ export function useGetCategories< TData = GetCategoriesQueryResponse, TError = unknown, >(options?: { query?: SWRConfiguration; client?: Partial>[0]>; }): SWRResponse { const { query: queryOptions, client: clientOptions = {} } = options ?? {}; const query = useSWR(`/categories`, { ...getCategoriesQueryOptions(clientOptions), ...queryOptions, }); return query; }