feat: integrate pixel teacher presence and resilient classroom preview
This commit is contained in:
@@ -2,6 +2,8 @@ import { hostApiFetch, createHostEventSource, ensureHostApiToken } from './host-
|
||||
import type {
|
||||
ConsultationRole,
|
||||
TeacherAvailability,
|
||||
TeacherCheckInInput,
|
||||
TeacherCheckInResult,
|
||||
TeacherDefinition,
|
||||
TeacherSend,
|
||||
TeacherTopic,
|
||||
@@ -14,6 +16,11 @@ export function teacherTopicsPath(projectId: string, sourceId: string, role?: Co
|
||||
: `/api/coding/projects/${encodeURIComponent(projectId)}/conversations/${encodeURIComponent(sourceId)}/teacher-topics`;
|
||||
}
|
||||
export const teacherApi = {
|
||||
checkIn: (projectId: string, input: TeacherCheckInInput) =>
|
||||
hostApiFetch<TeacherCheckInResult>(`/api/coding/projects/${encodeURIComponent(projectId)}/teacher-check-in`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(input),
|
||||
}),
|
||||
config: (role: ConsultationRole = 'teacher') =>
|
||||
hostApiFetch<TeacherAvailability & { definition: TeacherDefinition | null }>(
|
||||
`/api/coding/${role}/config`
|
||||
@@ -28,8 +35,8 @@ export const teacherApi = {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({ draftRevision, sampleContext }),
|
||||
}),
|
||||
read: (base: string, id: string) =>
|
||||
hostApiFetch<TeacherTopic>(base + '/' + encodeURIComponent(id)),
|
||||
read: (base: string, id: string, select = true) =>
|
||||
hostApiFetch<TeacherTopic>(base + '/' + encodeURIComponent(id) + (select ? '' : '?select=false')),
|
||||
send: (base: string, id: string, input: TeacherSend) =>
|
||||
hostApiFetch<TeacherTopic>(base + '/' + encodeURIComponent(id) + '/messages', {
|
||||
method: 'POST',
|
||||
|
||||
Reference in New Issue
Block a user