export type CreateApiMerchantIdDatafeedsDatafeedIdFetchNowArgs = {merchantId: string, datafeedId: string}; export type CreateApiMerchantIdDatafeedsDatafeedIdFetchNowOptions = {baseUrl?: string | undefined, Oauth2?: string | undefined, Oauth2c?: string | undefined, fetch?: typeof fetch | undefined}; /** * Invokes a fetch for the datafeed in your Merchant Center account. If you need to call this method more than once per day, we recommend you use the [Products service](https://developers.google.com/shopping-content/reference/rest/v2.1/products) to update your product data. * * POST /{merchantId}/datafeeds/{datafeedId}/fetchNow */ export const createApiMerchantIdDatafeedsDatafeedIdFetchNow = async (args: CreateApiMerchantIdDatafeedsDatafeedIdFetchNowArgs, options?: CreateApiMerchantIdDatafeedsDatafeedIdFetchNowOptions) => { 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', "*/*") if (Oauth2 !== undefined) headers.set('authorization', `Bearer ${Oauth2}`) if (Oauth2c !== undefined) headers.set('authorization', `Bearer ${Oauth2c}`) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.merchantId))}/datafeeds/${encodeURIComponent(String(args.datafeedId))}/fetchNow${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };