export type ServiceChannelServicesMessagingRefrigerantTrackingUpdateLeakRecordRequest = {Id: number, Note?: string | undefined, RepairDate?: string | undefined, InitialDate?: string | undefined, InitialMethod?: number | undefined, FollowUpDate?: string | undefined, FollowUpMethod?: number | undefined, LeakLocationId?: number | undefined, FaultCodeId?: number | undefined, ActionCodeId?: number | undefined, LeakAreaId?: number | undefined, CurrentTrackingNumber?: number | undefined, CompletedDate?: string | undefined}; export type UpdateApiRefrigeranttrackingLeakrecordArgs = {body: ServiceChannelServicesMessagingRefrigerantTrackingUpdateLeakRecordRequest}; export type UpdateApiRefrigeranttrackingLeakrecordOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Complete/update a leak event * * PUT /refrigeranttracking/leakrecord */ export const updateApiRefrigeranttrackingLeakrecord = async (args: UpdateApiRefrigeranttrackingLeakrecordArgs, options?: UpdateApiRefrigeranttrackingLeakrecordOptions) => { const {baseUrl = "https://sb2api.servicechannel.com/v3", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/refrigeranttracking/leakrecord${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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 };