@memori.ai/memori-api-client 0.1.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.
Files changed (70) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +188 -0
  3. package/dist/apiFetcher.d.ts +13 -0
  4. package/dist/backend/asset.d.ts +44 -0
  5. package/dist/backend/integration.d.ts +55 -0
  6. package/dist/backend/invitation.d.ts +82 -0
  7. package/dist/backend/memori.d.ts +125 -0
  8. package/dist/backend/user.d.ts +109 -0
  9. package/dist/backend.d.ts +273 -0
  10. package/dist/constants.d.ts +2 -0
  11. package/dist/engine/correlationPairs.d.ts +20 -0
  12. package/dist/engine/dialog.d.ts +88 -0
  13. package/dist/engine/importExport.d.ts +34 -0
  14. package/dist/engine/intents.d.ts +65 -0
  15. package/dist/engine/localizationKeys.d.ts +50 -0
  16. package/dist/engine/media.d.ts +48 -0
  17. package/dist/engine/memori.d.ts +30 -0
  18. package/dist/engine/memories.d.ts +50 -0
  19. package/dist/engine/nlp.d.ts +25 -0
  20. package/dist/engine/people.d.ts +46 -0
  21. package/dist/engine/promptedQuestions.d.ts +37 -0
  22. package/dist/engine/search.d.ts +30 -0
  23. package/dist/engine/session.d.ts +28 -0
  24. package/dist/engine/stats.d.ts +25 -0
  25. package/dist/engine/unansweredQuestions.d.ts +22 -0
  26. package/dist/engine/webhooks.d.ts +21 -0
  27. package/dist/engine.d.ts +297 -0
  28. package/dist/helpers/asset.d.ts +20 -0
  29. package/dist/helpers/getApiUrl.d.ts +1 -0
  30. package/dist/index.d.ts +582 -0
  31. package/dist/index.js +8 -0
  32. package/dist/memori-api-client.cjs.development.js +3666 -0
  33. package/dist/memori-api-client.cjs.development.js.map +1 -0
  34. package/dist/memori-api-client.cjs.production.min.js +2 -0
  35. package/dist/memori-api-client.cjs.production.min.js.map +1 -0
  36. package/dist/memori-api-client.esm.js +3660 -0
  37. package/dist/memori-api-client.esm.js.map +1 -0
  38. package/dist/speech.d.ts +10 -0
  39. package/dist/types.d.ts +410 -0
  40. package/package.json +125 -0
  41. package/src/apiFetcher.ts +29 -0
  42. package/src/backend/asset.ts +86 -0
  43. package/src/backend/integration.ts +98 -0
  44. package/src/backend/invitation.ts +115 -0
  45. package/src/backend/memori.ts +223 -0
  46. package/src/backend/user.ts +186 -0
  47. package/src/backend.ts +20 -0
  48. package/src/constants.ts +21 -0
  49. package/src/engine/correlationPairs.ts +31 -0
  50. package/src/engine/dialog.ts +158 -0
  51. package/src/engine/importExport.ts +43 -0
  52. package/src/engine/intents.ts +116 -0
  53. package/src/engine/localizationKeys.ts +94 -0
  54. package/src/engine/media.ts +79 -0
  55. package/src/engine/memori.ts +51 -0
  56. package/src/engine/memories.ts +89 -0
  57. package/src/engine/nlp.ts +39 -0
  58. package/src/engine/people.ts +82 -0
  59. package/src/engine/promptedQuestions.ts +63 -0
  60. package/src/engine/search.ts +49 -0
  61. package/src/engine/session.ts +49 -0
  62. package/src/engine/stats.ts +44 -0
  63. package/src/engine/unansweredQuestions.ts +38 -0
  64. package/src/engine/webhooks.ts +32 -0
  65. package/src/engine.ts +51 -0
  66. package/src/helpers/asset.ts +52 -0
  67. package/src/helpers/getApiUrl.ts +6 -0
  68. package/src/index.ts +20 -0
  69. package/src/speech.ts +242 -0
  70. package/src/types.ts +440 -0
