export type GetApiV1SurveysSurveyIdReportLinkArgs = {survey_id: number, report_id?: number | undefined}; export type GetApiV1SurveysSurveyIdReportLinkOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get responses report public link * * GET /v1/surveys/{survey_id}/report/link */ export const getApiV1SurveysSurveyIdReportLink = async (args: GetApiV1SurveysSurveyIdReportLinkArgs, options?: GetApiV1SurveysSurveyIdReportLinkOptions) => { const {baseUrl = "https://api.surveysparrow.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.report_id != null) query.append("report_id", String(args.report_id)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/surveys/${encodeURIComponent(String(args.survey_id))}/report/link${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() };