@insignia-education/api-sdk-js 0.17.1 → 0.17.2
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.17.
|
|
3
|
+
"version": "0.17.2",
|
|
4
4
|
"description": "JavaScript SDK for the Insignia Education API",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -33,10 +33,11 @@
|
|
|
33
33
|
"homepage": "https://github.com/insignia-education/api-sdk-js#readme",
|
|
34
34
|
"dependencies": {},
|
|
35
35
|
"devDependencies": {
|
|
36
|
-
"@babel/preset-env": "^7.
|
|
36
|
+
"@babel/preset-env": "^7.29.7",
|
|
37
37
|
"babel-jest": "^30.3.0",
|
|
38
38
|
"@eslint/js": "^9.0.0",
|
|
39
|
-
"eslint": "^
|
|
39
|
+
"eslint": "^10.10.0",
|
|
40
|
+
"globals": "^17.12.0",
|
|
40
41
|
"jest": "^30.3.0",
|
|
41
42
|
"jest-html-reporter": "^4.3.0"
|
|
42
43
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export default class BugReports {
|
|
2
|
+
#client;
|
|
3
|
+
|
|
4
|
+
constructor(client) {
|
|
5
|
+
this.#client = client;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/** File a bug report. body: { title, description, file_ids, affected_user_id? } */
|
|
9
|
+
create(body) {
|
|
10
|
+
return this.#client.post('/bug-reports', body);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** Admin queue listing. params: { tab: 'pending_mine'|'unassigned'|'past_mine'|'past_all', per_page, page } */
|
|
14
|
+
list(params = {}) {
|
|
15
|
+
return this.#client.get('/bug-reports', params);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get(id) {
|
|
19
|
+
return this.#client.get(`/bug-reports/${id}`);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
assign(id, assignedUserId) {
|
|
23
|
+
return this.#client.patch(`/bug-reports/${id}/assign`, { assigned_user_id: assignedUserId });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** body: { status, dismissed_reason?, solution? } */
|
|
27
|
+
updateStatus(id, body) {
|
|
28
|
+
return this.#client.patch(`/bug-reports/${id}/status`, body);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** { by_month, solved_by_user, dismissed_by_user } */
|
|
32
|
+
statistics() {
|
|
33
|
+
return this.#client.get('/bug-reports/statistics');
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Direct download link (format: 'csv' | 'xlsx', default 'csv') — open with <a href>, cookie-authenticated, same convention as Admin's *ExportUrl() methods. */
|
|
37
|
+
exportUrl({ format = 'csv' } = {}) {
|
|
38
|
+
return BugReports.#buildUrl(this.#client.baseUrl, '/bug-reports/export', { format });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
static #buildUrl(baseUrl, path, params) {
|
|
42
|
+
const qs = new URLSearchParams(
|
|
43
|
+
Object.entries(params).filter(([, v]) => v !== undefined && v !== null && v !== '')
|
|
44
|
+
).toString();
|
|
45
|
+
return `${baseUrl}${path}${qs ? `?${qs}` : ''}`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -31,6 +31,8 @@ export default class Organizations {
|
|
|
31
31
|
invite: (userId) => client.post(`${base}/invite`, { user_id: userId }),
|
|
32
32
|
/** Re-sends the invite email to a still-pending member with a fresh link. */
|
|
33
33
|
resendInvite: (userId) => client.post(`${base}/${userId}/resend-invite`),
|
|
34
|
+
/** Removes a pending invite or accepted membership without deleting the user account. */
|
|
35
|
+
remove: (userId) => client.del(`${base}/${userId}`),
|
|
34
36
|
/** Creates a real UserPayment for this member — same payload shape as users(id).payments().create(). */
|
|
35
37
|
createPayment: (userId, data) => client.put(`${base}/${userId}/payments`, data),
|
|
36
38
|
};
|
package/src/api/v1/Search.js
CHANGED
|
@@ -12,8 +12,15 @@ export default class Search {
|
|
|
12
12
|
* `includeTrashed` opts into soft-deleted accounts (flagged via `deleted_at` on the
|
|
13
13
|
* returned row) — off by default, since this same endpoint also backs pickers (coupon
|
|
14
14
|
* grant, referrer) that must never offer a deleted account as a valid target.
|
|
15
|
+
* `unblockedOnly` excludes users with a `blocked_at` set — used by the bug-report
|
|
16
|
+
* affected-user picker, which must never offer a blocked account as a target.
|
|
15
17
|
*/
|
|
16
|
-
query(q, offset = 0, includeTrashed = false) {
|
|
17
|
-
return this.#client.get('/search', {
|
|
18
|
+
query(q, offset = 0, includeTrashed = false, unblockedOnly = false) {
|
|
19
|
+
return this.#client.get('/search', {
|
|
20
|
+
q,
|
|
21
|
+
offset,
|
|
22
|
+
include_trashed: includeTrashed ? 1 : undefined,
|
|
23
|
+
unblocked_only: unblockedOnly ? 1 : undefined,
|
|
24
|
+
});
|
|
18
25
|
}
|
|
19
26
|
}
|
package/src/api/v1/index.js
CHANGED
|
@@ -21,6 +21,7 @@ import Hashes from './Hashes.js';
|
|
|
21
21
|
import Insignias from './Insignias.js';
|
|
22
22
|
import Languages from './Languages.js';
|
|
23
23
|
import Blocks from './Blocks.js';
|
|
24
|
+
import BugReports from './BugReports.js';
|
|
24
25
|
import MailBlacklist from './MailBlacklist.js';
|
|
25
26
|
import MailingLists from './MailingLists.js';
|
|
26
27
|
import Offers from './Offers.js';
|
|
@@ -79,6 +80,7 @@ export default class InsigniaApiV1 extends InsigniaApi {
|
|
|
79
80
|
this.languages = new Languages(this);
|
|
80
81
|
this.mailBlacklist = new MailBlacklist(this);
|
|
81
82
|
this.blocks = new Blocks(this);
|
|
83
|
+
this.bugReports = new BugReports(this);
|
|
82
84
|
this.mailingLists = new MailingLists(this);
|
|
83
85
|
this.offers = new Offers(this);
|
|
84
86
|
this.organizations = new Organizations(this);
|