@extrahorizon/javascript-sdk 8.2.0 → 8.2.1-dev-48-41fd1f1

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 (152) hide show
  1. package/CHANGELOG.md +1177 -1161
  2. package/README.md +108 -119
  3. package/build/index.cjs.js +1 -1
  4. package/build/index.mjs +1 -1
  5. package/build/types/btoa.d.ts +6 -6
  6. package/build/types/client.d.ts +136 -136
  7. package/build/types/constants.d.ts +15 -15
  8. package/build/types/errorHandler.d.ts +2 -2
  9. package/build/types/errors.d.ts +332 -332
  10. package/build/types/http/client.d.ts +2 -2
  11. package/build/types/http/index.d.ts +4 -4
  12. package/build/types/http/interceptors.d.ts +9 -9
  13. package/build/types/http/oAuth1Signature.d.ts +14 -14
  14. package/build/types/http/oauth1.d.ts +3 -3
  15. package/build/types/http/oauth2.d.ts +3 -3
  16. package/build/types/http/proxy.d.ts +3 -3
  17. package/build/types/http/types.d.ts +331 -331
  18. package/build/types/http/utils.d.ts +21 -21
  19. package/build/types/index.d.ts +9 -9
  20. package/build/types/mock.d.ts +43 -43
  21. package/build/types/mockType.d.ts +1547 -1511
  22. package/build/types/parseStoredCredentials.d.ts +11 -11
  23. package/build/types/rql/index.d.ts +16 -16
  24. package/build/types/rql/parser.d.ts +1 -1
  25. package/build/types/rql/types.d.ts +168 -168
  26. package/build/types/services/auth/applications/index.d.ts +5 -5
  27. package/build/types/services/auth/applications/types.d.ts +260 -190
  28. package/build/types/services/auth/index.d.ts +3 -3
  29. package/build/types/services/auth/oauth1/index.d.ts +5 -5
  30. package/build/types/services/auth/oauth1/types.d.ts +63 -63
  31. package/build/types/services/auth/oauth2/index.d.ts +5 -5
  32. package/build/types/services/auth/oauth2/types.d.ts +52 -52
  33. package/build/types/services/auth/oidc/index.d.ts +5 -5
  34. package/build/types/services/auth/oidc/loginAttempts/index.d.ts +5 -5
  35. package/build/types/services/auth/oidc/loginAttempts/types.d.ts +67 -67
  36. package/build/types/services/auth/oidc/providers/index.d.ts +5 -5
  37. package/build/types/services/auth/oidc/providers/types.d.ts +144 -144
  38. package/build/types/services/auth/oidc/types.d.ts +40 -40
  39. package/build/types/services/auth/types.d.ts +39 -39
  40. package/build/types/services/auth/users/index.d.ts +5 -5
  41. package/build/types/services/auth/users/types.d.ts +121 -121
  42. package/build/types/services/configurations/general.d.ts +5 -5
  43. package/build/types/services/configurations/groups.d.ts +5 -5
  44. package/build/types/services/configurations/index.d.ts +10 -10
  45. package/build/types/services/configurations/patients.d.ts +5 -5
  46. package/build/types/services/configurations/staff.d.ts +5 -5
  47. package/build/types/services/configurations/types.d.ts +222 -222
  48. package/build/types/services/configurations/users.d.ts +5 -5
  49. package/build/types/services/data/comments.d.ts +5 -5
  50. package/build/types/services/data/documents.d.ts +5 -5
  51. package/build/types/services/data/index.d.ts +13 -13
  52. package/build/types/services/data/indexes.d.ts +5 -5
  53. package/build/types/services/data/infrastructure.d.ts +10 -10
  54. package/build/types/services/data/json-schema.d.ts +121 -121
  55. package/build/types/services/data/properties.d.ts +5 -5
  56. package/build/types/services/data/schemas.d.ts +5 -5
  57. package/build/types/services/data/statuses.d.ts +5 -5
  58. package/build/types/services/data/transitions.d.ts +5 -5
  59. package/build/types/services/data/types.d.ts +899 -899
  60. package/build/types/services/dispatchers/actions/index.d.ts +5 -5
  61. package/build/types/services/dispatchers/actions/types.d.ts +78 -78
  62. package/build/types/services/dispatchers/dispatchers/index.d.ts +5 -5
  63. package/build/types/services/dispatchers/dispatchers/types.d.ts +111 -111
  64. package/build/types/services/dispatchers/index.d.ts +7 -7
  65. package/build/types/services/dispatchers/types.d.ts +2 -2
  66. package/build/types/services/events/events.d.ts +5 -5
  67. package/build/types/services/events/health.d.ts +9 -9
  68. package/build/types/services/events/index.d.ts +6 -6
  69. package/build/types/services/events/subscriptions.d.ts +5 -5
  70. package/build/types/services/events/types.d.ts +90 -90
  71. package/build/types/services/files/files.d.ts +5 -5
  72. package/build/types/services/files/formHelpers.d.ts +3 -3
  73. package/build/types/services/files/index.d.ts +6 -6
  74. package/build/types/services/files/settings/index.d.ts +5 -5
  75. package/build/types/services/files/settings/types.d.ts +38 -38
  76. package/build/types/services/files/tokens.d.ts +5 -5
  77. package/build/types/services/files/types.d.ts +185 -185
  78. package/build/types/services/helpers.d.ts +7 -7
  79. package/build/types/services/http-client.d.ts +22 -22
  80. package/build/types/services/index.d.ts +15 -15
  81. package/build/types/services/localizations/countries.d.ts +5 -5
  82. package/build/types/services/localizations/health.d.ts +9 -9
  83. package/build/types/services/localizations/index.d.ts +4 -4
  84. package/build/types/services/localizations/languages.d.ts +5 -5
  85. package/build/types/services/localizations/localizations.d.ts +5 -5
  86. package/build/types/services/localizations/types.d.ts +145 -145
  87. package/build/types/services/logs/access/index.d.ts +5 -5
  88. package/build/types/services/logs/access/types.d.ts +41 -41
  89. package/build/types/services/logs/index.d.ts +3 -3
  90. package/build/types/services/logs/types.d.ts +4 -4
  91. package/build/types/services/mails/index.d.ts +3 -3
  92. package/build/types/services/mails/mails.d.ts +5 -5
  93. package/build/types/services/mails/types.d.ts +141 -141
  94. package/build/types/services/notifications/health.d.ts +9 -9
  95. package/build/types/services/notifications/index.d.ts +7 -7
  96. package/build/types/services/notifications/notifications.d.ts +5 -5
  97. package/build/types/services/notifications/settings.d.ts +5 -5
  98. package/build/types/services/notifications/types.d.ts +222 -222
  99. package/build/types/services/payments/appStore.d.ts +5 -5
  100. package/build/types/services/payments/appStoreSubscriptions.d.ts +5 -5
  101. package/build/types/services/payments/health.d.ts +9 -9
  102. package/build/types/services/payments/index.d.ts +15 -15
  103. package/build/types/services/payments/orders.d.ts +5 -5
  104. package/build/types/services/payments/playStore.d.ts +5 -5
  105. package/build/types/services/payments/playStoreHistory.d.ts +5 -5
  106. package/build/types/services/payments/playStoreSubscriptions.d.ts +5 -5
  107. package/build/types/services/payments/products.d.ts +5 -5
  108. package/build/types/services/payments/stripe.d.ts +5 -5
  109. package/build/types/services/payments/subscriptions.d.ts +5 -5
  110. package/build/types/services/payments/types.d.ts +1189 -1189
  111. package/build/types/services/profiles/groups.d.ts +5 -5
  112. package/build/types/services/profiles/health.d.ts +9 -9
  113. package/build/types/services/profiles/index.d.ts +9 -9
  114. package/build/types/services/profiles/logs.d.ts +5 -5
  115. package/build/types/services/profiles/profiles.d.ts +5 -5
  116. package/build/types/services/profiles/types.d.ts +370 -369
  117. package/build/types/services/tasks/api/index.d.ts +5 -5
  118. package/build/types/services/tasks/api/types.d.ts +146 -146
  119. package/build/types/services/tasks/apiRequests/index.d.ts +5 -5
  120. package/build/types/services/tasks/apiRequests/logs/index.d.ts +5 -5
  121. package/build/types/services/tasks/apiRequests/logs/types.d.ts +25 -25
  122. package/build/types/services/tasks/apiRequests/types.d.ts +83 -83
  123. package/build/types/services/tasks/functions/index.d.ts +5 -5
  124. package/build/types/services/tasks/functions/types.d.ts +27 -27
  125. package/build/types/services/tasks/index.d.ts +15 -15
  126. package/build/types/services/tasks/logs/index.d.ts +5 -5
  127. package/build/types/services/tasks/logs/types.d.ts +28 -28
  128. package/build/types/services/tasks/schedules/index.d.ts +5 -5
  129. package/build/types/services/tasks/schedules/types.d.ts +88 -88
  130. package/build/types/services/tasks/tasks.d.ts +5 -5
  131. package/build/types/services/tasks/types.d.ts +107 -107
  132. package/build/types/services/templates/index.d.ts +3 -3
  133. package/build/types/services/templates/templates.d.ts +5 -5
  134. package/build/types/services/templates/types.d.ts +202 -202
  135. package/build/types/services/types.d.ts +77 -77
  136. package/build/types/services/users/activationRequests/index.d.ts +4 -4
  137. package/build/types/services/users/activationRequests/types.d.ts +70 -70
  138. package/build/types/services/users/forgotPasswordRequests/index.d.ts +4 -4
  139. package/build/types/services/users/forgotPasswordRequests/types.d.ts +70 -70
  140. package/build/types/services/users/globalRoles.d.ts +5 -5
  141. package/build/types/services/users/groupRoles.d.ts +5 -5
  142. package/build/types/services/users/health.d.ts +9 -9
  143. package/build/types/services/users/index.d.ts +16 -16
  144. package/build/types/services/users/settings/index.d.ts +4 -4
  145. package/build/types/services/users/settings/types.d.ts +47 -47
  146. package/build/types/services/users/types.d.ts +1116 -1055
  147. package/build/types/services/users/users.d.ts +5 -5
  148. package/build/types/sha1.d.ts +11 -11
  149. package/build/types/types.d.ts +102 -102
  150. package/build/types/utils.d.ts +4 -4
  151. package/build/types/version.d.ts +1 -1
  152. package/package.json +62 -62
