@insignia-education/api-sdk-js 0.25.9 → 0.25.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/package.json +1 -1
- package/src/api/v1/Admin.js +5 -0
- package/src/api/v1/Employee.js +4 -0
- package/src/api/v1/Teacher.js +3 -1
- package/src/api/v1/Users.js +14 -0
package/README.md
CHANGED
|
@@ -387,6 +387,8 @@ await v1.users.courses(1).get();
|
|
|
387
387
|
await v1.users.courseNotes(1).get();
|
|
388
388
|
await v1.users.quizzes(1).get();
|
|
389
389
|
await v1.users.sessions(1).get();
|
|
390
|
+
await v1.users.sessions(1).rate(10, { clarity_rating: 5, correction_rating: 4, motivation_rating: 5 });
|
|
391
|
+
await v1.users.topRatedTeachers();
|
|
390
392
|
await v1.users.surveys(1).get();
|
|
391
393
|
await v1.users.cart(1).get();
|
|
392
394
|
|
package/package.json
CHANGED
package/src/api/v1/Admin.js
CHANGED
|
@@ -53,6 +53,11 @@ export default class Admin {
|
|
|
53
53
|
return this.#client.get('/admin/statistics/course-ratings');
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
/** Teachers ranked by average session rating (best first): `[{ teacher_id, name, teacher_average, clarity_average, correction_average, motivation_average, ratings }]` (`teacher_average` = mean of the three). `from`/`to` (`YYYY-MM-DD`, both optional) limit it to ratings made in that period; omit both for all time. Employee-only. */
|
|
57
|
+
statisticsTeacherRatings({ from, to } = {}) {
|
|
58
|
+
return this.#client.get('/admin/statistics/teacher-ratings', { from, to });
|
|
59
|
+
}
|
|
60
|
+
|
|
56
61
|
/** Claude (Anthropic) token usage/spend for a date range, plus account balance. Each half resolves `{ available: false }` (not an error) when its required config (admin key / account balance) isn't set. */
|
|
57
62
|
statisticsClaudeUsage({ fromDate, toDate } = {}) {
|
|
58
63
|
return this.#client.get('/admin/statistics/claude-usage', { from_date: fromDate, to_date: toDate });
|
package/src/api/v1/Employee.js
CHANGED
|
@@ -18,6 +18,10 @@ export default class Employee {
|
|
|
18
18
|
teacherCourses: (teacherId) => this.#client.get(`${base}/teachers/${teacherId}/courses`),
|
|
19
19
|
/** All sessions for one course_date, any teacher. */
|
|
20
20
|
courseDateSessions: (courseDateId) => this.#client.get(`${base}/course-dates/${courseDateId}/sessions`),
|
|
21
|
+
/** Ranked roster ({id, name, email, rank}) of any course_date. */
|
|
22
|
+
courseDateStudents: (courseDateId) => this.#client.get(`${base}/course-dates/${courseDateId}/students`),
|
|
23
|
+
/** Save the ranking of one course_date's students: `studentIds` in order, first = rank 1. Returns the re-ranked roster. Ids not enrolled → 422. */
|
|
24
|
+
rankCourseDateStudents: (courseDateId, studentIds) => this.#client.put(`${base}/course-dates/${courseDateId}/students/ranking`, { student_ids: studentIds }),
|
|
21
25
|
/** Mark a student's attendance on any teacher's session. */
|
|
22
26
|
markAttendance: (sessionId, studentId, present) =>
|
|
23
27
|
this.#client.patch(`${base}/sessions/${sessionId}/attendance`, { student_id: studentId, present }),
|
package/src/api/v1/Teacher.js
CHANGED
|
@@ -54,8 +54,10 @@ export default class Teacher {
|
|
|
54
54
|
courseDates: () => this.#client.get(`${base}/course-dates`),
|
|
55
55
|
/** All sessions for one CourseDate, each with a `students` roster ({id, name, present}). */
|
|
56
56
|
courseDateSessions: (courseDateId) => this.#client.get(`${base}/course-dates/${courseDateId}/sessions`),
|
|
57
|
-
/** Enrolled roster ({id, name, email}) for one CourseDate, read straight off enrollment — shows up even before any session has been synced. Read-only: does not move students between dates. */
|
|
57
|
+
/** Enrolled roster ({id, name, email, rank}, ranked first — unranked last) for one CourseDate, read straight off enrollment — shows up even before any session has been synced. Read-only: does not move students between dates. */
|
|
58
58
|
courseDateStudents: (courseDateId) => this.#client.get(`${base}/course-dates/${courseDateId}/students`),
|
|
59
|
+
/** Save the teacher's ranking of one CourseDate's students: `studentIds` in order, first = rank 1. Returns the re-ranked roster ({id, name, email, rank}). Ids not enrolled → 422. */
|
|
60
|
+
rankCourseDateStudents: (courseDateId, studentIds) => this.#client.put(`${base}/course-dates/${courseDateId}/students/ranking`, { student_ids: studentIds }),
|
|
59
61
|
/** One student's quiz attempts in this CourseDate's course, every one of them - not just needs_teacher_correction=1 (auto-graded ones never show up in the "Quizzes por corregir" surfaces below). Each row carries `quiz.needs_teacher_correction`, `level`/`lesson`, `final_score_percentage`; filter by level/lesson client-side. */
|
|
60
62
|
courseDateStudentQuizzes: (courseDateId, studentId) => this.#client.get(`${base}/course-dates/${courseDateId}/students/${studentId}/quizzes`),
|
|
61
63
|
/** { url, pending } — the zip archive of this group's course materials, or pending:true while it's (re)building. */
|
package/src/api/v1/Users.js
CHANGED
|
@@ -160,9 +160,23 @@ export default class Users {
|
|
|
160
160
|
* session starts; a seller-and-above may reset any time.
|
|
161
161
|
*/
|
|
162
162
|
reset: (id) => client.post(`${base}/${id}/reset`),
|
|
163
|
+
/**
|
|
164
|
+
* Student rates a finished session they attended — one-time, locked afterwards.
|
|
165
|
+
* `{ clarity_rating, correction_rating, motivation_rating }` (clear explanations / helpful respectful
|
|
166
|
+
* corrections / motivates speaking English), each an integer 1-5. Only the student themself
|
|
167
|
+
* (not staff) can submit it. 422 if the session hasn't ended / has no teacher, 403 if the
|
|
168
|
+
* student wasn't marked present, 409 if already rated. The booking list rows carry the
|
|
169
|
+
* submitted rating as `my_rating` (or null).
|
|
170
|
+
*/
|
|
171
|
+
rate: (id, data) => client.post(`${base}/${id}/rating`, data),
|
|
163
172
|
};
|
|
164
173
|
}
|
|
165
174
|
|
|
175
|
+
/** Top 3 teachers by overall average session rating (all time), visible to any authenticated user: `[{ teacher_id, name, teacher_average, ratings }]` (`teacher_average` = mean of the three questions). */
|
|
176
|
+
topRatedTeachers() {
|
|
177
|
+
return this.#client.get('/teachers/top-rated');
|
|
178
|
+
}
|
|
179
|
+
|
|
166
180
|
surveys(userId) { return this.#nested(userId, 'surveys'); }
|
|
167
181
|
cart(userId) { return this.#nested(userId, 'cart'); }
|
|
168
182
|
|