export type GetApiMerchantIdAccountstatusesAccountIdArgs = {merchantId: string, accountId: string, destinations?: Array | undefined}; export type GetApiMerchantIdAccountstatusesAccountIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieves the status of a Merchant Center account. No itemLevelIssues are returned for multi-client accounts. * * GET /{merchantId}/accountstatuses/{accountId} */ export const getApiMerchantIdAccountstatusesAccountId = async (args: GetApiMerchantIdAccountstatusesAccountIdArgs, options?: GetApiMerchantIdAccountstatusesAccountIdOptions) => { 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('accept', "*/*") for (const item of args.destinations ?? []) query.append("destinations", String(item)) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.merchantId))}/accountstatuses/${encodeURIComponent(String(args.accountId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };