export type UpdateApiWorkordersWorkOrderIdUpdateWorkOrderLeakInspectionInfoArgs = {workOrderId: number, refrigerantWasUsed: boolean, leakWasDetected: boolean}; export type UpdateApiWorkordersWorkOrderIdUpdateWorkOrderLeakInspectionInfoOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update the leak inspection information * * PUT /workorders/{workOrderId}/UpdateWorkOrderLeakInspectionInfo */ export const updateApiWorkordersWorkOrderIdUpdateWorkOrderLeakInspectionInfo = async (args: UpdateApiWorkordersWorkOrderIdUpdateWorkOrderLeakInspectionInfoArgs, options?: UpdateApiWorkordersWorkOrderIdUpdateWorkOrderLeakInspectionInfoOptions) => { const {baseUrl = "https://sb2api.servicechannel.com/v3", fetch: fetchFn = fetch, oauth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.refrigerantWasUsed != null) query.append("refrigerantWasUsed", String(args.refrigerantWasUsed)) if (args.leakWasDetected != null) query.append("leakWasDetected", String(args.leakWasDetected)) if (oauth2 !== undefined) headers.set('authorization', `Bearer ${oauth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/workorders/${encodeURIComponent(String(args.workOrderId))}/UpdateWorkOrderLeakInspectionInfo${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };