epicenter-libs 3.33.0 → 3.34.1

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 (76) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/browser/epicenter.js +105 -2
  3. package/dist/browser/epicenter.js.map +1 -1
  4. package/dist/cjs/epicenter.js +105 -2
  5. package/dist/cjs/epicenter.js.map +1 -1
  6. package/dist/epicenter.js +105 -2
  7. package/dist/epicenter.js.map +1 -1
  8. package/dist/epicenter.min.js +1 -1
  9. package/dist/epicenter.min.js.map +1 -1
  10. package/dist/module/epicenter.js +105 -2
  11. package/dist/module/epicenter.js.map +1 -1
  12. package/dist/types/adapters/chat.d.ts +63 -0
  13. package/package.json +1 -1
  14. package/src/adapters/chat.ts +95 -0
  15. package/src/utils/identification.ts +4 -0
  16. package/dist/test/_virtual/runtime.js +0 -3
  17. package/dist/test/_virtual/runtime2.js +0 -3
  18. package/dist/test/adapters/account.js +0 -169
  19. package/dist/test/adapters/admin.js +0 -53
  20. package/dist/test/adapters/asset.js +0 -425
  21. package/dist/test/adapters/authentication.js +0 -349
  22. package/dist/test/adapters/channel.js +0 -201
  23. package/dist/test/adapters/chat.js +0 -199
  24. package/dist/test/adapters/cometd.js +0 -514
  25. package/dist/test/adapters/consensus.js +0 -484
  26. package/dist/test/adapters/daily.js +0 -244
  27. package/dist/test/adapters/email.js +0 -179
  28. package/dist/test/adapters/episode.js +0 -175
  29. package/dist/test/adapters/group.js +0 -655
  30. package/dist/test/adapters/leaderboard.js +0 -162
  31. package/dist/test/adapters/matchmaker.js +0 -159
  32. package/dist/test/adapters/presence.js +0 -85
  33. package/dist/test/adapters/project.js +0 -94
  34. package/dist/test/adapters/recaptcha.js +0 -24
  35. package/dist/test/adapters/run.js +0 -1008
  36. package/dist/test/adapters/somebody.js +0 -154
  37. package/dist/test/adapters/task.js +0 -192
  38. package/dist/test/adapters/time.js +0 -28
  39. package/dist/test/adapters/user.js +0 -105
  40. package/dist/test/adapters/vault.js +0 -403
  41. package/dist/test/adapters/video.js +0 -249
  42. package/dist/test/adapters/vonage.js +0 -130
  43. package/dist/test/adapters/wallet.js +0 -130
  44. package/dist/test/adapters/world.js +0 -507
  45. package/dist/test/apis/video.js +0 -294
  46. package/dist/test/apis/vonage.js +0 -121
  47. package/dist/test/epicenter.js +0 -121
  48. package/dist/test/node_modules/@babel/runtime/helpers/esm/defineProperty.js +0 -12
  49. package/dist/test/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +0 -14
  50. package/dist/test/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +0 -9
  51. package/dist/test/node_modules/@babel/runtime/helpers/esm/typeof.js +0 -11
  52. package/dist/test/node_modules/cometd/AckExtension.js +0 -91
  53. package/dist/test/node_modules/cometd/CallbackPollingTransport.js +0 -148
  54. package/dist/test/node_modules/cometd/Client.js +0 -2160
  55. package/dist/test/node_modules/cometd/Extension.js +0 -47
  56. package/dist/test/node_modules/cometd/LongPollingTransport.js +0 -135
  57. package/dist/test/node_modules/cometd/ReloadExtension.js +0 -214
  58. package/dist/test/node_modules/cometd/RequestTransport.js +0 -252
  59. package/dist/test/node_modules/cometd/Transport.js +0 -167
  60. package/dist/test/node_modules/cometd/TransportRegistry.js +0 -107
  61. package/dist/test/node_modules/cometd/WebSocketTransport.js +0 -384
  62. package/dist/test/node_modules/cometd/cometd.js +0 -9
  63. package/dist/test/node_modules/regenerator-runtime/runtime.js +0 -773
  64. package/dist/test/utilities.js +0 -17
  65. package/dist/test/utils/config.js +0 -189
  66. package/dist/test/utils/constants.js +0 -293
  67. package/dist/test/utils/cookies.js +0 -75
  68. package/dist/test/utils/error-manager.js +0 -57
  69. package/dist/test/utils/error.js +0 -12
  70. package/dist/test/utils/fault.js +0 -34
  71. package/dist/test/utils/filter-parser.js +0 -68
  72. package/dist/test/utils/helpers.js +0 -9
  73. package/dist/test/utils/identification.js +0 -161
  74. package/dist/test/utils/result.js +0 -20
  75. package/dist/test/utils/router.js +0 -551
  76. package/dist/test/utils/store.js +0 -79
@@ -136,3 +136,66 @@ export declare function getMessages(chatKey: string, optionals?: {
136
136
  maxRecords?: number;
137
137
  horizon?: number;
138
138
  } & RoutingOptions): Promise<ChatMessageReadOutView[]>;
139
+ /**
140
+ * Retrieves messages for a given user; requires facilitator authentication; works with an admin user
141
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/chat/message/{CHAT_KEY}/{PSEUDONYM_KEY}`
142
+ *
143
+ * @example
144
+ * import { chatAdapter } from 'epicenter-libs';
145
+ * // gets the chat message with id: 5
146
+ * const message = await chatAdapter.getMessagesForUser('0000017dd3bf540e5ada5b1e058f08f20461', '000001796733eef0842f4d6d960997018a33', { horizon: 5, maxRecords: 1 });
147
+ * // gets the 10 chat messages starting from id 5 (inclusive)
148
+ * const messages = await chatAdapter.getMessagesForUser('0000017dd3bf540e5ada5b1e058f08f20461', '000001796733eef0842f4d6d960997018a33', { horizon: 5, maxRecords: 10 });
149
+ *
150
+ * @param chatKey Key associated with the chat
151
+ * @param pseudonymKey Key associated with the user whose messages are being retrieved
152
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
153
+ * @param [optionals.maxRecords] Maximum number of messages to get
154
+ * @param [optionals.horizon] The message ID from which to start with; works backwards so if `maxRecords=20` and `horizon=50`, it will get the 20 messages starting from message ID 50, working backwards (50, 49, 48..., etc.). If this value is omitted the platform assumes it is the most recent message in the chat
155
+ * @returns promise that resolves to the list of chat messages requested
156
+ */
157
+ export declare function getMessagesForUser(chatKey: string, pseudonymKey: string, optionals?: {
158
+ maxRecords?: number;
159
+ horizon?: number;
160
+ } & RoutingOptions): Promise<ChatMessageReadOutView[]>;
161
+ /**
162
+ * Retrieves messages from for a given chat for an admin user; requires support authentication
163
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/chat/message/all/{CHAT_KEY}`
164
+ *
165
+ * @example
166
+ * import { chatAdapter } from 'epicenter-libs';
167
+ * // gets the chat message with id: 5
168
+ * const message = await chatAdapter.getMessagesAdmin('0000017dd3bf540e5ada5b1e058f08f20461', { horizon: 5, maxRecords: 1 });
169
+ * // gets the 10 chat messages starting from id 5 (inclusive)
170
+ * const messages = await chatAdapter.getMessagesAdmin('0000017dd3bf540e5ada5b1e058f08f20461', { horizon: 5, maxRecords: 10 });
171
+ *
172
+ * @param chatKey Key associated with the chat
173
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
174
+ * @param [optionals.maxRecords] Maximum number of messages to get
175
+ * @param [optionals.horizon] The message ID from which to start with; works backwards so if `maxRecords=20` and `horizon=50`, it will get the 20 messages starting from message ID 50, working backwards (50, 49, 48..., etc.). If this value is omitted the platform assumes it is the most recent message in the chat
176
+ * @returns promise that resolves to the list of chat messages requested
177
+ */
178
+ export declare function getMessagesAdmin(chatKey: string, optionals?: {
179
+ maxRecords?: number;
180
+ horizon?: number;
181
+ } & RoutingOptions): Promise<ChatMessageReadOutView[]>;
182
+ /**
183
+ * Sends a message to a chat as an admin user; requires support authentication
184
+ * Base URL: PUT `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/chat/message/system/{CHAT_KEY}` or PUT `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/chat/message/system/{CHAT_KEY}/{USER_KEY}`
185
+ *
186
+ * @example
187
+ * import { chatAdapter } from 'epicenter-libs';
188
+ * // Send a public message to the chat
189
+ * await chatAdapter.sendMessageAdmin('0000017dd3bf540e5ada5b1e058f08f20461', 'hello');
190
+ * // Send a private message to a specific user
191
+ * await chatAdapter.sendMessageAdmin('0000017dd3bf540e5ada5b1e058f08f20461', 'hello, privately', { userKey: '000001796733eef0842f4d6d960997018a33' });
192
+ *
193
+ * @param chatKey Key associated with the chat
194
+ * @param message Message text to send
195
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
196
+ * @param [optionals.userKey] Key of the user to send the message to. If omitted, will send as a public message
197
+ * @returns promise that resolves to the chat message created
198
+ */
199
+ export declare function sendMessageAdmin(chatKey: string, message: string, optionals?: {
200
+ userKey?: string;
201
+ } & RoutingOptions): Promise<ChatMessageReadOutView>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "epicenter-libs",
3
- "version": "3.33.0",
3
+ "version": "3.34.1",
4
4
  "main": "dist/cjs/epicenter.js",
