import type { SWRConfiguration, SWRResponse } from "swr"; import useSWR from "swr"; import client from "../../client"; import type { GetCountriesQueryResponse } from "../models/GetCountries"; export function getCountriesQueryOptions< TData = GetCountriesQueryResponse, TError = unknown, >( options: Partial[0]> = {} ): SWRConfiguration { return { fetcher: () => { return client({ method: "get", url: `/countries`, ...options, }); }, }; } /** * @description Retrieve an array containing the countries that carbon projects originate from * @summary Countries * @link /countries */ export function useGetCountries< TData = GetCountriesQueryResponse, TError = unknown, >(options?: { query?: SWRConfiguration; client?: Partial>[0]>; }): SWRResponse { const { query: queryOptions, client: clientOptions = {} } = options ?? {}; const query = useSWR(`/countries`, { ...getCountriesQueryOptions(clientOptions), ...queryOptions, }); return query; }