import {z} from 'zod' export type EnvianceRestServicesCommonTimeZoneInfo = {id?: number | undefined, name?: string | undefined, stdOffset?: number | undefined, dstOffset?: number | undefined, currentOffset?: number | undefined}; export type EnvianceBusinessUdfRestUrlItem = {label?: string | undefined, url?: string | undefined}; export type EnvianceRestServicesUdfsProperty = {name?: string | undefined, urlItems?: Array | undefined, values?: Array | undefined, beginDate?: string | undefined, endDate?: string | undefined, caption?: string | undefined, captionLocalized?: string | undefined}; export type EnvianceRestServicesVer2ComplianceModelAddress = {street1?: string | undefined, street2?: string | undefined, street3?: string | undefined, city?: string | undefined, countyOrRegion?: string | undefined, stateOrProvince?: string | undefined, country?: string | undefined, postalCode?: string | undefined}; export type EnvianceRestServicesVer2ComplianceModelGeoLocation = {latitude?: number | undefined, longitude?: number | undefined, latNS?: string | undefined, latDeg?: number | undefined, latMin?: number | undefined, latSec?: number | undefined, longEW?: string | undefined, longDeg?: number | undefined, longMin?: number | undefined, longSec?: number | undefined, utmZone?: string | undefined, utmEast?: number | undefined, utmNorth?: number | undefined, formatType?: number | undefined}; export type EnvianceBusinessTaggingObjectsTagsEntitiesTagHistory = {BeginDate?: string | undefined, EndDate?: string | undefined}; export type EnvianceRestServicesCommonTagAssociationInfo = {tagScheme?: string | undefined, tag?: string | undefined, tagHistory?: Array | undefined}; export type EnvianceRestServicesCommonLocalizationInfo = {culture?: string | undefined, value?: string | undefined}; export type EnvianceRestServicesVer2ComplianceModelMailingAddressInfo = {Country?: string | undefined, State?: string | undefined, City?: string | undefined, PostalCode?: string | undefined, Address1?: string | undefined, Address2?: string | undefined, Address3?: string | undefined}; export type EnvianceRestServicesVer2ComplianceModelContactInfo = {FirstName?: string | undefined, LastName?: string | undefined, Title?: string | undefined, Company?: string | undefined, TelNo?: string | undefined, FaxNo?: string | undefined, Mobile?: string | undefined, Email?: string | undefined}; export type EnvianceRestServicesVer2ComplianceModelLocationHistoryInfo = {BeginDate?: string | undefined, LocationId?: string | undefined, Location?: string | undefined}; export type EnvianceRestServicesVer2ComplianceModelRegulatoryIdentificationInfo = {RCRA?: string | undefined, TRI?: string | undefined, RMP?: string | undefined, StateID1?: string | undefined, StateID2?: string | undefined, StateID3?: string | undefined, LocalID1?: string | undefined, LocalID2?: string | undefined, LocalID3?: string | undefined, IDType1?: string | undefined, IDType2?: string | undefined, IDType3?: string | undefined, IDNo1?: string | undefined, IDNo2?: string | undefined, IDNo3?: string | undefined}; export type EnvianceRestServicesVer2ComplianceModelLocationInfo = {id?: unknown | undefined, name?: string | undefined, isSensitiveData?: boolean | undefined, CorityLink?: boolean | undefined, CorityCachedID?: number | undefined, CorityObjectType?: string | undefined, type?: string | undefined, parentPath?: string | undefined, parentPathLocalized?: string | undefined, timeZone?: EnvianceRestServicesCommonTimeZoneInfo | undefined, activeDate?: string | undefined, inactiveDate?: string | undefined, responsibleUser?: string | undefined, fieldTemplate?: string | undefined, calcFieldTemplate?: string | undefined, fieldValues?: Array | undefined, calcFieldValues?: Array | undefined, description?: string | undefined, address?: EnvianceRestServicesVer2ComplianceModelAddress | undefined, documents?: Array | undefined, geoLocation?: EnvianceRestServicesVer2ComplianceModelGeoLocation | undefined, security: unknown, tags?: Array | undefined, namelocalized?: Array | undefined, mailingAddress?: EnvianceRestServicesVer2ComplianceModelMailingAddressInfo | undefined, contactInformation?: EnvianceRestServicesVer2ComplianceModelContactInfo | undefined, locationHistory?: Array | undefined, regulatoryIdentification?: EnvianceRestServicesVer2ComplianceModelRegulatoryIdentificationInfo | undefined, note?: string | undefined, SIC1?: string | undefined, SIC2?: string | undefined, dunBradNo?: string | undefined, otherAddress?: string | undefined}; export type UpdateLocation = {locationInfo?: EnvianceRestServicesVer2ComplianceModelLocationInfo | undefined}; export type PatchApiVer2ComplianceServiceSvcLocationsLocationIdOrPathArgs = {'EnvApi-Systemid'?: string | undefined, 'EnvApi-Packageid'?: string | undefined, 'EnvApi-Udf-DateTime-Iso-In-CustomFields'?: string | undefined, 'EnvApi-Udf-DateTime-ReadInUserTz'?: string | undefined, 'EnvApi-Udf-Value-Invariant'?: string | undefined, 'EnvApi-Localization-All'?: string | undefined, 'x-client-request-id'?: string | undefined, locationIdOrPath: string, body: UpdateLocation}; export type PatchApiVer2ComplianceServiceSvcLocationsLocationIdOrPathOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; export const patchApiVer2ComplianceServiceSvcLocationsLocationIdOrPathResponse = z.string(); export const validateResponse = async ( schema: { readonly '~standard': { readonly validate: (value: unknown) => ({ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }) | Promise<{ readonly value: Output; readonly issues?: undefined } | { readonly issues: ReadonlyArray<{ readonly message: string; readonly path?: ReadonlyArray | undefined }> }> } }, value: unknown ): Promise => { const result = await schema['~standard'].validate(value) if (result.issues !== undefined) { const detail = result.issues .map(({ message, path }) => path?.length ? `${path.map((segment) => String(typeof segment === 'object' ? segment.key : segment)).join('.')}: ${message}` : message ) .join('; ') throw new Error(`Response does not match the schema: ${detail}`, { cause: { issues: result.issues } }) } return result.value }; /** * PATCH /ver2/ComplianceService.svc/locations/{locationIdOrPath} */ export const patchApiVer2ComplianceServiceSvcLocationsLocationIdOrPath = async (args: PatchApiVer2ComplianceServiceSvcLocationsLocationIdOrPathArgs, options: PatchApiVer2ComplianceServiceSvcLocationsLocationIdOrPathOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args['EnvApi-Systemid'] != null) headers.set("EnvApi-Systemid", String(args['EnvApi-Systemid'])) if (args['EnvApi-Packageid'] != null) headers.set("EnvApi-Packageid", String(args['EnvApi-Packageid'])) if (args['EnvApi-Udf-DateTime-Iso-In-CustomFields'] != null) headers.set("EnvApi-Udf-DateTime-Iso-In-CustomFields", String(args['EnvApi-Udf-DateTime-Iso-In-CustomFields'])) if (args['EnvApi-Udf-DateTime-ReadInUserTz'] != null) headers.set("EnvApi-Udf-DateTime-ReadInUserTz", String(args['EnvApi-Udf-DateTime-ReadInUserTz'])) if (args['EnvApi-Udf-Value-Invariant'] != null) headers.set("EnvApi-Udf-Value-Invariant", String(args['EnvApi-Udf-Value-Invariant'])) if (args['EnvApi-Localization-All'] != null) headers.set("EnvApi-Localization-All", String(args['EnvApi-Localization-All'])) if (args['x-client-request-id'] != null) headers.set("x-client-request-id", String(args['x-client-request-id'])) const url = `${baseUrl.replace(/\/+$/, '')}/ver2/ComplianceService.svc/locations/${encodeURIComponent(String(args.locationIdOrPath))}${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 validateResponse(patchApiVer2ComplianceServiceSvcLocationsLocationIdOrPathResponse, await res.json()) };