export type GetApiEcologyApiV1SitesSiteIdArgs = {'site-id': string}; export type GetApiEcologyApiV1SitesSiteIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Get site by ID * * GET /ecology/api/v1/sites/{site-id} */ export const getApiEcologyApiV1SitesSiteId = async (args: GetApiEcologyApiV1SitesSiteIdArgs, options: GetApiEcologyApiV1SitesSiteIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/ecology/api/v1/sites/${encodeURIComponent(String(args['site-id']))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };