export type ActivityUpdate = {activity?: ({comment?: string | undefined, feeling?: string | undefined, image_url?: string | undefined, is_visible?: boolean | undefined, location?: string | undefined, latitude?: number | undefined, longitude?: number | undefined, time?: number | undefined, state?: string | undefined, progress?: Record | undefined}) | undefined}; export type PatchApiV1ActivitiesIdArgs = {id: number, body: ActivityUpdate}; export type PatchApiV1ActivitiesIdOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update activity * * PATCH /v1/activities/{id} */ export const patchApiV1ActivitiesId = async (args: PatchApiV1ActivitiesIdArgs, options?: PatchApiV1ActivitiesIdOptions) => { const {baseUrl = "http://localhost:3000", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/activities/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };