import type { SWRConfiguration, SWRResponse } from "swr"; import useSWR from "swr"; import client from "../../client"; import type { GetProjectsIdPathParams, GetProjectsIdQueryParams, GetProjectsIdQueryResponse, } from "../models/GetProjectsId"; export function getProjectsIdQueryOptions< TData = GetProjectsIdQueryResponse, TError = unknown, >( id: GetProjectsIdPathParams["id"], params?: GetProjectsIdQueryParams, options: Partial[0]> = {} ): SWRConfiguration { return { fetcher: () => { return client({ method: "get", url: `/projects/${id}`, params, ...options, }); }, }; } /** * @description Retrieve a carbon project by its project ID * @summary Project details * @link /projects/:id */ export function useGetProjectsId< TData = GetProjectsIdQueryResponse, TError = unknown, >( id: GetProjectsIdPathParams["id"], params?: GetProjectsIdQueryParams, options?: { query?: SWRConfiguration; client?: Partial>[0]>; } ): SWRResponse { const { query: queryOptions, client: clientOptions = {} } = options ?? {}; const query = useSWR(`/projects/${id}`, { ...getProjectsIdQueryOptions(id, params, clientOptions), ...queryOptions, }); return query; }