export type GetApiV2RewardSuppliersManualCouponsRewardSupplierIdCouponsExtensionArgs = {reward_supplier_id: string, extension: string, operation_id?: (string | null) | undefined, issued?: (boolean | null) | undefined, include_expired?: (boolean | null) | undefined, limit?: (string | null) | undefined, offset?: (string | null) | undefined}; export type GetApiV2RewardSuppliersManualCouponsRewardSupplierIdCouponsExtensionOptions = {baseUrl?: string | undefined, HEADER?: string | undefined, fetch?: typeof fetch | undefined}; /** * Download manual coupons file * * GET /v2/reward-suppliers/manual-coupons/{reward_supplier_id}/coupons{extension} * * Also accepts auth: QUERY, COOKIE */ export const getApiV2RewardSuppliersManualCouponsRewardSupplierIdCouponsExtension = async (args: GetApiV2RewardSuppliersManualCouponsRewardSupplierIdCouponsExtensionArgs, options?: GetApiV2RewardSuppliersManualCouponsRewardSupplierIdCouponsExtensionOptions) => { const {baseUrl = "https://api.extole.io", fetch: fetchFn = fetch, HEADER} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.operation_id != null) query.append("operation_id", String(args.operation_id)) if (args.issued != null) query.append("issued", String(args.issued)) if (args.include_expired != null) query.append("include_expired", String(args.include_expired)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.offset != null) query.append("offset", String(args.offset)) if (HEADER !== undefined) headers.set("Authorization", HEADER) const url = `${baseUrl.replace(/\/+$/, '')}/v2/reward-suppliers/manual-coupons/${encodeURIComponent(String(args.reward_supplier_id))}/coupons${encodeURIComponent(String(args.extension))}${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() };