@insignia-education/api-sdk-js 0.15.54 → 0.15.56

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/.nvmrc CHANGED
@@ -1 +1 @@
1
- 24
1
+ 25
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insignia-education/api-sdk-js",
3
- "version": "0.15.54",
3
+ "version": "0.15.56",
4
4
  "description": "JavaScript SDK for the Insignia Education API",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "author": "Insignia Education",
21
21
  "license": "MIT",
22
22
  "engines": {
23
- "node": ">=24"
23
+ "node": ">=25"
24
24
  },
25
25
  "bugs": {
26
26
  "url": "https://github.com/insignia-education/api-sdk-js/issues"
@@ -60,6 +60,8 @@ export default class Teacher {
60
60
  ungradedQuizzes: () => this.#client.get(`${base}/quizzes/ungraded`),
61
61
  /** Mark one student's attendance (present: true/false) on one of this teacher's own sessions. */
62
62
  markAttendance: (sessionId, studentId, present) => this.#client.patch(`${base}/sessions/${sessionId}/attendance`, { student_id: studentId, present }),
63
+ /** Mark the teacher's own presence (present: true/false) on one of their own sessions. */
64
+ markTeacherPresent: (sessionId, present) => this.#client.patch(`${base}/sessions/${sessionId}/teacher-present`, { present }),
63
65
  /** Attendance/substitution totals. Pass { from, to } (YYYY-MM-DD) to filter, omit for all-time. */
64
66
  stats: ({ from, to } = {}) => this.#client.get(`${base}/stats`, { from, to }),
65
67
  /** Pay owed for sessions taught (teacher_present = 1), per course. Pass { from, to } (YYYY-MM-DD) to filter, omit for all-time. */
@@ -47,8 +47,31 @@ export default class Users {
47
47
  };
48
48
  }
49
49
  courseNotes(userId) { return this.#nested(userId, 'course-notes'); }
50
- quizzes(userId) { return this.#nested(userId, 'quizzes'); }
51
- sessions(userId) { return this.#nested(userId, 'sessions'); }
50
+
51
+ /** get() accepts an optional { courseId } filter to narrow to a single course. */
52
+ quizzes(userId) {
53
+ const base = `/users/${userId}/quizzes`;
54
+ const client = this.#client;
55
+ return {
56
+ get: (id = null, { courseId } = {}) => id ? client.get(`${base}/${id}`) : client.get(courseId ? `${base}?course_id=${courseId}` : base),
57
+ create: (data) => client.put(base, data),
58
+ edit: (id, data) => client.patch(`${base}/${id}`, data),
59
+ delete: (id) => client.del(`${base}/${id}`),
60
+ };
61
+ }
62
+
63
+ /** get() accepts an optional { courseId } filter to narrow to a single course. */
64
+ sessions(userId) {
65
+ const base = `/users/${userId}/sessions`;
66
+ const client = this.#client;
67
+ return {
68
+ get: (id = null, { courseId } = {}) => id ? client.get(`${base}/${id}`) : client.get(courseId ? `${base}?course_id=${courseId}` : base),
69
+ create: (data) => client.put(base, data),
70
+ edit: (id, data) => client.patch(`${base}/${id}`, data),
71
+ delete: (id) => client.del(`${base}/${id}`),
72
+ };
73
+ }
74
+
52
75
  surveys(userId) { return this.#nested(userId, 'surveys'); }
53
76
  cart(userId) { return this.#nested(userId, 'cart'); }
54
77