export type ProductId = {productId?: string | undefined}; export type DeliveryAreaPostalCodeRange = {firstPostalCode?: string | undefined, lastPostalCode?: string | undefined}; export type DeliveryArea = {postalCodeRange?: DeliveryAreaPostalCodeRange | undefined, regionCode?: string | undefined, countryCode?: string | undefined}; export type ProductDeliveryTimeAreaDeliveryTimeDeliveryTime = {minHandlingTimeDays?: number | undefined, maxHandlingTimeDays?: number | undefined, minTransitTimeDays?: number | undefined, maxTransitTimeDays?: number | undefined}; export type ProductDeliveryTimeAreaDeliveryTime = {deliveryArea?: DeliveryArea | undefined, deliveryTime?: ProductDeliveryTimeAreaDeliveryTimeDeliveryTime | undefined}; export type ProductDeliveryTime = {productId?: ProductId | undefined, areaDeliveryTimes?: Array | undefined}; export type CreateApiMerchantIdProductdeliverytimeArgs = {merchantId: string, body: ProductDeliveryTime}; export type CreateApiMerchantIdProductdeliverytimeOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Creates or updates the delivery time of a product. * * POST /{merchantId}/productdeliverytime */ export const createApiMerchantIdProductdeliverytime = async (args: CreateApiMerchantIdProductdeliverytimeArgs, options?: CreateApiMerchantIdProductdeliverytimeOptions) => { 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))}/productdeliverytime${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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() };