export type DeleteApiMerchantIdAccountsAccountIdArgs = {merchantId: string, accountId: string, force?: boolean | undefined}; export type DeleteApiMerchantIdAccountsAccountIdOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a Merchant Center sub-account. * * DELETE /{merchantId}/accounts/{accountId} */ export const deleteApiMerchantIdAccountsAccountId = async (args: DeleteApiMerchantIdAccountsAccountIdArgs, options?: DeleteApiMerchantIdAccountsAccountIdOptions) => { const {baseUrl = "https://shoppingcontent.googleapis.com/content/v2.1", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.force != null) query.append("force", String(args.force)) if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.merchantId))}/accounts/${encodeURIComponent(String(args.accountId))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };