export type ProductWeight = {unit?: string | undefined, value?: number | undefined}; export type ProductDimension = {value?: number | undefined, unit?: string | undefined}; export type ProductShippingDimension = {value?: number | undefined, unit?: string | undefined}; export type Price = {value?: string | undefined, currency?: string | undefined}; export type FreeShippingThreshold = {priceThreshold?: Price | undefined, country?: string | undefined}; export type ProductShipping = {postalCode?: string | undefined, country?: string | undefined, service?: string | undefined, locationGroupName?: string | undefined, locationId?: unknown | undefined, maxHandlingTime?: unknown | undefined, maxTransitTime?: unknown | undefined, region?: string | undefined, minTransitTime?: unknown | undefined, price?: Price | undefined, minHandlingTime?: unknown | undefined}; export type ProductSubscriptionCost = {periodLength?: unknown | undefined, period?: string | undefined, amount?: Price | undefined}; export type ProductShippingWeight = {unit?: string | undefined, value?: number | undefined}; export type ProductStructuredTitle = {digitalSourceType?: string | undefined, content?: string | undefined}; export type ProductSustainabilityIncentive = {amount?: Price | undefined, type?: ('TYPE_UNSPECIFIED' | 'EV_TAX_CREDIT' | 'EV_PRICE_DISCOUNT') | undefined, percentage?: number | undefined}; export type LoyaltyProgram = {price?: Price | undefined, memberPriceEffectiveDate?: string | undefined, programLabel?: string | undefined, cashbackForFutureUse?: Price | undefined, shippingLabel?: string | undefined, tierLabel?: string | undefined, loyaltyPoints?: unknown | undefined}; export type Installment = {months?: unknown | undefined, downpayment?: Price | undefined, amount?: Price | undefined, creditType?: string | undefined}; export type ProductUnitPricingBaseMeasure = {value?: unknown | undefined, unit?: string | undefined}; export type CustomAttribute = {groupValues?: Array | undefined, name?: string | undefined, value?: string | undefined}; export type ProductStructuredDescription = {digitalSourceType?: string | undefined, content?: string | undefined}; export type ProductCertification = {certificationAuthority?: string | undefined, certificationCode?: string | undefined, certificationName?: string | undefined, certificationValue?: string | undefined}; export type ProductTax = {country?: string | undefined, taxShip?: boolean | undefined, region?: string | undefined, postalCode?: string | undefined, rate?: number | undefined, locationId?: unknown | undefined}; export type CloudExportAdditionalProperties = {maxValue?: number | undefined, propertyName?: string | undefined, minValue?: number | undefined, textValue?: Array | undefined, intValue?: Array | undefined, floatValue?: Array | undefined, boolValue?: boolean | undefined, unitCode?: string | undefined}; export type ProductProductDetail = {attributeValue?: string | undefined, sectionName?: string | undefined, attributeName?: string | undefined}; export type ProductUnitPricingMeasure = {value?: number | undefined, unit?: string | undefined}; export type Product = {promotionIds?: Array | undefined, color?: string | undefined, isBundle?: boolean | undefined, virtualModelLink?: string | undefined, id?: string | undefined, productWeight?: ProductWeight | undefined, title?: string | undefined, gender?: string | undefined, productWidth?: ProductDimension | undefined, excludedDestinations?: Array | undefined, customLabel1?: string | undefined, channel?: string | undefined, adult?: boolean | undefined, sizeType?: string | undefined, expirationDate?: string | undefined, multipack?: unknown | undefined, transitTimeLabel?: string | undefined, displayAdsValue?: number | undefined, taxCategory?: string | undefined, productTypes?: Array | undefined, shippingHeight?: ProductShippingDimension | undefined, gtin?: string | undefined, mpn?: string | undefined, maximumRetailPrice?: Price | undefined, disclosureDate?: string | undefined, freeShippingThreshold?: Array | undefined, minHandlingTime?: unknown | undefined, shoppingAdsExcludedCountries?: Array | undefined, shipping?: Array | undefined, mobileLink?: string | undefined, maxHandlingTime?: unknown | undefined, subscriptionCost?: ProductSubscriptionCost | undefined, sellOnGoogleQuantity?: unknown | undefined, customLabel3?: string | undefined, price?: Price | undefined, lifestyleImageLinks?: Array | undefined, description?: string | undefined, feedLabel?: string | undefined, shippingLabel?: string | undefined, productHeight?: ProductDimension | undefined, shippingLength?: ProductShippingDimension | undefined, shippingWeight?: ProductShippingWeight | undefined, contentLanguage?: string | undefined, googleProductCategory?: string | undefined, displayAdsLink?: string | undefined, externalSellerId?: string | undefined, linkTemplate?: string | undefined, structuredTitle?: ProductStructuredTitle | undefined, availability?: string | undefined, condition?: string | undefined, sustainabilityIncentives?: Array | undefined, loyaltyPrograms?: Array | undefined, material?: string | undefined, source?: string | undefined, pause?: string | undefined, loyaltyProgram?: LoyaltyProgram | undefined, displayAdsId?: string | undefined, installment?: Installment | undefined, productHighlights?: Array | undefined, customLabel2?: string | undefined, unitPricingBaseMeasure?: ProductUnitPricingBaseMeasure | undefined, salePrice?: Price | undefined, ageGroup?: string | undefined, mobileLinkTemplate?: string | undefined, brand?: string | undefined, pickupSla?: string | undefined, includedDestinations?: Array | undefined, displayAdsTitle?: string | undefined, targetCountry?: string | undefined, itemGroupId?: string | undefined, pattern?: string | undefined, adsRedirect?: string | undefined, identifierExists?: boolean | undefined, productLength?: ProductDimension | undefined, energyEfficiencyClass?: string | undefined, maxEnergyEfficiencyClass?: string | undefined, kind?: string | undefined, customAttributes?: Array | undefined, salePriceEffectiveDate?: string | undefined, costOfGoodsSold?: Price | undefined, sizeSystem?: string | undefined, canonicalLink?: string | undefined, structuredDescription?: ProductStructuredDescription | undefined, customLabel0?: string | undefined, certifications?: Array | undefined, taxes?: Array | undefined, additionalImageLinks?: Array | undefined, link?: string | undefined, displayAdsSimilarIds?: Array | undefined, shippingWidth?: ProductShippingDimension | undefined, autoPricingMinPrice?: Price | undefined, offerId?: string | undefined, pickupMethod?: string | undefined, sizes?: Array | undefined, adsGrouping?: string | undefined, cloudExportAdditionalProperties?: Array | undefined, additionalSizeType?: string | undefined, minEnergyEfficiencyClass?: string | undefined, availabilityDate?: string | undefined, adsLabels?: Array | undefined, productDetails?: Array | undefined, unitPricingMeasure?: ProductUnitPricingMeasure | undefined, customLabel4?: string | undefined, imageLink?: string | undefined}; export type CreateApiMerchantIdProductsArgs = {merchantId: string, feedId?: string | undefined, body: Product}; export type CreateApiMerchantIdProductsOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Uploads a product to your Merchant Center account. If an item with the same channel, contentLanguage, offerId, and targetCountry already exists, this method updates that entry. * * POST /{merchantId}/products */ export const createApiMerchantIdProducts = async (args: CreateApiMerchantIdProductsArgs, options?: CreateApiMerchantIdProductsOptions) => { 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.feedId != null) query.append("feedId", String(args.feedId)) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.merchantId))}/products${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() };