export type CreateApiApiProfileVisitProjectArgs = {body: {projectId: string | null}}; export type CreateApiApiProfileVisitProjectOptions = {baseUrl: string, personalAccessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Visit project * * POST /api/profile/visit-project * * Also accepts auth: internalAuth */ export const createApiApiProfileVisitProject = async (args: CreateApiApiProfileVisitProjectArgs, options: CreateApiApiProfileVisitProjectOptions) => { const {baseUrl, fetch: fetchFn = fetch, personalAccessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (personalAccessToken !== undefined) headers.set('authorization', `Bearer ${personalAccessToken}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/profile/visit-project${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };