@extrahorizon/javascript-sdk 8.2.0-test

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 (153) hide show
  1. package/CHANGELOG.md +1161 -0
  2. package/LICENSE +21 -0
  3. package/README.md +119 -0
  4. package/build/index.cjs.js +1 -0
  5. package/build/index.mjs +1 -0
  6. package/build/types/btoa.d.ts +6 -0
  7. package/build/types/client.d.ts +136 -0
  8. package/build/types/constants.d.ts +15 -0
  9. package/build/types/errorHandler.d.ts +2 -0
  10. package/build/types/errors.d.ts +332 -0
  11. package/build/types/http/client.d.ts +2 -0
  12. package/build/types/http/index.d.ts +4 -0
  13. package/build/types/http/interceptors.d.ts +9 -0
  14. package/build/types/http/oAuth1Signature.d.ts +14 -0
  15. package/build/types/http/oauth1.d.ts +3 -0
  16. package/build/types/http/oauth2.d.ts +3 -0
  17. package/build/types/http/proxy.d.ts +3 -0
  18. package/build/types/http/types.d.ts +331 -0
  19. package/build/types/http/utils.d.ts +21 -0
  20. package/build/types/index.d.ts +9 -0
  21. package/build/types/mock.d.ts +43 -0
  22. package/build/types/mockType.d.ts +1511 -0
  23. package/build/types/parseStoredCredentials.d.ts +11 -0
  24. package/build/types/rql/index.d.ts +16 -0
  25. package/build/types/rql/parser.d.ts +1 -0
  26. package/build/types/rql/types.d.ts +168 -0
  27. package/build/types/services/auth/applications/index.d.ts +5 -0
  28. package/build/types/services/auth/applications/types.d.ts +190 -0
  29. package/build/types/services/auth/index.d.ts +3 -0
  30. package/build/types/services/auth/oauth1/index.d.ts +5 -0
  31. package/build/types/services/auth/oauth1/types.d.ts +63 -0
  32. package/build/types/services/auth/oauth2/index.d.ts +5 -0
  33. package/build/types/services/auth/oauth2/types.d.ts +52 -0
  34. package/build/types/services/auth/oidc/index.d.ts +5 -0
  35. package/build/types/services/auth/oidc/loginAttempts/index.d.ts +5 -0
  36. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +67 -0
  37. package/build/types/services/auth/oidc/providers/index.d.ts +5 -0
  38. package/build/types/services/auth/oidc/providers/types.d.ts +144 -0
  39. package/build/types/services/auth/oidc/types.d.ts +40 -0
  40. package/build/types/services/auth/types.d.ts +39 -0
  41. package/build/types/services/auth/users/index.d.ts +5 -0
  42. package/build/types/services/auth/users/types.d.ts +121 -0
  43. package/build/types/services/configurations/general.d.ts +5 -0
  44. package/build/types/services/configurations/groups.d.ts +5 -0
  45. package/build/types/services/configurations/index.d.ts +10 -0
  46. package/build/types/services/configurations/patients.d.ts +5 -0
  47. package/build/types/services/configurations/staff.d.ts +5 -0
  48. package/build/types/services/configurations/types.d.ts +222 -0
  49. package/build/types/services/configurations/users.d.ts +5 -0
  50. package/build/types/services/data/comments.d.ts +5 -0
  51. package/build/types/services/data/documents.d.ts +5 -0
  52. package/build/types/services/data/index.d.ts +13 -0
  53. package/build/types/services/data/indexes.d.ts +5 -0
  54. package/build/types/services/data/infrastructure.d.ts +10 -0
  55. package/build/types/services/data/json-schema.d.ts +121 -0
  56. package/build/types/services/data/properties.d.ts +5 -0
  57. package/build/types/services/data/schemas.d.ts +5 -0
  58. package/build/types/services/data/statuses.d.ts +5 -0
  59. package/build/types/services/data/transitions.d.ts +5 -0
  60. package/build/types/services/data/types.d.ts +899 -0
  61. package/build/types/services/dispatchers/actions/index.d.ts +5 -0
  62. package/build/types/services/dispatchers/actions/types.d.ts +78 -0
  63. package/build/types/services/dispatchers/dispatchers/index.d.ts +5 -0
  64. package/build/types/services/dispatchers/dispatchers/types.d.ts +111 -0
  65. package/build/types/services/dispatchers/index.d.ts +7 -0
  66. package/build/types/services/dispatchers/types.d.ts +2 -0
  67. package/build/types/services/events/events.d.ts +5 -0
  68. package/build/types/services/events/health.d.ts +9 -0
  69. package/build/types/services/events/index.d.ts +6 -0
  70. package/build/types/services/events/subscriptions.d.ts +5 -0
  71. package/build/types/services/events/types.d.ts +90 -0
  72. package/build/types/services/files/files.d.ts +5 -0
  73. package/build/types/services/files/formHelpers.d.ts +3 -0
  74. package/build/types/services/files/index.d.ts +6 -0
  75. package/build/types/services/files/settings/index.d.ts +5 -0
  76. package/build/types/services/files/settings/types.d.ts +38 -0
  77. package/build/types/services/files/tokens.d.ts +5 -0
  78. package/build/types/services/files/types.d.ts +185 -0
  79. package/build/types/services/helpers.d.ts +7 -0
  80. package/build/types/services/http-client.d.ts +22 -0
  81. package/build/types/services/index.d.ts +15 -0
  82. package/build/types/services/localizations/countries.d.ts +5 -0
  83. package/build/types/services/localizations/health.d.ts +9 -0
  84. package/build/types/services/localizations/index.d.ts +4 -0
  85. package/build/types/services/localizations/languages.d.ts +5 -0
  86. package/build/types/services/localizations/localizations.d.ts +5 -0
  87. package/build/types/services/localizations/types.d.ts +145 -0
  88. package/build/types/services/logs/access/index.d.ts +5 -0
  89. package/build/types/services/logs/access/types.d.ts +41 -0
  90. package/build/types/services/logs/index.d.ts +3 -0
  91. package/build/types/services/logs/types.d.ts +4 -0
  92. package/build/types/services/mails/index.d.ts +3 -0
  93. package/build/types/services/mails/mails.d.ts +5 -0
  94. package/build/types/services/mails/types.d.ts +141 -0
  95. package/build/types/services/notifications/health.d.ts +9 -0
  96. package/build/types/services/notifications/index.d.ts +7 -0
  97. package/build/types/services/notifications/notifications.d.ts +5 -0
  98. package/build/types/services/notifications/settings.d.ts +5 -0
  99. package/build/types/services/notifications/types.d.ts +222 -0
  100. package/build/types/services/payments/appStore.d.ts +5 -0
  101. package/build/types/services/payments/appStoreSubscriptions.d.ts +5 -0
  102. package/build/types/services/payments/health.d.ts +9 -0
  103. package/build/types/services/payments/index.d.ts +15 -0
  104. package/build/types/services/payments/orders.d.ts +5 -0
  105. package/build/types/services/payments/playStore.d.ts +5 -0
  106. package/build/types/services/payments/playStoreHistory.d.ts +5 -0
  107. package/build/types/services/payments/playStoreSubscriptions.d.ts +5 -0
  108. package/build/types/services/payments/products.d.ts +5 -0
  109. package/build/types/services/payments/stripe.d.ts +5 -0
  110. package/build/types/services/payments/subscriptions.d.ts +5 -0
  111. package/build/types/services/payments/types.d.ts +1189 -0
  112. package/build/types/services/profiles/groups.d.ts +5 -0
  113. package/build/types/services/profiles/health.d.ts +9 -0
  114. package/build/types/services/profiles/index.d.ts +9 -0
  115. package/build/types/services/profiles/logs.d.ts +5 -0
  116. package/build/types/services/profiles/profiles.d.ts +5 -0
  117. package/build/types/services/profiles/types.d.ts +369 -0
  118. package/build/types/services/tasks/api/index.d.ts +5 -0
  119. package/build/types/services/tasks/api/types.d.ts +146 -0
  120. package/build/types/services/tasks/apiRequests/index.d.ts +5 -0
  121. package/build/types/services/tasks/apiRequests/logs/index.d.ts +5 -0
  122. package/build/types/services/tasks/apiRequests/logs/types.d.ts +25 -0
  123. package/build/types/services/tasks/apiRequests/types.d.ts +83 -0
  124. package/build/types/services/tasks/functions/index.d.ts +5 -0
  125. package/build/types/services/tasks/functions/types.d.ts +27 -0
  126. package/build/types/services/tasks/index.d.ts +15 -0
  127. package/build/types/services/tasks/logs/index.d.ts +5 -0
  128. package/build/types/services/tasks/logs/types.d.ts +28 -0
  129. package/build/types/services/tasks/schedules/index.d.ts +5 -0
  130. package/build/types/services/tasks/schedules/types.d.ts +88 -0
  131. package/build/types/services/tasks/tasks.d.ts +5 -0
  132. package/build/types/services/tasks/types.d.ts +107 -0
  133. package/build/types/services/templates/index.d.ts +3 -0
  134. package/build/types/services/templates/templates.d.ts +5 -0
  135. package/build/types/services/templates/types.d.ts +202 -0
  136. package/build/types/services/types.d.ts +77 -0
  137. package/build/types/services/users/activationRequests/index.d.ts +4 -0
  138. package/build/types/services/users/activationRequests/types.d.ts +70 -0
  139. package/build/types/services/users/forgotPasswordRequests/index.d.ts +4 -0
  140. package/build/types/services/users/forgotPasswordRequests/types.d.ts +70 -0
  141. package/build/types/services/users/globalRoles.d.ts +5 -0
  142. package/build/types/services/users/groupRoles.d.ts +5 -0
  143. package/build/types/services/users/health.d.ts +9 -0
  144. package/build/types/services/users/index.d.ts +16 -0
  145. package/build/types/services/users/settings/index.d.ts +4 -0
  146. package/build/types/services/users/settings/types.d.ts +47 -0
  147. package/build/types/services/users/types.d.ts +1055 -0
  148. package/build/types/services/users/users.d.ts +5 -0
  149. package/build/types/sha1.d.ts +11 -0
  150. package/build/types/types.d.ts +102 -0
  151. package/build/types/utils.d.ts +4 -0
  152. package/build/types/version.d.ts +1 -0
  153. package/package.json +57 -0
