@insignia-education/api-sdk-js 0.25.8 → 0.25.10
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/CompanyCelebrations.js +16 -0
- package/src/api/v1/Users.js +14 -0
- package/src/api/v1/index.js +2 -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 });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default class CompanyCelebrations {
|
|
2
|
+
#client;
|
|
3
|
+
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.#client = client;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** Admin-only: a year of celebratory media, one entry per month (`{ month, media: { url, kind }[] }[]`, empty `media` where unset). */
|
|
9
|
+
get(year = new Date().getFullYear()) { return this.#client.get('/company-celebrations', { year }); }
|
|
10
|
+
|
|
11
|
+
/** Admin-only: replaces one month's media list (`kind` is `image` or `video`; `[]` clears it); resolves the full year. */
|
|
12
|
+
edit(year, month, media) { return this.#client.put('/company-celebrations', { year, month, media }); }
|
|
13
|
+
|
|
14
|
+
/** Sellers-and-above: the celebration to show right now — `{ active, year, month, media }`, `active` only in the month's first week. */
|
|
15
|
+
current() { return this.#client.get('/sales/celebration'); }
|
|
16
|
+
}
|
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
|
|
package/src/api/v1/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import Accounts from './Accounts.js';
|
|
|
6
6
|
import Certificates from './Certificates.js';
|
|
7
7
|
import Changelogs from './Changelogs.js';
|
|
8
8
|
import CompanySalesGoals from './CompanySalesGoals.js';
|
|
9
|
+
import CompanyCelebrations from './CompanyCelebrations.js';
|
|
9
10
|
import CompanySettings from './CompanySettings.js';
|
|
10
11
|
import ContactForms from './ContactForms.js';
|
|
11
12
|
import ContactTypes from './ContactTypes.js';
|
|
@@ -67,6 +68,7 @@ export default class InsigniaApiV1 extends InsigniaApi {
|
|
|
67
68
|
this.certificates = new Certificates(this);
|
|
68
69
|
this.changelogs = new Changelogs(this);
|
|
69
70
|
this.companySalesGoals = new CompanySalesGoals(this);
|
|
71
|
+
this.companyCelebrations = new CompanyCelebrations(this);
|
|
70
72
|
this.companySettings = new CompanySettings(this);
|
|
71
73
|
this.contactForms = new ContactForms(this);
|
|
72
74
|
this.contactTypes = new ContactTypes(this);
|