@insignia-education/api-sdk-js 0.15.23 → 0.15.26
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/Auth.js +2 -2
- package/src/api/v1/Users.js +21 -0
package/package.json
CHANGED
package/src/api/v1/Auth.js
CHANGED
|
@@ -5,7 +5,7 @@ export default class Auth {
|
|
|
5
5
|
this.#client = client;
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
loginOrRegister(email,
|
|
8
|
+
loginOrRegister(email, captcha_token) { return this.#client.get(`/auth/login-register-check?email=${encodeURIComponent(email)}&captcha_token=${encodeURIComponent(captcha_token)}`); }
|
|
9
9
|
register(data) { return this.#client.put('/auth/register', data); }
|
|
10
10
|
/** May resolve to { two_factor_required: true } — then call twoFactor({ pin }). */
|
|
11
11
|
login(data) { return this.#client.post('/auth/login', data); }
|
|
@@ -13,7 +13,7 @@ export default class Auth {
|
|
|
13
13
|
refresh() { return this.#client.post('/auth/refresh'); }
|
|
14
14
|
logout() { return this.#client.post('/auth/logout'); }
|
|
15
15
|
user() { return this.#client.get('/auth/user'); }
|
|
16
|
-
forgotPassword(email,
|
|
16
|
+
forgotPassword(email, captcha_token) { return this.#client.post('/auth/forgot-password', { email, captcha_token }); }
|
|
17
17
|
resetPassword(data) { return this.#client.post('/auth/reset-password', data); }
|
|
18
18
|
magicLinkSend(email) { return this.#client.post('/auth/magic-link/send', { email }); }
|
|
19
19
|
magicLinkVerify(data) { return this.#client.post('/auth/magic-link/verify', data); }
|
package/src/api/v1/Users.js
CHANGED
|
@@ -85,6 +85,15 @@ export default class Users {
|
|
|
85
85
|
|
|
86
86
|
statistics(userId) { return { get: () => this.#client.get(`/users/${userId}/statistics`) }; }
|
|
87
87
|
|
|
88
|
+
/** Read-only: login attempts are recorded by the auth flow itself, not over the API. */
|
|
89
|
+
logins(userId) {
|
|
90
|
+
const base = `/users/${userId}/logins`;
|
|
91
|
+
const client = this.#client;
|
|
92
|
+
return {
|
|
93
|
+
get: () => client.get(base),
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
|
|
88
97
|
experiences(userId) {
|
|
89
98
|
const base = `/users/${userId}/experiences`;
|
|
90
99
|
const client = this.#client;
|
|
@@ -127,4 +136,16 @@ export default class Users {
|
|
|
127
136
|
|
|
128
137
|
/** Employee-only: everything this user already owns (courses/sessions/quizzes). */
|
|
129
138
|
ownedItems(userId) { return this.#client.get(`/users/${userId}/owned-items`); }
|
|
139
|
+
|
|
140
|
+
/** Sales-and-above: mint a one-time login link that logs the browser in as this user. */
|
|
141
|
+
phantom(userId) { return this.#client.post(`/users/${userId}/phantom`); }
|
|
142
|
+
|
|
143
|
+
/** Read-only: notifications are created by internal services, not over the API. */
|
|
144
|
+
notifications(userId) {
|
|
145
|
+
const base = `/users/${userId}/notifications`;
|
|
146
|
+
const client = this.#client;
|
|
147
|
+
return {
|
|
148
|
+
get: () => client.get(base),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
130
151
|
}
|