export type WorksiteData = {field_value: string, field_key?: (string | null) | undefined}; export type WorksiteTypes = {id?: number | undefined, work_type: number, claimed_by?: (number | null) | undefined, phase?: (number | null) | undefined, status?: (string | null) | undefined, recur?: (string | null) | undefined, next_recur_at?: (string | null) | undefined, created_at?: string | undefined}; export type Flag = {id?: number | undefined, reason_t?: (string | null) | undefined, is_high_priority?: (boolean | null) | undefined, notes?: string | undefined, requested_action?: (string | null) | undefined, action?: (string | null) | undefined, created_at?: string | undefined, flag_id?: number | undefined, attr?: (Record | null) | undefined}; export type WorksiteNotes = {id?: number | undefined, note: string, created_at?: string | undefined, is_survivor?: string | undefined, note_type?: ('ai_generated_call_summary' | 'survivor_note' | 'volunteer_note' | 'auto_generated_flag_note') | undefined}; export type WorksiteUsersTime = {id?: number | undefined, worksite?: (number | null) | undefined, volunteers?: (number | null) | undefined, created_by_name?: string | undefined, created_by_org?: string | undefined, seconds?: (number | null) | undefined}; export type FileJoin = {tag?: (string | null) | undefined, title?: (string | null) | undefined, notes?: (string | null) | undefined, created_at?: string | undefined, file_updated_at?: string | undefined, id?: number | undefined, file: number | null, filename?: string | undefined, url?: string | undefined, full_url?: string | undefined, general_file_url?: string | undefined, blog_url?: string | undefined, large_blog_url?: string | undefined, large_thumbnail_url?: string | undefined, small_thumbnail_url?: string | undefined, filename_original?: string | undefined, file_type_t?: string | undefined, mime_content_type?: string | undefined, attr?: string | undefined, image_exif?: string | undefined}; export type Worksite = {id?: number | undefined, name?: string | undefined, address?: string | undefined, case_number?: string | undefined, phone1?: string | undefined, phone2?: string | undefined, phone1_notes?: (string | null) | undefined, phone2_notes?: (string | null) | undefined, email?: string | undefined, location: string | null, blurred_location?: (string | null) | undefined, form_data: Array, postal_code?: string | undefined, incident: number | null, work_types?: Array | undefined, city?: string | undefined, language?: (number | null) | undefined, state?: string | undefined, county?: string | undefined, skip_duplicate_check?: boolean | undefined, send_sms?: boolean | undefined, flags?: Array | undefined, notes?: Array | undefined, what3words?: (string | null) | undefined, pluscode?: (string | null) | undefined, reported_by?: (number | null) | undefined, updated_at?: string | undefined, events?: string | undefined, key_work_type?: string | undefined, time?: Array | undefined, files?: Array | undefined, favorite?: string | undefined, svi?: (unknown | null) | undefined, auto_contact_frequency_t?: (string | null) | undefined}; export type PatchApiWorksitesIdArgs = {body: Worksite}; export type PatchApiWorksitesIdOptions = {baseUrl?: string | undefined, Token?: string | undefined, fetch?: typeof fetch | undefined}; /** * Partially update worksite * * PATCH /worksites/{id} */ export const patchApiWorksitesId = async (args: PatchApiWorksitesIdArgs, options?: PatchApiWorksitesIdOptions) => { const {baseUrl = "https://crisiscleanup-3-api-production.up.railway.app", fetch: fetchFn = fetch, Token} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (Token !== undefined) headers.set("Authorization", Token) const url = `${baseUrl.replace(/\/+$/, '')}/worksites/${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 };