import type { SWRConfiguration, SWRResponse } from "swr"; import useSWR from "swr"; import client from "../../client"; import type { GetVintagesQueryParams, GetVintagesQueryResponse, } from "../models/GetVintages"; export function getVintagesQueryOptions< TData = GetVintagesQueryResponse, TError = unknown, >( params?: GetVintagesQueryParams, options: Partial[0]> = {} ): SWRConfiguration { return { fetcher: () => { return client({ method: "get", url: `/vintages`, params, ...options, }); }, }; } /** * @description Retrieve an array of the vintages of available carbon projects * @summary Vintages * @link /vintages */ export function useGetVintages< TData = GetVintagesQueryResponse, TError = unknown, >( params?: GetVintagesQueryParams, options?: { query?: SWRConfiguration; client?: Partial>[0]>; } ): SWRResponse { const { query: queryOptions, client: clientOptions = {} } = options ?? {}; const query = useSWR(`/vintages`, { ...getVintagesQueryOptions(params, clientOptions), ...queryOptions, }); return query; }