@insignia-education/api-sdk-js 0.15.21 → 0.15.23

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.15.21",
3
+ "version": "0.15.23",
4
4
  "description": "JavaScript SDK for the Insignia Education API",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -51,6 +51,14 @@ export default class Payments {
51
51
  const base = `/payments/${paymentId}`;
52
52
  const client = this.#client;
53
53
  return {
54
+ /**
55
+ * Adds a line. `data` carries only identifiers — every price is
56
+ * derived server-side from the selected entity, never sent by the
57
+ * client. By type: courses `{course_id, course_date_id?}`, premiums
58
+ * `{course_premium_id}`, sessions `{course_id, type_id, quantity}`,
59
+ * quizzes `{quiz_id, course_id, quantity}`, taxes `{tax_id}`.
60
+ */
61
+ create: (type, data) => client.put(`${base}/${type}`, data),
54
62
  delete: (type, id) => client.del(`${base}/${type}/${id}`),
55
63
  restore: (type, id) => client.post(`${base}/${type}/${id}/restore`),
56
64
  };
@@ -0,0 +1,10 @@
1
+ export default class Search {
2
+ #client;
3
+
4
+ constructor(client) {
5
+ this.#client = client;
6
+ }
7
+
8
+ /** Sales-and-above global search: users (name/email/dni) and courses (cod/title). */
9
+ query(q) { return this.#client.get('/search', { q }); }
10
+ }
@@ -21,6 +21,7 @@ import Organizations from './Organizations.js';
21
21
  import PaymentMethods from './PaymentMethods.js';
22
22
  import Payments from './Payments.js';
23
23
  import Quizzes from './Quizzes.js';
24
+ import Search from './Search.js';
24
25
  import ShortLinks from './ShortLinks.js';
25
26
  import Surveys from './Surveys.js';
26
27
  import Premiums from './Premiums.js';
@@ -69,6 +70,7 @@ export default class InsigniaApiV1 extends InsigniaApi {
69
70
  this.paymentMethods = new PaymentMethods(this);
70
71
  this.payments = new Payments(this);
71
72
  this.quizzes = new Quizzes(this);
73
+ this.search = new Search(this);
72
74
  this.shortLinks = new ShortLinks(this);
73
75
  this.surveys = new Surveys(this);
74
76
  this.premiums = new Premiums(this);