@medrunner/api-client 0.3.7 → 0.3.8
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.
- package/dist/index.d.mts +362 -1
- package/dist/index.d.ts +362 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.d.mts
CHANGED
|
@@ -16,9 +16,21 @@ interface DbItem {
|
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
interface ApiToken extends DbItem {
|
|
19
|
+
/**
|
|
20
|
+
* The user who created the token
|
|
21
|
+
* */
|
|
19
22
|
userId: string;
|
|
23
|
+
/**
|
|
24
|
+
* Human-readable name for the token, assigned by the user
|
|
25
|
+
* */
|
|
20
26
|
name: string;
|
|
27
|
+
/**
|
|
28
|
+
* The timestamp at which the token will expire in Unix seconds
|
|
29
|
+
* */
|
|
21
30
|
expirationDate?: number;
|
|
31
|
+
/**
|
|
32
|
+
* When the token was last used to generate a new access token, iso-8601 timestamp
|
|
33
|
+
* */
|
|
22
34
|
lastUsed?: string;
|
|
23
35
|
}
|
|
24
36
|
|
|
@@ -36,10 +48,28 @@ interface TokenGrant {
|
|
|
36
48
|
refreshTokenExpiration?: string;
|
|
37
49
|
}
|
|
38
50
|
|
|
51
|
+
/**
|
|
52
|
+
* Configuration for the Medrunner API.
|
|
53
|
+
* */
|
|
39
54
|
interface ApiConfig {
|
|
55
|
+
/**
|
|
56
|
+
* The base URL of the API - defaults to https://api.medrunner.space
|
|
57
|
+
* */
|
|
40
58
|
baseUrl?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Your API token retrieved after logging in. If none is provided, the refresh token will be used to retrieve an
|
|
61
|
+
* access token.
|
|
62
|
+
* */
|
|
41
63
|
accessToken?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Your refresh token, used to obtain new API tokens. If none is provided, authenticated requests will not be possible
|
|
66
|
+
* when the {@link accessToken} expires. If no access token is provided either, only unauthenticated requests are
|
|
67
|
+
* possible.
|
|
68
|
+
* */
|
|
42
69
|
refreshToken?: string;
|
|
70
|
+
/**
|
|
71
|
+
* Use cookie base auth instead of tokens - defaults to false
|
|
72
|
+
* */
|
|
43
73
|
cookieAuth?: boolean;
|
|
44
74
|
}
|
|
45
75
|
|
|
@@ -88,48 +118,156 @@ declare abstract class ApiEndpoint {
|
|
|
88
118
|
private makeRequest;
|
|
89
119
|
}
|
|
90
120
|
|
|
121
|
+
/**
|
|
122
|
+
* Request body for creating an api token.
|
|
123
|
+
* */
|
|
91
124
|
interface CreateApiTokenRequest {
|
|
125
|
+
/**
|
|
126
|
+
* Human-readable name for the token
|
|
127
|
+
* */
|
|
92
128
|
name: string;
|
|
129
|
+
/**
|
|
130
|
+
* Optional expiration date for the token
|
|
131
|
+
* */
|
|
93
132
|
expirationDate?: Date;
|
|
94
133
|
}
|
|
95
134
|
|
|
135
|
+
/**
|
|
136
|
+
* Request body for sign-out.
|
|
137
|
+
* */
|
|
96
138
|
interface SignOutRequest {
|
|
139
|
+
/**
|
|
140
|
+
* The refresh token to be invalidated
|
|
141
|
+
* */
|
|
97
142
|
refreshToken: string;
|
|
98
143
|
}
|
|
99
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Endpoints for interacting with auth.
|
|
147
|
+
* */
|
|
100
148
|
declare class AuthEndpoint extends ApiEndpoint {
|
|
101
149
|
constructor(config: DefaultApiConfig, tokenManager: TokenManager, log?: Logger, headerProvider?: HeaderProvider);
|
|
102
150
|
protected endpoint(): string;
|
|
151
|
+
/**
|
|
152
|
+
* Invalidate a refresh token.
|
|
153
|
+
*
|
|
154
|
+
* @param oldToken - Token to be invalidated
|
|
155
|
+
*
|
|
156
|
+
* */
|
|
103
157
|
signOut(oldToken?: SignOutRequest): Promise<ApiResponse>;
|
|
158
|
+
/**
|
|
159
|
+
* Gets all api tokens for the user.
|
|
160
|
+
*
|
|
161
|
+
* */
|
|
104
162
|
getApiTokens(): Promise<ApiResponse<ApiToken[]>>;
|
|
163
|
+
/**
|
|
164
|
+
* Creates an api token.
|
|
165
|
+
*
|
|
166
|
+
* @param newToken - Emergency details for the new emergency
|
|
167
|
+
* @returns The newly-created api token
|
|
168
|
+
*
|
|
169
|
+
* */
|
|
105
170
|
createApiToken(newToken: CreateApiTokenRequest): Promise<ApiResponse<string>>;
|
|
171
|
+
/**
|
|
172
|
+
* Delete an api token.
|
|
173
|
+
*
|
|
174
|
+
* @param id - The id of the api token to delete
|
|
175
|
+
*
|
|
176
|
+
* */
|
|
106
177
|
deleteApiToken(id: string): Promise<ApiResponse>;
|
|
107
178
|
}
|
|
108
179
|
|
|
109
180
|
interface ChatMessage extends DbItem {
|
|
181
|
+
/**
|
|
182
|
+
* The emergency associated with the chat message
|
|
183
|
+
* */
|
|
110
184
|
emergencyId: string;
|
|
185
|
+
/**
|
|
186
|
+
* The user id of the message sender
|
|
187
|
+
* */
|
|
111
188
|
senderId: string;
|
|
189
|
+
/**
|
|
190
|
+
* The timestamp at which the message was sent in Unix seconds
|
|
191
|
+
* */
|
|
112
192
|
messageSentTimestamp: number;
|
|
193
|
+
/**
|
|
194
|
+
* The contents of the message
|
|
195
|
+
* */
|
|
113
196
|
contents: string;
|
|
197
|
+
/**
|
|
198
|
+
* Whether the message has been edited
|
|
199
|
+
* */
|
|
114
200
|
edited: boolean;
|
|
115
201
|
}
|
|
116
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Response data which is paginated and includes the data and a token to get the next page.
|
|
205
|
+
* */
|
|
117
206
|
interface PaginatedResponse<T = unknown> {
|
|
207
|
+
/**
|
|
208
|
+
* The page of data returned by the request
|
|
209
|
+
* */
|
|
118
210
|
data: T[];
|
|
211
|
+
/**
|
|
212
|
+
* The pagination token to get the next page of data in a subsequent request
|
|
213
|
+
* */
|
|
119
214
|
paginationToken?: string;
|
|
120
215
|
}
|
|
121
216
|
|
|
217
|
+
/**
|
|
218
|
+
* Request body for creating a new chat message.
|
|
219
|
+
* */
|
|
122
220
|
interface ChatMessageRequest {
|
|
221
|
+
/**
|
|
222
|
+
* The id of the emergency associated with the message
|
|
223
|
+
* */
|
|
123
224
|
emergencyId: string;
|
|
225
|
+
/**
|
|
226
|
+
* The message contents
|
|
227
|
+
* */
|
|
124
228
|
contents: string;
|
|
125
229
|
}
|
|
126
230
|
|
|
231
|
+
/**
|
|
232
|
+
* Endpoints for interacting with chat messages.
|
|
233
|
+
* */
|
|
127
234
|
declare class ChatMessageEndpoint extends ApiEndpoint {
|
|
128
235
|
constructor(config: DefaultApiConfig, tokenManager: TokenManager, log?: Logger, headerProvider?: HeaderProvider);
|
|
129
236
|
protected endpoint(): string;
|
|
237
|
+
/**
|
|
238
|
+
* Gets the specified amount of chat messages for a given emergency.
|
|
239
|
+
*
|
|
240
|
+
* @deprecated Use {@link getMessageHistory} instead
|
|
241
|
+
*
|
|
242
|
+
* @param emergencyId - The emergency for which to fetch the chat history
|
|
243
|
+
* @param limit - The number of emergencies to get
|
|
244
|
+
* @param paginationToken - The number to use for pagination
|
|
245
|
+
* */
|
|
130
246
|
getHistory(emergencyId: string, limit: number, paginationToken?: string): Promise<ApiResponse<PaginatedResponse<ChatMessage>>>;
|
|
247
|
+
/**
|
|
248
|
+
* Gets the specified amount of chat messages for a given emergency.
|
|
249
|
+
*
|
|
250
|
+
* @param emergencyId - The emergency for which to fetch the chat history
|
|
251
|
+
* @param limit - The number of emergencies to get
|
|
252
|
+
* @param paginationToken - The number to use for pagination
|
|
253
|
+
* */
|
|
131
254
|
getMessageHistory(emergencyId: string, limit: number, paginationToken?: string): Promise<ApiResponse<PaginatedResponse<ChatMessage>>>;
|
|
255
|
+
/**
|
|
256
|
+
* Sends a new chat message
|
|
257
|
+
*
|
|
258
|
+
* @param message - The message to send
|
|
259
|
+
* @returns The newly-created chat message
|
|
260
|
+
*
|
|
261
|
+
* */
|
|
132
262
|
sendMessage(message: ChatMessageRequest): Promise<ApiResponse<ChatMessage>>;
|
|
263
|
+
/**
|
|
264
|
+
* Update a chat message
|
|
265
|
+
*
|
|
266
|
+
* @param id - The id of the message to update
|
|
267
|
+
* @param contents - The new content of the message
|
|
268
|
+
* @returns The updated chat message
|
|
269
|
+
*
|
|
270
|
+
* */
|
|
133
271
|
updateMessage(id: string, contents: string): Promise<ApiResponse<ChatMessage>>;
|
|
134
272
|
}
|
|
135
273
|
|
|
@@ -162,6 +300,9 @@ interface Person extends WritableDbItem {
|
|
|
162
300
|
deactivationReason: AccountDeactivationReason;
|
|
163
301
|
clientStats: ClientStats;
|
|
164
302
|
activeEmergency?: string;
|
|
303
|
+
/**
|
|
304
|
+
* @deprecated Use {@link Person.clientPortalPreferencesBlob} instead.
|
|
305
|
+
*/
|
|
165
306
|
clientPortalPreferences: Record<string, unknown>;
|
|
166
307
|
clientPortalPreferencesBlob?: string;
|
|
167
308
|
redeemedCodes: RedeemedCode[];
|
|
@@ -200,21 +341,67 @@ declare enum CodeType {
|
|
|
200
341
|
CitizenCon2954 = 1
|
|
201
342
|
}
|
|
202
343
|
|
|
344
|
+
/**
|
|
345
|
+
* Endpoints for interacting with clients.
|
|
346
|
+
* */
|
|
203
347
|
declare class ClientEndpoint extends ApiEndpoint {
|
|
204
348
|
constructor(config: DefaultApiConfig, tokenManager: TokenManager, log?: Logger, headerProvider?: HeaderProvider);
|
|
205
349
|
protected endpoint(): string;
|
|
350
|
+
/**
|
|
351
|
+
* Gets the current client.
|
|
352
|
+
* */
|
|
206
353
|
get(): Promise<ApiResponse<Person>>;
|
|
354
|
+
/**
|
|
355
|
+
* Gets the specified amount of emergencies the client has created.
|
|
356
|
+
* @param limit - The number of emergencies to get
|
|
357
|
+
* @param paginationToken - The number to use for pagination
|
|
358
|
+
* */
|
|
207
359
|
getHistory(limit: number, paginationToken?: string): Promise<ApiResponse<PaginatedResponse<ClientHistory>>>;
|
|
360
|
+
/**
|
|
361
|
+
* Gets the blocklist status of the current client.
|
|
362
|
+
* */
|
|
208
363
|
getBlockedStatus(): Promise<ApiResponse<BlockedStatus>>;
|
|
209
|
-
|
|
364
|
+
/**
|
|
365
|
+
* Links the current user to a rsiHandle.
|
|
366
|
+
*
|
|
367
|
+
* @param rsiHandle - The RSI handle of the client
|
|
368
|
+
* @returns The updated Person object of the client
|
|
369
|
+
*
|
|
370
|
+
* */
|
|
371
|
+
linkClient(rsiHandle: string): Promise<ApiResponse<Person>>;
|
|
372
|
+
/**
|
|
373
|
+
* Updates the settings of the current user for the Client Portal.
|
|
374
|
+
*
|
|
375
|
+
* @deprecated Use {@link setUserSettings} instead
|
|
376
|
+
* @param settings - The stringfied new object settings that will replace the old one
|
|
377
|
+
* @returns The updated settings object
|
|
378
|
+
*
|
|
379
|
+
* */
|
|
210
380
|
setSettings(settings: Record<string, unknown>): Promise<ApiResponse<Record<string, unknown>>>;
|
|
381
|
+
/**
|
|
382
|
+
* Updates the settings of the current user for the Client Portal.
|
|
383
|
+
*
|
|
384
|
+
* @param settings - The object settings to add or update
|
|
385
|
+
*
|
|
386
|
+
* */
|
|
211
387
|
setUserSettings(settings: string): Promise<ApiResponse>;
|
|
388
|
+
/**
|
|
389
|
+
* Deactivate the current client.
|
|
390
|
+
* */
|
|
212
391
|
deactivate(): Promise<ApiResponse>;
|
|
213
392
|
}
|
|
214
393
|
|
|
394
|
+
/**
|
|
395
|
+
* Endpoints for interacting with promotional codes.
|
|
396
|
+
* */
|
|
215
397
|
declare class CodeEndpoint extends ApiEndpoint {
|
|
216
398
|
constructor(config: DefaultApiConfig, tokenManager: TokenManager, log?: Logger, headerProvider?: HeaderProvider);
|
|
217
399
|
protected endpoint(): string;
|
|
400
|
+
/**
|
|
401
|
+
* Redeems the specified promotional code for the current user
|
|
402
|
+
*
|
|
403
|
+
* @param code - The code to redeem.
|
|
404
|
+
* */
|
|
218
405
|
redeem(code: string): Promise<ApiResponse>;
|
|
219
406
|
}
|
|
220
407
|
|
|
@@ -297,6 +484,9 @@ interface Emergency extends WritableDbItem {
|
|
|
297
484
|
clientMessage?: MessageCache;
|
|
298
485
|
coordinationThread?: MessageCache;
|
|
299
486
|
afterActionReportMessage?: MessageCache;
|
|
487
|
+
/**
|
|
488
|
+
* @deprecated Will be removed in a future update.
|
|
489
|
+
*/
|
|
300
490
|
interactionMessageId?: string;
|
|
301
491
|
respondingTeam: Team;
|
|
302
492
|
respondingTeams: RespondingTeam[];
|
|
@@ -363,27 +553,87 @@ interface RespondingTeam {
|
|
|
363
553
|
teamName: string;
|
|
364
554
|
}
|
|
365
555
|
|
|
556
|
+
/**
|
|
557
|
+
* Request body for creating a new emergency.
|
|
558
|
+
* */
|
|
366
559
|
interface CreateEmergencyRequest {
|
|
560
|
+
/**
|
|
561
|
+
* Additional details or remarks to include
|
|
562
|
+
* */
|
|
367
563
|
remarks?: string;
|
|
564
|
+
/**
|
|
565
|
+
* The location of the emergency
|
|
566
|
+
* */
|
|
368
567
|
location: Location;
|
|
568
|
+
/**
|
|
569
|
+
* The threat level of the emergency
|
|
570
|
+
*
|
|
571
|
+
* @remarks
|
|
572
|
+
* This will be removed in the future.
|
|
573
|
+
* */
|
|
369
574
|
threatLevel: ThreatLevel;
|
|
575
|
+
/**
|
|
576
|
+
* The rsiHandle of the client
|
|
577
|
+
*
|
|
578
|
+
* @remarks
|
|
579
|
+
* This is optional, if the client already has an RSI handle set on his profile, this will be ignored.
|
|
580
|
+
* */
|
|
370
581
|
rsiHandle?: string;
|
|
371
582
|
}
|
|
583
|
+
/**
|
|
584
|
+
* Only real matching locations will be accepted (see /emergency/meta/locations).
|
|
585
|
+
* */
|
|
372
586
|
interface Location {
|
|
587
|
+
/**
|
|
588
|
+
* The star system the emergency is located in
|
|
589
|
+
* */
|
|
373
590
|
system: string;
|
|
591
|
+
/**
|
|
592
|
+
* The nearest planetary body to the emergency
|
|
593
|
+
* */
|
|
374
594
|
subsystem: string;
|
|
595
|
+
/**
|
|
596
|
+
* The nearest moon to the emergency, if applicable
|
|
597
|
+
* */
|
|
375
598
|
tertiaryLocation?: string;
|
|
376
599
|
}
|
|
377
600
|
|
|
601
|
+
/**
|
|
602
|
+
* A supported location from which an emergency may be submitted.
|
|
603
|
+
* */
|
|
378
604
|
interface LocationDetail {
|
|
605
|
+
/**
|
|
606
|
+
* The name of this location
|
|
607
|
+
* */
|
|
379
608
|
name: string;
|
|
609
|
+
/**
|
|
610
|
+
* The type of this location
|
|
611
|
+
* */
|
|
380
612
|
type: LocationType;
|
|
613
|
+
/**
|
|
614
|
+
* Additional locations which are within this location (e.g. moons of a planet, or planets of a system)
|
|
615
|
+
* */
|
|
381
616
|
children: LocationDetail[];
|
|
382
617
|
}
|
|
618
|
+
/**
|
|
619
|
+
* The type of location.
|
|
620
|
+
* */
|
|
383
621
|
declare enum LocationType {
|
|
622
|
+
/**
|
|
623
|
+
* The location type is not known
|
|
624
|
+
* */
|
|
384
625
|
UNKNOWN = 0,
|
|
626
|
+
/**
|
|
627
|
+
* A system, e.g. Stanton
|
|
628
|
+
* */
|
|
385
629
|
SYSTEM = 1,
|
|
630
|
+
/**
|
|
631
|
+
* A planet, e.g. Crusader
|
|
632
|
+
* */
|
|
386
633
|
PLANET = 2,
|
|
634
|
+
/**
|
|
635
|
+
* A moon, e.g. Daymar
|
|
636
|
+
* */
|
|
387
637
|
MOON = 3
|
|
388
638
|
}
|
|
389
639
|
|
|
@@ -421,26 +671,98 @@ declare enum Level {
|
|
|
421
671
|
Tier10Section3 = 1003
|
|
422
672
|
}
|
|
423
673
|
|
|
674
|
+
/**
|
|
675
|
+
* Details about a team responding to an alert.
|
|
676
|
+
* */
|
|
424
677
|
interface TeamDetailsResponse {
|
|
678
|
+
/**
|
|
679
|
+
* Details about each individual responder.
|
|
680
|
+
* */
|
|
425
681
|
stats: ResponderDetails[];
|
|
682
|
+
/**
|
|
683
|
+
* The aggregated mission success rate from all responders, appropriately weighted by number of missions.
|
|
684
|
+
* */
|
|
426
685
|
aggregatedSuccessRate: number;
|
|
427
686
|
}
|
|
687
|
+
/**
|
|
688
|
+
* Details about an alert responder.
|
|
689
|
+
* */
|
|
428
690
|
interface ResponderDetails {
|
|
691
|
+
/**
|
|
692
|
+
* The responder's id.
|
|
693
|
+
* */
|
|
429
694
|
id: string;
|
|
695
|
+
/**
|
|
696
|
+
* The responder's level.
|
|
697
|
+
* */
|
|
430
698
|
level: Level;
|
|
699
|
+
/**
|
|
700
|
+
* The success rate of all prior missions this staff member has responded to.
|
|
701
|
+
* */
|
|
431
702
|
missionSuccessRate: number;
|
|
703
|
+
/**
|
|
704
|
+
* The success rate of all prior missions this staff member has acted as a dispatcher for.
|
|
705
|
+
* */
|
|
432
706
|
dispatchSuccessRate: number;
|
|
433
707
|
}
|
|
434
708
|
|
|
709
|
+
/**
|
|
710
|
+
* Endpoints for interacting with emergencies.
|
|
711
|
+
* */
|
|
435
712
|
declare class EmergencyEndpoint extends ApiEndpoint {
|
|
436
713
|
constructor(config: DefaultApiConfig, tokenManager: TokenManager, log?: Logger, headerProvider?: HeaderProvider);
|
|
437
714
|
protected endpoint(): string;
|
|
715
|
+
/**
|
|
716
|
+
* Gets an emergency by id.
|
|
717
|
+
*
|
|
718
|
+
* @param id - The id of the emergency to retrieve
|
|
719
|
+
* */
|
|
438
720
|
getEmergency(id: string): Promise<ApiResponse<Emergency>>;
|
|
721
|
+
/**
|
|
722
|
+
* Bulk fetches emergencies by id.
|
|
723
|
+
*
|
|
724
|
+
* @param ids - a list of emergencies to retrieve
|
|
725
|
+
* */
|
|
439
726
|
getEmergencies(ids: string[]): Promise<ApiResponse<Emergency[]>>;
|
|
727
|
+
/**
|
|
728
|
+
* Creates a new emergency.
|
|
729
|
+
*
|
|
730
|
+
* @param newEmergency - Emergency details for the new emergency
|
|
731
|
+
* @returns The newly-created emergency
|
|
732
|
+
*
|
|
733
|
+
* */
|
|
440
734
|
createEmergency(newEmergency: CreateEmergencyRequest): Promise<ApiResponse<Emergency>>;
|
|
735
|
+
/**
|
|
736
|
+
* Cancels an existing emergency.
|
|
737
|
+
*
|
|
738
|
+
* @remarks
|
|
739
|
+
* Emergency must still be in the {@link MissionStatus.RECEIVED} state in order to be canceled.
|
|
740
|
+
*
|
|
741
|
+
* @param id - The id of the emergency to cancel
|
|
742
|
+
* @param reason - The reason the emergency was canceled
|
|
743
|
+
* */
|
|
441
744
|
cancelEmergencyWithReason(id: string, reason: CancellationReason): Promise<ApiResponse>;
|
|
745
|
+
/**
|
|
746
|
+
* Allows the client to rate their emergency.
|
|
747
|
+
*
|
|
748
|
+
* @param id - The id of the emergency to rate
|
|
749
|
+
* @param rating - The rating to give the services provided
|
|
750
|
+
* @param remarks - Additional remarks provided by the client
|
|
751
|
+
*
|
|
752
|
+
* @internal
|
|
753
|
+
* */
|
|
442
754
|
rateServices(id: string, rating: ResponseRating, remarks?: string): Promise<ApiResponse>;
|
|
755
|
+
/**
|
|
756
|
+
* Fetches additional details about the responding team for an alert.
|
|
757
|
+
*
|
|
758
|
+
* @param id - The id of the emergency to get team details about
|
|
759
|
+
* */
|
|
443
760
|
teamDetails(id: string): Promise<ApiResponse<TeamDetailsResponse>>;
|
|
761
|
+
/**
|
|
762
|
+
* Gets a tree of valid locations from which an emergency may be submitted.
|
|
763
|
+
*
|
|
764
|
+
* @deprecated Use {@link getPublicSettings} instead.
|
|
765
|
+
* */
|
|
444
766
|
emergencyLocations(): Promise<ApiResponse<LocationDetail[]>>;
|
|
445
767
|
}
|
|
446
768
|
|
|
@@ -486,27 +808,56 @@ declare enum ServiceStatus {
|
|
|
486
808
|
OFFLINE = 4
|
|
487
809
|
}
|
|
488
810
|
|
|
811
|
+
/**
|
|
812
|
+
* Endpoints for interacting with the public org settings.
|
|
813
|
+
* */
|
|
489
814
|
declare class OrgSettingsEndpoint extends ApiEndpoint {
|
|
490
815
|
constructor(config: DefaultApiConfig, tokenManager: TokenManager, log?: Logger, headerProvider?: HeaderProvider);
|
|
491
816
|
protected endpoint(): string;
|
|
817
|
+
/**
|
|
818
|
+
* Get the public org settings.
|
|
819
|
+
*
|
|
820
|
+
* */
|
|
492
821
|
getPublicSettings(): Promise<ApiResponse<PublicOrgSettings>>;
|
|
493
822
|
}
|
|
494
823
|
|
|
824
|
+
/**
|
|
825
|
+
* Information about a medal
|
|
826
|
+
* */
|
|
495
827
|
interface MedalInformation {
|
|
828
|
+
/**
|
|
829
|
+
* The level linked to the medal
|
|
830
|
+
* */
|
|
496
831
|
level: Level;
|
|
832
|
+
/**
|
|
833
|
+
* The number of successful missions required to earn the medal
|
|
834
|
+
* */
|
|
497
835
|
successfulMissions: number;
|
|
498
836
|
}
|
|
499
837
|
|
|
838
|
+
/**
|
|
839
|
+
* Endpoints for interacting with staff.
|
|
840
|
+
* */
|
|
500
841
|
declare class StaffEndpoint extends ApiEndpoint {
|
|
501
842
|
constructor(config: DefaultApiConfig, tokenManager: TokenManager, log?: Logger, headerProvider?: HeaderProvider);
|
|
502
843
|
protected endpoint(): string;
|
|
844
|
+
/**
|
|
845
|
+
* Gets detailed information about medals.
|
|
846
|
+
* */
|
|
503
847
|
medalsInformation(): Promise<ApiResponse<MedalInformation[]>>;
|
|
504
848
|
}
|
|
505
849
|
|
|
850
|
+
/**
|
|
851
|
+
* Endpoints for interacting with emergencies.
|
|
852
|
+
* */
|
|
506
853
|
declare class WebsocketEndpoint extends ApiEndpoint {
|
|
507
854
|
constructor(config: DefaultApiConfig, tokenManager: TokenManager, log?: Logger, headerProvider?: HeaderProvider);
|
|
508
855
|
private websocketManager;
|
|
509
856
|
protected endpoint(): string;
|
|
857
|
+
/**
|
|
858
|
+
* Gets realtime updates.
|
|
859
|
+
*
|
|
860
|
+
* */
|
|
510
861
|
initialize(): Promise<HubConnection>;
|
|
511
862
|
}
|
|
512
863
|
|
|
@@ -521,6 +872,9 @@ interface ApiClient<TEmergency extends EmergencyEndpoint = EmergencyEndpoint, TC
|
|
|
521
872
|
websocket: TWebsocket;
|
|
522
873
|
}
|
|
523
874
|
|
|
875
|
+
/**
|
|
876
|
+
* An API client for basic client interactions with the Medrunner API.
|
|
877
|
+
* */
|
|
524
878
|
declare class MedrunnerApiClient<TEmergency extends EmergencyEndpoint = EmergencyEndpoint, TClient extends ClientEndpoint = ClientEndpoint, TStaff extends StaffEndpoint = StaffEndpoint, TOrgSettings extends OrgSettingsEndpoint = OrgSettingsEndpoint, TChatMessage extends ChatMessageEndpoint = ChatMessageEndpoint, TCode extends CodeEndpoint = CodeEndpoint, TAuth extends AuthEndpoint = AuthEndpoint, TWebsocket extends WebsocketEndpoint = WebsocketEndpoint> implements ApiClient<TEmergency, TClient, TStaff, TOrgSettings, TChatMessage, TCode, TAuth, TWebsocket> {
|
|
525
879
|
readonly emergency: TEmergency;
|
|
526
880
|
readonly client: TClient;
|
|
@@ -531,6 +885,13 @@ declare class MedrunnerApiClient<TEmergency extends EmergencyEndpoint = Emergenc
|
|
|
531
885
|
readonly auth: TAuth;
|
|
532
886
|
readonly websocket: TWebsocket;
|
|
533
887
|
protected constructor(emergency: TEmergency, client: TClient, staff: TStaff, orgSettings: TOrgSettings, chatMessage: TChatMessage, code: TCode, auth: TAuth, websocket: TWebsocket);
|
|
888
|
+
/**
|
|
889
|
+
* Constructs a new API client.
|
|
890
|
+
*
|
|
891
|
+
* @param config - The API configuration
|
|
892
|
+
* @param refreshCallback - a callback function called whenever a refresh token exchange is performed
|
|
893
|
+
* @param log - A logger which logs request details
|
|
894
|
+
* */
|
|
534
895
|
static buildClient(config: ApiConfig, refreshCallback?: AsyncAction<TokenGrant>, log?: Logger): MedrunnerApiClient;
|
|
535
896
|
}
|
|
536
897
|
|