export type GetApiTwakeV1InviteIdArgs = {id: string}; export type GetApiTwakeV1InviteIdOptions = {baseUrl: string, cookieAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Accepts an invitation * * GET /_twake/v1/invite/{id} */ export const getApiTwakeV1InviteId = async (args: GetApiTwakeV1InviteIdArgs, options: GetApiTwakeV1InviteIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, cookieAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (cookieAuth !== undefined) cookies.push("lemonldap=" + encodeURIComponent(cookieAuth)) const url = `${baseUrl.replace(/\/+$/, '')}/_twake/v1/invite/${encodeURIComponent(String(args.id))}${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 undefined };