export type PriceAmount = {value?: string | undefined, currency?: string | undefined}; export type ReturnPolicyOnlineRestockingFee = {fixedFee?: PriceAmount | undefined, microPercent?: number | undefined}; export type ReturnPolicyOnlinePolicy = {type?: ('TYPE_UNSPECIFIED' | 'NUMBER_OF_DAYS_AFTER_DELIVERY' | 'NO_RETURNS' | 'LIFETIME_RETURNS') | undefined, days?: unknown | undefined}; export type ReturnPolicyOnlineReturnShippingFee = {type?: ('TYPE_UNSPECIFIED' | 'FIXED' | 'CUSTOMER_PAYING_ACTUAL_FEE') | undefined, fixedFee?: PriceAmount | undefined}; export type ReturnPolicyOnlineReturnReasonCategoryInfo = {returnLabelSource?: ('RETURN_LABEL_SOURCE_UNSPECIFIED' | 'DOWNLOAD_AND_PRINT' | 'IN_THE_BOX' | 'CUSTOMER_RESPONSIBILITY') | undefined, returnReasonCategory?: ('RETURN_REASON_CATEGORY_UNSPECIFIED' | 'BUYER_REMORSE' | 'ITEM_DEFECT') | undefined, returnShippingFee?: ReturnPolicyOnlineReturnShippingFee | undefined}; export type ReturnPolicyOnline = {restockingFee?: ReturnPolicyOnlineRestockingFee | undefined, returnMethods?: (Array<'RETURN_METHOD_UNSPECIFIED' | 'BY_MAIL' | 'IN_STORE' | 'AT_A_KIOSK'>) | undefined, policy?: ReturnPolicyOnlinePolicy | undefined, returnPolicyUri?: string | undefined, itemConditions?: (Array<'ITEM_CONDITION_UNSPECIFIED' | 'NEW' | 'USED'>) | undefined, returnPolicyId?: string | undefined, name?: string | undefined, countries?: Array | undefined, label?: string | undefined, returnReasonCategoryInfo?: Array | undefined}; export type PatchApiMerchantIdReturnpolicyonlineReturnPolicyIdArgs = {merchantId: string, returnPolicyId: string, body: ReturnPolicyOnline}; export type PatchApiMerchantIdReturnpolicyonlineReturnPolicyIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates an existing return policy. * * PATCH /{merchantId}/returnpolicyonline/{returnPolicyId} */ export const patchApiMerchantIdReturnpolicyonlineReturnPolicyId = async (args: PatchApiMerchantIdReturnpolicyonlineReturnPolicyIdArgs, options?: PatchApiMerchantIdReturnpolicyonlineReturnPolicyIdOptions) => { 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 (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.merchantId))}/returnpolicyonline/${encodeURIComponent(String(args.returnPolicyId))}${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() };