@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
@@ -0,0 +1,98 @@
1
+ import { ResponseSpec, Integration } from '../types';
2
+ import { apiFetcher } from '../apiFetcher';
3
+
4
+ export default (apiUrl: string) => ({
5
+ /**
6
+ * Gets a list of integration objects for a specified Memori object.
7
+ * @param memoriID - The id of the Memori object
8
+ * @param authToken - The login token
9
+ * @returns A list of Integration objects
10
+ */
11
+ getMemoriIntegrationsList: (authToken: string, memoriID: string) =>
12
+ apiFetcher(`/Integrations/${authToken}/${memoriID}`, {
13
+ apiUrl,
14
+ }) as Promise<
15
+ ResponseSpec & {
16
+ integrations: Integration[];
17
+ }
18
+ >,
19
+
20
+ /**
21
+ * Gets a list of integration objects.
22
+ * @param authToken - The login token
23
+ * @returns A list of Integration objects
24
+ */
25
+ getAllIntegrationsList: (authToken: string) =>
26
+ apiFetcher(`/AllIntegrations/${authToken}`, {
27
+ apiUrl,
28
+ }) as Promise<
29
+ ResponseSpec & {
30
+ integrations: Integration[];
31
+ }
32
+ >,
33
+
34
+ /**
35
+ * Gets the detail of an integration object of the currently logged in User.
36
+ * @param authToken - The login token
37
+ * @param integrationID - The ID of the integration object
38
+ * @returns The Integration object
39
+ */
40
+ getIntegration: (authToken: string, integrationID: string) =>
41
+ apiFetcher(`/Integration/${authToken}/${integrationID}`, {
42
+ apiUrl,
43
+ }) as Promise<
44
+ ResponseSpec & {
45
+ integration: Integration;
46
+ }
47
+ >,
48
+
49
+ /**
50
+ * Delete an exsisting integration object.
51
+ * @param authToken - The login token
52
+ * @param integrationID - The ID of the integration object
53
+ */
54
+ deleteIntegration: (authToken: string, integrationID: string) =>
55
+ apiFetcher(`/Integration/${authToken}/${integrationID}`, {
56
+ apiUrl,
57
+ method: 'DELETE',
58
+ }) as Promise<ResponseSpec>,
59
+
60
+ /**
61
+ * Register a new integration object.
62
+ * @param authToken - The login token
63
+ * @param integration - The Integration object
64
+ * @returns The Integration object
65
+ */
66
+ createIntegration: (authToken: string, integration: Integration) =>
67
+ apiFetcher(`/Integration/${authToken}`, {
68
+ apiUrl,
69
+ method: 'POST',
70
+ body: integration,
71
+ }) as Promise<
72
+ ResponseSpec & {
73
+ integration: Integration;
74
+ }
75
+ >,
76
+
77
+ /**
78
+ * Updates the integration object.
79
+ * @param authToken - The login token
80
+ * @param integrationID - The id of the Integration object
81
+ * @param integration - The Integration object
82
+ * @returns The Integration object
83
+ */
84
+ updateIntegration: (
85
+ authToken: string,
86
+ integrationID: string,
87
+ integration: Integration
88
+ ) =>
89
+ apiFetcher(`/Integration/${authToken}/${integrationID}`, {
90
+ apiUrl,
91
+ method: 'PATCH',
92
+ body: integration,
93
+ }) as Promise<
94
+ ResponseSpec & {
95
+ integration: Integration;
96
+ }
97
+ >,
98
+ });
@@ -0,0 +1,115 @@
1
+ import { ResponseSpec, Invitation } from '../types';
2
+ import { apiFetcher } from '../apiFetcher';
3
+
4
+ export default (apiUrl: string) => ({
5
+ /**
6
+ * Gets a list of invitations sent by the currently logged in User.
7
+ * @param {string} authToken - The login token
8
+ * @returns The list of Invitation objects.
9
+ */
10
+ getSentInvitations: (authToken: string) =>
11
+ apiFetcher(`/SentInvitations/${authToken}`, {
12
+ apiUrl,
13
+ }) as Promise<ResponseSpec & { invitations: Invitation[] }>,
14
+
15
+ /**
16
+ * Gets a list of invitations received by the currently logged in User.
17
+ * @param {string} authToken - The login token
18
+ * @returns The list of Invitation objects.
19
+ */
20
+ getReceivedInvitations: (authToken: string) =>
21
+ apiFetcher(`/ReceivedInvitations/${authToken}`, {
22
+ apiUrl,
23
+ }) as Promise<ResponseSpec & { invitations: Invitation[] }>,
24
+
25
+ /**
26
+ * Gets a list of all invitation objects
27
+ * @param {string} authToken - The login token
28
+ * @returns The list of Invitation objects.
29
+ */
30
+ getAllInvitations: (authToken: string) =>
31
+ apiFetcher(`/AllInvitations/${authToken}`, {
32
+ apiUrl,
33
+ }) as Promise<ResponseSpec & { invitations: Invitation[] }>,
34
+
35
+ /**
36
+ * Gets the details of an Invitation object of the currently logged in User.
37
+ * @param {string} authToken - The login token
38
+ * @param {string} invitationId - The ID of the Invitation object
39
+ * @returns The Invitation object.
40
+ */
41
+ getInvitation: (authToken: string, invitationId: string) =>
42
+ apiFetcher(`/Invitation/${authToken}/${invitationId}`, {
43
+ apiUrl,
44
+ }) as Promise<ResponseSpec & { invitation: Invitation }>,
45
+
46
+ /**
47
+ * Updates an existing Invitation object sent by the currently logged in User.
48
+ * @param {string} authToken - The login token
49
+ * @param {Invitation} invitation - The Invitation object
50
+ * @returns The Invitation object.
51
+ */
52
+ updateInvitation: (
53
+ authToken: string,
54
+ invitation: Partial<Omit<Invitation, 'invitationID'>> & {
55
+ invitationID: string;
56
+ }
57
+ ) =>
58
+ apiFetcher(`/Invitation/${authToken}/${invitation.invitationID}`, {
59
+ apiUrl,
60
+ method: 'PATCH',
61
+ body: invitation,
62
+ }) as Promise<ResponseSpec & { invitation: Invitation }>,
63
+
64
+ /**
65
+ * Deletes an existing Invitation object.
66
+ * @param {string} authToken - The login token
67
+ * @param {string} invitationId - The ID of the Invitation object
68
+ * @returns The Invitation object.
69
+ */
70
+ deleteInvitation: (authToken: string, invitationId: string) =>
71
+ apiFetcher(`/Invitation/${authToken}/${invitationId}`, {
72
+ apiUrl,
73
+ method: 'DELETE',
74
+ }) as Promise<ResponseSpec>,
75
+
76
+ /**
77
+ * Accepts an Invitation object.
78
+ * @param {string} authToken - The login token
79
+ * @param {string} invitationId - The ID of the Invitation object
80
+ * @returns The Invitation object.
81
+ */
82
+ acceptInvitation: (authToken: string, invitationId: string) =>
83
+ apiFetcher(`/AcceptInvitation/${authToken}/${invitationId}`, {
84
+ apiUrl,
85
+ method: 'POST',
86
+ }) as Promise<ResponseSpec & { invitation: Invitation }>,
87
+
88
+ /**
89
+ * Rejects an Invitation object.
90
+ * @param {string} authToken - The login token
91
+ * @param {string} invitationId - The ID of the Invitation object
92
+ * @returns The Invitation object.
93
+ */
94
+ rejectInvitation: (authToken: string, invitationId: string) =>
95
+ apiFetcher(`/RejectInvitation/${authToken}/${invitationId}`, {
96
+ apiUrl,
97
+ method: 'POST',
98
+ }) as Promise<ResponseSpec & { invitation: Invitation }>,
99
+
100
+ /**
101
+ * Send a new Invitation object
102
+ * @param {string} authToken - The login token
103
+ * @param {Invitation} invitation - The Invitation object
104
+ * @returns The Invitation object.
105
+ */
106
+ sendInvitation: (
107
+ authToken: string,
108
+ invitation: Partial<Omit<Invitation, 'invitationID'>>
109
+ ) =>
110
+ apiFetcher(`/SendInvitation/${authToken}`, {
111
+ apiUrl,
112
+ method: 'POST',
113
+ body: invitation,
114
+ }) as Promise<ResponseSpec & { invitation: Invitation }>,
115
+ });
@@ -0,0 +1,223 @@
1
+ import { ResponseSpec, Memori, MemoriConfig } from '../types';
2
+ import { apiFetcher } from '../apiFetcher';
3
+
4
+ export default (apiUrl: string) => ({
5
+ /**
6
+ * Gets a list of all the public Memori objects for a specific Tenant.
7
+ * @param tenant - The name of the tenant
8
+ * @returns A list of Memori objects
9
+ */
10
+ getTenantPublicMemoriList: (tenant: string) =>
11
+ apiFetcher(`/TenantPublicMemori/${encodeURI(tenant)}`, {
12
+ apiUrl,
13
+ }) as Promise<
14
+ ResponseSpec & {
15
+ memori: Memori[];
16
+ }
17
+ >,
18
+
19
+ /**
20
+ * Gets a list of all the public Memori objects for a specific Tenant accessible from user session.
21
+ * @param authToken - The login token
22
+ * @returns A list of Memori objects
23
+ */
24
+ getPublicMemoriList: (authToken: string) =>
25
+ apiFetcher(`/PublicMemori/${authToken}`, {
26
+ apiUrl,
27
+ }) as Promise<
28
+ ResponseSpec & {
29
+ memori: Memori[];
30
+ }
31
+ >,
32
+
33
+ /**
34
+ * Gets a list of all Memori objects.
35
+ * @param authToken - The login token
36
+ * @returns A list of Memori objects
37
+ */
38
+ getAllMemori: (authToken: string) =>
39
+ apiFetcher(`/AllMemori/${authToken}`, {
40
+ apiUrl,
41
+ }) as Promise<
42
+ ResponseSpec & {
43
+ memori: Memori[];
44
+ }
45
+ >,
46
+
47
+ /**
48
+ * Gets a list of Memori objects for the currently logged in User.
49
+ * @param authToken - The login token
50
+ * @returns A list of Memori objects
51
+ */
52
+ getUserMemoriList: (authToken: string) =>
53
+ apiFetcher(`/Memori/${authToken}`, {
54
+ apiUrl,
55
+ }) as Promise<
56
+ ResponseSpec & {
57
+ memori: Memori[];
58
+ }
59
+ >,
60
+
61
+ /**
62
+ * Gets a list of Memori objects for the currently logged in User.
63
+ * @param authToken - The login token
64
+ * @returns A list of Memori objects
65
+ */
66
+ getSharedMemoriList: (authToken: string) =>
67
+ apiFetcher(`/SharedMemori/${authToken}`, {
68
+ apiUrl,
69
+ }) as Promise<
70
+ ResponseSpec & {
71
+ memori: Memori[];
72
+ }
73
+ >,
74
+
75
+ /**
76
+ * Gets a list of all the known Memori categories (or tags).
77
+ * @param {string} tenant - The name of the tenant
78
+ * @returns A list of Memori categories
79
+ */
80
+ getTenantCategories: (tenant: string) =>
81
+ apiFetcher(`/TenantMemoriCategories/${encodeURI(tenant)}`, {
82
+ apiUrl,
83
+ }) as Promise<
84
+ ResponseSpec & {
85
+ memoriCategories: string[];
86
+ }
87
+ >,
88
+
89
+ /**
90
+ * Gets a list of all the Memori Configuration objects.
91
+ * @param authToken - The login token
92
+ * @returns A list of Memori Configuration objects
93
+ */
94
+ getMemoriConfigs: (authToken: string) =>
95
+ apiFetcher(`/MemoriConfigs/${authToken}`, {
96
+ apiUrl,
97
+ }) as Promise<
98
+ ResponseSpec & {
99
+ memoriConfigs: MemoriConfig[];
100
+ }
101
+ >,
102
+
103
+ /**
104
+ * Register a new Memori object.
105
+ * @param authToken - The login token
106
+ * @param memori - The Memori object
107
+ * @returns The created Memori object
108
+ */
109
+ createMemori: (authToken: string, memori: Memori) =>
110
+ apiFetcher(`/Memori/${authToken}`, {
111
+ apiUrl,
112
+ body: memori,
113
+ method: 'POST',
114
+ }) as Promise<ResponseSpec & { memori: Memori }>,
115
+
116
+ /**
117
+ * Update an existing Memori object.
118
+ * @param authToken - The login token
119
+ * @param memori - The Memori object
120
+ * @returns The created Memori object
121
+ */
122
+ updateMemori: (authToken: string, memori: Memori) =>
123
+ apiFetcher(`/Memori/${authToken}/${memori.memoriID}`, {
124
+ apiUrl,
125
+ body: memori,
126
+ method: 'PATCH',
127
+ }) as Promise<ResponseSpec & { memori: Memori }>,
128
+
129
+ /**
130
+ * Deletes an existing Memori object.
131
+ * @param authToken - The login token
132
+ * @param memori - The Memori object
133
+ */
134
+ deleteMemori: (authToken: string, memori: Memori) =>
135
+ apiFetcher(`/Memori/${authToken}`, {
136
+ apiUrl,
137
+ body: memori,
138
+ method: 'DELETE',
139
+ }) as Promise<ResponseSpec>,
140
+
141
+ /**
142
+ * Gets the details of a Memori object of the currently logged in User.
143
+ * @param authToken - The login token
144
+ * @param memoriID - The ID of the Memori object
145
+ * @returns A Memori object
146
+ */
147
+ getMemoriById: (authToken: string, memoriID: string) =>
148
+ apiFetcher(`/Memori/${authToken}/${memoriID}`, {
149
+ apiUrl,
150
+ }) as Promise<ResponseSpec & { memori: Memori }>,
151
+
152
+ /**
153
+ * Gets the details of a Memori object of the currently logged in User.
154
+ * @param {string} tenantName - The Name of the Tenant
155
+ * @param {string} userID - The ID of the User object
156
+ * @param {string} memoriID - The ID of the Memori object
157
+ * @param {string?} authToken - The login token
158
+ * @returns A Memori object
159
+ */
160
+ getMemoriByUserAndId: (
161
+ tenantName: string,
162
+ userID: string,
163
+ memoriID: string,
164
+ authToken?: string
165
+ ) =>
166
+ apiFetcher(
167
+ `/MemoriById/${tenantName}/${userID}/${memoriID}${
168
+ authToken ? `/${authToken}` : ''
169
+ }`,
170
+ {
171
+ apiUrl,
172
+ }
173
+ ) as Promise<ResponseSpec & { memori: Memori }>,
174
+
175
+ /**
176
+ * Gets the details of a Memori object by name, owner and tenant
177
+ * @param {string} tenant - The name of the tenant
178
+ * @param {string} userName - The name of the user
179
+ * @param {string} memoriName - The name of the Memori object
180
+ * @param {string=} [authToken=''] - The token of the Memori object
181
+ */
182
+ getMemori: (
183
+ tenant: string,
184
+ userName: string,
185
+ memoriName: string,
186
+ authToken?: string
187
+ ) =>
188
+ apiFetcher(
189
+ `/Memori/${encodeURI(tenant)}/${encodeURI(userName)}/${encodeURI(
190
+ memoriName
191
+ )}/${authToken ?? ''}`,
192
+ {
193
+ apiUrl,
194
+ }
195
+ ) as Promise<ResponseSpec & { memori: Memori }>,
196
+
197
+ /**
198
+ * Gets the statistics for sessions opened in a specified interval for the specified Memori object.
199
+ * @param {string} authToken - The login token
200
+ * @param {string} memoriID - The ID of the Memori object
201
+ * @param {string=} dateFrom - The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
202
+ * @param {string=} dateTo - The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
203
+ */
204
+ getMemoriSessions: (
205
+ authToken: string,
206
+ memoriID: string,
207
+ dateFrom?: string,
208
+ dateTo?: string
209
+ ) =>
210
+ apiFetcher(
211
+ `/MemoriSessions/${authToken}/${memoriID}${
212
+ dateFrom ? `/${dateFrom}` : ''
213
+ }${dateFrom && dateTo ? `/${dateTo}` : ''}`,
214
+ {
215
+ apiUrl,
216
+ }
217
+ ) as Promise<
218
+ ResponseSpec & {
219
+ totalSessions: number;
220
+ validSessions: number;
221
+ }
222
+ >,
223
+ });
@@ -0,0 +1,186 @@
1
+ import { ResponseSpec, Tenant, User } from '../types';
2
+ import { apiFetcher } from '../apiFetcher';
3
+
4
+ export default (apiUrl: string) => ({
5
+ /**
6
+ * Registers a new user.
7
+ * @param user - The user object
8
+ * @returns The created user object
9
+ */
10
+ userSignIn: (user: User) =>
11
+ apiFetcher('/User', {
12
+ apiUrl,
13
+ body: user,
14
+ method: 'POST',
15
+ }) as Promise<ResponseSpec & { user: User }>,
16
+
17
+ /**
18
+ * Confirms the registration of a User and performs a Login.
19
+ * @param user - The user object
20
+ * @returns The created user object
21
+ */
22
+ userConfirmSignIn: (user: User) =>
23
+ apiFetcher('/UserConfirm', {
24
+ apiUrl,
25
+ body: user,
26
+ method: 'POST',
27
+ }) as Promise<ResponseSpec & { user: User; token?: string }>,
28
+
29
+ /**
30
+ * Tries a login with the specified credentials and returns a login token if successful.
31
+ * @param user - The user object
32
+ * @returns The logged in user object
33
+ */
34
+ userLogin: (user: User) =>
35
+ apiFetcher('/Login', {
36
+ apiUrl,
37
+ body: user,
38
+ method: 'POST',
39
+ }) as Promise<
40
+ ResponseSpec & { user: User; token?: string; flowID?: string }
41
+ >,
42
+
43
+ /**
44
+ * Logs out the user.
45
+ * @param authToken - The login token
46
+ */
47
+ userLogout: (authToken: string) =>
48
+ apiFetcher(`/Logout/${authToken}`, {
49
+ apiUrl,
50
+ method: 'POST',
51
+ }) as Promise<ResponseSpec>,
52
+
53
+ /**
54
+ * Gets the details of a User object.
55
+ * @param authToken - The login token
56
+ * @param userID - The user ID
57
+ * @returns The user object
58
+ */
59
+ getUser: (authToken: string, userID: string) =>
60
+ apiFetcher(`/User/${authToken}/${userID}`, {
61
+ apiUrl,
62
+ }) as Promise<
63
+ ResponseSpec & {
64
+ user: User;
65
+ }
66
+ >,
67
+
68
+ /**
69
+ * Gets a list of all the existing User objects.
70
+ * @param authToken - The login token
71
+ * @returns A list of User objects
72
+ */
73
+ getUsersList: (authToken: string) =>
74
+ apiFetcher(`/Users/${authToken}`, {
75
+ apiUrl,
76
+ }) as Promise<
77
+ ResponseSpec & {
78
+ users: User[];
79
+ }
80
+ >,
81
+
82
+ /**
83
+ * Deletes the currently logged in User.
84
+ * @param {string} authToken - The login token
85
+ * @param {string} userID: The User ID
86
+ */
87
+ deleteUser: (authToken: string, userID: string) =>
88
+ apiFetcher(`/User/${authToken}/${userID}`, {
89
+ apiUrl,
90
+ method: 'DELETE',
91
+ }) as Promise<ResponseSpec>,
92
+
93
+ /**
94
+ * Updates the details of a User object.
95
+ * @param authToken - The login token
96
+ * @param userID - The user ID
97
+ * @returns The user object
98
+ */
99
+ updateUser: (authToken: string, userID: string, user: User) =>
100
+ apiFetcher(`/User/${authToken}/${userID}`, {
101
+ apiUrl,
102
+ method: 'PATCH',
103
+ body: user,
104
+ }) as Promise<
105
+ ResponseSpec & {
106
+ user: User;
107
+ }
108
+ >,
109
+
110
+ /**
111
+ * Resets a User's password.
112
+ * If found, the User receives a verification code via e-mail.
113
+ * The code must be sent via the ResetConfirm API, passing the same User object
114
+ * sent to this API with the addition of the verification code and the new password.
115
+ * @param {User} user - The user object
116
+ */
117
+ resetPassword: (user: User) =>
118
+ apiFetcher(`/ResetPassword`, {
119
+ apiUrl,
120
+ body: user,
121
+ method: 'POST',
122
+ }) as Promise<ResponseSpec>,
123
+
124
+ /**
125
+ * Confirms the password reset of a User and performs a Login
126
+ * @param {User} user - The user object
127
+ */
128
+ resetConfirm: (user: User) =>
129
+ apiFetcher(`/ResetConfirm`, {
130
+ apiUrl,
131
+ body: user,
132
+ method: 'POST',
133
+ }) as Promise<
134
+ ResponseSpec & {
135
+ user: User;
136
+ token?: string;
137
+ flowID?: string;
138
+ }
139
+ >,
140
+
141
+ /**
142
+ * Recovers a User's name and sends it to their configured e-mail.
143
+ * @param {User} user - The user object
144
+ */
145
+ recoverUsername: (user: User) =>
146
+ apiFetcher(`/RecoverUsername`, {
147
+ apiUrl,
148
+ body: user,
149
+ method: 'POST',
150
+ }) as Promise<ResponseSpec>,
151
+
152
+ /**
153
+ * Gets the details of a Tenant object.
154
+ * @param tenantName - The name of the tenant
155
+ */
156
+ getTenantConfig: (tenantName: string) =>
157
+ apiFetcher(`/Tenant/${tenantName}`, {
158
+ apiUrl,
159
+ }) as Promise<
160
+ ResponseSpec & {
161
+ tenant: Tenant;
162
+ }
163
+ >,
164
+
165
+ /**
166
+ * Re-sends the verification code to confirm a pending User registration.
167
+ * @param {User} user - The user object
168
+ */
169
+ resendVerificationCode: (user: Partial<User>) =>
170
+ apiFetcher(`/ResendVerificationCode`, {
171
+ apiUrl,
172
+ body: user,
173
+ method: 'POST',
174
+ }) as Promise<ResponseSpec>,
175
+
176
+ /**
177
+ * Registers a new user.
178
+ * @param {User} user - The user object
179
+ */
180
+ createUser: (authToken: string, user: Partial<User>) =>
181
+ apiFetcher(`/User/${authToken}`, {
182
+ apiUrl,
183
+ body: user,
184
+ method: 'POST',
185
+ }) as Promise<ResponseSpec & { user: User }>,
186
+ });
package/src/backend.ts ADDED
@@ -0,0 +1,20 @@
1
+ import memori from './backend/memori';
2
+ import user from './backend/user';
3
+ import integration from './backend/integration';
4
+ import asset from './backend/asset';
5
+ import invitation from './backend/invitation';
6
+
7
+ const backendAPI = (apiUrl: string) => ({
8
+ asset: asset(apiUrl),
9
+ memori: memori(apiUrl),
10
+ user: user(apiUrl),
11
+ integration: integration(apiUrl),
12
+ invitation: invitation(apiUrl),
13
+ ...asset(apiUrl),
14
+ ...memori(apiUrl),
15
+ ...user(apiUrl),
16
+ ...integration(apiUrl),
17
+ ...invitation(apiUrl),
18
+ });
19
+
20
+ export default backendAPI;
@@ -0,0 +1,21 @@
1
+ export const allowedMediaTypes = [
2
+ 'image/jpeg',
3
+ 'image/png',
4
+ 'image/jpg',
5
+ 'image/gif',
6
+ 'text/plain',
7
+ 'application/msword',
8
+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
9
+ 'application/vnd.ms-excel',
10
+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
11
+ 'application/pdf',
12
+ 'video/mp4',
13
+ 'video/avi',
14
+ 'audio/mpeg3',
15
+ 'audio/wav',
16
+ 'audio/mpeg',
17
+ 'video/mpeg',
18
+ 'model/gltf-binary',
19
+ ];
20
+
21
+ export const anonTag = '👤';
@@ -0,0 +1,31 @@
1
+ import { ResponseSpec } from '../types';
2
+ import { apiFetcher } from '../apiFetcher';
3
+
4
+ /****************************
5
+ * *
6
+ * CorrelationPairs *
7
+ * *
8
+ ****************************/
9
+
10
+ export default (apiUrl: string) => ({
11
+ /**
12
+ * Lists all Correlation Pair objects.
13
+ * @param {string} sessionId The session ID
14
+ */
15
+ getCorrelationPairs: async (sessionId: string) =>
16
+ apiFetcher(`/CorrelationPairs/${sessionId}`, {
17
+ method: 'GET',
18
+ apiUrl,
19
+ }) as Promise<ResponseSpec>,
20
+
21
+ /**
22
+ * Removes an existing Correlation Pair object.
23
+ * @param {string} sessionId The session ID
24
+ * @param {string} pairId The Correlation Pair object ID
25
+ */
26
+ deleteCorrelationPair: async (sessionId: string, pairId: string) =>
27
+ apiFetcher(`/CorrelationPair/${sessionId}/${pairId}`, {
28
+ method: 'GET',
29
+ apiUrl,
30
+ }) as Promise<ResponseSpec>,
31
+ });