@memori.ai/memori-api-client 1.0.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
 
2
2
 
3
+ ## [1.2.0](https://github.com/memori-ai/memori-api-client/compare/v1.1.0...v1.2.0) (2023-03-09)
4
+
5
+
6
+ ### Features
7
+
8
+ * update import apis ([1e924ef](https://github.com/memori-ai/memori-api-client/commit/1e924ef54c3ce38312a0e7d169fd60702c43f3f8))
9
+
10
+ ## [1.1.0](https://github.com/memori-ai/memori-api-client/compare/v1.0.0...v1.1.0) (2023-02-16)
11
+
12
+
13
+ ### ⚠ BREAKING CHANGES
14
+
15
+ * rename signin in signup, typo
16
+ * update memori lists api, rename user memori list
17
+
18
+ ### Features
19
+
20
+ * add new user attributes ([5b10720](https://github.com/memori-ai/memori-api-client/commit/5b107206331a0ac6a579f983c5eb0fe04b4d9fc4))
21
+ * update memori lists api, rename user memori list ([6349149](https://github.com/memori-ai/memori-api-client/commit/63491496731ae65978c4ad81404881811ab6b13b))
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * api url parsing allowing http for localhost ([6b6d881](https://github.com/memori-ai/memori-api-client/commit/6b6d8812385002e40cbbfc7fe87cd72daed3f5aa))
27
+
28
+
29
+ ### Changes
30
+
31
+ * rename signin in signup, typo ([6fc8dc4](https://github.com/memori-ai/memori-api-client/commit/6fc8dc4ecced9b379d7ace49f2c25e83985755c1))
32
+
3
33
  ## [1.0.0](https://github.com/memori-ai/memori-api-client/compare/v0.11.0...v1.0.0) (2023-02-01)
4
34
 
5
35
 
@@ -32,12 +32,32 @@ declare const _default: (apiUrl: string) => {
32
32
  getAllMemori: (authToken: string) => Promise<ResponseSpec & {
33
33
  memori: Memori[];
34
34
  }>;
35
+ /**
36
+ * Gets a list of Memori objects owned by the specified user.
37
+ * @param {string} tenantName - The name of the tenant
38
+ * @param {string} userID - The user name
39
+ * @param {string=} authToken - The login token
40
+ * @returns A list of Memori objects
41
+ */
42
+ getUserByIDMemoriList: (tenantName: string, userID: string, authToken?: string | undefined) => Promise<ResponseSpec & {
43
+ memori: Memori[];
44
+ }>;
45
+ /**
46
+ * Gets a list of Memori objects owned by the specified user.
47
+ * @param {string} tenantName - The name of the tenant
48
+ * @param {string} userName - The user name
49
+ * @param {string=} authToken - The login token
50
+ * @returns A list of Memori objects
51
+ */
52
+ getUserMemoriList: (tenantName: string, userName: string, authToken?: string | undefined) => Promise<ResponseSpec & {
53
+ memori: Memori[];
54
+ }>;
35
55
  /**
36
56
  * Gets a list of Memori objects for the currently logged in User.
37
57
  * @param authToken - The login token
38
58
  * @returns A list of Memori objects
39
59
  */
40
- getUserMemoriList: (authToken: string) => Promise<ResponseSpec & {
60
+ getMemoriList: (authToken: string) => Promise<ResponseSpec & {
41
61
  memori: Memori[];
42
62
  }>;
43
63
  /**
@@ -5,7 +5,7 @@ declare const _default: (apiUrl: string) => {
5
5
  * @param user - The user object
6
6
  * @returns The created user object
7
7
  */
8
- userSignIn: (user: User) => Promise<ResponseSpec & {
8
+ userSignUp: (user: User) => Promise<ResponseSpec & {
9
9
  user: User;
10
10
  }>;
11
11
  /**
@@ -13,7 +13,7 @@ declare const _default: (apiUrl: string) => {
13
13
  * @param user - The user object
14
14
  * @returns The created user object
15
15
  */
16
- userConfirmSignIn: (user: User) => Promise<ResponseSpec & {
16
+ userConfirmSignUp: (user: User) => Promise<ResponseSpec & {
17
17
  user: User;
18
18
  token?: string | undefined;
19
19
  }>;
@@ -1,12 +1,29 @@
1
- import { ResponseSpec, ImportReponse, ImportCSVParams, ExportCSVParams } from '../types';
1
+ import { ResponseSpec, ImportReponse, ExportCSVParams, ImportParams } from '../types';
2
2
  declare const _default: (apiUrl: string) => {
3
3
  /**
4
4
  * Imports memories from a CSV file.
5
5
  * @param {string} sessionId The session ID
6
- * @param {string[]} csvRows Rows of the CSV file.
7
- * @param {ImportCSVParams} params The specifications and content of the CSV file
6
+ * @param {string[]} rows Rows of the CSV file.
7
+ * @param {ImportParams} params The specifications and content of the CSV file
8
8
  */
9
- importCSV: (sessionId: string, csvRows: string[], params: ImportCSVParams) => Promise<ResponseSpec & ImportReponse>;
9
+ importCSV: (sessionId: string, rows: string[], params: ImportParams) => Promise<ResponseSpec & ImportReponse>;
10
+ /**
11
+ * Gets the status of an ongoing Import process.
12
+ * @param {string} importID The import process ID
13
+ */
14
+ importStatus: (importID: string) => Promise<ResponseSpec & ImportReponse>;
15
+ /**
16
+ * Interrupts an ongoing Import process.
17
+ * @param {string} importID The import process ID
18
+ */
19
+ stopImport: (importID: string) => Promise<ResponseSpec & ImportReponse>;
20
+ /**
21
+ * Imports memories from a TXT file.
22
+ * @param {string} sessionId The session ID
23
+ * @param {string[]} rows Rows of the TXT file.
24
+ * @param {ImportCSVParams} params The specifications and content of the TXT file
25
+ */
26
+ importTXT: (sessionId: string, rows: string[], params: Omit<ImportParams, 'csvSpecs'>) => Promise<ResponseSpec & ImportReponse>;
10
27
  /**
11
28
  * Exports memories to a CSV file.
12
29
  * @param {string} sessionID The session ID
@@ -405,7 +405,7 @@ function _extends() {
405
405
  }
406
406
 
407
407
  var getApiUrl = function getApiUrl(hostname) {
408
- return hostname ? new URL(hostname.startsWith('http') ? hostname : "https://" + hostname).origin.replace('http://', 'https://') : 'https://backend.memori.ai';
408
+ return hostname ? new URL(hostname.startsWith('http') ? hostname : "https://" + hostname).origin : 'https://backend.memori.ai';
409
409
  };
410
410
 
411
411
  var apiFetcher = function apiFetcher(path, opts) {
@@ -468,12 +468,38 @@ var memori = (function (apiUrl) {
468
468
  });
469
469
  },
470
470
 
471
+ /**
472
+ * Gets a list of Memori objects owned by the specified user.
473
+ * @param {string} tenantName - The name of the tenant
474
+ * @param {string} userID - The user name
475
+ * @param {string=} authToken - The login token
476
+ * @returns A list of Memori objects
477
+ */
478
+ getUserByIDMemoriList: function getUserByIDMemoriList(tenantName, userID, authToken) {
479
+ return apiFetcher("/UserMemoriByID/" + tenantName + "/" + userID + (authToken ? "/" + authToken : ''), {
480
+ apiUrl: apiUrl
481
+ });
482
+ },
483
+
484
+ /**
485
+ * Gets a list of Memori objects owned by the specified user.
486
+ * @param {string} tenantName - The name of the tenant
487
+ * @param {string} userName - The user name
488
+ * @param {string=} authToken - The login token
489
+ * @returns A list of Memori objects
490
+ */
491
+ getUserMemoriList: function getUserMemoriList(tenantName, userName, authToken) {
492
+ return apiFetcher("/UserMemori/" + tenantName + "/" + userName + (authToken ? "/" + authToken : ''), {
493
+ apiUrl: apiUrl
494
+ });
495
+ },
496
+
471
497
  /**
472
498
  * Gets a list of Memori objects for the currently logged in User.
473
499
  * @param authToken - The login token
474
500
  * @returns A list of Memori objects
475
501
  */
476
- getUserMemoriList: function getUserMemoriList(authToken) {
502
+ getMemoriList: function getMemoriList(authToken) {
477
503
  return apiFetcher("/Memori/" + authToken, {
478
504
  apiUrl: apiUrl
479
505
  });
@@ -642,7 +668,7 @@ var user = (function (apiUrl) {
642
668
  * @param user - The user object
643
669
  * @returns The created user object
644
670
  */
645
- userSignIn: function userSignIn(user) {
671
+ userSignUp: function userSignUp(user) {
646
672
  return apiFetcher('/User', {
647
673
  apiUrl: apiUrl,
648
674
  body: user,
@@ -655,7 +681,7 @@ var user = (function (apiUrl) {
655
681
  * @param user - The user object
656
682
  * @returns The created user object
657
683
  */
658
- userConfirmSignIn: function userConfirmSignIn(user) {
684
+ userConfirmSignUp: function userConfirmSignUp(user) {
659
685
  return apiFetcher('/UserConfirm', {
660
686
  apiUrl: apiUrl,
661
687
  body: user,
@@ -1639,11 +1665,11 @@ var importExport = (function (apiUrl) {
1639
1665
  /**
1640
1666
  * Imports memories from a CSV file.
1641
1667
  * @param {string} sessionId The session ID
1642
- * @param {string[]} csvRows Rows of the CSV file.
1643
- * @param {ImportCSVParams} params The specifications and content of the CSV file
1668
+ * @param {string[]} rows Rows of the CSV file.
1669
+ * @param {ImportParams} params The specifications and content of the CSV file
1644
1670
  */
1645
1671
  importCSV: function () {
1646
- var _importCSV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId, csvRows, params) {
1672
+ var _importCSV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId, rows, params) {
1647
1673
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1648
1674
  while (1) {
1649
1675
  switch (_context.prev = _context.next) {
@@ -1652,7 +1678,7 @@ var importExport = (function (apiUrl) {
1652
1678
  method: 'POST',
1653
1679
  apiUrl: apiUrl,
1654
1680
  body: _extends({
1655
- csvRows: csvRows
1681
+ rows: rows
1656
1682
  }, params)
1657
1683
  }));
1658
1684
 
@@ -1671,6 +1697,101 @@ var importExport = (function (apiUrl) {
1671
1697
  return importCSV;
1672
1698
  }(),
1673
1699
 
1700
+ /**
1701
+ * Gets the status of an ongoing Import process.
1702
+ * @param {string} importID The import process ID
1703
+ */
1704
+ importStatus: function () {
1705
+ var _importStatus = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(importID) {
1706
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1707
+ while (1) {
1708
+ switch (_context2.prev = _context2.next) {
1709
+ case 0:
1710
+ return _context2.abrupt("return", apiFetcher("/ImportExport/ImportStatus/" + importID, {
1711
+ method: 'GET',
1712
+ apiUrl: apiUrl
1713
+ }));
1714
+
1715
+ case 1:
1716
+ case "end":
1717
+ return _context2.stop();
1718
+ }
1719
+ }
1720
+ }, _callee2);
1721
+ }));
1722
+
1723
+ function importStatus(_x4) {
1724
+ return _importStatus.apply(this, arguments);
1725
+ }
1726
+
1727
+ return importStatus;
1728
+ }(),
1729
+
1730
+ /**
1731
+ * Interrupts an ongoing Import process.
1732
+ * @param {string} importID The import process ID
1733
+ */
1734
+ stopImport: function () {
1735
+ var _stopImport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(importID) {
1736
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1737
+ while (1) {
1738
+ switch (_context3.prev = _context3.next) {
1739
+ case 0:
1740
+ return _context3.abrupt("return", apiFetcher("/ImportExport/StopImport/" + importID, {
1741
+ method: 'POST',
1742
+ apiUrl: apiUrl
1743
+ }));
1744
+
1745
+ case 1:
1746
+ case "end":
1747
+ return _context3.stop();
1748
+ }
1749
+ }
1750
+ }, _callee3);
1751
+ }));
1752
+
1753
+ function stopImport(_x5) {
1754
+ return _stopImport.apply(this, arguments);
1755
+ }
1756
+
1757
+ return stopImport;
1758
+ }(),
1759
+
1760
+ /**
1761
+ * Imports memories from a TXT file.
1762
+ * @param {string} sessionId The session ID
1763
+ * @param {string[]} rows Rows of the TXT file.
1764
+ * @param {ImportCSVParams} params The specifications and content of the TXT file
1765
+ */
1766
+ importTXT: function () {
1767
+ var _importTXT = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, rows, params) {
1768
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1769
+ while (1) {
1770
+ switch (_context4.prev = _context4.next) {
1771
+ case 0:
1772
+ return _context4.abrupt("return", apiFetcher("/ImportExport/ImportTXT/" + sessionId, {
1773
+ method: 'POST',
1774
+ apiUrl: apiUrl,
1775
+ body: _extends({
1776
+ rows: rows
1777
+ }, params)
1778
+ }));
1779
+
1780
+ case 1:
1781
+ case "end":
1782
+ return _context4.stop();
1783
+ }
1784
+ }
1785
+ }, _callee4);
1786
+ }));
1787
+
1788
+ function importTXT(_x6, _x7, _x8) {
1789
+ return _importTXT.apply(this, arguments);
1790
+ }
1791
+
1792
+ return importTXT;
1793
+ }(),
1794
+
1674
1795
  /**
1675
1796
  * Exports memories to a CSV file.
1676
1797
  * @param {string} sessionID The session ID
@@ -1678,12 +1799,12 @@ var importExport = (function (apiUrl) {
1678
1799
  * @returns The CSV file content
1679
1800
  */
1680
1801
  exportCSV: function () {
1681
- var _exportCSV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionID, params) {
1682
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1802
+ var _exportCSV = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionID, params) {
1803
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1683
1804
  while (1) {
1684
- switch (_context2.prev = _context2.next) {
1805
+ switch (_context5.prev = _context5.next) {
1685
1806
  case 0:
1686
- return _context2.abrupt("return", apiFetcher("/ImportExport/ExportCSV/" + sessionID, {
1807
+ return _context5.abrupt("return", apiFetcher("/ImportExport/ExportCSV/" + sessionID, {
1687
1808
  method: 'POST',
1688
1809
  apiUrl: apiUrl,
1689
1810
  body: params,
@@ -1692,13 +1813,13 @@ var importExport = (function (apiUrl) {
1692
1813
 
1693
1814
  case 1:
1694
1815
  case "end":
1695
- return _context2.stop();
1816
+ return _context5.stop();
1696
1817
  }
1697
1818
  }
1698
- }, _callee2);
1819
+ }, _callee5);
1699
1820
  }));
1700
1821
 
1701
- function exportCSV(_x4, _x5) {
1822
+ function exportCSV(_x9, _x10) {
1702
1823
  return _exportCSV.apply(this, arguments);
1703
1824
  }
1704
1825