@insignia-education/api-sdk-js 0.23.0 → 0.24.1
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 +1 -1
- package/src/api/v1/Admin.js +20 -0
- package/src/api/v1/Users.js +18 -0
package/package.json
CHANGED
package/src/api/v1/Admin.js
CHANGED
|
@@ -28,6 +28,26 @@ export default class Admin {
|
|
|
28
28
|
return this.#client.get('/admin/statistics/sales', { from_date: fromDate, to_date: toDate });
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
/** Enrolled (non-teacher) students per course, biggest first — `[{ course_id, title, students }]`. Courses with no students are omitted. */
|
|
32
|
+
statisticsStudentsByCourse() {
|
|
33
|
+
return this.#client.get('/admin/statistics/students-by-course');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Enrolled students per birth country, biggest first — `[{ country_id, title, cod, students }]`. Students with no birth country set share one row with `country_id: null`. */
|
|
37
|
+
statisticsStudentsByBirthCountry() {
|
|
38
|
+
return this.#client.get('/admin/statistics/students-by-birth-country');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** Same as statisticsStudentsByBirthCountry(), grouped by the students' current country instead. */
|
|
42
|
+
statisticsStudentsByCurrentCountry() {
|
|
43
|
+
return this.#client.get('/admin/statistics/students-by-current-country');
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Enrolled students per age group (whole years as of today) — always all eight groups, in order, zero-filled: `[{ group: '0-17' | '18-24' | '25-34' | '35-44' | '45-54' | '55-64' | '65+' | 'unknown', students }]`. `unknown` = no birth date. */
|
|
47
|
+
statisticsStudentsByAgeGroup() {
|
|
48
|
+
return this.#client.get('/admin/statistics/students-by-age-group');
|
|
49
|
+
}
|
|
50
|
+
|
|
31
51
|
/** 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. */
|
|
32
52
|
statisticsClaudeUsage({ fromDate, toDate } = {}) {
|
|
33
53
|
return this.#client.get('/admin/statistics/claude-usage', { from_date: fromDate, to_date: toDate });
|
package/src/api/v1/Users.js
CHANGED
|
@@ -226,6 +226,24 @@ export default class Users {
|
|
|
226
226
|
};
|
|
227
227
|
}
|
|
228
228
|
|
|
229
|
+
/**
|
|
230
|
+
* Guided-tutorial status per user. Each tutorial is identified by a code
|
|
231
|
+
* (e.g. "dashboard-student") and is `pending` until the user finishes or skips
|
|
232
|
+
* it, then `viewed` — so the front can avoid showing the same tour twice.
|
|
233
|
+
*/
|
|
234
|
+
tutorials(userId) {
|
|
235
|
+
const base = `/users/${userId}/tutorials`;
|
|
236
|
+
const client = this.#client;
|
|
237
|
+
return {
|
|
238
|
+
/** Every known tutorial code with its status: [{ code, status, viewed_at }]. */
|
|
239
|
+
get: () => client.get(base),
|
|
240
|
+
/** One tutorial's { code, status: 'pending'|'viewed', viewed_at }. Unknown code → 404. */
|
|
241
|
+
status: (code) => client.get(`${base}/${code}`),
|
|
242
|
+
/** Mark a tutorial as viewed (idempotent). Unknown code → 404. */
|
|
243
|
+
markViewed: (code) => client.post(`${base}/${code}/viewed`),
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
|
|
229
247
|
experiences(userId) {
|
|
230
248
|
const base = `/users/${userId}/experiences`;
|
|
231
249
|
const client = this.#client;
|