export type AddressLayoutV2AppliesTo = {country_iso: string, datasets: Array, language?: (string | null) | undefined, script?: (string | null) | undefined}; export type AddressLayoutV2ElementConfigurationWithDefault = {default?: (string | null) | undefined, configuration_by_element?: ({[key: string]: string | null} | null) | undefined}; export type AddressLayoutV2Options = {variation?: number | undefined, flatten_diacritics?: boolean | undefined, use_secondary_postcode?: (string | null) | undefined, enable_enhanced_layout?: boolean | undefined, display_enhanced_info_on_picklist?: boolean | undefined, enable_intelligent_layout?: boolean | undefined, capitalise_unused?: boolean | undefined, separate_elements?: boolean | undefined, element_separator?: AddressLayoutV2ElementConfigurationWithDefault | undefined, retention_element_separator?: AddressLayoutV2ElementConfigurationWithDefault | undefined, prepend_element_separator?: AddressLayoutV2ElementConfigurationWithDefault | undefined, separate_element_separator?: AddressLayoutV2ElementConfigurationWithDefault | undefined, terminate_lines?: boolean | undefined, line_terminator?: AddressLayoutV2ElementConfigurationWithDefault | undefined, conditional_format?: (string | null) | undefined, pad_lines?: boolean | undefined, padding_character?: (string | null) | undefined, multiple_dataplus_delimiter?: (string | null) | undefined, abbreviate_item?: (Array | null) | undefined, capitalise_item?: (Array | null) | undefined, exclude_item?: (Array | null) | undefined, element_extras?: ({[key: string]: string | null} | null) | undefined}; export type AddressLayoutV2LineElement = {element_name?: (string | null) | undefined}; export type AddressLayoutV2Line = {line_name?: (string | null) | undefined, max_width?: (number | null) | undefined, elements?: (Array | null) | undefined}; export type AddressLayoutsV2UpdateLayout = {id: string, name: string, comment?: (string | null) | undefined, applies_to: Array, options?: AddressLayoutV2Options | undefined, lines: Array}; export type AddressLayoutsV2UpdateRequest = {layout: AddressLayoutsV2UpdateLayout}; export type UpdateApiAddressLayoutsV2NameArgs = {'Reference-Id'?: string | undefined, name: string, body: AddressLayoutsV2UpdateRequest}; export type UpdateApiAddressLayoutsV2NameOptions = {baseUrl?: string | undefined, OAuth2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates an address layout. * * PUT /address/layouts/v2/{name} * * Also accepts auth: Auth-Token, x-app-key */ export const updateApiAddressLayoutsV2Name = async (args: UpdateApiAddressLayoutsV2NameArgs, options?: UpdateApiAddressLayoutsV2NameOptions) => { const {baseUrl = "https://api.experianaperture.io", fetch: fetchFn = fetch, OAuth2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (args['Reference-Id'] != null) headers.set("Reference-Id", String(args['Reference-Id'])) if (OAuth2 !== undefined) headers.set('authorization', `Bearer ${OAuth2}`) const url = `${baseUrl.replace(/\/+$/, '')}/address/layouts/v2/${encodeURIComponent(String(args.name))}${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 };