export type DeleteApiMerchantIdPosTargetMerchantIdStoreStoreCodeArgs = {merchantId: string, targetMerchantId: string, storeCode: string}; export type DeleteApiMerchantIdPosTargetMerchantIdStoreStoreCodeOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deletes a store for the given merchant. * * DELETE /{merchantId}/pos/{targetMerchantId}/store/{storeCode} */ export const deleteApiMerchantIdPosTargetMerchantIdStoreStoreCode = async (args: DeleteApiMerchantIdPosTargetMerchantIdStoreStoreCodeArgs, options?: DeleteApiMerchantIdPosTargetMerchantIdStoreStoreCodeOptions) => { const {baseUrl = "https://shoppingcontent.googleapis.com/content/v2.1", fetch: fetchFn = fetch, Oauth2, Oauth2c} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.merchantId))}/pos/${encodeURIComponent(String(args.targetMerchantId))}/store/${encodeURIComponent(String(args.storeCode))}${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 };