export type Price = {value?: string | undefined, currency?: string | undefined}; export type CustomAttribute = {groupValues?: Array | undefined, name?: string | undefined, value?: string | undefined}; export type LocalInventory = {price?: Price | undefined, quantity?: number | undefined, kind?: string | undefined, pickupSla?: string | undefined, salePrice?: Price | undefined, instoreProductLocation?: string | undefined, availability?: string | undefined, pickupMethod?: string | undefined, customAttributes?: Array | undefined, storeCode?: string | undefined, salePriceEffectiveDate?: string | undefined}; export type LocalinventoryCustomBatchRequestEntry = {localInventory?: LocalInventory | undefined, batchId?: number | undefined, merchantId?: unknown | undefined, method?: string | undefined, productId?: string | undefined}; export type LocalinventoryCustomBatchRequest = {entries?: Array | undefined}; export type CreateApiLocalinventoryBatchArgs = {body: LocalinventoryCustomBatchRequest}; export type CreateApiLocalinventoryBatchOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Updates local inventory for multiple products or stores in a single request. * * POST /localinventory/batch */ export const createApiLocalinventoryBatch = async (args: CreateApiLocalinventoryBatchArgs, options?: CreateApiLocalinventoryBatchOptions) => { 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(/\/+$/, '')}/localinventory/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() };