export type CreateApiV1SurveysSurveyIdShareLinkArgs = {survey_id: number}; export type CreateApiV1SurveysSurveyIdShareLinkOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Create link share for Survey * * POST /v1/surveys/{survey_id}/share/link */ export const createApiV1SurveysSurveyIdShareLink = async (args: CreateApiV1SurveysSurveyIdShareLinkArgs, options?: CreateApiV1SurveysSurveyIdShareLinkOptions) => { const {baseUrl = "https://api.surveysparrow.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/v1/surveys/${encodeURIComponent(String(args.survey_id))}/share/link${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() };