export type GetApiAffiliatesOffersOfferIdProductfeedsProductFeedIdDownloadArgs = {offerId: number, productFeedId: number}; export type GetApiAffiliatesOffersOfferIdProductfeedsProductFeedIdDownloadOptions = {baseUrl?: string | undefined, APIKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download Product Feed * * GET /affiliates/offers/{offerId}/productfeeds/{productFeedId}/download */ export const getApiAffiliatesOffersOfferIdProductfeedsProductFeedIdDownload = async (args: GetApiAffiliatesOffersOfferIdProductfeedsProductFeedIdDownloadArgs, options?: GetApiAffiliatesOffersOfferIdProductfeedsProductFeedIdDownloadOptions) => { const {baseUrl = "https://api.eflow.team/v1", fetch: fetchFn = fetch, APIKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/csv") if (APIKey !== undefined) headers.set("X-Eflow-Api-Key", APIKey) const url = `${baseUrl.replace(/\/+$/, '')}/affiliates/offers/${encodeURIComponent(String(args.offerId))}/productfeeds/${encodeURIComponent(String(args.productFeedId))}/download${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.text() };