@@ -1,1055 +1,1116 @@
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
- }
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
+ */
369
+ find(options?: OptionsWithRql): Promise<PagedResult<Role>>;
370
+ /**
371
+ * Returns the first role found
372
+ *
373
+ * Permission | Scope | Effect
374
+ * - | - | -
375
+ * `VIEW_ROLE` | `global` | **Required** for this endpoint
376
+ */
377
+ findFirst(options?: OptionsWithRql): Promise<Role>;
378
+ /**
379
+ * Returns the first role with a specific id
380
+ *
381
+ * Permission | Scope | Effect
382
+ * - | - | -
383
+ * `VIEW_ROLE` | `global` | **Required** for this endpoint
384
+ */
385
+ findById(id: ObjectId, options?: OptionsWithRql): Promise<Role>;
386
+ /**
387
+ * Returns the first role with a specific name
388
+ *
389
+ * Permission | Scope | Effect
390
+ * - | - | -
391
+ * `VIEW_ROLE` | `global` | **Required** for this endpoint
392
+ */
393
+ findByName(name: string, options?: OptionsWithRql): Promise<Role>;
394
+ /**
395
+ * @deprecated Use `find` instead
396
+ *
397
+ * Retrieve a list of roles
398
+ *
399
+ * Permission | Scope | Effect
400
+ * - | - | -
401
+ * `VIEW_ROLE` | `global` | **Required** for this endpoint
402
+ * @returns PagedResult<Role>
403
+ */
404
+ get(options?: OptionsWithRql): Promise<PagedResult<Role>>;
405
+ /**
406
+ * Create a role
407
+ *
408
+ * Permission | Scope | Effect
409
+ * - | - | -
410
+ * `CREATE_ROLE` | `global` | **Required** for this endpoint
411
+ * @param requestBody The role data
412
+ * @returns Role
413
+ */
414
+ create(requestBody: RoleCreation, options?: OptionsBase): Promise<Role>;
415
+ /**
416
+ * Delete a role
417
+ *
418
+ * Permission | Scope | Effect
419
+ * - | - | -
420
+ * `DELETE_ROLE` | `global` | **Required** for this endpoint
421
+ * @param rql Add filters to the requested list.
422
+ * @returns AffectedRecords
423
+ * @throws {ResourceUnknownError}
424
+ */
425
+ remove(rql: RQLString, options?: OptionsBase): Promise<AffectedRecords>;
426
+ /**
427
+ * Update a role
428
+ *
429
+ * Permission | Scope | Effect
430
+ * - | - | -
431
+ * `UPDATE_ROLE` | `global` | **Required** for this endpoint
432
+ * @param id Id of the targeted role
433
+ * @param requestBody RoleUpdate
434
+ * @returns Promise<Role>
435
+ */
436
+ update(id: ObjectId, requestBody: RoleUpdate, options?: OptionsBase): Promise<Role>;
437
+ /**
438
+ * Add permissions to a role
439
+ *
440
+ * Permission | Scope | Effect
441
+ * - | - | -
442
+ * `ADD_ROLE_PERMISSION` | `global` | **Required** for this endpoint
443
+ * @param requestBody RolePermissions
444
+ * @returns AffectedRecords
445
+ * @throws {ResourceUnknownError}
446
+ */
447
+ addPermissions(rql: RQLString, requestBody: RolePermissions, options?: OptionsBase): Promise<AffectedRecords>;
448
+ /**
449
+ * Remove permissions from roles
450
+ *
451
+ * Permission | Scope | Effect
452
+ * - | - | -
453
+ * `REMOVE_ROLE_PERMISSION` | `global` | **Required** for this endpoint
454
+ * @param rql Add filters to the requested list.
455
+ * @param requestBody RolePermissions
456
+ * @returns AffectedRecords
457
+ * @throws {ResourceUnknownError}
458
+ */
459
+ removePermissions(rql: RQLString, requestBody: RolePermissions, options?: OptionsBase): Promise<AffectedRecords>;
460
+ /**
461
+ * Add roles to users
462
+ *
463
+ * Permission | Scope | Effect
464
+ * - | - | -
465
+ * `ADD_ROLE_TO_USER` | `global` | **Required** for this endpoint
466
+ * @param requestBody UserRoles
467
+ * @returns AffectedRecords
468
+ */
469
+ addToUsers(rql: RQLString, requestBody: UserRoles, options?: OptionsBase): Promise<AffectedRecords>;
470
+ /**
471
+ * Remove roles from users
472
+ *
473
+ * Permission | Scope | Effect
474
+ * - | - | -
475
+ * `REMOVE_ROLE_FROM_USER` | `global` | **Required** for this endpoint
476
+ * @param rql Add filters to the requested list.
477
+ * @param requestBody UserRoles
478
+ * @returns AffectedRecords
479
+ */
480
+ removeFromUser(rql: RQLString, requestBody: UserRoles, options?: OptionsBase): Promise<AffectedRecords>;
481
+ }
482
+ export interface UsersGroupRolesService {
483
+ /**
484
+ * Retrieve a list of group permissions
485
+ *
486
+ * Permission | Scope | Effect
487
+ * - | - | -
488
+ * none | | Everyone can use this endpoint
489
+ * @returns PagedResult<GlobalPermission>
490
+ */
491
+ getPermissions(options?: OptionsBase): Promise<PagedResult<GlobalPermission>>;
492
+ /**
493
+ * Retrieve a list of group roles
494
+ *
495
+ * Permission | Scope | Effect
496
+ * - | - | -
497
+ * none | `staff enlistment` | View the roles for the group
498
+ * `VIEW_GROUP` | `global` | View any group its roles
499
+ */
500
+ find(groupId: ObjectId, options?: OptionsWithRql): Promise<PagedResult<GroupRole>>;
501
+ /**
502
+ * Returns the first group role found
503
+ *
504
+ * Permission | Scope | Effect
505
+ * - | - | -
506
+ * none | `staff enlistment` | View the roles for the group
507
+ * `VIEW_GROUP` | `global` | View any group its roles
508
+ */
509
+ findFirst(groupId: ObjectId, options?: OptionsWithRql): Promise<GroupRole>;
510
+ /**
511
+ * Finds a group role by its id
512
+ *
513
+ * Permission | Scope | Effect
514
+ * - | - | -
515
+ * none | `staff enlistment` | View the roles for the group
516
+ * `VIEW_GROUP` | `global` | View any group its roles
517
+ */
518
+ findById(groupId: ObjectId, roleId: ObjectId, options?: OptionsWithRql): Promise<GroupRole>;
519
+ /**
520
+ * Returns the first group role found by a specific name
521
+ *
522
+ * Permission | Scope | Effect
523
+ * - | - | -
524
+ * none | `staff enlistment` | View the roles for the group
525
+ * `VIEW_GROUP` | `global` | View any group its roles
526
+ */
527
+ findByName(groupId: ObjectId, roleName: string, options?: OptionsWithRql): Promise<GroupRole>;
528
+ /**
529
+ * @deprecated Use `find` instead
530
+ *
531
+ * Retrieve a list of group roles
532
+ *
533
+ * Permission | Scope | Effect
534
+ * - | - | -
535
+ * none | `staff enlistment` | View the roles for the group
536
+ * `VIEW_GROUP` | `global` | View any group its roles
537
+ * @param groupId Id of the targeted group
538
+ * @returns PagedResult<GroupRole>
539
+ */
540
+ get(groupId: ObjectId, options?: OptionsWithRql): Promise<PagedResult<GroupRole>>;
541
+ /**
542
+ * Add role to a group
543
+ *
544
+ * Permission | Scope | Effect
545
+ * - | - | -
546
+ * `CREATE_GROUP_ROLE` | `staff enlistment` | Create a role for any group
547
+ * `CREATE_GROUP_ROLE` | `global` | Create a role for the group
548
+ * @param groupId Id of the targeted group
549
+ * @param requestBody The role to add
550
+ * @returns GroupRole
551
+ */
552
+ add(groupId: ObjectId, requestBody: AddRole, options?: OptionsBase): Promise<GroupRole>;
553
+ /**
554
+ * Update a group role
555
+ *
556
+ * Permission | Scope | Effect
557
+ * - | - | -
558
+ * `UPDATE_GROUP_ROLE` | `staff enlistment` | Update a role for the group
559
+ * `UPDATE_GROUP_ROLE` | `global` | Update a role for any group
560
+ * @param groupId Id of the targeted group
561
+ * @param roleId Id of the targeted role
562
+ * @param requestBody The role data to update
563
+ * @returns GroupRole
564
+ * @throws {ResourceUnknownError}
565
+ */
566
+ update(groupId: ObjectId, roleId: ObjectId, requestBody: AddRole, options?: OptionsBase): Promise<GroupRole>;
567
+ /**
568
+ * Remove a role from a group
569
+ *
570
+ * Permission | Scope | Effect
571
+ * - | - | -
572
+ * `DELETE_GROUP_ROLE` | `staff enlistment` | Delete a role for the group
573
+ * `DELETE_GROUP_ROLE` | `global` | Delete a role from any group
574
+ * @param rql Add filters to the requested list.
575
+ * @param groupId Id of the targeted group
576
+ * @returns AffectedRecords
577
+ * @throws {ResourceUnknownError}
578
+ */
579
+ remove(rql: RQLString, groupId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
580
+ /**
581
+ * Add permissions to group roles
582
+ *
583
+ * Permission | Scope | Effect
584
+ * - | - | -
585
+ * `ADD_GROUP_ROLE_PERMISSION` | `staff enlistment` | Add permissions to roles of the group
586
+ * `ADD_GROUP_ROLE_PERMISSION` | `global` | Add permissions to roles of any group
587
+ * @param groupId Id of the targeted group
588
+ * @param requestBody GroupRolePermissions
589
+ * @returns AffectedRecords
590
+ * @throws {ResourceUnknownError}
591
+ */
592
+ addPermissions(groupId: ObjectId, requestBody: GroupRolePermissions, options?: OptionsWithRql): Promise<AffectedRecords>;
593
+ /**
594
+ * Remove permissions from group roles
595
+ *
596
+ * Permission | Scope | Effect
597
+ * - | - | -
598
+ * `REMOVE_GROUP_ROLE_PERMISSION` | `staff enlistment` | Remove permissions from roles of the group
599
+ * `REMOVE_GROUP_ROLE_PERMISSION` | `global` | Remove permissions from roles of any group
600
+ * @param rql Add filters to the requested list.
601
+ * @param groupId Id of the targeted group
602
+ * @param requestBody GroupRolePermissions
603
+ * @returns AffectedRecords
604
+ * @throws {ResourceUnknownError}
605
+ */
606
+ removePermissions(rql: RQLString, groupId: ObjectId, requestBody: GroupRolePermissions, options?: OptionsBase): Promise<AffectedRecords>;
607
+ /**
608
+ * Assign roles to staff members of a group
609
+ *
610
+ * Permission | Scope | Effect
611
+ * - | - | -
612
+ * `ADD_GROUP_ROLE_TO_STAFF` | `staff enlistment` | Assign roles for the group
613
+ * `ADD_GROUP_ROLE_TO_STAFF` | `global` | Assign roles for any group
614
+ * @param groupId Id of the targeted group
615
+ * @param requestBody StaffRoles
616
+ * @returns AffectedRecords
617
+ * @throws {ResourceUnknownError}
618
+ */
619
+ assignToStaff(groupId: ObjectId, requestBody: StaffRoles, options?: OptionsWithRql): Promise<AffectedRecords>;
620
+ /**
621
+ * Remove roles from staff members of a group
622
+ *
623
+ * Permission | Scope | Effect
624
+ * - | - | -
625
+ * `REMOVE_GROUP_ROLE_FROM_STAFF` | `staff enlistment` | Remove roles from staff of the group
626
+ * `REMOVE_GROUP_ROLE_FROM_STAFF` | `global` | Remove roles from staff of any group
627
+ * @param rql Add filters to the requested list.
628
+ * @param groupId Id of the targeted group
629
+ * @param requestBody StaffRoles
630
+ * @returns AffectedRecords
631
+ * @throws {ResourceUnknownError}
632
+ */
633
+ removeFromStaff(rql: RQLString, groupId: ObjectId, requestBody: StaffRoles, options?: OptionsBase): Promise<AffectedRecords>;
634
+ /**
635
+ * Add users to staff
636
+ *
637
+ * Permission | Scope | Effect
638
+ * - | - | -
639
+ * `ADD_STAFF` | `staff enlistment` | Add staff to the group
640
+ * `ADD_STAFF` | `global` | Add staff to any group
641
+ * @param requestBody StaffGroups
642
+ * @returns AffectedRecords
643
+ * @throws {ResourceUnknownError}
644
+ */
645
+ addUsersToStaff(requestBody: StaffGroups, options?: OptionsWithRql): Promise<AffectedRecords>;
646
+ /**
647
+ * Remove users from staff
648
+ *
649
+ * Permission | Scope | Effect
650
+ * - | - | -
651
+ * `REMOVE_STAFF` | `staff enlistment` | Remove staff from the group
652
+ * `REMOVE_STAFF` | `global` | Remove staff from any group
653
+ * @param rql Add filters to the requested list.
654
+ * @param requestBody StaffGroups
655
+ * @returns AffectedRecords
656
+ * @throws {ResourceUnknownError}
657
+ */
658
+ removeUsersFromStaff(rql: RQLString, requestBody: StaffGroups, options?: OptionsBase): Promise<AffectedRecords>;
659
+ }
660
+ export interface UsersService {
661
+ /**
662
+ * Retrieve the current logged in user
663
+ *
664
+ * Permission | Scope | Effect
665
+ * - | - | -
666
+ * none | | Everyone can use this endpoint
667
+ * @returns {UserData} UserData
668
+ */
669
+ me(options?: OptionsBase): Promise<User>;
670
+ /**
671
+ * Retrieve a specific user
672
+ * @params {string} userId of the targeted user (required)
673
+ *
674
+ * Permission | Scope | Effect
675
+ * - | - | -
676
+ * none | | See your own user object
677
+ * none | group | See a subset of the fields for any staff member or patient of the group
678
+ * VIEW_PATIENTS | global | See a subset of fields for any user with a patient enlistment
679
+ * VIEW_STAFF | global | See a subset of fields for any user with a staff enlistment
680
+ * VIEW_USER | global | See any user object
681
+ * @throws {ResourceUnknownError}
682
+ * @returns {UserData} UserData
683
+ */
684
+ findById(userId: string, options?: OptionsBase): Promise<User>;
685
+ /**
686
+ * Update a specific user
687
+ * @params {string} userId of the targeted user (required)
688
+ * @params {Pick<UserData,'firstName' | 'lastName' | 'phoneNumber' | 'language' | 'timeZone'>} data Fields to update
689
+ *
690
+ * Permission | Scope | Effect
691
+ * - | - | -
692
+ * none | | Update your own data
693
+ * `UPDATE_USER` | global | Update any user
694
+ * @throws {ResourceUnknownError}
695
+ * @returns {UserData} UserData
696
+ */
697
+ update(userId: string, userData: UserDataUpdate, options?: OptionsBase): Promise<UserData>;
698
+ /**
699
+ * Retrieve a list of users
700
+ *
701
+ * Permission | Scope | Effect
702
+ * - | - | -
703
+ * none | `patient enlistment` | See a limited set of fields of the staff members (of the groups where you are enlisted as a patient)
704
+ * 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)
705
+ * `VIEW_USER` | `global` | See all fields of all users
706
+ * @returns PagedResultWithPager<User>
707
+ */
708
+ find(options?: OptionsWithRql): Promise<PagedResultWithPager<User>>;
709
+ /**
710
+ * Request a list of all users
711
+ *
712
+ * Do not pass in an rql with limit operator!
713
+ *
714
+ * Permission | Scope | Effect
715
+ * - | - | -
716
+ * none | `patient enlistment` | See a limited set of fields of the staff members (of the groups where you are enlisted as a patient)
717
+ * 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)
718
+ * `VIEW_USER` | `global` | See all fields of all users
719
+ * @returns User[]
720
+ */
721
+ findAll(options?: OptionsWithRql): Promise<User[]>;
722
+ /**
723
+ * Request a list of all users
724
+ *
725
+ * Permission | Scope | Effect
726
+ * - | - | -
727
+ * none | `patient enlistment` | See a limited set of fields of the staff members (of the groups where you are enlisted as a patient)
728
+ * 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)
729
+ * `VIEW_USER` | `global` | See all fields of all users
730
+ * @returns User[]
731
+ */
732
+ findAllIterator(options?: OptionsWithRql): FindAllIterator<User>;
733
+ findFirst(options?: {
734
+ rql?: RQLString;
735
+ }): Promise<User>;
736
+ /**
737
+ * @deprecated
738
+ * Delete a list of users
739
+ *
740
+ * Permission | Scope | Effect
741
+ * - | - | -
742
+ * none | | Delete your own user (object)
743
+ * `DELETE_USER` | `global` | Delete any user
744
+ * @param rql Add filters to the requested list.
745
+ * @returns AffectedRecords
746
+ */
747
+ removeUsers(rql: RQLString, options?: OptionsBase): Promise<AffectedRecords>;
748
+ /**
749
+ * Retrieve a list of users that have a patient enlistment
750
+ *
751
+ * Permission | Scope | Effect
752
+ * - | - | -
753
+ * none | `staff enlistment` | View the patients of the group
754
+ * `VIEW_PATIENTS` | `global` | View all patients
755
+ * @returns Patient Success
756
+ */
757
+ patients(options?: OptionsWithRql): Promise<PagedResult<Patient>>;
758
+ /**
759
+ * Retrieve a list of users that have a staff enlistment
760
+ *
761
+ * Permission | Scope | Effect
762
+ * - | - | -
763
+ * none | `staff enlistment` | View the other staff members of the group
764
+ * `VIEW_STAFF` | `global` | View all staff members
765
+ * @returns StaffMember Success
766
+ */
767
+ staff(options?: OptionsWithRql): Promise<PagedResult<StaffMember>>;
768
+ /**
769
+ * Delete a specific user
770
+ *
771
+ * Permission | Scope | Effect
772
+ * - | - | -
773
+ * none | | Delete your own user object
774
+ * `DELETE_USER` | `global` | Delete any user
775
+ * @param userId Id of the targeted user
776
+ * @returns AffectedRecords
777
+ * @throws {ResourceUnknownError}
778
+ */
779
+ remove(userId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
780
+ /**
781
+ * Update the email address of a specific user.
782
+ *
783
+ * An email is send to the new email address with a token and instructions to reactivate the account.
784
+ * The token should be used to complete the account activation via `exh.users.validateEmailActivation`.
785
+ *
786
+ * By default the email send to the user is the email template configured by `reactivationEmailTemplateId`.
787
+ * The template receives a 40 hexadecimal character hash in the `content.activation_hash` variable.
788
+ * The hash should be used within 60 minutes, otherwise `exh.users.requestEmailActivation` should be used to request a new email.
789
+ *
790
+ * If enabled, a pin code can be used rather than a hash.
791
+ * The pin code mode must be enabled by the `enablePinCodeActivationRequests` verification setting.
792
+ * To use the pin code mode, the `activationMode` field can be set to `pin_code`.
793
+ * Then the email send to the user is the email template configured by `reactivationPinEmailTemplateId`.
794
+ * The pin code template receives a 8 digit pin code in the `content.pin_code` variable.
795
+ * The pin code should be used within 15 minutes, otherwise `exh.users.requestEmailActivation` should be used to request a new email.
796
+ *
797
+ * If a custom (or no) account activation flow is desired, the `activationMode` field can be set to `manual`.
798
+ * No email will be send.
799
+ *
800
+ * Permission | Scope | Effect
801
+ * - | - | -
802
+ * none | | Update your own data
803
+ * `UPDATE_USER_EMAIL` | `global` | Update any user
804
+ *
805
+ * @throws {EmailUsedError}
806
+ * @throws {ResourceUnknownError}
807
+ * @throws {PinCodesNotEnabledError} Pin codes are not enabled, please check the verification settings
808
+ */
809
+ updateEmail(userId: ObjectId, requestBody: EmailUpdate, options?: OptionsBase): Promise<User>;
810
+ /**
811
+ * Add a patient enlistment to a user
812
+ *
813
+ * Permission | Scope | Effect
814
+ * - | - | -
815
+ * `ADD_PATIENT` | `global` | **Required** for this endpoint
816
+ * @param userId Id of the targeted user
817
+ * @param requestBody AddPatientEnlistment
818
+ * @returns AffectedRecords
819
+ * @throws {ResourceAlreadyExistsError}
820
+ */
821
+ addPatientEnlistment(userId: ObjectId, requestBody: AddPatientEnlistment, options?: OptionsBase): Promise<AffectedRecords>;
822
+ /**
823
+ * Remove a patient enlistment from a user
824
+ *
825
+ * Permission | Scope | Effect
826
+ * - | - | -
827
+ * none | | Remove a patient enlistment from yourself
828
+ * `REMOVE_PATIENT` | `staff enlistment` | Remove a patient enlistment for the group
829
+ * `REMOVE_PATIENT` | `global` | Remove any patient enlistment
830
+ * @param userId Id of the targeted user
831
+ * @param groupId Id of the targeted group
832
+ * @returns AffectedRecords
833
+ * @throws {ResourceUnknownError}
834
+ */
835
+ removePatientEnlistment(userId: ObjectId, groupId: ObjectId, options?: OptionsBase): Promise<AffectedRecords>;
836
+ /**
837
+ * Create an account.
838
+ *
839
+ * An email is send to the supplied email address with a token and instructions to activate the account.
840
+ * The token should be used to complete the account activation via `exh.users.validateEmailActivation`.
841
+ *
842
+ * By default the email send to the user is the email template configured by `activationEmailTemplateId`.
843
+ * The template receives a 40 hexadecimal character hash in the `content.activation_hash` variable.
844
+ * The hash should be used within 60 minutes, otherwise `exh.users.requestEmailActivation` should be used to request a new email.
845
+ *
846
+ * If enabled, a pin code can be used rather than a hash.
847
+ * The pin code mode must be enabled by the `enablePinCodeActivationRequests` verification setting.
848
+ * To use the pin code mode, the `activationMode` field can be set to `pin_code`.
849
+ * Then the email send to the user is the email template configured by `activationPinEmailTemplateId`.
850
+ * The pin code template receives a 8 digit pin code in the `content.pin_code` variable.
851
+ * The pin code should be used within 15 minutes, otherwise `exh.users.requestEmailActivation` should be used to request a new email.
852
+ *
853
+ * If a custom (or no) account activation flow is desired, the `activationMode` field can be set to `manual`.
854
+ * No email will be send.
855
+ *
856
+ * Permission | Scope | Effect
857
+ * - | - | -
858
+ * none | | Everyone can use this endpoint
859
+ *
860
+ * @throws {EmailUsedError}
861
+ * @throws {PinCodesNotEnabledError} Pin codes are not enabled, please check the verification settings
862
+ */
863
+ createAccount(requestBody: RegisterUserData, options?: OptionsBase): Promise<User>;
864
+ /**
865
+ * Change your password
866
+ *
867
+ * Permission | Scope | Effect
868
+ * - | - | -
869
+ * none | | Everyone can use this endpoint
870
+ * @param requestBody ChangePassword
871
+ * @returns User
872
+ * @throws {PasswordError}
873
+ */
874
+ changePassword(requestBody: ChangePassword, options?: OptionsBase): Promise<boolean>;
875
+ /**
876
+ * Authenticate a user
877
+ *
878
+ * Permission | Scope | Effect
879
+ * - | - | -
880
+ * none | | Everyone can use this endpoint
881
+ * @param requestBody Authenticate
882
+ * @returns User
883
+ * @throws {AuthenticationError}
884
+ * @throws {LoginTimeoutError}
885
+ * @throws {LoginFreezeError}
886
+ * @throws {TooManyFailedAttemptsError}
887
+ */
888
+ authenticate(requestBody: Authenticate, options?: OptionsBase): Promise<User>;
889
+ /**
890
+ * Request an email activation.
891
+ *
892
+ * An email is send to the supplied email address with a token and instructions to activate the account.
893
+ * The token should be used to complete the account activation via `exh.users.validateEmailActivation`.
894
+ *
895
+ * The email send to the user is the email template configured by `activationEmailTemplateId`.
896
+ * The template receives a 40 hexadecimal character hash in the `content.activation_hash` variable.
897
+ * The hash should be used within 60 minutes, otherwise this method should be called again to request a new email.
898
+ *
899
+ * Permission | Scope | Effect
900
+ * - | - | -
901
+ * none | | Everyone can use this endpoint
902
+ *
903
+ * @throws {EmailUnknownError}
904
+ * @throws {AlreadyActivatedError}
905
+ * @throws {IllegalStateError} Attempting to use `activationEmailTemplateId` while not configured. See `exh.users.setEmailTemplates`.
906
+ * @throws {ActivationRequestLimitError} The maximum allowed consecutive activation requests is reached
907
+ * @throws {ActivationRequestTimeoutError} Activation request too short after the previous one
908
+ */
909
+ requestEmailActivation(email: string, options?: OptionsBase): Promise<boolean>;
910
+ /**
911
+ * Request an email activation.
912
+ *
913
+ * An email is send to the supplied email address with a token and instructions to activate the account.
914
+ * The token should be used to complete the account activation via `exh.users.validateEmailActivation`.
915
+ *
916
+ * By default the email send to the user is the email template configured by `activationEmailTemplateId`.
917
+ * The template receives a 40 hexadecimal character hash in the `content.activation_hash` variable.
918
+ * The hash should be used within 60 minutes, otherwise this method should be called again to request a new email.
919
+ *
920
+ * If enabled, a pin code can be used rather than a hash.
921
+ * The pin code mode must be enabled by the `enablePinCodeActivationRequests` verification setting.
922
+ * To use the pin code mode, the `activationMode` field can be set to `pin_code`.
923
+ * Then the email send to the user is the email template configured by `activationPinEmailTemplateId`.
924
+ * The pin code template receives a 8 digit pin code in the `content.pin_code` variable.
925
+ * The pin code should be used within 15 minutes, otherwise this method should be called again to request a new email.
926
+ *
927
+ * Permission | Scope | Effect
928
+ * - | - | -
929
+ * none | | Everyone can use this endpoint
930
+ *
931
+ * @throws {EmailUnknownError}
932
+ * @throws {AlreadyActivatedError}
933
+ * @throws {IllegalStateError} Attempting to use either `activationEmailTemplateId` or `activationPinEmailTemplateId` while not configured. See `exh.users.setEmailTemplates`.
934
+ * @throws {ActivationRequestLimitError} The maximum allowed consecutive activation requests is reached
935
+ * @throws {ActivationRequestTimeoutError} Activation request too short after the previous one
936
+ */
937
+ requestEmailActivation(data: ActivationRequestData, options?: OptionsBase): Promise<boolean>;
938
+ /**
939
+ * Complete an email activation.
940
+ *
941
+ * Either a hash activation with just the `hash` field.
942
+ * Or a pin code activation with the `email` and `pinCode` fields.
943
+ *
944
+ * Permission | Scope | Effect
945
+ * - | - | -
946
+ * none | | Everyone can use this endpoint
947
+ *
948
+ * @throws {ActivationUnknownError}
949
+ * @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
950
+ * @throws {IncorrectPinCodeError} The provided pin code was incorrect
951
+ */
952
+ validateEmailActivation(requestBody: ActivationCompletion, options?: OptionsBase): Promise<boolean>;
953
+ /**
954
+ * Request a password reset.
955
+ *
956
+ * An email is send to the targeted user with a token and instructions to reset their password.
957
+ * The token should be used to complete the password reset via `exh.users.validatePasswordReset`.
958
+ *
959
+ * The email send to the user is the email template configured by `passwordResetEmailTemplateId`.
960
+ * The template receives a 40 hexadecimal character hash in the `content.reset_hash` variable.
961
+ * The hash should be used within 60 minutes, otherwise this method should be called again to request a new email.
962
+ *
963
+ * Permission | Scope | Effect
964
+ * - | - | -
965
+ * none | | Everyone can use this endpoint
966
+ *
967
+ * @throws {EmailUnknownError}
968
+ * @throws {NotActivatedError}
969
+ * @throws {IllegalStateError} Attempting to use either `passwordResetEmailTemplateId` or `passwordResetPinEmailTemplateId` while not configured. See `exh.users.setEmailTemplates`.
970
+ * @throws {ForgotPasswordRequestLimitError} The maximum allowed consecutive forgot password requests is reached
971
+ * @throws {ForgotPasswordRequestTimeoutError} Forgot password request too short after the previous one
972
+ */
973
+ requestPasswordReset(email: string, options?: OptionsBase): Promise<boolean>;
974
+ /**
975
+ * Request a password reset.
976
+ *
977
+ * An email is send to the targeted user with a token and instructions to reset their password.
978
+ * The token should be used to complete the password reset via `exh.users.validatePasswordReset`.
979
+ *
980
+ * By default the email send to the user is the email template configured by `passwordResetEmailTemplateId`.
981
+ * The template receives a 40 hexadecimal character hash in the `content.reset_hash` variable.
982
+ * The hash should be used within 60 minutes, otherwise this method should be called again to request a new email.
983
+ *
984
+ * If enabled, a pin code can be used rather than a hash.
985
+ * The pin code mode must be enabled by the `enablePinCodeForgotPasswordRequests` verification setting.
986
+ * To use the pin code mode, the `mode` field can be set to `pin_code`.
987
+ * Then the email send to the user is the email template configured by `passwordResetPinEmailTemplateId`.
988
+ * The pin code template receives a 8 digit pin code in the `content.pin_code` variable.
989
+ * The pin code should be used within 15 minutes, otherwise this method should be called again to request a new email.
990
+ *
991
+ * Permission | Scope | Effect
992
+ * - | - | -
993
+ * none | | Everyone can use this endpoint
994
+ *
995
+ * @throws {EmailUnknownError}
996
+ * @throws {NotActivatedError}
997
+ * @throws {IllegalStateError} Attempting to use either `passwordResetEmailTemplateId` or `passwordResetPinEmailTemplateId` while not configured. See `exh.users.setEmailTemplates`.
998
+ * @throws {DisabledForOidcUsersError}
999
+ * @throws {PinCodesNotEnabledError} Pin codes are not enabled, please check the verification settings
1000
+ * @throws {ForgotPasswordRequestLimitError} The maximum allowed consecutive forgot password requests is reached
1001
+ * @throws {ForgotPasswordRequestTimeoutError} Forgot password request too short after the previous one
1002
+ */
1003
+ requestPasswordReset(data: PasswordResetRequestData, options?: OptionsBase): Promise<boolean>;
1004
+ /**
1005
+ * Complete a password reset.
1006
+ *
1007
+ * Either a hash password reset with the `hash` and `newPassword` fields.
1008
+ * Or a pin code password reset with the `email`, `pinCode` and `newPassword` fields.
1009
+ *
1010
+ * Permission | Scope | Effect
1011
+ * - | - | -
1012
+ * none | | Everyone can use this endpoint
1013
+ *
1014
+ * @throws {NotActivatedError}
1015
+ * @throws {NewPasswordHashUnknownError} The provided hash either does not exist or is expired
1016
+ * @throws {NewPasswordPinCodeUnknownError} No password reset request was found or it is expired for the provided email
1017
+ * @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
1018
+ * @throws {IncorrectPinCodeError} The provided pin code was incorrect
1019
+ * @throws {DisabledForOidcUsersError}
1020
+ */
1021
+ validatePasswordReset(requestBody: PasswordResetCompletion, options?: OptionsBase): Promise<boolean>;
1022
+ /**
1023
+ * Confirm the password for the user making the request
1024
+ *
1025
+ * Permission | Scope | Effect
1026
+ * - | - | -
1027
+ * none | | Everyone can use this endpoint
1028
+ * @param requestBody the password to confirm
1029
+ * @returns {boolean} true if password was confirmed
1030
+ * @throws {AuthenticationError}
1031
+ * @throws {LoginTimeoutError}
1032
+ * @throws {LoginFreezeError}
1033
+ * @throws {TooManyFailedAttemptsError}
1034
+ */
1035
+ confirmPassword(requestBody: ConfirmPassword, options?: OptionsBase): Promise<boolean>;
1036
+ /**
1037
+ * Check if an email address is still available
1038
+ *
1039
+ * Permission | Scope | Effect
1040
+ * - | - | -
1041
+ * none | | Everyone can use this endpoint
1042
+ * @param email
1043
+ * @returns emailAvailable will be true on success
1044
+ */
1045
+ isEmailAvailable(email: string, options?: OptionsBase): Promise<{
1046
+ emailAvailable: boolean;
1047
+ }>;
1048
+ /**
1049
+ * Update the profile image of a user
1050
+ *
1051
+ * Permission | Scope | Effect
1052
+ * - | - | -
1053
+ * none | | Update your own profile image
1054
+ * `UPDATE_PROFILE_IMAGE` | `global` | Update any user its profile image
1055
+ * @deprecated this method is deprecated in swagger
1056
+ * @param userId Id of the targeted user
1057
+ * @param requestBody Hash
1058
+ * @returns User
1059
+ * @throws {ResourceUnknownError}
1060
+ */
1061
+ updateProfileImage(userId: ObjectId, requestBody: Hash, options?: OptionsBase): Promise<User>;
1062
+ /**
1063
+ * Delete the profile image of a user
1064
+ *
1065
+ * Permission | Scope | Effect
1066
+ * - | - | -
1067
+ * none | | Delete your own profile image
1068
+ * `UPDATE_PROFILE_IMAGE` | `global` | Delete any user its profile image
1069
+ * @param userId Id of the targeted user
1070
+ * @returns User
1071
+ * @throws {ResourceUnknownError}
1072
+ */
1073
+ deleteProfileImage(userId: ObjectId, options?: OptionsBase): Promise<User>;
1074
+ /**
1075
+ * Retrieve the current pasword policy
1076
+ *
1077
+ * Permission | Scope | Effect
1078
+ * - | - | -
1079
+ * none | | Everyone can use this endpoint
1080
+ * @returns {PasswordPolicy} PasswordPolicy
1081
+ */
1082
+ passwordPolicy(options?: OptionsBase): Promise<PasswordPolicy>;
1083
+ /**
1084
+ * Update the current pasword policy
1085
+ *
1086
+ * Permission | Scope | Effect
1087
+ * - | - | -
1088
+ * `UPDATE_PASSWORD_POLICY` | `global` | Update password policy
1089
+ * @returns {PasswordPolicy} PasswordPolicy
1090
+ */
1091
+ updatePasswordPolicy(requestBody: PasswordPolicy, options?: OptionsBase): Promise<PasswordPolicy>;
1092
+ /**
1093
+ * ## Retrieve a list of email templates
1094
+ *
1095
+ * **Global Permissions:**
1096
+ * - `VIEW_USER_SERVICE_EMAIL_TEMPLATES` - Allows a user to view the email templates configuration
1097
+ *
1098
+ * **Notes:**
1099
+ * - If an email template has not been set, it will not appear in the response
1100
+ * @param options {@link OptionsBase} - Add options to the request
1101
+ * @returns A list of email templates {@link EmailTemplates}
1102
+ */
1103
+ getEmailTemplates(options?: OptionsBase): Promise<EmailTemplates>;
1104
+ /**
1105
+ * ## Set the list of email templates
1106
+ *
1107
+ * **Global Permissions:**
1108
+ * - `UPDATE_USER_SERVICE_EMAIL_TEMPLATES` - Allows a user to update the email templates configuration
1109
+ *
1110
+ * **Notes:**
1111
+ * - This operation works as an update and will only update the templates that are provided
1112
+ * @param templates {@link EmailTemplatesUpdate} - A partial list of email templates to update
1113
+ * @returns A list of email templates {@link EmailTemplates}
1114
+ */
1115
+ setEmailTemplates(templates: Partial<EmailTemplates>): Promise<EmailTemplates>;
1116
+ }