5
5
  "type": "module",
6
6
  "module": "dist/module/epicenter.js",
@@ -224,3 +224,98 @@ export async function getMessages(
224
224
  .get(`/chat/message/${chatKey}`, routingOptions)
225
225
  .then(({ body }) => body);
226
226
  }
227
+
228
+ /**
229
+ * Retrieves messages for a given user; requires facilitator authentication; works with an admin user
230
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/chat/message/{CHAT_KEY}/{PSEUDONYM_KEY}`
231
+ *
232
+ * @example
233
+ * import { chatAdapter } from 'epicenter-libs';
234
+ * // gets the chat message with id: 5
235
+ * const message = await chatAdapter.getMessagesForUser('0000017dd3bf540e5ada5b1e058f08f20461', '000001796733eef0842f4d6d960997018a33', { horizon: 5, maxRecords: 1 });
236
+ * // gets the 10 chat messages starting from id 5 (inclusive)
237
+ * const messages = await chatAdapter.getMessagesForUser('0000017dd3bf540e5ada5b1e058f08f20461', '000001796733eef0842f4d6d960997018a33', { horizon: 5, maxRecords: 10 });
238
+ *
239
+ * @param chatKey Key associated with the chat
240
+ * @param pseudonymKey Key associated with the user whose messages are being retrieved
241
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
242
+ * @param [optionals.maxRecords] Maximum number of messages to get
243
+ * @param [optionals.horizon] The message ID from which to start with; works backwards so if `maxRecords=20` and `horizon=50`, it will get the 20 messages starting from message ID 50, working backwards (50, 49, 48..., etc.). If this value is omitted the platform assumes it is the most recent message in the chat
244
+ * @returns promise that resolves to the list of chat messages requested
245
+ */
246
+ export async function getMessagesForUser(
247
+ chatKey: string,
248
+ pseudonymKey: string,
249
+ optionals: {
250
+ maxRecords?: number;
251
+ horizon?: number;
252
+ } & RoutingOptions = {},
253
+ ): Promise<ChatMessageReadOutView[]> {
254
+ const { maxRecords, horizon, ...routingOptions } = optionals;
255
+ return new Router()
256
+ .withSearchParams({ maxRecords, horizon })
257
+ .get(`/chat/message/${chatKey}/${pseudonymKey}`, routingOptions)
258
+ .then(({ body }) => body);
259
+ }
260
+
261
+ /**
262
+ * Retrieves messages from for a given chat for an admin user; requires support authentication
263
+ * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/chat/message/all/{CHAT_KEY}`
264
+ *
265
+ * @example
266
+ * import { chatAdapter } from 'epicenter-libs';
267
+ * // gets the chat message with id: 5
268
+ * const message = await chatAdapter.getMessagesAdmin('0000017dd3bf540e5ada5b1e058f08f20461', { horizon: 5, maxRecords: 1 });
269
+ * // gets the 10 chat messages starting from id 5 (inclusive)
270
+ * const messages = await chatAdapter.getMessagesAdmin('0000017dd3bf540e5ada5b1e058f08f20461', { horizon: 5, maxRecords: 10 });
271
+ *
272
+ * @param chatKey Key associated with the chat
273
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
274
+ * @param [optionals.maxRecords] Maximum number of messages to get
275
+ * @param [optionals.horizon] The message ID from which to start with; works backwards so if `maxRecords=20` and `horizon=50`, it will get the 20 messages starting from message ID 50, working backwards (50, 49, 48..., etc.). If this value is omitted the platform assumes it is the most recent message in the chat
276
+ * @returns promise that resolves to the list of chat messages requested
277
+ */
278
+ export async function getMessagesAdmin(
279
+ chatKey: string,
280
+ optionals: {
281
+ maxRecords?: number;
282
+ horizon?: number;
283
+ } & RoutingOptions = {},
284
+ ): Promise<ChatMessageReadOutView[]> {
285
+ const { maxRecords, horizon, ...routingOptions } = optionals;
286
+ return new Router()
287
+ .withSearchParams({ maxRecords, horizon })
288
+ .get(`/chat/message/all/${chatKey}`, routingOptions)
289
+ .then(({ body }) => body);
290
+ }
291
+
292
+ /**
293
+ * Sends a message to a chat as an admin user; requires support authentication
294
+ * Base URL: PUT `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/chat/message/system/{CHAT_KEY}` or PUT `https://forio.com/api/v3/{ACCOUNT}/{PROJECT}/chat/message/system/{CHAT_KEY}/{USER_KEY}`
295
+ *
296
+ * @example
297
+ * import { chatAdapter } from 'epicenter-libs';
298
+ * // Send a public message to the chat
299
+ * await chatAdapter.sendMessageAdmin('0000017dd3bf540e5ada5b1e058f08f20461', 'hello');
300
+ * // Send a private message to a specific user
301
+ * await chatAdapter.sendMessageAdmin('0000017dd3bf540e5ada5b1e058f08f20461', 'hello, privately', { userKey: '000001796733eef0842f4d6d960997018a33' });
302
+ *
303
+ * @param chatKey Key associated with the chat
304
+ * @param message Message text to send
305
+ * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
306
+ * @param [optionals.userKey] Key of the user to send the message to. If omitted, will send as a public message
307
+ * @returns promise that resolves to the chat message created
308
+ */
309
+ export async function sendMessageAdmin(
310
+ chatKey: string,
311
+ message: string,
312
+ optionals: { userKey?: string } & RoutingOptions = {},
313
+ ): Promise<ChatMessageReadOutView> {
314
+ const { userKey, ...routingOptions } = optionals;
315
+ const uriComponent = userKey ? `/${userKey}` : '';
316
+ return new Router()
317
+ .put(`/chat/message/system/${chatKey}${uriComponent}`, {
318
+ body: { message },
319
+ ...routingOptions,
320
+ }).then(({ body }) => body);
321
+ }
@@ -230,6 +230,10 @@ class Identification {
230
230
  const project = account && projectShortName ? `/${projectShortName}` : '';
231
231
  this.session = session;
232
232
  cookies.removeItem(EPI_SSO_KEY, { path: `/app${account}${project}` });
233
+ cookies.removeItem(EPI_SSO_KEY, {
234
+ domain: `.${window.location.hostname}`,
235
+ path: `/app${account}${project}`,
236
+ });
233
237
  }
