export type ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperServiceChannelApiModelWorkordersComplianceWorkOrderComplianceStatus = {Value?: ('Open' | 'Expired' | 'InvalidDocument' | 'Pass' | 'PassWithRecommendation' | 'Fail' | 'FailWithRemediation') | undefined}; export type ServiceChannelApiModelWorkordersComplianceComplianceAttachment = {Name?: string | undefined, Uri?: string | undefined}; export type ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperServiceChannelApiModelWorkordersComplianceComplianceAttachment = {Value?: ServiceChannelApiModelWorkordersComplianceComplianceAttachment | undefined}; export type ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperSystemNullableSystemDateTimeOffset = {Value?: string | undefined}; export type ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperSystemString = {Value?: string | undefined}; export type ServiceChannelServicesWebApiModelsRequestCompliancePartialUpdateWorkOrderComplianceRequest = {Status?: ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperServiceChannelApiModelWorkordersComplianceWorkOrderComplianceStatus | undefined, Attachment?: ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperServiceChannelApiModelWorkordersComplianceComplianceAttachment | undefined, ValidFromDate?: ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperSystemNullableSystemDateTimeOffset | undefined, ValidToDate?: ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperSystemNullableSystemDateTimeOffset | undefined, RemediationDueDate?: ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperSystemNullableSystemDateTimeOffset | undefined, Comment?: ServiceChannelServicesWebApiModelsRequestCompliancePatchedDataWrapperSystemString | undefined}; export type PatchApiWorkordersWorkOrderIdComplianceArgs = {workOrderId: number, body: ServiceChannelServicesWebApiModelsRequestCompliancePartialUpdateWorkOrderComplianceRequest}; export type PatchApiWorkordersWorkOrderIdComplianceOptions = {baseUrl?: string | undefined, oauth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Partial update the compliance for a work order * * PATCH /workorders/{workOrderId}/compliance */ export const patchApiWorkordersWorkOrderIdCompliance = async (args: PatchApiWorkordersWorkOrderIdComplianceArgs, options?: PatchApiWorkordersWorkOrderIdComplianceOptions) => { 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(/\/+$/, '')}/workorders/${encodeURIComponent(String(args.workOrderId))}/compliance${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 };