export type AccountGoogleMyBusinessLink = {gmbAccountId?: string | undefined, status?: string | undefined, gmbEmail?: string | undefined}; export type AccountAddress = {country?: string | undefined, region?: string | undefined, streetAddress?: string | undefined, postalCode?: string | undefined, locality?: string | undefined}; export type AccountCustomerService = {phoneNumber?: string | undefined, url?: string | undefined, email?: string | undefined}; export type AccountBusinessInformation = {address?: AccountAddress | undefined, koreanBusinessRegistrationNumber?: string | undefined, phoneVerificationStatus?: string | undefined, phoneNumber?: string | undefined, customerService?: AccountCustomerService | undefined}; export type AccountIdentityType = {selfIdentified?: boolean | undefined}; export type AccountBusinessIdentity = {smallBusiness?: AccountIdentityType | undefined, womenOwned?: AccountIdentityType | undefined, latinoOwned?: AccountIdentityType | undefined, includeForPromotions?: boolean | undefined, blackOwned?: AccountIdentityType | undefined, veteranOwned?: AccountIdentityType | undefined}; export type AccountConversionSettings = {freeListingsAutoTaggingEnabled?: boolean | undefined}; export type AccountYouTubeChannelLink = {status?: string | undefined, channelId?: string | undefined}; export type AccountShippingImprovements = {allowShippingImprovements?: boolean | undefined}; export type AccountItemUpdatesSettings = {allowStrictAvailabilityUpdates?: boolean | undefined, allowPriceUpdates?: boolean | undefined, allowAvailabilityUpdates?: boolean | undefined, allowConditionUpdates?: boolean | undefined}; export type AccountItemUpdates = {effectiveAllowAvailabilityUpdates?: boolean | undefined, effectiveAllowStrictAvailabilityUpdates?: boolean | undefined, accountItemUpdatesSettings?: AccountItemUpdatesSettings | undefined, effectiveAllowPriceUpdates?: boolean | undefined, effectiveAllowConditionUpdates?: boolean | undefined}; export type AccountImageImprovementsSettings = {allowAutomaticImageImprovements?: boolean | undefined}; export type AccountImageImprovements = {effectiveAllowAutomaticImageImprovements?: boolean | undefined, accountImageImprovementsSettings?: AccountImageImprovementsSettings | undefined}; export type AccountAutomaticImprovements = {shippingImprovements?: AccountShippingImprovements | undefined, itemUpdates?: AccountItemUpdates | undefined, imageImprovements?: AccountImageImprovements | undefined}; export type AccountUser = {admin?: boolean | undefined, orderManager?: boolean | undefined, emailAddress?: string | undefined, reportingManager?: boolean | undefined, paymentsAnalyst?: boolean | undefined, paymentsManager?: boolean | undefined, readOnly?: boolean | undefined}; export type AccountAdsLink = {adsId?: unknown | undefined, status?: string | undefined}; export type Account = {labelIds?: Array | undefined, sellerId?: string | undefined, googleMyBusinessLink?: AccountGoogleMyBusinessLink | undefined, businessInformation?: AccountBusinessInformation | undefined, id?: unknown | undefined, businessIdentity?: AccountBusinessIdentity | undefined, conversionSettings?: AccountConversionSettings | undefined, kind?: string | undefined, websiteUrl?: string | undefined, automaticLabelIds?: Array | undefined, cssId?: unknown | undefined, youtubeChannelLinks?: Array | undefined, automaticImprovements?: AccountAutomaticImprovements | undefined, accountManagement?: string | undefined, users?: Array | undefined, adsLinks?: Array | undefined, name?: string | undefined, adultContent?: boolean | undefined}; export type AccountsCustomBatchRequestEntryLinkRequest = {linkedAccountId?: string | undefined, services?: Array | undefined, linkType?: string | undefined, action?: string | undefined}; export type AccountsCustomBatchRequestEntry = {account?: Account | undefined, linkRequest?: AccountsCustomBatchRequestEntryLinkRequest | undefined, batchId?: number | undefined, overwrite?: boolean | undefined, view?: string | undefined, method?: string | undefined, accountId?: unknown | undefined, force?: boolean | undefined, merchantId?: unknown | undefined, labelIds?: Array | undefined}; export type AccountsCustomBatchRequest = {entries?: Array | undefined}; export type CreateApiAccountsBatchArgs = {body: AccountsCustomBatchRequest}; export type CreateApiAccountsBatchOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieves, inserts, updates, and deletes multiple Merchant Center (sub-)accounts in a single request. * * POST /accounts/batch */ export const createApiAccountsBatch = async (args: CreateApiAccountsBatchArgs, options?: CreateApiAccountsBatchOptions) => { 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(/\/+$/, '')}/accounts/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() };