234
238
  }
235
239
  }
@@ -1,3 +0,0 @@
1
- import { __require as requireRuntime } from '../node_modules/regenerator-runtime/runtime.js';
2
-
3
- requireRuntime();
@@ -1,3 +0,0 @@
1
- var runtime = {exports: {}};
2
-
3
- export { runtime as __module };
@@ -1,169 +0,0 @@
1
- import Router from '../utils/router.js';
2
-
3
- /**
4
- * Retrieves account information by account short name
5
- * Base URL: GET `https://forio.com/api/v3/{ACCOUNT}/account`
6
- *
7
- * @example
8
- * import { accountAdapter } from 'epicenter-libs';
9
- * const account = await accountAdapter.getAccount('acme');
10
- *
11
- * @param accountShortName The short name of the account to retrieve
12
- * @returns promise that resolves to the account information
13
- */
14
- async function getAccount(accountShortName) {
15
- return await new Router().withAccountShortName(accountShortName).get('/account').then(({
16
- body
17
- }) => body);
18
- }
19
-
20
- /**
21
- * Creates a new personal or team account
22
- * Base URL: POST `https://forio.com/api/v3/epicenter/manager/account`
23
- *
24
- * @example
25
- * import { accountAdapter } from 'epicenter-libs';
26
- * // Create a personal account
27
- * const personalAccount = await accountAdapter.createAccount({
28
- * objectType: 'personal',
29
- * adminKey: 'admin-key',
30
- * name: 'John Doe',
31
- * shortName: 'johndoe',
32
- * });
33
- * // Create a team account with billing
34
- * const teamAccount = await accountAdapter.createAccount({
35
- * objectType: 'team',
36
- * adminKey: 'admin-key',
37
- * name: 'Acme Corp',
38
- * shortName: 'acme',
39
- * billingInformation: {
40
- * billingInterval: 'monthly',
41
- * subscriptionPlan: 'standard',
42
- * },
43
- * });
44
- *
45
- * @param view Account creation information
46
- * @param view.objectType Account type; either 'personal' or 'team'
47
- * @param view.shortName Unique short name for account, used as part of URL
48
- * @param view.adminKey Admin key for the account
49
- * @param view.name Descriptive name of account
50
- * @param [view.workerPartition] Defines location of model execution
51
- * @param [view.active] Determines if the account can be used
52
- * @param [view.sharedSecret] Optional shared secret for the account
53
- * @param [view.secretStrategy] Configuration related to account secrets (team only)
54
- * @param [view.displayNameStrategy] Configuration related to user displayName (team only)
55
- * @param [view.allowDeletion] Determines if this account can be deleted (team only)
56
- * @param [view.retentionPreference] Configuration related to data, user, group retention preferences (team only)
57
- * @param [view.multiFactorStrategy] Configuration related to multifactor authentication (team only)
58
- * @param [view.apiSecret] Configuration related to API secret keys (team only)
59
- * @param [view.accountSetting] Configuration related to account usage limits and capabilities (team only)
60
- * @param [view.billingInformation] Subscription and billing configuration (team only)
61
- * @param [view.legacySettings] API settings used for compatibility with legacy accounts (team only)
62
- * @param [view.allowStrongFacilitators] Determines if facilitators can update participants' identifying information (team only)
63
- * @param [view.allowAmbiguousHandles] Determines if a handle can be reused for an admin and a user in this account (team only)
64
- * @param [view.lockoutLimits] Configuration related to failed login attempt limits (team only)
65
- * @returns promise that resolves to the newly created account
66
- */
67
- async function createAccount(view) {
68
- return await new Router().withAccountShortName('epicenter').withProjectShortName('manager').post('/account', {
69
- body: view
70
- }).then(({
71
- body
72
- }) => body);
73
- }
74
-
75
- /**
76
- * Updates an existing personal or team account
77
- * Base URL: PATCH `https://forio.com/api/v3/{ACCOUNT}/account`
78
- *
79
- * @example
80
- * import { accountAdapter } from 'epicenter-libs';
81
- * // Update a personal account
82
- * const updatedPersonal = await accountAdapter.updateAccount({
83
- * objectType: 'personal',
84
- * name: 'Jane Doe',
85
- * active: true,
86
- * });
87
- * // Update a team account
88
- * const updatedTeam = await accountAdapter.updateAccount({
89
- * objectType: 'team',
90
- * name: 'Acme Corporation',
91
- * billingInterval: 'annual',
92
- * });
93
- *
94
- * @param view Account update information
95
- * @param view.objectType Account type; either 'personal' or 'team'
96
- * @param [view.name] Updated descriptive name of account
97
- * @param [view.workerPartition] Updated location of model execution
98
- * @param [view.active] Updated status determining if the account can be used
99
- * @param [view.billingInterval] Updated billing interval (team only)
100
- * @param [optionals] Optional arguments; pass network call options overrides here.
101
- * @returns promise that resolves to the updated account information
102
- */
103
- async function updateAccount(view, optionals = {}) {
104
- return await new Router().patch('/account', {
105
- body: view,
106
- ...optionals
107
- }).then(({
108
- body
109
- }) => body);
110
- }
111
-
112
- /**
113
- * Deletes an account by account short name
114
- * Base URL: DELETE `https://forio.com/api/v3/{ACCOUNT}/account`
115
- *
116
- * @example
117
- * import { accountAdapter } from 'epicenter-libs';
118
- * await accountAdapter.removeAccount('acme');
119
- *
120
- * @param accountShortName The short name of the account to delete
121
- * @returns promise that resolves when the account is deleted
122
- */
123
- async function removeAccount(accountShortName) {
124
- return await new Router().withAccountShortName(accountShortName).delete('/account').then(({
125
- body
126
- }) => body);
127
- }
128
-
129
- /**
130
- * Retrieves all team accounts for a given admin user
131
- * Base URL: GET `https://forio.com/api/v3/epicenter/manager/account/team/for/{ADMIN_KEY}`
132
- *
133
- * @example
134
- * import { accountAdapter } from 'epicenter-libs';
135
- * const teams = await accountAdapter.teamForAdmin('admin-key-123', {
136
- * includeAllMembers: true,
137
- * filter: 'active',
138
- * first: 0,
139
- * max: 50,
140
- * });
141
- *
142
- * @param adminKey Admin key to retrieve teams for
143
- * @param [optionals] Optional arguments; pass network call options overrides here. Special arguments specific to this method are listed below if they exist.
144
- * @param [optionals.includeAllMembers] Include all members in the response
145
- * @param [optionals.filter] Filter string for results
146
- * @param [optionals.first] Index of first result to return
147
- * @param [optionals.max] Maximum number of results to return
148
- * @returns promise that resolves to an array of team accounts
149
- */
150
- async function teamForAdmin(adminKey, optionals = {}) {
151
- const {
152
- includeAllMembers,
153
- filter,
154
- first,
155
- max,
156
- ...routingOptions
157
- } = optionals;
158
- const searchParams = {
159
- includeAllMembers,
160
- filter,
161
- first,
162
- max
163
- };
164
- return await new Router().withAccountShortName('epicenter').withProjectShortName('manager').withSearchParams(searchParams).get(`/account/team/for/${adminKey}`, routingOptions).then(({
165
- body
166
- }) => body);
167
- }
168
-
169
- export { createAccount, getAccount, removeAccount, teamForAdmin, updateAccount };
@@ -1,53 +0,0 @@
1
- import Router from '../utils/router.js';
2
-
3
- /**
4
- * Creates a new admin user
5
- * Base URL: POST `https://forio.com/api/v3/epicenter/manager/admin`
6
- *
7
- * @example
8
- * import { adminAdapter } from 'epicenter-libs';
9
- * const admin = await adminAdapter.createAdmin({
10
- * handle: 'admin@example.com',
11
- * email: 'admin@example.com',
12
- * givenName: 'Jane',
13
- * familyName: 'Doe',
14
- * verified: true,
15
- * active: true,
16
- * });
17
- *
18
- * @param view Admin user information
19
- * @param view.handle Handle for the admin user
20
- * @param view.email Email address for the admin user
21
- * @param [view.givenName] Admin user's given name
22
- * @param [view.familyName] Admin user's family name
23
- * @param view.verified Verification status; must be true
24
- * @param [view.active] Active status; defaults to true if unset
25
- * @returns promise that resolves to the newly created admin user
26
- */
27
- async function createAdmin(view) {
28
- return await new Router().withAccountShortName('epicenter').withProjectShortName('manager').post('/admin', {
29
- body: view
30
- }).then(({
31
- body
32
- }) => body);
33
- }
34
-
35
- /**
36
- * Retrieves an admin user by handle
37
- * Base URL: GET `https://forio.com/api/v3/epicenter/manager/admin/with/{HANDLE}`
38
- *
39
- * @example
40
- * import { adminAdapter } from 'epicenter-libs';
41
- * const admin = await adminAdapter.getWithHandle('admin@example.com');
42
- *
43
- * @param handle Handle for the admin user
44
- * @param [optionals] Optional arguments; pass network call options overrides here.
45
- * @returns promise that resolves to the admin user
46
- */
47
- async function getWithHandle(handle, optionals = {}) {
48
- return await new Router().withAccountShortName('epicenter').withProjectShortName('manager').get(`/admin/with/${handle}`, optionals).then(({
49
- body
50
- }) => body);
51
- }
52
-
53
- export { createAdmin, getWithHandle };