@insignia-education/api-sdk-js 0.15.42 → 0.15.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@insignia-education/api-sdk-js",
3
- "version": "0.15.42",
3
+ "version": "0.15.45",
4
4
  "description": "JavaScript SDK for the Insignia Education API",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -0,0 +1,23 @@
1
+ export default class Employee {
2
+ #client;
3
+
4
+ constructor(client) {
5
+ this.#client = client;
6
+ }
7
+
8
+ dashboard() {
9
+ const base = '/employee/dashboard';
10
+ return {
11
+ /** All teachers' sessions for a given date (YYYY-MM-DD). */
12
+ sessions: (date) => this.#client.get(`${base}/sessions`, { date }),
13
+ /** All sessions for one course_date, any teacher. */
14
+ courseDateSessions: (courseDateId) => this.#client.get(`${base}/course-dates/${courseDateId}/sessions`),
15
+ /** Mark a student's attendance on any teacher's session. */
16
+ markAttendance: (sessionId, studentId, present) =>
17
+ this.#client.patch(`${base}/sessions/${sessionId}/attendance`, { student_id: studentId, present }),
18
+ /** Mark whether the assigned teacher showed up to a session. */
19
+ markTeacherPresent: (sessionId, present) =>
20
+ this.#client.patch(`${base}/sessions/${sessionId}/teacher-present`, { present }),
21
+ };
22
+ }
23
+ }
@@ -7,4 +7,12 @@ export default class Sales {
7
7
 
8
8
  /** Options for the UTM link generator: courses, session types, active coupons, known utm source/medium/campaign values. */
9
9
  utmGeneratorOptions() { return this.#client.get('/sales/utm-generator/options'); }
10
+
11
+ /** Counts + amount totals for the current seller's own payments, by status (pending/approved/rejected). */
12
+ myStats() { return this.#client.get('/sales/my-stats'); }
13
+
14
+ /** Paginated list of the current seller's own attributed payments. */
15
+ mySales({ page, perPage } = {}) {
16
+ return this.#client.get('/sales/my-sales', { page, per_page: perPage });
17
+ }
10
18
  }
@@ -46,12 +46,18 @@ export default class Teacher {
46
46
  dashboard() {
47
47
  const base = '/teacher/dashboard';
48
48
  return {
49
- /** Own scheduled sessions for a given date (YYYY-MM-DD). */
49
+ /** Own scheduled sessions for a given date (YYYY-MM-DD), each with a `students` roster ({id, name, present}). */
50
50
  sessions: (date) => this.#client.get(`${base}/sessions`, { date }),
51
+ /** Every CourseDate this teacher is assigned to. */
52
+ courseDates: () => this.#client.get(`${base}/course-dates`),
53
+ /** All sessions for one CourseDate, each with a `students` roster ({id, name, present}). */
54
+ courseDateSessions: (courseDateId) => this.#client.get(`${base}/course-dates/${courseDateId}/sessions`),
55
+ /** Ungraded quiz submissions from one CourseDate's own students. */
56
+ courseDateUngradedQuizzes: (courseDateId) => this.#client.get(`${base}/course-dates/${courseDateId}/quizzes/ungraded`),
51
57
  /** Ungraded quiz submissions grouped by course, for every course this teacher teaches. */
52
58
  ungradedQuizzes: () => this.#client.get(`${base}/quizzes/ungraded`),
53
- /** Mark a student's attendance (present: true/false) on one of this teacher's own sessions. */
54
- markAttendance: (sessionId, present) => this.#client.patch(`${base}/sessions/${sessionId}/attendance`, { present }),
59
+ /** Mark one student's attendance (present: true/false) on one of this teacher's own sessions. */
60
+ markAttendance: (sessionId, studentId, present) => this.#client.patch(`${base}/sessions/${sessionId}/attendance`, { student_id: studentId, present }),
55
61
  /** Attendance/substitution totals. Pass { from, to } (YYYY-MM-DD) to filter, omit for all-time. */
56
62
  stats: ({ from, to } = {}) => this.#client.get(`${base}/stats`, { from, to }),
57
63
  /** Pay owed for sessions taught (teacher_present = 1), per course. Pass { from, to } (YYYY-MM-DD) to filter, omit for all-time. */
@@ -9,6 +9,8 @@ export default class Users {
9
9
  getByUsername(username) { return this.#client.get(`/users/username/${username}`); }
10
10
  findByUsername(username) { return this.#client.get(`/users/find/${username}`); }
11
11
  cashReceivers() { return this.#client.get('/users/cash-receivers'); }
12
+ /** Seller-type users, for the payment forms' Seller picker (checkout + admin payment create/edit). */
13
+ sellers() { return this.#client.get('/users/sellers'); }
12
14
  /** Employee-only: users assignable as a course owner (super-admins, education centers, organizations). */
13
15
  assignable() { return this.#client.get('/users/assignable'); }
14
16
  /** Employee-only: users assignable as a course teacher (super-admins, admins, employees, teachers). */
@@ -134,6 +136,9 @@ export default class Users {
134
136
  /** GET /users/{orgId}/organization/members — members where manager_id = orgId. */
135
137
  organizationMembers(orgId) { return this.#client.get(`/users/${orgId}/organization/members`); }
136
138
 
139
+ /** GET /users/{orgId}/organization/students — distinct students with a course_count, for the Students tab list. */
140
+ organizationStudents(orgId) { return this.#client.get(`/users/${orgId}/organization/students`); }
141
+
137
142
  /** Employee-only: everything this user already owns (courses/sessions/quizzes). */
138
143
  ownedItems(userId) { return this.#client.get(`/users/${userId}/owned-items`); }
139
144
 
@@ -13,6 +13,7 @@ import Courses from './Courses.js';
13
13
  import Currencies from './Currencies.js';
14
14
  import Dashboard from './Dashboard.js';
15
15
  import EducationCenter from './EducationCenter.js';
16
+ import Employee from './Employee.js';
16
17
  import Files from './Files.js';
17
18
  import Forums from './Forums.js';
18
19
  import Hashes from './Hashes.js';
@@ -66,6 +67,7 @@ export default class InsigniaApiV1 extends InsigniaApi {
66
67
  this.currencies = new Currencies(this);
67
68
  this.dashboard = new Dashboard(this);
68
69
  this.educationCenter = new EducationCenter(this);
70
+ this.employee = new Employee(this);
69
71
  this.files = new Files(this);
70
72
  this.forums = new Forums(this);
71
73
  this.hashes = new Hashes(this);