export type Price = {value?: string | undefined, currency?: string | undefined}; export type CustomAttribute = {groupValues?: Array | undefined, name?: string | undefined, value?: string | undefined}; export type RegionalInventory = {price?: Price | undefined, regionId?: string | undefined, availability?: string | undefined, customAttributes?: Array | undefined, kind?: string | undefined, salePriceEffectiveDate?: string | undefined, salePrice?: Price | undefined}; export type RegionalinventoryCustomBatchRequestEntry = {method?: string | undefined, productId?: string | undefined, batchId?: number | undefined, regionalInventory?: RegionalInventory | undefined, merchantId?: unknown | undefined}; export type RegionalinventoryCustomBatchRequest = {entries?: Array | undefined}; export type CreateApiRegionalinventoryBatchArgs = {body: RegionalinventoryCustomBatchRequest}; export type CreateApiRegionalinventoryBatchOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates regional inventory for multiple products or regions in a single request. * * POST /regionalinventory/batch */ export const createApiRegionalinventoryBatch = async (args: CreateApiRegionalinventoryBatchArgs, options?: CreateApiRegionalinventoryBatchOptions) => { 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(/\/+$/, '')}/regionalinventory/batch${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() };