export type RegionPostalCodeAreaPostalCodeRange = {begin?: string | undefined, end?: string | undefined}; export type RegionPostalCodeArea = {regionCode?: string | undefined, postalCodes?: Array | undefined}; export type RegionGeoTargetArea = {geotargetCriteriaIds?: Array | undefined}; export type Region = {postalCodeArea?: RegionPostalCodeArea | undefined, regionalInventoryEligible?: boolean | undefined, geotargetArea?: RegionGeoTargetArea | undefined, shippingEligible?: boolean | undefined, merchantId?: unknown | undefined, displayName?: string | undefined, regionId?: string | undefined}; export type PatchApiMerchantIdRegionsRegionIdArgs = {merchantId: string, regionId: string, updateMask?: string | undefined, body: Region}; export type PatchApiMerchantIdRegionsRegionIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates a region definition in your Merchant Center account. * * PATCH /{merchantId}/regions/{regionId} */ export const patchApiMerchantIdRegionsRegionId = async (args: PatchApiMerchantIdRegionsRegionIdArgs, options?: PatchApiMerchantIdRegionsRegionIdOptions) => { const {baseUrl = "https://shoppingcontent.googleapis.com/content/v2.1", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") if (args.updateMask != null) query.append("updateMask", String(args.updateMask)) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.merchantId))}/regions/${encodeURIComponent(String(args.regionId))}${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 res.blob() };