package/LICENSE ADDED
@@ -0,0 +1,18 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2022 Memori Srl
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
18
+
package/README.md ADDED
@@ -0,0 +1,188 @@
1
+ # memori-api-client
2
+
3
+ [![npm version](https://img.shields.io/github/package-json/v/memori-ai/memori-api-client)](https://www.npmjs.com/package/@memoriai/memori-api-client)
4
+ ![Tests](https://github.com/memori-ai/memori-api-client/workflows/CI/badge.svg?branch=main)
5
+ ![TypeScript Support](https://img.shields.io/badge/TypeScript-Support-blue)
6
+
7
+ TypeScript client to integrate with [Memori](https://memori.ai) API.
8
+
9
+ ## Installation
10
+
11
+ ```bash
12
+ yarn add @memori.ai/memori-api-client
13
+ ```
14
+
15
+ ```bash
16
+ npm install @memori.ai/memori-api-client
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ Every method has JSDoc annotations with usage and description and typings information.
22
+
23
+ See an example [here](https://github.com/memori-ai/examples/blob/main/ts-sdk/index.ts).
24
+
25
+ ```ts
26
+ import memoriApiClient from '@memori.ai/memori-api-client';
27
+
28
+ const memori = memoriApiClient('https://backend.memori.ai');
29
+
30
+ (async () => {
31
+ const { sessionID, currentState, ...response } = await memori.initSession(
32
+ '768b9654-e781-4c3c-81fa-ae1529d1bfbe'
33
+ );
34
+
35
+ const {
36
+ currentState: dialogState,
37
+ ...resp
38
+ } = await memori.postTextEnteredEvent(sessionID, 'Ciao, Memori!');
39
+ })();
40
+ ```
41
+
42
+ For the specification of the APIs, see the typings or the documentation from the dashboard if you are allowed to see it.
43
+
44
+ ### Constants
45
+
46
+ ```ts
47
+ import memoriApiClient from '@memori.ai/memori-api-client';
48
+
49
+ const memori = memoriApiClient('https://backend.memori.ai');
50
+
51
+ memori.constants.allowedMediaTypes; // list of allowed media types in asset upload
52
+ memori.constants.anonTag; // tag for anonymous users
53
+ ```
54
+
55
+ ### TTS
56
+
57
+ Bundled with this client there is a TTS utility that can be used to synthesize text to speech.
58
+
59
+ ```ts
60
+ const memori = memoriApiClient('https://backend.memori.ai');
61
+
62
+ // Needs Azure Speech API key
63
+ // See https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/quickstarts/setup-platform?pivots=programming-language-javascript
64
+ // Second parameter is for debug mode
65
+ const speechSdk = memori.speech(AZURE_COGNITIVE_SERVICES_TTS_KEY, true);
66
+
67
+ // Requires the language code of the text to be spoken
68
+ // And the voice type (female or male)
69
+ const speech = speechSdk('it', 'FEMALE');
70
+
71
+ speech.speak('Ciao, Memori!', () => {
72
+ console.log('spoken');
73
+ });
74
+
75
+ speech.isSpeaking();
76
+
77
+ speech.stopSpeaking();
78
+ ```
79
+
80
+ ### STT
81
+
82
+ There is also a speech recognition utility.
83
+
84
+ ```ts
85
+ // Same as for the TTS
86
+ const speech = speechSdk('it', 'FEMALE');
87
+
88
+ speech.recognize(transcript => {
89
+ console.log('Recognized ', transcript);
90
+ });
91
+
92
+ speech.isRecognizing();
93
+
94
+ speech.stopRecognizing();
95
+ ```
96
+
97
+ ### Asset
98
+
99
+ There is a helper method parsing media urls from the DB, handling different cases
100
+
101
+ ```ts
102
+ const memori = memoriApiClient('https://backend.memori.ai');
103
+
104
+ memori.asset.getResourceUrl({
105
+ type: 'avatar',
106
+ resourceURI: '768b9654-e781-4c3c-81fa-ae1529d1bfbe.png',
107
+ mediaType: 'image/png',
108
+ sessionId: 'be2e4a44-890b-483b-a26a-f6e122f36e2b',
109
+ });
110
+ ```
111
+
112
+ ## Development
113
+
114
+ To run TSDX, use:
115
+
116
+ ```bash
117
+ npm start # or yarn start
118
+ ```
119
+
120
+ This builds to `/dist` and runs the project in watch mode so any edits you save inside `src` causes a rebuild to `/dist`.
121
+
122
+ To do a one-off build, use `npm run build` or `yarn build`.
123
+
124
+ To run tests, use `npm test` or `yarn test`.
125
+
126
+ ### Formatting and linting
127
+
128
+ Code quality is set up with `prettier`, `husky`, and `lint-staged`.
129
+
130
+ You can run prettier with `npm format` or `yarn format`.
131
+ You can run linter with `npm lint` or `yarn lint`.
132
+ You can run type checking with `npm typecheck` or `yarn typecheck`.
133
+
134
+ ### Jest
135
+
136
+ Jest tests are set up to run with `npm test` or `yarn test`.
137
+
138
+ ### Bundle Analysis
139
+
140
+ [`size-limit`](https://github.com/ai/size-limit) is set up to calculate the real cost of your library with `npm run size` and visualize the bundle with `npm run analyze`.
141
+
142
+ ### Rollup
143
+
144
+ TSDX uses [Rollup](https://rollupjs.org) as a bundler and generates multiple rollup configs for various module formats and build settings. See [Optimizations](#optimizations) for details.
145
+
146
+ ### TypeScript
147
+
148
+ `tsconfig.json` is set up to interpret `dom` and `esnext` types, as well as `react` for `jsx`.
149
+ You can run type checking with `npm typecheck` or `yarn typecheck`.
150
+
151
+ ### Continuous Integration
152
+
153
+ #### GitHub Actions
154
+
155
+ Two actions are added by default:
156
+
157
+ - `main` which installs deps w/ cache, lints, tests, and builds on all pushes against a Node and OS matrix
158
+ - `size` which comments cost comparison of your library on every pull request using [`size-limit`](https://github.com/ai/size-limit)
159
+
160
+ ### Optimizations
161
+
162
+ Please see the main `tsdx` [optimizations docs](https://github.com/palmerhq/tsdx#optimizations). In particular, know that you can take advantage of development-only optimizations:
163
+
164
+ ```js
165
+ // ./types/index.d.ts
166
+ declare var __DEV__: boolean;
167
+
168
+ // inside your code...
169
+ if (__DEV__) {
170
+ console.log('foo');
171
+ }
172
+ ```
173
+
174
+ You can also choose to install and use [invariant](https://github.com/palmerhq/tsdx#invariant) and [warning](https://github.com/palmerhq/tsdx#warning) functions.
175
+
176
+ ### Module Formats
177
+
178
+ CJS, ESModules, and UMD module formats are supported.
179
+
180
+ The appropriate paths are configured in `package.json` and `dist/index.js` accordingly. Please report if any issues are found.
181
+
182
+ ### Commitlint
183
+
184
+ We use [commmitlint](https://commitlint.js.org/) for commit message validation based on [Conventional Commits](https://www.conventionalcommits.org/en/).
185
+
186
+ ### Release
187
+
188
+ Changelog and release management with [release-it](https://github.com/release-it/release-it), using [convential changelog](https://github.com/release-it/conventional-changelog).
@@ -0,0 +1,13 @@
1
+ export declare const fetcher: (path: string, opts: {
2
+ apiUrl: string;
3
+ method?: string;
4
+ body?: object;
5
+ headers?: object;
6
+ }) => Promise<any>;
7
+ export declare const devFetcher: (data: any) => Promise<any>;
8
+ export declare const apiFetcher: (path: string, opts: {
9
+ apiUrl: string;
10
+ method?: string;
11
+ body?: object;
12
+ headers?: object;
13
+ }) => Promise<any>;
@@ -0,0 +1,44 @@
1
+ import { ResponseSpec, Asset } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * URL to upload a file creating a new Asset object to access it.
5
+ * @param {string} authToken - The login token
6
+ * @param {string} memoriID - The memori ID
7
+ * @param {string=} memoryID - The memory ID
8
+ * @returns The URL to upload a file
9
+ */
10
+ getUploadAssetURL: (authToken: string, memoriID: string, memoryID?: string | undefined) => string;
11
+ /**
12
+ * Uploads a file and creates a new Asset object to access it.
13
+ * @param {string} authToken - The login token
14
+ * @param {string} memoriID - The memori ID
15
+ * @param {string=} memoryID - The memory ID
16
+ * @returns Response of an Upload Asset request.
17
+ */
18
+ uploadAsset: (fileName: string, fileUrl: string, authToken: string, memoriID: string, memoryID?: string | undefined) => Promise<ResponseSpec & {
19
+ asset: Asset;
20
+ }>;
21
+ /**
22
+ * Downloads a file from an Asset object
23
+ * @param {string} fileName - The file name
24
+ * @param {string} sessionID - The session ID
25
+ * @returns The asset file
26
+ */
27
+ getAsset: (fileName: string, sessionID: string) => Promise<any>;
28
+ /**
29
+ * Updates an Asset object
30
+ * @param {string} authToken - The login token
31
+ * @param {string} assetURL - The asset URL
32
+ * @returns The updated asset object
33
+ */
34
+ updateAsset: (authToken: string, assetURL: string, asset: Asset) => Promise<ResponseSpec & {
35
+ asset: Asset;
36
+ }>;
37
+ /**
38
+ * Deletes an Asset object
39
+ * @param {string} authToken - The login token
40
+ * @param {string} assetURL - The asset URL
41
+ */
42
+ deleteAsset: (authToken: string, assetURL: string) => Promise<ResponseSpec>;
43
+ };
44
+ export default _default;
@@ -0,0 +1,55 @@
1
+ import { ResponseSpec, Integration } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * Gets a list of integration objects for a specified Memori object.
5
+ * @param memoriID - The id of the Memori object
6
+ * @param authToken - The login token
7
+ * @returns A list of Integration objects
8
+ */
9
+ getMemoriIntegrationsList: (authToken: string, memoriID: string) => Promise<ResponseSpec & {
10
+ integrations: Integration[];
11
+ }>;
12
+ /**
13
+ * Gets a list of integration objects.
14
+ * @param authToken - The login token
15
+ * @returns A list of Integration objects
16
+ */
17
+ getAllIntegrationsList: (authToken: string) => Promise<ResponseSpec & {
18
+ integrations: Integration[];
19
+ }>;
20
+ /**
21
+ * Gets the detail of an integration object of the currently logged in User.
22
+ * @param authToken - The login token
23
+ * @param integrationID - The ID of the integration object
24
+ * @returns The Integration object
25
+ */
26
+ getIntegration: (authToken: string, integrationID: string) => Promise<ResponseSpec & {
27
+ integration: Integration;
28
+ }>;
29
+ /**
30
+ * Delete an exsisting integration object.
31
+ * @param authToken - The login token
32
+ * @param integrationID - The ID of the integration object
33
+ */
34
+ deleteIntegration: (authToken: string, integrationID: string) => Promise<ResponseSpec>;
35
+ /**
36
+ * Register a new integration object.
37
+ * @param authToken - The login token
38
+ * @param integration - The Integration object
39
+ * @returns The Integration object
40
+ */
41
+ createIntegration: (authToken: string, integration: Integration) => Promise<ResponseSpec & {
42
+ integration: Integration;
43
+ }>;
44
+ /**
45
+ * Updates the integration object.
46
+ * @param authToken - The login token
47
+ * @param integrationID - The id of the Integration object
48
+ * @param integration - The Integration object
49
+ * @returns The Integration object
50
+ */
51
+ updateIntegration: (authToken: string, integrationID: string, integration: Integration) => Promise<ResponseSpec & {
52
+ integration: Integration;
53
+ }>;
54
+ };
55
+ export default _default;
@@ -0,0 +1,82 @@
1
+ import { ResponseSpec, Invitation } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * Gets a list of invitations sent by the currently logged in User.
5
+ * @param {string} authToken - The login token
6
+ * @returns The list of Invitation objects.
7
+ */
8
+ getSentInvitations: (authToken: string) => Promise<ResponseSpec & {
9
+ invitations: Invitation[];
10
+ }>;
11
+ /**
12
+ * Gets a list of invitations received by the currently logged in User.
13
+ * @param {string} authToken - The login token
14
+ * @returns The list of Invitation objects.
15
+ */
16
+ getReceivedInvitations: (authToken: string) => Promise<ResponseSpec & {
17
+ invitations: Invitation[];
18
+ }>;
19
+ /**
20
+ * Gets a list of all invitation objects
21
+ * @param {string} authToken - The login token
22
+ * @returns The list of Invitation objects.
23
+ */
24
+ getAllInvitations: (authToken: string) => Promise<ResponseSpec & {
25
+ invitations: Invitation[];
26
+ }>;
27
+ /**
28
+ * Gets the details of an Invitation object of the currently logged in User.
29
+ * @param {string} authToken - The login token
30
+ * @param {string} invitationId - The ID of the Invitation object
31
+ * @returns The Invitation object.
32
+ */
33
+ getInvitation: (authToken: string, invitationId: string) => Promise<ResponseSpec & {
34
+ invitation: Invitation;
35
+ }>;
36
+ /**
37
+ * Updates an existing Invitation object sent by the currently logged in User.
38
+ * @param {string} authToken - The login token
39
+ * @param {Invitation} invitation - The Invitation object
40
+ * @returns The Invitation object.
41
+ */
42
+ updateInvitation: (authToken: string, invitation: Partial<Omit<Invitation, 'invitationID'>> & {
43
+ invitationID: string;
44
+ }) => Promise<ResponseSpec & {
45
+ invitation: Invitation;
46
+ }>;
47
+ /**
48
+ * Deletes an existing Invitation object.
49
+ * @param {string} authToken - The login token
50
+ * @param {string} invitationId - The ID of the Invitation object
51
+ * @returns The Invitation object.
52
+ */
53
+ deleteInvitation: (authToken: string, invitationId: string) => Promise<ResponseSpec>;
54
+ /**
55
+ * Accepts an Invitation object.
56
+ * @param {string} authToken - The login token
57
+ * @param {string} invitationId - The ID of the Invitation object
58
+ * @returns The Invitation object.
59
+ */
60
+ acceptInvitation: (authToken: string, invitationId: string) => Promise<ResponseSpec & {
61
+ invitation: Invitation;
62
+ }>;
63
+ /**
64
+ * Rejects an Invitation object.
65
+ * @param {string} authToken - The login token
66
+ * @param {string} invitationId - The ID of the Invitation object
67
+ * @returns The Invitation object.
68
+ */
69
+ rejectInvitation: (authToken: string, invitationId: string) => Promise<ResponseSpec & {
70
+ invitation: Invitation;
71
+ }>;
72
+ /**
73
+ * Send a new Invitation object
74
+ * @param {string} authToken - The login token
75
+ * @param {Invitation} invitation - The Invitation object
76
+ * @returns The Invitation object.
77
+ */
78
+ sendInvitation: (authToken: string, invitation: Partial<Omit<Invitation, 'invitationID'>>) => Promise<ResponseSpec & {
79
+ invitation: Invitation;
80
+ }>;
81
+ };
82
+ export default _default;
@@ -0,0 +1,125 @@
1
+ import { ResponseSpec, Memori, MemoriConfig } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * Gets a list of all the public Memori objects for a specific Tenant.
5
+ * @param tenant - The name of the tenant
6
+ * @returns A list of Memori objects
7
+ */
8
+ getTenantPublicMemoriList: (tenant: string) => Promise<ResponseSpec & {
9
+ memori: Memori[];
10
+ }>;
11
+ /**
12
+ * Gets a list of all the public Memori objects for a specific Tenant accessible from user session.
13
+ * @param authToken - The login token
14
+ * @returns A list of Memori objects
15
+ */
16
+ getPublicMemoriList: (authToken: string) => Promise<ResponseSpec & {
17
+ memori: Memori[];
18
+ }>;
19
+ /**
20
+ * Gets a list of all Memori objects.
21
+ * @param authToken - The login token
22
+ * @returns A list of Memori objects
23
+ */
24
+ getAllMemori: (authToken: string) => Promise<ResponseSpec & {
25
+ memori: Memori[];
26
+ }>;
27
+ /**
28
+ * Gets a list of Memori objects for the currently logged in User.
29
+ * @param authToken - The login token
30
+ * @returns A list of Memori objects
31
+ */
32
+ getUserMemoriList: (authToken: string) => Promise<ResponseSpec & {
33
+ memori: Memori[];
34
+ }>;
35
+ /**
36
+ * Gets a list of Memori objects for the currently logged in User.
37
+ * @param authToken - The login token
38
+ * @returns A list of Memori objects
39
+ */
40
+ getSharedMemoriList: (authToken: string) => Promise<ResponseSpec & {
41
+ memori: Memori[];
42
+ }>;
43
+ /**
44
+ * Gets a list of all the known Memori categories (or tags).
45
+ * @param {string} tenant - The name of the tenant
46
+ * @returns A list of Memori categories
47
+ */
48
+ getTenantCategories: (tenant: string) => Promise<ResponseSpec & {
49
+ memoriCategories: string[];
50
+ }>;
51
+ /**
52
+ * Gets a list of all the Memori Configuration objects.
53
+ * @param authToken - The login token
54
+ * @returns A list of Memori Configuration objects
55
+ */
56
+ getMemoriConfigs: (authToken: string) => Promise<ResponseSpec & {
57
+ memoriConfigs: MemoriConfig[];
58
+ }>;
59
+ /**
60
+ * Register a new Memori object.
61
+ * @param authToken - The login token
62
+ * @param memori - The Memori object
63
+ * @returns The created Memori object
64
+ */
65
+ createMemori: (authToken: string, memori: Memori) => Promise<ResponseSpec & {
66
+ memori: Memori;
67
+ }>;
68
+ /**
69
+ * Update an existing Memori object.
70
+ * @param authToken - The login token
71
+ * @param memori - The Memori object
72
+ * @returns The created Memori object
73
+ */
74
+ updateMemori: (authToken: string, memori: Memori) => Promise<ResponseSpec & {
75
+ memori: Memori;
76
+ }>;
77
+ /**
78
+ * Deletes an existing Memori object.
79
+ * @param authToken - The login token
80
+ * @param memori - The Memori object
81
+ */
82
+ deleteMemori: (authToken: string, memori: Memori) => Promise<ResponseSpec>;
83
+ /**
84
+ * Gets the details of a Memori object of the currently logged in User.
85
+ * @param authToken - The login token
86
+ * @param memoriID - The ID of the Memori object
87
+ * @returns A Memori object
88
+ */
89
+ getMemoriById: (authToken: string, memoriID: string) => Promise<ResponseSpec & {
90
+ memori: Memori;
91
+ }>;
92
+ /**
93
+ * Gets the details of a Memori object of the currently logged in User.
94
+ * @param {string} tenantName - The Name of the Tenant
95
+ * @param {string} userID - The ID of the User object
96
+ * @param {string} memoriID - The ID of the Memori object
97
+ * @param {string?} authToken - The login token
98
+ * @returns A Memori object
99
+ */
100
+ getMemoriByUserAndId: (tenantName: string, userID: string, memoriID: string, authToken?: string | undefined) => Promise<ResponseSpec & {
101
+ memori: Memori;
102
+ }>;
103
+ /**
104
+ * Gets the details of a Memori object by name, owner and tenant
105
+ * @param {string} tenant - The name of the tenant
106
+ * @param {string} userName - The name of the user
107
+ * @param {string} memoriName - The name of the Memori object
108
+ * @param {string=} [authToken=''] - The token of the Memori object
109
+ */
110
+ getMemori: (tenant: string, userName: string, memoriName: string, authToken?: string | undefined) => Promise<ResponseSpec & {
111
+ memori: Memori;
112
+ }>;
113
+ /**
114
+ * Gets the statistics for sessions opened in a specified interval for the specified Memori object.
115
+ * @param {string} authToken - The login token
116
+ * @param {string} memoriID - The ID of the Memori object
117
+ * @param {string=} dateFrom - The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
118
+ * @param {string=} dateTo - The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
119
+ */
120
+ getMemoriSessions: (authToken: string, memoriID: string, dateFrom?: string | undefined, dateTo?: string | undefined) => Promise<ResponseSpec & {
121
+ totalSessions: number;
122
+ validSessions: number;
123
+ }>;
124
+ };
125
+ export default _default;
@@ -0,0 +1,109 @@
1
+ import { ResponseSpec, Tenant, User } from '../types';
2
+ declare const _default: (apiUrl: string) => {
3
+ /**
4
+ * Registers a new user.
5
+ * @param user - The user object
6
+ * @returns The created user object
7
+ */
8
+ userSignIn: (user: User) => Promise<ResponseSpec & {
9
+ user: User;
10
+ }>;
11
+ /**
12
+ * Confirms the registration of a User and performs a Login.
13
+ * @param user - The user object
14
+ * @returns The created user object
15
+ */
16
+ userConfirmSignIn: (user: User) => Promise<ResponseSpec & {
17
+ user: User;
18
+ token?: string | undefined;
19
+ }>;
20
+ /**
21
+ * Tries a login with the specified credentials and returns a login token if successful.
22
+ * @param user - The user object
23
+ * @returns The logged in user object
24
+ */
25
+ userLogin: (user: User) => Promise<ResponseSpec & {
26
+ user: User;
27
+ token?: string | undefined;
28
+ flowID?: string | undefined;
29
+ }>;
30
+ /**
31
+ * Logs out the user.
32
+ * @param authToken - The login token
33
+ */
34
+ userLogout: (authToken: string) => Promise<ResponseSpec>;
35
+ /**
36
+ * Gets the details of a User object.
37
+ * @param authToken - The login token
38
+ * @param userID - The user ID
39
+ * @returns The user object
40
+ */
41
+ getUser: (authToken: string, userID: string) => Promise<ResponseSpec & {
42
+ user: User;
43
+ }>;
44
+ /**
45
+ * Gets a list of all the existing User objects.
46
+ * @param authToken - The login token
47
+ * @returns A list of User objects
48
+ */
49
+ getUsersList: (authToken: string) => Promise<ResponseSpec & {
50
+ users: User[];
51
+ }>;
52
+ /**
53
+ * Deletes the currently logged in User.
54
+ * @param {string} authToken - The login token
55
+ * @param {string} userID: The User ID
56
+ */
57
+ deleteUser: (authToken: string, userID: string) => Promise<ResponseSpec>;
58
+ /**
59
+ * Updates the details of a User object.
60
+ * @param authToken - The login token
61
+ * @param userID - The user ID
62
+ * @returns The user object
63
+ */
64
+ updateUser: (authToken: string, userID: string, user: User) => Promise<ResponseSpec & {
65
+ user: User;
66
+ }>;
67
+ /**
68
+ * Resets a User's password.
69
+ * If found, the User receives a verification code via e-mail.
70
+ * The code must be sent via the ResetConfirm API, passing the same User object
71
+ * sent to this API with the addition of the verification code and the new password.
72
+ * @param {User} user - The user object
73
+ */
74
+ resetPassword: (user: User) => Promise<ResponseSpec>;
75
+ /**
76
+ * Confirms the password reset of a User and performs a Login
77
+ * @param {User} user - The user object
78
+ */
79
+ resetConfirm: (user: User) => Promise<ResponseSpec & {
80
+ user: User;
81
+ token?: string | undefined;
82
+ flowID?: string | undefined;
83
+ }>;
84
+ /**
85
+ * Recovers a User's name and sends it to their configured e-mail.
86
+ * @param {User} user - The user object
87
+ */
88
+ recoverUsername: (user: User) => Promise<ResponseSpec>;
89
+ /**
90
+ * Gets the details of a Tenant object.
91
+ * @param tenantName - The name of the tenant
92
+ */
93
+ getTenantConfig: (tenantName: string) => Promise<ResponseSpec & {
94
+ tenant: Tenant;
95
+ }>;
96
+ /**
97
+ * Re-sends the verification code to confirm a pending User registration.
98
+ * @param {User} user - The user object
99
+ */
100
+ resendVerificationCode: (user: Partial<User>) => Promise<ResponseSpec>;
101
+ /**
102
+ * Registers a new user.
103
+ * @param {User} user - The user object
104
+ */
105
+ createUser: (authToken: string, user: Partial<User>) => Promise<ResponseSpec & {
106
+ user: User;
107
+ }>;
108
+ };
109
+ export default _default;