@@ -0,0 +1,1055 @@
1
+ import { RQLString } from '../../rql';
2
+ import { FindAllIterator } from '../../services/helpers';
3
+ import { ObjectId, LanguageCode, TimeZone, PagedResult, AffectedRecords, OptionsBase, OptionsWithRql, PagedResultWithPager } from '../types';
4
+ export interface UserData {
5
+ id: string;
6
+ firstName: string;
7
+ lastName: string;
8
+ language: LanguageCode;
9
+ timeZone: TimeZone;
10
+ email: string;
11
+ phoneNumber: string;
12
+ activation: boolean;
13
+ patientEnlistments?: PatientEnlistment[];
14
+ roles?: Role[];
15
+ staffEnlistments?: StaffEnlistment[];
16
+ lastFailedTimestamp?: Date;
17
+ failedCount?: number;
18
+ profileImage?: string;
19
+ creationTimestamp: Date;
20
+ updateTimestamp: Date;
21
+ }
22
+ export declare type User = UserData;
23
+ export declare type UserDataUpdate = Partial<Pick<UserData, 'firstName' | 'lastName' | 'phoneNumber' | 'language' | 'timeZone'>>;
24
+ export interface PatientEnlistment {
25
+ groupId: string;
26
+ expiryTimestamp: Date;
27
+ expired: boolean;
28
+ creationTimestamp: Date;
29
+ }
30
+ export interface Role {
31
+ id: string;
32
+ name: string;
33
+ description: string;
34
+ permissions?: Permission[];
35
+ creationTimestamp: Date;
36
+ updateTimestamp: Date;
37
+ }
38
+ export interface Permission {
39
+ name: string;
40
+ description: string;
41
+ }
42
+ export interface StaffEnlistment {
43
+ groupId: string;
44
+ roles?: GroupRole[];
45
+ creationTimestamp: Date;
46
+ updateTimestamp: Date;
47
+ }
48
+ export interface GroupRole {
49
+ id: ObjectId;
50
+ groupId: string;
51
+ name: string;
52
+ description: string;
53
+ permissions: string[];
54
+ creationTimestamp: Date;
55
+ updateTimestamp: Date;
56
+ }
57
+ export interface RegisterUserData {
58
+ firstName: string;
59
+ lastName: string;
60
+ email: string;
61
+ password: string;
62
+ phoneNumber: string;
63
+ birthday?: string;
64
+ gender?: Gender;
65
+ country?: string;
66
+ region?: string;
67
+ language: string;
68
+ timeZone?: string;
69
+ /** The activation mode to use. Defaults to `hash`. */
70
+ activationMode?: 'hash' | 'pin_code' | 'manual';
71
+ }
72
+ export declare enum Gender {
73
+ Unknown = 0,
74
+ Male = 1,
75
+ Female = 2,
76
+ NotApplicable = 9
77
+ }
78
+ export interface EmailUpdate {
79
+ email: string;
80
+ activationMode?: 'hash' | 'pin_code' | 'manual';
81
+ }
82
+ export interface AddPatientEnlistment {
83
+ groupId: ObjectId;
84
+ expiryTimestamp?: number;
85
+ }
86
+ export interface ChangePassword {
87
+ oldPassword: string;
88
+ newPassword: string;
89
+ }
90
+ export interface Authenticate {
91
+ email: string;
92
+ password: string;
93
+ }
94
+ export declare type ActivationCompletion = ActivationHashCompletion | ActivationPinCodeCompletion;
95
+ export interface ActivationHashCompletion {
96
+ hash: string;
97
+ }
98
+ export interface ActivationPinCodeCompletion {
99
+ email: string;
100
+ pinCode: string;
101
+ }
102
+ export declare type PasswordResetCompletion = PasswordResetHashCompletion | PasswordResetPinCodeCompletion;
103
+ export interface PasswordResetHashCompletion {
104
+ hash: string;
105
+ newPassword: string;
106
+ }
107
+ export interface PasswordResetPinCodeCompletion {
108
+ email: string;
109
+ pinCode: string;
110
+ newPassword: string;
111
+ }
112
+ export interface ConfirmPassword {
113
+ password: string;
114
+ }
115
+ export interface GlobalPermission {
116
+ name?: GlobalPermissionName;
117
+ description?: string;
118
+ }
119
+ export interface PasswordPolicy {
120
+ minimumLength: number;
121
+ maximumLength: number;
122
+ upperCaseRequired: boolean;
123
+ lowerCaseRequired: boolean;
124
+ symbolRequired: boolean;
125
+ numberRequired: boolean;
126
+ pattern?: string;
127
+ messageFormat?: string;
128
+ }
129
+ export declare enum GlobalPermissionName {
130
+ VIEW_PRESCRIPTIONS = "VIEW_PRESCRIPTIONS",
131
+ CREATE_PRESCRIPTIONS = "CREATE_PRESCRIPTIONS",
132
+ DELETE_PRESCRIPTIONS = "DELETE_PRESCRIPTIONS",
133
+ VIEW_BALANCE = "VIEW_BALANCE",
134
+ VIEW_CREDIT_TRANSACTION = "VIEW_CREDIT_TRANSACTION",
135
+ UPDATE_GROUP = "UPDATE_GROUP",
136
+ DELETE_GROUP = "DELETE_GROUP",
137
+ VIEW_PATIENTS = "VIEW_PATIENTS",
138
+ ADD_PATIENT = "ADD_PATIENT",
139
+ REMOVE_PATIENT = "REMOVE_PATIENT",
140
+ VIEW_STAFF = "VIEW_STAFF",
141
+ ADD_STAFF = "ADD_STAFF",
142
+ REMOVE_STAFF = "REMOVE_STAFF",
143
+ CREATE_GROUP_ROLE = "CREATE_GROUP_ROLE",
144
+ UPDATE_GROUP_ROLE = "UPDATE_GROUP_ROLE",
145
+ DELETE_GROUP_ROLE = "DELETE_GROUP_ROLE",
146
+ ADD_GROUP_ROLE_PERMISSION = "ADD_GROUP_ROLE_PERMISSION",
147
+ REMOVE_GROUP_ROLE_PERMISSION = "REMOVE_GROUP_ROLE_PERMISSION",
148
+ ADD_GROUP_ROLE_TO_STAFF = "ADD_GROUP_ROLE_TO_STAFF",
149
+ REMOVE_GROUP_ROLE_FROM_STAFF = "REMOVE_GROUP_ROLE_FROM_STAFF",
150
+ VIEW_MEASUREMENTS = "VIEW_MEASUREMENTS",
151
+ UPDATE_MEASUREMENTS = "UPDATE_MEASUREMENTS",
152
+ TRANSITION_MEASUREMENTS = "TRANSITION_MEASUREMENTS",
153
+ DELETE_MEASUREMENTS = "DELETE_MEASUREMENTS",
154
+ CREATE_MEASUREMENT_COMMENTS = "CREATE_MEASUREMENT_COMMENTS",
155
+ VIEW_MEASUREMENT_COMMENTS = "VIEW_MEASUREMENT_COMMENTS",
156
+ UPDATE_PROFILES = "UPDATE_PROFILES",
157
+ DELETE_PROFILES = "DELETE_PROFILES",
158
+ CREATE_PROFILE_LOG_ENTRIES = "CREATE_PROFILE_LOG_ENTRIES",
159
+ VIEW_PROFILE_LOG_ENTRIES = "VIEW_PROFILE_LOG_ENTRIES",
160
+ UPDATE_GROUPS = "UPDATE_GROUPS",
161
+ CREATE_REPORTS = "CREATE_REPORTS",
162
+ VIEW_REPORTS = "VIEW_REPORTS",
163
+ UPDATE_REPORTS = "UPDATE_REPORTS",
164
+ DELETE_REPORTS = "DELETE_REPORTS",
165
+ VIEW_GROUP_REPORT_CONFIGURATIONS = "VIEW_GROUP_REPORT_CONFIGURATIONS",
166
+ VIEW_PATIENT_REPORT_CONFIGURATIONS = "VIEW_PATIENT_REPORT_CONFIGURATIONS",
167
+ UPDATE_GROUP_REPORT_CONFIGURATIONS = "UPDATE_GROUP_REPORT_CONFIGURATIONS",
168
+ UPDATE_PATIENT_REPORT_CONFIGURATIONS = "UPDATE_PATIENT_REPORT_CONFIGURATIONS",
169
+ CREATE_REPORT_SHARES = "CREATE_REPORT_SHARES",
170
+ DELETE_REPORT_SHARES = "DELETE_REPORT_SHARES",
171
+ VIEW_DISPATCHERS = "VIEW_DISPATCHERS",
172
+ APPROVE_GROUP_REQUESTS = "APPROVE_GROUP_REQUESTS",
173
+ DELETE_AUTHORIZATIONS = "DELETE_AUTHORIZATIONS",
174
+ VIEW_SENTIANCE_DATA = "VIEW_SENTIANCE_DATA",
175
+ UPDATE_PRESCRIPTION_STATUS = "UPDATE_PRESCRIPTION_STATUS",
176
+ UPDATE_STRIPE_PRODUCTS = "UPDATE_STRIPE_PRODUCTS",
177
+ UPDATE_SENTIANCE_DATA = "UPDATE_SENTIANCE_DATA",
178
+ CANCEL_TASKS = "CANCEL_TASKS",
179
+ CANCEL_TASKS_FUNCTIONS = "CANCEL_TASKS_FUNCTIONS",
180
+ CREATE_DISPATCHERS = "CREATE_DISPATCHERS",
181
+ UPDATE_TEMPLATES = "UPDATE_TEMPLATES",
182
+ VIEW_DOCUMENT_COMMENTS = "VIEW_DOCUMENT_COMMENTS",
183
+ DELETE_SCHEMAS = "DELETE_SCHEMAS",
184
+ VIEW_FILES = "VIEW_FILES",
185
+ VIEW_GROUPS = "VIEW_GROUP",
186
+ UPDATE_PACKAGES = "UPDATE_PACKAGES",
187
+ UPDATE_GROUP_REQUESTS = "UPDATE_GROUP_REQUESTS",
188
+ CREATE_DOCUMENT_COMMENTS = "CREATE_DOCUMENT_COMMENTS",
189
+ CREATE_PACKAGES = "CREATE_PACKAGES",
190
+ VIEW_DOCUMENTS = "VIEW_DOCUMENTS",
191
+ UPDATE_DOCUMENT_COMMENTS = "UPDATE_DOCUMENT_COMMENTS",
192
+ CREATE_DOCUMENTS = "CREATE_DOCUMENTS",
193
+ CREATE_TASKS = "CREATE_TASKS",
194
+ CREATE_TASKS_FUNCTIONS = "CREATE_TASKS_FUNCTIONS",
195
+ DELETE_USER = "DELETE_USER",
196
+ VIEW_ACTIVE_PERIODS = "VIEW_ACTIVE_PERIODS",
197
+ VIEW_MAILS = "VIEW_MAILS",
198
+ ADD_ROLE_PERMISSION = "ADD_ROLE_PERMISSION",
199
+ VIEW_GROUP_REQUESTS = "VIEW_GROUP_REQUESTS",
200
+ UPDATE_APPLICATIONS = "UPDATE_APPLICATIONS",
201
+ CREATE_STRIPE_PRODUCTS = "CREATE_STRIPE_PRODUCTS",
202
+ VIEW_APPLICATIONS = "VIEW_APPLICATIONS",
203
+ UPDATE_USER_EMAIL = "UPDATE_USER_EMAIL",
204
+ VIEW_NOTIFICATION_SETTINGS = "VIEW_NOTIFICATION_SETTINGS",
205
+ DELETE_LOCALIZATIONS = "DELETE_LOCALIZATIONS",
206
+ DELETE_CONFIGURATIONS = "DELETE_CONFIGURATIONS",
207
+ SEND_MAILS = "SEND_MAILS",
208
+ VIEW_GROUP = "VIEW_GROUP",
209
+ UPDATE_STRIPE_ORDERS = "UPDATE_STRIPE_ORDERS",
210
+ CREATE_TEMPLATES = "CREATE_TEMPLATES",
211
+ VIEW_CONFIGURATIONS = "VIEW_CONFIGURATIONS",
212
+ UPDATE_DOCUMENTS = "UPDATE_DOCUMENTS",
213
+ UPDATE_LOCALIZATIONS = "UPDATE_LOCALIZATIONS",
214
+ VIEW_TEMPLATES = "VIEW_TEMPLATES",
215
+ DELETE_TEMPLATES = "DELETE_TEMPLATES",
216
+ ADD_CREDITS = "ADD_CREDITS",
217
+ UPDATE_PROFILE_IMAGE = "UPDATE_PROFILE_IMAGE",
218
+ DELETE_DISPATCHERS = "DELETE_DISPATCHERS",
219
+ DELETE_DOCUMENTS = "DELETE_DOCUMENTS",
220
+ UPDATE_DISPATCHERS = "UPDATE_DISPATCHERS",
221
+ ADD_APPLICATION_VERSION = "ADD_APPLICATION_VERSION",
222
+ UPDATE_USER = "UPDATE_USER",
223
+ VIEW_TASKS = "VIEW_TASKS",
224
+ VIEW_TASKS_FUNCTIONS = "VIEW_TASKS_FUNCTIONS",
225
+ CREATE_PROFILES = "CREATE_PROFILES",
226
+ PRERENDER_REPORTS = "PRERENDER_REPORTS",
227
+ VIEW_SUBSCRIPTIONS = "VIEW_SUBSCRIPTIONS",
228
+ VIEW_STRIPE_ORDERS = "VIEW_STRIPE_ORDERS",
229
+ UPDATE_FREE_STATUS = "UPDATE_FREE_STATUS",
230
+ REMOVE_ROLE_PERMISSION = "REMOVE_ROLE_PERMISSION",
231
+ REMOVE_APPLICATION_VERSION = "REMOVE_APPLICATION_VERSION",
232
+ VIEW_USER = "VIEW_USER",
233
+ DISABLE_SCHEMAS = "DISABLE_SCHEMAS",
234
+ MANAGE_SERVICE_ALERTS = "MANAGE_SERVICE_ALERTS",
235
+ ACTIVATE_PRESCRIPTIONS = "ACTIVATE_PRESCRIPTIONS",
236
+ CREATE_LOCALIZATIONS = "CREATE_LOCALIZATIONS",
237
+ CREATE_SUBSCRIPTIONS = "CREATE_SUBSCRIPTIONS",
238
+ UPDATE_CONFIGURATIONS = "UPDATE_CONFIGURATIONS",
239
+ VIEW_EVENTS = "VIEW_EVENTS",
240
+ DELETE_PACKAGES = "DELETE_PACKAGES",
241
+ CREATE_GROUP = "CREATE_GROUP",
242
+ CREATE_ROLE = "CREATE_ROLE",
243
+ UPDATE_SCHEMAS = "UPDATE_SCHEMAS",
244
+ CREATE_NOTIFICATIONS = "CREATE_NOTIFICATIONS",
245
+ PAY_PRESCRIPTIONS = "PAY_PRESCRIPTIONS",
246
+ CREATE_APPLICATIONS = "CREATE_APPLICATIONS",
247
+ UPDATE_ROLE = "UPDATE_ROLE",
248
+ TRANSFER_PERIOD = "TRANSFER_PERIOD",
249
+ ADD_ROLE_TO_USER = "ADD_ROLE_TO_USER",
250
+ VIEW_AUTHORIZATIONS = "VIEW_AUTHORIZATIONS",
251
+ TRANSITION_DOCUMENTS = "TRANSITION_DOCUMENTS",
252
+ REMOVE_ROLE_FROM_USER = "REMOVE_ROLE_FROM_USER",
253
+ VIEW_ROLE = "VIEW_ROLE",
254
+ UPDATE_NOTIFICATION_SETTINGS = "UPDATE_NOTIFICATION_SETTINGS",
255
+ VIEW_PERIODS = "VIEW_PERIODS",
256
+ SYNC_PROFILE_GROUPS = "SYNC_PROFILE_GROUPS",
257
+ DELETE_APPLICATIONS = "DELETE_APPLICATIONS",
258
+ CREATE_SCHEMAS = "CREATE_SCHEMAS",
259
+ CREATE_EVENTS = "CREATE_EVENTS",
260
+ VIEW_AWS_SES_STATISTICS = "VIEW_AWS_SES_STATISTICS",
261
+ DELETE_ROLE = "DELETE_ROLE",
262
+ UPDATE_PRESCRIPTIONS = "UPDATE_PRESCRIPTIONS",
263
+ CREATE_USER_PERIODS = "CREATE_USER_PERIODS",
264
+ VIEW_PLAY_STORE_PURCHASES = "VIEW_PLAY_STORE_PURCHASES",
265
+ VIEW_PLAY_STORE_NOTIFICATIONS = "VIEW_PLAY_STORE_NOTIFICATIONS",
266
+ VIEW_PLAY_STORE_PURCHASE_INFOS = "VIEW_PLAY_STORE_PURCHASE_INFOS",
267
+ VIEW_PLAY_STORE_SUBSCRIPTIONS = "VIEW_PLAY_STORE_SUBSCRIPTIONS",
268
+ CREATE_PLAY_STORE_SUBSCRIPTION_PRODUCT = "CREATE_PLAY_STORE_SUBSCRIPTION_PRODUCT",
269
+ DELETE_PLAY_STORE_SUBSCRIPTION_PRODUCT = "DELETE_PLAY_STORE_SUBSCRIPTION_PRODUCT",
270
+ UPDATE_PLAY_STORE_SUBSCRIPTION_PRODUCT = "UPDATE_PLAY_STORE_SUBSCRIPTION_PRODUCT"
271
+ }
272
+ export interface GroupRolePermissions {
273
+ permissions: GlobalPermissionName[];
274
+ }
275
+ export interface Hash {
276
+ hash: string;
277
+ }
278
+ export interface Patient {
279
+ id?: ObjectId;
280
+ firstName?: string;
281
+ lastName?: string;
282
+ email?: string;
283
+ activation?: boolean;
284
+ phoneNumber?: string;
285
+ profileImage?: string;
286
+ language?: LanguageCode;
287
+ timeZone?: TimeZone;
288
+ patientEnlistments?: PatientEnlistment[];
289
+ }
290
+ export interface RoleCreation {
291
+ name: string;
292
+ description: string;
293
+ }
294
+ export interface RoleUpdate {
295
+ name?: string;
296
+ description?: string;
297
+ }
298
+ export interface AddRole {
299
+ name: string;
300
+ description: string;
301
+ }
302
+ export interface RolePermissions {
303
+ permissions: GlobalPermissionName[];
304
+ }
305
+ export interface StaffGroups {
306
+ groups: ObjectId[];
307
+ }
308
+ export interface StaffMember {
309
+ id?: ObjectId;
310
+ firstName?: string;
311
+ lastName?: string;
312
+ profileImage?: string;
313
+ email?: string;
314
+ phoneNumber?: string;
315
+ timeZone?: TimeZone;
316
+ staffEnlistments?: StaffEnlistment[];
317
+ }
318
+ export interface StaffRoles {
319
+ roles: ObjectId[];
320
+ }
321
+ export interface UserRoles {
322
+ roles: ObjectId[];
323
+ }
324
+ export interface EmailTemplates {
325
+ /** Template id used by the User Service for the account activation email. */
326
+ activationEmailTemplateId: string;
327
+ /** Template id used by the User Service for the account reactivation email. */
328
+ reactivationEmailTemplateId: string;
329
+ /** Template id used by the User Service for the password reset email. */
330
+ passwordResetEmailTemplateId: string;
331
+ /** Template id used by the User Service for the OIDC unlink email. */
332
+ oidcUnlinkEmailTemplateId: string;
333
+ /** Template id used by the User Service for the OIDC unlink pin code email. */
334
+ oidcUnlinkPinEmailTemplateId: string;
335
+ /** Template id used by the User Service for the account activation pin code email. */
336
+ activationPinEmailTemplateId: string;
337
+ /** Template id used by the User Service for the account reactivation pin code email. */
338
+ reactivationPinEmailTemplateId: string;
339
+ /** Template id used by the User Service for the password reset pin code email. */
340
+ passwordResetPinEmailTemplateId: string;
341
+ }
342
+ export interface PasswordResetRequestData {
343
+ email: string;
344
+ /** The verification mode to use. Defaults to `hash`. */
345
+ mode?: 'hash' | 'pin_code';
346
+ }
347
+ export interface ActivationRequestData {
348
+ email: string;
349
+ /** The verification mode to use. Defaults to `hash`. */
350
+ mode?: 'hash' | 'pin_code';
351
+ }
352
+ export interface UsersGlobalRolesService {
353
+ /**
354
+ * Retrieve a list of permissions
355
+ *
356
+ * Permission | Scope | Effect
357
+ * - | - | -
358
+ * none | | Everyone can use this endpoint
359
+ * @returns PagedResult<GlobalPermission>
360
+ */
361
+ getPermissions(options?: OptionsBase): Promise<PagedResult<GlobalPermission>>;
362
+ /**
363
+ * Retrieve a list of roles
364
+ *
365
+ * Permission | Scope | Effect
366
+ * - | - | -
367
+ * `VIEW_ROLE` | `global` | **Required** for this endpoint
368
+ * @param rql Add filters to the requested list.
369
+ * @returns PagedResult<Role>
370
+ */
371
+ get(options?: OptionsWithRql): Promise<PagedResult<Role>>;
372
+ /**
373
+ * Create a role
374
+ *
375
+ * Permission | Scope | Effect
376
+ * - | - | -
377
+ * `CREATE_ROLE` | `global` | **Required** for this endpoint
378
+ * @param requestBody The role data
379
+ * @returns Role
380
+ */
381
+ create(requestBody: RoleCreation, options?: OptionsBase): Promise<Role>;
382
+ /**
383
+ * Delete a role
384
+ *
385
+ * Permission | Scope | Effect
386
+ * - | - | -
387
+ * `DELETE_ROLE` | `global` | **Required** for this endpoint
388
+ * @param rql Add filters to the requested list.
389
+ * @returns AffectedRecords
390
+ * @throws {ResourceUnknownError}
391
+ */
392
+ remove(rql: RQLString, options?: OptionsBase): Promise<AffectedRecords>;
393
+ /**
394
+ * Update a role
395
+ *
396
+ * Permission | Scope | Effect
397
+ * - | - | -
398
+ * `UPDATE_ROLE` | `global` | **Required** for this endpoint
399
+ * @param id Id of the targeted role
400
+ * @param requestBody RoleUpdate
401
+ * @returns Promise<Role>
402
+ */
403
+ update(id: ObjectId, requestBody: RoleUpdate, options?: OptionsBase): Promise<Role>;
404
+ /**
405
+ * Add permissions to a role
406
+ *
407
+ * Permission | Scope | Effect
408
+ * - | - | -
409
+ * `ADD_ROLE_PERMISSION` | `global` | **Required** for this endpoint
410
+ * @param requestBody RolePermissions
411
+ * @returns AffectedRecords
412
+ * @throws {ResourceUnknownError}
413
+ */
414
+ addPermissions(rql: RQLString, requestBody: RolePermissions, options?: OptionsBase): Promise<AffectedRecords>;
415
+ /**
416
+ * Remove permissions from roles
417
+ *
418
+ * Permission | Scope | Effect
419
+ * - | - | -
420
+ * `REMOVE_ROLE_PERMISSION` | `global` | **Required** for this endpoint
421
+ * @param rql Add filters to the requested list.
422
+ * @param requestBody RolePermissions
423
+ * @returns AffectedRecords
424
+ * @throws {ResourceUnknownError}
425
+ */
426
+ removePermissions(rql: RQLString, requestBody: RolePermissions, options?: OptionsBase): Promise<AffectedRecords>;
427
+ /**
428
+ * Add roles to users
429
+ *
430
+ * Permission | Scope | Effect
431
+ * - | - | -
432
+ * `ADD_ROLE_TO_USER` | `global` | **Required** for this endpoint
433
+ * @param requestBody UserRoles
434
+ * @returns AffectedRecords
435
+ */
436
+ addToUsers(rql: RQLString, requestBody: UserRoles, options?: OptionsBase): Promise<AffectedRecords>;
437
+ /**
438
+ * Remove roles from users
439
+ *
440
+ * Permission | Scope | Effect
441
+ * - | - | -
442
+ * `REMOVE_ROLE_FROM_USER` | `global` | **Required** for this endpoint
443
+ * @param rql Add filters to the requested list.
444
+ * @param requestBody UserRoles
445
+ * @returns AffectedRecords
446
+ */
447
+ removeFromUser(rql: RQLString, requestBody: UserRoles, options?: OptionsBase): Promise<AffectedRecords>;
448
+ }
449
+ export interface UsersGroupRolesService {
450
+ /**
451
+ * Retrieve a list of group permissions
452
+ *
453
+ * Permission | Scope | Effect
454
+ * - | - | -
455
+ * none | | Everyone can use this endpoint
456
+ * @returns PagedResult<GlobalPermission>
457
+ */
458
+ getPermissions(options?: OptionsBase): Promise<PagedResult<GlobalPermission>>;
459
+ /**
460
+ * Retrieve a list of group roles
461
+ *
462
+ * Permission | Scope | Effect
463
+ * - | - | -
464
+ * none | `staff enlistment` | View the roles for the group
465
+ * `VIEW_GROUP` | `global` | View any group its roles
466
+ * @param groupId Id of the targeted group
467
+ * @param rql Add filters to the requested list.
468
+ * @returns PagedResult<GroupRole>
469
+ */
470
+ get(groupId: ObjectId, options?: OptionsWithRql): Promise<PagedResult<GroupRole>>;
471
+ /**
472
+ * Add role to a group
473
+ *
474
+ * Permission | Scope | Effect
475
+ * - | - | -
476
+ * `CREATE_GROUP_ROLE` | `staff enlistment` | Create a role for any group
477
+ * `CREATE_GROUP_ROLE` | `global` | Create a role for the group
478
+ * @param groupId Id of the targeted group
479
+ * @param requestBody The role to add
480
+ * @returns GroupRole
481
+ */
482
+ add(groupId: ObjectId, requestBody: AddRole, options?: OptionsBase): Promise<GroupRole>;
483
+ /**
484
+ * Update a group role
485
+ *
486
+ * Permission | Scope | Effect
487
+ * - | - | -
488
+ * `UPDATE_GROUP_ROLE` | `staff enlistment` | Update a role for the group
489
+ * `UPDATE_GROUP_ROLE` | `global` | Update a role for any group
490
+ * @param groupId Id of the targeted group
491
+ * @param roleId Id of the targeted role
492
+ * @param requestBody The role data to update
493
+ * @returns GroupRole
494
+ * @throws {ResourceUnknownError}
495
+ */
496
+ update(groupId: ObjectId, roleId: ObjectId, requestBody: AddRole, options?: OptionsBase): Promise<GroupRole>;
497
+ /**
498
+ * Remove a role from a group
499
+ *
500
+ * Permission | Scope | Effect
501
+ * - | - | -
502
+ * `DELETE_GROUP_ROLE` | `staff enlistment` | Delete a role for the group
503
+ * `DELETE_GROUP_ROLE` | `global` | Delete a role from any group
504
+ * @param groupId Id of the targeted group
505
+ * @param roleId Id of the targeted role
506
+ * @param rql Add filters to the requested list.
507
+ * @returns AffectedRecords
508
+ * @throws {ResourceUnknownError}
509
+ */
510
+ remove(rql: RQLString, groupId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
511
+ /**
512
+ * Add permissions to group roles
513
+ *
514
+ * Permission | Scope | Effect
515
+ * - | - | -
516
+ * `ADD_GROUP_ROLE_PERMISSION` | `staff enlistment` | Add permissions to roles of the group
517
+ * `ADD_GROUP_ROLE_PERMISSION` | `global` | Add permissions to roles of any group
518
+ * @param groupId Id of the targeted group
519
+ * @param rql Add filters to the requested list.
520
+ * @param requestBody GroupRolePermissions
521
+ * @returns AffectedRecords
522
+ * @throws {ResourceUnknownError}
523
+ */
524
+ addPermissions(groupId: ObjectId, requestBody: GroupRolePermissions, options?: OptionsWithRql): Promise<AffectedRecords>;
525
+ /**
526
+ * Remove permissions from group roles
527
+ *
528
+ * Permission | Scope | Effect
529
+ * - | - | -
530
+ * `REMOVE_GROUP_ROLE_PERMISSION` | `staff enlistment` | Remove permissions from roles of the group
531
+ * `REMOVE_GROUP_ROLE_PERMISSION` | `global` | Remove permissions from roles of any group
532
+ * @param groupId Id of the targeted group
533
+ * @param rql Add filters to the requested list.
534
+ * @param requestBody GroupRolePermissions
535
+ * @returns AffectedRecords
536
+ * @throws {ResourceUnknownError}
537
+ */
538
+ removePermissions(rql: RQLString, groupId: ObjectId, requestBody: GroupRolePermissions, options?: OptionsBase): Promise<AffectedRecords>;
539
+ /**
540
+ * Assign roles to staff members of a group
541
+ *
542
+ * Permission | Scope | Effect
543
+ * - | - | -
544
+ * `ADD_GROUP_ROLE_TO_STAFF` | `staff enlistment` | Assign roles for the group
545
+ * `ADD_GROUP_ROLE_TO_STAFF` | `global` | Assign roles for any group
546
+ * @param groupId Id of the targeted group
547
+ * @param rql Add filters to the requested list.
548
+ * @param requestBody StaffRoles
549
+ * @returns AffectedRecords
550
+ * @throws {ResourceUnknownError}
551
+ */
552
+ assignToStaff(groupId: ObjectId, requestBody: StaffRoles, options?: OptionsWithRql): Promise<AffectedRecords>;
553
+ /**
554
+ * Remove roles from staff members of a group
555
+ *
556
+ * Permission | Scope | Effect
557
+ * - | - | -
558
+ * `REMOVE_GROUP_ROLE_FROM_STAFF` | `staff enlistment` | Remove roles from staff of the group
559
+ * `REMOVE_GROUP_ROLE_FROM_STAFF` | `global` | Remove roles from staff of any group
560
+ * @param groupId Id of the targeted group
561
+ * @param rql Add filters to the requested list.
562
+ * @param requestBody StaffRoles
563
+ * @returns AffectedRecords
564
+ * @throws {ResourceUnknownError}
565
+ */
566
+ removeFromStaff(rql: RQLString, groupId: ObjectId, requestBody: StaffRoles, options?: OptionsBase): Promise<AffectedRecords>;
567
+ /**
568
+ * Add users to staff
569
+ *
570
+ * Permission | Scope | Effect
571
+ * - | - | -
572
+ * `ADD_STAFF` | `staff enlistment` | Add staff to the group
573
+ * `ADD_STAFF` | `global` | Add staff to any group
574
+ * @param rql Add filters to the requested list.
575
+ * @param requestBody StaffGroups
576
+ * @returns AffectedRecords
577
+ * @throws {ResourceUnknownError}
578
+ */
579
+ addUsersToStaff(requestBody: StaffGroups, options?: OptionsWithRql): Promise<AffectedRecords>;
580
+ /**
581
+ * Remove users from staff
582
+ *
583
+ * Permission | Scope | Effect
584
+ * - | - | -
585
+ * `REMOVE_STAFF` | `staff enlistment` | Remove staff from the group
586
+ * `REMOVE_STAFF` | `global` | Remove staff from any group
587
+ * @param rql Add filters to the requested list.
588
+ * @param requestBody StaffGroups
589
+ * @returns AffectedRecords
590
+ * @throws {ResourceUnknownError}
591
+ */
592
+ removeUsersFromStaff(rql: RQLString, requestBody: StaffGroups, options?: OptionsBase): Promise<AffectedRecords>;
593
+ }
594
+ export interface UsersService {
595
+ /**
596
+ * Retrieve the current logged in user
597
+ *
598
+ * Permission | Scope | Effect
599
+ * - | - | -
600
+ * none | | Everyone can use this endpoint
601
+ * @returns {UserData} UserData
602
+ */
603
+ me(options?: OptionsBase): Promise<User>;
604
+ /**
605
+ * Retrieve a specific user
606
+ * @params {string} userId of the targeted user (required)
607
+ *
608
+ * Permission | Scope | Effect
609
+ * - | - | -
610
+ * none | | See your own user object
611
+ * none | group | See a subset of the fields for any staff member or patient of the group
612
+ * VIEW_PATIENTS | global | See a subset of fields for any user with a patient enlistment
613
+ * VIEW_STAFF | global | See a subset of fields for any user with a staff enlistment
614
+ * VIEW_USER | global | See any user object
615
+ * @throws {ResourceUnknownError}
616
+ * @returns {UserData} UserData
617
+ */
618
+ findById(userId: string, options?: OptionsBase): Promise<User>;
619
+ /**
620
+ * Update a specific user
621
+ * @params {string} userId of the targeted user (required)
622
+ * @params {Pick<UserData,'firstName' | 'lastName' | 'phoneNumber' | 'language' | 'timeZone'>} data Fields to update
623
+ *
624
+ * Permission | Scope | Effect
625
+ * - | - | -
626
+ * none | | Update your own data
627
+ * `UPDATE_USER` | global | Update any user
628
+ * @throws {ResourceUnknownError}
629
+ * @returns {UserData} UserData
630
+ */
631
+ update(userId: string, userData: UserDataUpdate, options?: OptionsBase): Promise<UserData>;
632
+ /**
633
+ * Retrieve a list of users
634
+ *
635
+ * Permission | Scope | Effect
636
+ * - | - | -
637
+ * none | `patient enlistment` | See a limited set of fields of the staff members (of the groups where you are enlisted as a patient)
638
+ * none | `staff enlistment` | See a limited set of fields of all patients and staff members (of the groups where you are enlisted as staff member)
639
+ * `VIEW_USER` | `global` | See all fields of all users
640
+ * @param rql Add filters to the requested list.
641
+ * @returns PagedResultWithPager<User>
642
+ */
643
+ find(options?: OptionsWithRql): Promise<PagedResultWithPager<User>>;
644
+ /**
645
+ * Request a list of all users
646
+ *
647
+ * Do not pass in an rql with limit operator!
648
+ *
649
+ * Permission | Scope | Effect
650
+ * - | - | -
651
+ * none | `patient enlistment` | See a limited set of fields of the staff members (of the groups where you are enlisted as a patient)
652
+ * none | `staff enlistment` | See a limited set of fields of all patients and staff members (of the groups where you are enlisted as staff member)
653
+ * `VIEW_USER` | `global` | See all fields of all users
654
+ * @param rql Add filters to the requested list.
655
+ * @returns User[]
656
+ */
657
+ findAll(options?: OptionsWithRql): Promise<User[]>;
658
+ /**
659
+ * Request a list of all users
660
+ *
661
+ * Permission | Scope | Effect
662
+ * - | - | -
663
+ * none | `patient enlistment` | See a limited set of fields of the staff members (of the groups where you are enlisted as a patient)
664
+ * none | `staff enlistment` | See a limited set of fields of all patients and staff members (of the groups where you are enlisted as staff member)
665
+ * `VIEW_USER` | `global` | See all fields of all users
666
+ * @param rql Add filters to the requested list.
667
+ * @returns User[]
668
+ */
669
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<User>;
670
+ findFirst(options?: {
671
+ rql?: RQLString;
672
+ }): Promise<User>;
673
+ /**
674
+ * @deprecated
675
+ * Delete a list of users
676
+ *
677
+ * Permission | Scope | Effect
678
+ * - | - | -
679
+ * none | | Delete your own user (object)
680
+ * `DELETE_USER` | `global` | Delete any user
681
+ * @param rql Add filters to the requested list.
682
+ * @returns AffectedRecords
683
+ */
684
+ removeUsers(rql: RQLString, options?: OptionsBase): Promise<AffectedRecords>;
685
+ /**
686
+ * Retrieve a list of users that have a patient enlistment
687
+ *
688
+ * Permission | Scope | Effect
689
+ * - | - | -
690
+ * none | `staff enlistment` | View the patients of the group
691
+ * `VIEW_PATIENTS` | `global` | View all patients
692
+ * @param rql Add filters to the requested list.
693
+ * @returns Patient Success
694
+ */
695
+ patients(options?: OptionsWithRql): Promise<PagedResult<Patient>>;
696
+ /**
697
+ * Retrieve a list of users that have a staff enlistment
698
+ *
699
+ * Permission | Scope | Effect
700
+ * - | - | -
701
+ * none | `staff enlistment` | View the other staff members of the group
702
+ * `VIEW_STAFF` | `global` | View all staff members
703
+ * @param rql Add filters to the requested list.
704
+ * @returns StaffMember Success
705
+ */
706
+ staff(options?: OptionsWithRql): Promise<PagedResult<StaffMember>>;
707
+ /**
708
+ * Delete a specific user
709
+ *
710
+ * Permission | Scope | Effect
711
+ * - | - | -
712
+ * none | | Delete your own user object
713
+ * `DELETE_USER` | `global` | Delete any user
714
+ * @param userId Id of the targeted user
715
+ * @returns AffectedRecords
716
+ * @throws {ResourceUnknownError}
717
+ */
718
+ remove(userId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
719
+ /**
720
+ * Update the email address of a specific user.
721
+ *
722
+ * An email is send to the new email address with a token and instructions to reactivate the account.
723
+ * The token should be used to complete the account activation via `exh.users.validateEmailActivation`.
724
+ *
725
+ * By default the email send to the user is the email template configured by `reactivationEmailTemplateId`.
726
+ * The template receives a 40 hexadecimal character hash in the `content.activation_hash` variable.
727
+ * The hash should be used within 60 minutes, otherwise `exh.users.requestEmailActivation` should be used to request a new email.
728
+ *
729
+ * If enabled, a pin code can be used rather than a hash.
730
+ * The pin code mode must be enabled by the `enablePinCodeActivationRequests` verification setting.
731
+ * To use the pin code mode, the `activationMode` field can be set to `pin_code`.
732
+ * Then the email send to the user is the email template configured by `reactivationPinEmailTemplateId`.
733
+ * The pin code template receives a 8 digit pin code in the `content.pin_code` variable.
734
+ * The pin code should be used within 15 minutes, otherwise `exh.users.requestEmailActivation` should be used to request a new email.
735
+ *
736
+ * If a custom (or no) account activation flow is desired, the `activationMode` field can be set to `manual`.
737
+ * No email will be send.
738
+ *
739
+ * Permission | Scope | Effect
740
+ * - | - | -
741
+ * none | | Update your own data
742
+ * `UPDATE_USER_EMAIL` | `global` | Update any user
743
+ *
744
+ * @throws {EmailUsedError}
745
+ * @throws {ResourceUnknownError}
746
+ * @throws {PinCodesNotEnabledError} Pin codes are not enabled, please check the verification settings
747
+ */
748
+ updateEmail(userId: ObjectId, requestBody: EmailUpdate, options?: OptionsBase): Promise<User>;
749
+ /**
750
+ * Add a patient enlistment to a user
751
+ *
752
+ * Permission | Scope | Effect
753
+ * - | - | -
754
+ * `ADD_PATIENT` | `global` | **Required** for this endpoint
755
+ * @param userId Id of the targeted user
756
+ * @param requestBody AddPatientEnlistment
757
+ * @returns AffectedRecords
758
+ * @throws {ResourceAlreadyExistsError}
759
+ */
760
+ addPatientEnlistment(userId: ObjectId, requestBody: AddPatientEnlistment, options?: OptionsBase): Promise<AffectedRecords>;
761
+ /**
762
+ * Remove a patient enlistment from a user
763
+ *
764
+ * Permission | Scope | Effect
765
+ * - | - | -
766
+ * none | | Remove a patient enlistment from yourself
767
+ * `REMOVE_PATIENT` | `staff enlistment` | Remove a patient enlistment for the group
768
+ * `REMOVE_PATIENT` | `global` | Remove any patient enlistment
769
+ * @param userId Id of the targeted user
770
+ * @param groupId Id of the targeted group
771
+ * @returns AffectedRecords
772
+ * @throws {ResourceUnknownError}
773
+ */
774
+ removePatientEnlistment(userId: ObjectId, groupId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
775
+ /**
776
+ * Create an account.
777
+ *
778
+ * An email is send to the supplied email address with a token and instructions to activate the account.
779
+ * The token should be used to complete the account activation via `exh.users.validateEmailActivation`.
780
+ *
781
+ * By default the email send to the user is the email template configured by `activationEmailTemplateId`.
782
+ * The template receives a 40 hexadecimal character hash in the `content.activation_hash` variable.
783
+ * The hash should be used within 60 minutes, otherwise `exh.users.requestEmailActivation` should be used to request a new email.
784
+ *
785
+ * If enabled, a pin code can be used rather than a hash.
786
+ * The pin code mode must be enabled by the `enablePinCodeActivationRequests` verification setting.
787
+ * To use the pin code mode, the `activationMode` field can be set to `pin_code`.
788
+ * Then the email send to the user is the email template configured by `activationPinEmailTemplateId`.
789
+ * The pin code template receives a 8 digit pin code in the `content.pin_code` variable.
790
+ * The pin code should be used within 15 minutes, otherwise `exh.users.requestEmailActivation` should be used to request a new email.
791
+ *
792
+ * If a custom (or no) account activation flow is desired, the `activationMode` field can be set to `manual`.
793
+ * No email will be send.
794
+ *
795
+ * Permission | Scope | Effect
796
+ * - | - | -
797
+ * none | | Everyone can use this endpoint
798
+ *
799
+ * @throws {EmailUsedError}
800
+ * @throws {PinCodesNotEnabledError} Pin codes are not enabled, please check the verification settings
801
+ */
802
+ createAccount(requestBody: RegisterUserData, options?: OptionsBase): Promise<User>;
803
+ /**
804
+ * Change your password
805
+ *
806
+ * Permission | Scope | Effect
807
+ * - | - | -
808
+ * none | | Everyone can use this endpoint
809
+ * @param requestBody ChangePassword
810
+ * @returns User
811
+ * @throws {PasswordError}
812
+ */
813
+ changePassword(requestBody: ChangePassword, options?: OptionsBase): Promise<boolean>;
814
+ /**
815
+ * Authenticate a user
816
+ *
817
+ * Permission | Scope | Effect
818
+ * - | - | -
819
+ * none | | Everyone can use this endpoint
820
+ * @param requestBody Authenticate
821
+ * @returns User
822
+ * @throws {AuthenticationError}
823
+ * @throws {LoginTimeoutError}
824
+ * @throws {LoginFreezeError}
825
+ * @throws {TooManyFailedAttemptsError}
826
+ */
827
+ authenticate(requestBody: Authenticate, options?: OptionsBase): Promise<User>;
828
+ /**
829
+ * Request an email activation.
830
+ *
831
+ * An email is send to the supplied email address with a token and instructions to activate the account.
832
+ * The token should be used to complete the account activation via `exh.users.validateEmailActivation`.
833
+ *
834
+ * The email send to the user is the email template configured by `activationEmailTemplateId`.
835
+ * The template receives a 40 hexadecimal character hash in the `content.activation_hash` variable.
836
+ * The hash should be used within 60 minutes, otherwise this method should be called again to request a new email.
837
+ *
838
+ * Permission | Scope | Effect
839
+ * - | - | -
840
+ * none | | Everyone can use this endpoint
841
+ *
842
+ * @throws {EmailUnknownError}
843
+ * @throws {AlreadyActivatedError}
844
+ * @throws {IllegalStateError} Attempting to use `activationEmailTemplateId` while not configured. See `exh.users.setEmailTemplates`.
845
+ * @throws {ActivationRequestLimitError} The maximum allowed consecutive activation requests is reached
846
+ * @throws {ActivationRequestTimeoutError} Activation request too short after the previous one
847
+ */
848
+ requestEmailActivation(email: string, options?: OptionsBase): Promise<boolean>;
849
+ /**
850
+ * Request an email activation.
851
+ *
852
+ * An email is send to the supplied email address with a token and instructions to activate the account.
853
+ * The token should be used to complete the account activation via `exh.users.validateEmailActivation`.
854
+ *
855
+ * By default the email send to the user is the email template configured by `activationEmailTemplateId`.
856
+ * The template receives a 40 hexadecimal character hash in the `content.activation_hash` variable.
857
+ * The hash should be used within 60 minutes, otherwise this method should be called again to request a new email.
858
+ *
859
+ * If enabled, a pin code can be used rather than a hash.
860
+ * The pin code mode must be enabled by the `enablePinCodeActivationRequests` verification setting.
861
+ * To use the pin code mode, the `activationMode` field can be set to `pin_code`.
862
+ * Then the email send to the user is the email template configured by `activationPinEmailTemplateId`.
863
+ * The pin code template receives a 8 digit pin code in the `content.pin_code` variable.
864
+ * The pin code should be used within 15 minutes, otherwise this method should be called again to request a new email.
865
+ *
866
+ * Permission | Scope | Effect
867
+ * - | - | -
868
+ * none | | Everyone can use this endpoint
869
+ *
870
+ * @throws {EmailUnknownError}
871
+ * @throws {AlreadyActivatedError}
872
+ * @throws {IllegalStateError} Attempting to use either `activationEmailTemplateId` or `activationPinEmailTemplateId` while not configured. See `exh.users.setEmailTemplates`.
873
+ * @throws {ActivationRequestLimitError} The maximum allowed consecutive activation requests is reached
874
+ * @throws {ActivationRequestTimeoutError} Activation request too short after the previous one
875
+ */
876
+ requestEmailActivation(data: ActivationRequestData, options?: OptionsBase): Promise<boolean>;
877
+ /**
878
+ * Complete an email activation.
879
+ *
880
+ * Either a hash activation with just the `hash` field.
881
+ * Or a pin code activation with the `email` and `pinCode` fields.
882
+ *
883
+ * Permission | Scope | Effect
884
+ * - | - | -
885
+ * none | | Everyone can use this endpoint
886
+ *
887
+ * @throws {ActivationUnknownError}
888
+ * @throws {TooManyFailedAttemptsError} Attempts are blocked due to too many failed attempts, a new activation request needs to be generated before new attempts can be made
889
+ * @throws {IncorrectPinCodeError} The provided pin code was incorrect
890
+ */
891
+ validateEmailActivation(requestBody: ActivationCompletion, options?: OptionsBase): Promise<boolean>;
892
+ /**
893
+ * Request a password reset.
894
+ *
895
+ * An email is send to the targeted user with a token and instructions to reset their password.
896
+ * The token should be used to complete the password reset via `exh.users.validatePasswordReset`.
897
+ *
898
+ * The email send to the user is the email template configured by `passwordResetEmailTemplateId`.
899
+ * The template receives a 40 hexadecimal character hash in the `content.reset_hash` variable.
900
+ * The hash should be used within 60 minutes, otherwise this method should be called again to request a new email.
901
+ *
902
+ * Permission | Scope | Effect
903
+ * - | - | -
904
+ * none | | Everyone can use this endpoint
905
+ *
906
+ * @throws {EmailUnknownError}
907
+ * @throws {NotActivatedError}
908
+ * @throws {IllegalStateError} Attempting to use either `passwordResetEmailTemplateId` or `passwordResetPinEmailTemplateId` while not configured. See `exh.users.setEmailTemplates`.
909
+ * @throws {ForgotPasswordRequestLimitError} The maximum allowed consecutive forgot password requests is reached
910
+ * @throws {ForgotPasswordRequestTimeoutError} Forgot password request too short after the previous one
911
+ */
912
+ requestPasswordReset(email: string, options?: OptionsBase): Promise<boolean>;
913
+ /**
914
+ * Request a password reset.
915
+ *
916
+ * An email is send to the targeted user with a token and instructions to reset their password.
917
+ * The token should be used to complete the password reset via `exh.users.validatePasswordReset`.
918
+ *
919
+ * By default the email send to the user is the email template configured by `passwordResetEmailTemplateId`.
920
+ * The template receives a 40 hexadecimal character hash in the `content.reset_hash` variable.
921
+ * The hash should be used within 60 minutes, otherwise this method should be called again to request a new email.
922
+ *
923
+ * If enabled, a pin code can be used rather than a hash.
924
+ * The pin code mode must be enabled by the `enablePinCodeForgotPasswordRequests` verification setting.
925
+ * To use the pin code mode, the `mode` field can be set to `pin_code`.
926
+ * Then the email send to the user is the email template configured by `passwordResetPinEmailTemplateId`.
927
+ * The pin code template receives a 8 digit pin code in the `content.pin_code` variable.
928
+ * The pin code should be used within 15 minutes, otherwise this method should be called again to request a new email.
929
+ *
930
+ * Permission | Scope | Effect
931
+ * - | - | -
932
+ * none | | Everyone can use this endpoint
933
+ *
934
+ * @throws {EmailUnknownError}
935
+ * @throws {NotActivatedError}
936
+ * @throws {IllegalStateError} Attempting to use either `passwordResetEmailTemplateId` or `passwordResetPinEmailTemplateId` while not configured. See `exh.users.setEmailTemplates`.
937
+ * @throws {DisabledForOidcUsersError}
938
+ * @throws {PinCodesNotEnabledError} Pin codes are not enabled, please check the verification settings
939
+ * @throws {ForgotPasswordRequestLimitError} The maximum allowed consecutive forgot password requests is reached
940
+ * @throws {ForgotPasswordRequestTimeoutError} Forgot password request too short after the previous one
941
+ */
942
+ requestPasswordReset(data: PasswordResetRequestData, options?: OptionsBase): Promise<boolean>;
943
+ /**
944
+ * Complete a password reset.
945
+ *
946
+ * Either a hash password reset with the `hash` and `newPassword` fields.
947
+ * Or a pin code password reset with the `email`, `pinCode` and `newPassword` fields.
948
+ *
949
+ * Permission | Scope | Effect
950
+ * - | - | -
951
+ * none | | Everyone can use this endpoint
952
+ *
953
+ * @throws {NotActivatedError}
954
+ * @throws {NewPasswordHashUnknownError} The provided hash either does not exist or is expired
955
+ * @throws {NewPasswordPinCodeUnknownError} No password reset request was found or it is expired for the provided email
956
+ * @throws {TooManyFailedAttemptsError} Attempts are blocked due to too many failed attempts, a new password reset request needs to be generated before new attempts can be made
957
+ * @throws {IncorrectPinCodeError} The provided pin code was incorrect
958
+ * @throws {DisabledForOidcUsersError}
959
+ */
960
+ validatePasswordReset(requestBody: PasswordResetCompletion, options?: OptionsBase): Promise<boolean>;
961
+ /**
962
+ * Confirm the password for the user making the request
963
+ *
964
+ * Permission | Scope | Effect
965
+ * - | - | -
966
+ * none | | Everyone can use this endpoint
967
+ * @param requestBody the password to confirm
968
+ * @returns {boolean} true if password was confirmed
969
+ * @throws {AuthenticationError}
970
+ * @throws {LoginTimeoutError}
971
+ * @throws {LoginFreezeError}
972
+ * @throws {TooManyFailedAttemptsError}
973
+ */
974
+ confirmPassword(requestBody: ConfirmPassword, options?: OptionsBase): Promise<boolean>;
975
+ /**
976
+ * Check if an email address is still available
977
+ *
978
+ * Permission | Scope | Effect
979
+ * - | - | -
980
+ * none | | Everyone can use this endpoint
981
+ * @param email
982
+ * @returns emailAvailable will be true on success
983
+ */
984
+ isEmailAvailable(email: string, options?: OptionsBase): Promise<{
985
+ emailAvailable: boolean;
986
+ }>;
987
+ /**
988
+ * Update the profile image of a user
989
+ *
990
+ * Permission | Scope | Effect
991
+ * - | - | -
992
+ * none | | Update your own profile image
993
+ * `UPDATE_PROFILE_IMAGE` | `global` | Update any user its profile image
994
+ * @deprecated this method is deprecated in swagger
995
+ * @param userId Id of the targeted user
996
+ * @param requestBody Hash
997
+ * @returns User
998
+ * @throws {ResourceUnknownError}
999
+ */
1000
+ updateProfileImage(userId: ObjectId, requestBody: Hash, options?: OptionsBase): Promise<User>;
1001
+ /**
1002
+ * Delete the profile image of a user
1003
+ *
1004
+ * Permission | Scope | Effect
1005
+ * - | - | -
1006
+ * none | | Delete your own profile image
1007
+ * `UPDATE_PROFILE_IMAGE` | `global` | Delete any user its profile image
1008
+ * @param userId Id of the targeted user
1009
+ * @returns User
1010
+ * @throws {ResourceUnknownError}
1011
+ */
1012
+ deleteProfileImage(userId: ObjectId, options?: OptionsBase): Promise<User>;
1013
+ /**
1014
+ * Retrieve the current pasword policy
1015
+ *
1016
+ * Permission | Scope | Effect
1017
+ * - | - | -
1018
+ * none | | Everyone can use this endpoint
1019
+ * @returns {PasswordPolicy} PasswordPolicy
1020
+ */
1021
+ passwordPolicy(options?: OptionsBase): Promise<PasswordPolicy>;
1022
+ /**
1023
+ * Update the current pasword policy
1024
+ *
1025
+ * Permission | Scope | Effect
1026
+ * - | - | -
1027
+ * `UPDATE_PASSWORD_POLICY` | `global` | Update password policy
1028
+ * @returns {PasswordPolicy} PasswordPolicy
1029
+ */
1030
+ updatePasswordPolicy(requestBody: PasswordPolicy, options?: OptionsBase): Promise<PasswordPolicy>;
1031
+ /**
1032
+ * ## Retrieve a list of email templates
1033
+ *
1034
+ * **Global Permissions:**
1035
+ * - `VIEW_USER_SERVICE_EMAIL_TEMPLATES` - Allows a user to view the email templates configuration
1036
+ *
1037
+ * **Notes:**
1038
+ * - If an email template has not been set, it will not appear in the response
1039
+ * @param options {@link OptionsBase} - Add options to the request
1040
+ * @returns A list of email templates {@link EmailTemplates}
1041
+ */
1042
+ getEmailTemplates(options?: OptionsBase): Promise<EmailTemplates>;
1043
+ /**
1044
+ * ## Set the list of email templates
1045
+ *
1046
+ * **Global Permissions:**
1047
+ * - `UPDATE_USER_SERVICE_EMAIL_TEMPLATES` - Allows a user to update the email templates configuration
1048
+ *
1049
+ * **Notes:**
1050
+ * - This operation works as an update and will only update the templates that are provided
1051
+ * @param templates {@link EmailTemplatesUpdate} - A partial list of email templates to update
1052
+ * @returns A list of email templates {@link EmailTemplates}
1053
+ */
1054
+ setEmailTemplates(templates: Partial<EmailTemplates>): Promise<EmailTemplates>;
1055
+ }