export type CreateApiAnnotationsUuidVoteArgs = {uuid: Array}; export type CreateApiAnnotationsUuidVoteOptions = {baseUrl?: string | undefined, userJwtRequired?: string | undefined, fetch?: typeof fetch | undefined}; /** * Vote on an annotation * * POST /annotations/{uuid}/vote */ export const createApiAnnotationsUuidVote = async (args: CreateApiAnnotationsUuidVoteArgs, options?: CreateApiAnnotationsUuidVoteOptions) => { const {baseUrl = "https://api.inaturalist.org/v2", fetch: fetchFn = fetch, userJwtRequired} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (userJwtRequired !== undefined) headers.set("Authorization", userJwtRequired) const url = `${baseUrl.replace(/\/+$/, '')}/annotations/${encodeURIComponent(String(args.uuid))}/vote${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };