@insignia-education/api-sdk-js 0.22.0 → 0.24.0

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.22.0",
3
+ "version": "0.24.0",
4
4
  "description": "JavaScript SDK for the Insignia Education API",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -163,6 +163,13 @@ export default class Admin {
163
163
  });
164
164
  }
165
165
 
166
+ /** Organization-wide OpenAI completion usage, model breakdown and spend for a date range. Resolves `{ available: false }` when the API server has no valid OpenAI Admin API key. */
167
+ reportsOpenAiUsage({ fromDate, toDate } = {}) {
168
+ return this.#client.get('/admin/reports/openai-usage', {
169
+ from_date: fromDate, to_date: toDate,
170
+ });
171
+ }
172
+
166
173
  /** Direct link to a repo's CI-generated test-coverage HTML report ('api' | 'front' | 'api-sdk-js') — open with <a href>/<iframe src>, cookie-authenticated, not fetch. */
167
174
  coverageUrl(repo) {
168
175
  return `${this.#client.baseUrl}/admin/coverage/${repo}/`;
@@ -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;