@sonoransoftware/sonoran.js 1.0.34 → 1.0.36

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 (44) hide show
  1. package/.github/workflows/auto-pr-on-branch-push.yml +89 -0
  2. package/.github/workflows/codex_instructions.md +24 -0
  3. package/.github/workflows/push-pr-nudge-codex.yml +50 -0
  4. package/dist/constants.d.ts +242 -1
  5. package/dist/constants.js +1 -0
  6. package/dist/index.d.ts +1 -1
  7. package/dist/instance/Instance.d.ts +6 -0
  8. package/dist/instance/Instance.js +27 -0
  9. package/dist/instance/instance.types.d.ts +3 -0
  10. package/dist/libs/rest/src/lib/REST.d.ts +2 -1
  11. package/dist/libs/rest/src/lib/REST.js +118 -0
  12. package/dist/libs/rest/src/lib/RequestManager.d.ts +2 -0
  13. package/dist/libs/rest/src/lib/RequestManager.js +209 -0
  14. package/dist/libs/rest/src/lib/errors/RateLimitError.js +19 -1
  15. package/dist/libs/rest/src/lib/utils/constants.d.ts +108 -24
  16. package/dist/libs/rest/src/lib/utils/constants.js +118 -2
  17. package/dist/managers/CADActiveUnitsManager.d.ts +3 -0
  18. package/dist/managers/CADActiveUnitsManager.js +16 -6
  19. package/dist/managers/CADManager.d.ts +223 -0
  20. package/dist/managers/CADManager.js +513 -4
  21. package/dist/managers/CADServerManager.d.ts +11 -0
  22. package/dist/managers/CADServerManager.js +56 -13
  23. package/dist/managers/CMSManager.d.ts +78 -0
  24. package/dist/managers/CMSManager.js +213 -3
  25. package/dist/managers/CMSServerManager.d.ts +8 -0
  26. package/dist/managers/CMSServerManager.js +61 -18
  27. package/dist/managers/RadioManager.d.ts +55 -0
  28. package/dist/managers/RadioManager.js +224 -0
  29. package/package.json +1 -1
  30. package/readme.md +294 -12
  31. package/src/constants.ts +281 -1
  32. package/src/index.ts +42 -1
  33. package/src/instance/Instance.ts +30 -1
  34. package/src/instance/instance.types.ts +4 -1
  35. package/src/libs/rest/src/lib/REST.ts +117 -1
  36. package/src/libs/rest/src/lib/RequestManager.ts +229 -10
  37. package/src/libs/rest/src/lib/errors/RateLimitError.ts +20 -2
  38. package/src/libs/rest/src/lib/utils/constants.ts +223 -26
  39. package/src/managers/CADActiveUnitsManager.ts +19 -6
  40. package/src/managers/CADManager.ts +574 -4
  41. package/src/managers/CADServerManager.ts +59 -15
  42. package/src/managers/CMSManager.ts +196 -2
  43. package/src/managers/CMSServerManager.ts +65 -21
  44. package/src/managers/RadioManager.ts +187 -0
@@ -1,4 +1,4 @@
1
- import { productEnums } from '../../../../../constants';
1
+ import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload } from '../../../../../constants';
2
2
  import type { RESTOptions } from '../REST';
3
3
 
4
4
  export const DefaultUserAgent = 'Sonoran.js NPM Module';
@@ -17,6 +17,13 @@ export const DefaultCMSRestOptions: Required<RESTOptions> = {
17
17
  rejectOnRateLimit: true
18
18
  };
19
19
 
20
+ export const DefaultRadioRestOptions: Required<RESTOptions> = {
21
+ agent: {},
22
+ api: 'https://api.sonoranradio.com',
23
+ headers: {},
24
+ rejectOnRateLimit: true
25
+ };
26
+
20
27
  /**
21
28
  * The events that the REST manager emits
22
29
  */
@@ -163,6 +170,24 @@ export const GeneralCADAPITypes: APITypeData[] = [
163
170
  path: 'general/send_photo',
164
171
  method: 'POST',
165
172
  minVersion: 4
173
+ },
174
+ {
175
+ type: 'SET_CLOCK',
176
+ path: 'general/set_clock',
177
+ method: 'POST',
178
+ minVersion: 3
179
+ },
180
+ {
181
+ type: 'JOIN_COMMUNITY',
182
+ path: 'sso/community',
183
+ method: 'POST',
184
+ minVersion: 0
185
+ },
186
+ {
187
+ type: 'LEAVE_COMMUNITY',
188
+ path: 'sso/community',
189
+ method: 'POST',
190
+ minVersion: 0
166
191
  }
167
192
  ];
168
193
 
@@ -347,6 +372,18 @@ export const GeneralCMSAPITypes: APITypeData[] = [
347
372
  method: 'POST', // Would've been 'GET' but fetch doesn't allow body with GET requests.
348
373
  minVersion: 3
349
374
  },
375
+ {
376
+ type: 'GET_CURRENT_CLOCK_IN',
377
+ path: 'general/get_current_clock_in',
378
+ method: 'POST', // Would've been 'GET' but fetch doesn't allow body with GET requests.
379
+ minVersion: 0
380
+ },
381
+ {
382
+ type: 'GET_ACCOUNTS',
383
+ path: 'general/get_accounts',
384
+ method: 'POST', // Would've been 'GET' but fetch doesn't allow body with GET requests.
385
+ minVersion: 0
386
+ },
350
387
  {
351
388
  type: 'GET_ACCOUNT_RANKS',
352
389
  path: 'general/get_account_ranks',
@@ -365,6 +402,12 @@ export const GeneralCMSAPITypes: APITypeData[] = [
365
402
  method: 'POST', // Would've been 'GET' but fetch doesn't allow body with GET requests.
366
403
  minVersion: 2,
367
404
  },
405
+ {
406
+ type: 'GET_PROFILE_FIELDS',
407
+ path: 'general/get_profile_fields',
408
+ method: 'POST', // Would've been 'GET' but fetch doesn't allow body with GET requests.
409
+ minVersion: 0
410
+ },
368
411
  {
369
412
  type: 'GET_SUB_VERSION',
370
413
  path: 'general/get_sub_version',
@@ -412,6 +455,18 @@ export const GeneralCMSAPITypes: APITypeData[] = [
412
455
  path: 'general/force_sync',
413
456
  method: 'POST',
414
457
  minVersion: 0
458
+ },
459
+ {
460
+ type: 'TRIGGER_PROMOTION_FLOWS',
461
+ path: 'general/trigger_promotion_flows',
462
+ method: 'POST',
463
+ minVersion: 0
464
+ },
465
+ {
466
+ type: 'GET_PROMOTION_FLOWS',
467
+ path: 'general/get_promotion_flows',
468
+ method: 'POST',
469
+ minVersion: 0
415
470
  }
416
471
  ];
417
472
 
@@ -422,6 +477,12 @@ export const ServersCMSAPITypes: APITypeData[] = [
422
477
  method: 'POST', // Would've been 'GET' but fetch doesn't allow body with GET requests.
423
478
  minVersion: 2
424
479
  },
480
+ {
481
+ type: 'SET_GAME_SERVERS',
482
+ path: 'servers/set_game_servers',
483
+ method: 'POST',
484
+ minVersion: 2
485
+ },
425
486
  {
426
487
  type: 'VERIFY_WHITELIST',
427
488
  path: 'servers/verify_whitelist',
@@ -451,6 +512,12 @@ export const FormsCMSAPITypes: APITypeData[] = [
451
512
  path: 'forms/change/stage',
452
513
  method: 'POST',
453
514
  minVersion: 0
515
+ },
516
+ {
517
+ type: 'GET_FORM_TEMPLATE_SUBMISSIONS',
518
+ path: 'forms/get_template_submissions',
519
+ method: 'POST',
520
+ minVersion: 0
454
521
  }
455
522
  ];
456
523
 
@@ -484,6 +551,57 @@ export const ERLCMSAPITypes: APITypeData[] = [
484
551
  }
485
552
  ];
486
553
 
554
+ export const RadioAPITypes: APITypeData[] = [
555
+ {
556
+ type: 'RADIO_GET_COMMUNITY_CHANNELS',
557
+ path: 'api/radio/get-community-channels',
558
+ method: 'GET',
559
+ minVersion: 0
560
+ },
561
+ {
562
+ type: 'RADIO_GET_CONNECTED_USERS',
563
+ path: 'api/radio/get-connected-users',
564
+ method: 'GET',
565
+ minVersion: 0
566
+ },
567
+ {
568
+ type: 'RADIO_GET_CONNECTED_USER',
569
+ path: 'api/radio/get-connected-user',
570
+ method: 'GET',
571
+ minVersion: 0
572
+ },
573
+ {
574
+ type: 'RADIO_SET_USER_CHANNELS',
575
+ path: 'api/radio/set-user-channels',
576
+ method: 'POST',
577
+ minVersion: 0
578
+ },
579
+ {
580
+ type: 'RADIO_SET_USER_DISPLAY_NAME',
581
+ path: 'api/set-user-display-name',
582
+ method: 'POST',
583
+ minVersion: 0
584
+ },
585
+ {
586
+ type: 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP',
587
+ path: 'radio/check-server-subscription',
588
+ method: 'GET',
589
+ minVersion: 0
590
+ },
591
+ {
592
+ type: 'RADIO_SET_SERVER_IP',
593
+ path: 'radio/set-server-ip',
594
+ method: 'POST',
595
+ minVersion: 0
596
+ },
597
+ {
598
+ type: 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS',
599
+ path: 'radio/set-server-speakers',
600
+ method: 'POST',
601
+ minVersion: 0
602
+ }
603
+ ];
604
+
487
605
  function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeData[] {
488
606
  return array.map((val) => {
489
607
  return {
@@ -493,9 +611,9 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
493
611
  });
494
612
  }
495
613
 
496
- export const AllAPITypes: AllAPITypeData[] = [ ...formatForAll(GeneralCADAPITypes, productEnums.CAD), ...formatForAll(CivilianCADAPITypes, productEnums.CAD), ...formatForAll(EmergencyCADAPITypes, productEnums.CAD), ...formatForAll(GeneralCMSAPITypes, productEnums.CMS), ...formatForAll(ServersCMSAPITypes, productEnums.CMS), ...formatForAll(EventsCMSAPITypes, productEnums.CMS), ...formatForAll(FormsCMSAPITypes, productEnums.CMS), ...formatForAll(CommunitiesCMSAPITypes, productEnums.CMS), ...formatForAll(ERLCMSAPITypes, productEnums.CMS) ];
614
+ export const AllAPITypes: AllAPITypeData[] = [ ...formatForAll(GeneralCADAPITypes, productEnums.CAD), ...formatForAll(CivilianCADAPITypes, productEnums.CAD), ...formatForAll(EmergencyCADAPITypes, productEnums.CAD), ...formatForAll(GeneralCMSAPITypes, productEnums.CMS), ...formatForAll(ServersCMSAPITypes, productEnums.CMS), ...formatForAll(EventsCMSAPITypes, productEnums.CMS), ...formatForAll(FormsCMSAPITypes, productEnums.CMS), ...formatForAll(CommunitiesCMSAPITypes, productEnums.CMS), ...formatForAll(ERLCMSAPITypes, productEnums.CMS), ...formatForAll(RadioAPITypes, productEnums.RADIO) ];
497
615
 
498
- export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | "ERLC_GET_ONLINE_PLAYERS" | "ERLC_GET_PLAYER_QUEUE" | "ERLC_ADD_NEW_RECORD";
616
+ export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'SET_CLOCK' | 'JOIN_COMMUNITY' | 'LEAVE_COMMUNITY' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'GET_CURRENT_CLOCK_IN' | 'GET_ACCOUNTS' | 'GET_PROFILE_FIELDS' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'GET_FORM_TEMPLATE_SUBMISSIONS' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | 'TRIGGER_PROMOTION_FLOWS' | 'GET_PROMOTION_FLOWS' | 'SET_GAME_SERVERS' | 'ERLC_GET_ONLINE_PLAYERS' | 'ERLC_GET_PLAYER_QUEUE' | 'ERLC_ADD_NEW_RECORD' | 'RADIO_GET_COMMUNITY_CHANNELS' | 'RADIO_GET_CONNECTED_USERS' | 'RADIO_GET_CONNECTED_USER' | 'RADIO_SET_USER_CHANNELS' | 'RADIO_SET_USER_DISPLAY_NAME' | 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP' | 'RADIO_SET_SERVER_IP' | 'RADIO_SET_IN_GAME_SPEAKER_LOCATIONS';
499
617
 
500
618
  export interface CMSServerAPIStruct {
501
619
  id: number;
@@ -758,13 +876,9 @@ export interface CADStreetSignStruct {
758
876
 
759
877
  export interface CADUnitLocationStruct {
760
878
  apiId: string;
761
- location: string;
879
+ location: string;
762
880
  }
763
881
 
764
- export interface CMSProfileField {
765
- id: string;
766
- value: string;
767
- }
768
882
  export interface RESTTypedAPIDataStructs {
769
883
  // CAD - General
770
884
  GET_SERVERS: [];
@@ -787,7 +901,7 @@ export interface RESTTypedAPIDataStructs {
787
901
  ];
788
902
  CHECK_APIID: [apiId: string];
789
903
  APPLY_PERMISSION_KEY: [
790
- apiId: string,
904
+ apiId: string | undefined,
791
905
  permissionKey: string
792
906
  ];
793
907
  SET_ACCOUNT_PERMISSIONS: [data: CADModifyAccountPermsStruct];
@@ -796,9 +910,29 @@ export interface RESTTypedAPIDataStructs {
796
910
  AUTH_STREETSIGNS: [serverId: number];
797
911
  SET_POSTALS: [data: CADSetPostalStruct[]];
798
912
  SEND_PHOTO: [
799
- apiId: string,
913
+ apiId: string | undefined,
800
914
  url: string
801
915
  ];
916
+ SET_CLOCK: [
917
+ data: {
918
+ serverId: number,
919
+ currentUtc: string,
920
+ currentGame: string,
921
+ secondsPerHour: number
922
+ }
923
+ ];
924
+ JOIN_COMMUNITY: [
925
+ payload: {
926
+ internalKey: string,
927
+ accounts: Array<{ account: string }>
928
+ }
929
+ ];
930
+ LEAVE_COMMUNITY: [
931
+ payload: {
932
+ internalKey: string,
933
+ accounts: Array<{ account: string }>
934
+ }
935
+ ];
802
936
  // CAD - Civilian
803
937
  GET_CHARACTERS: [apiId: string];
804
938
  NEW_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
@@ -808,15 +942,15 @@ export interface RESTTypedAPIDataStructs {
808
942
  GET_IDENTIFIERS: [apiId: string];
809
943
  MODIFY_IDENTIFIER: [data: CADModifyIdentifierStruct];
810
944
  SET_IDENTIFIER: [
811
- apiId: string,
945
+ apiId: string | undefined,
812
946
  identId: number
813
947
  ];
814
948
  UNIT_PANIC: [
815
- apiId: string,
949
+ apiId: string | undefined,
816
950
  isPanic: boolean
817
951
  ];
818
952
  UNIT_STATUS: [
819
- apiId: string,
953
+ apiId: string | undefined,
820
954
  status: number,
821
955
  serverId: number
822
956
  ];
@@ -828,7 +962,7 @@ export interface RESTTypedAPIDataStructs {
828
962
  GET_CALLS: [data: CADGetCallsStruct];
829
963
  GET_ACTIVE_UNITS: [data: CADGetActiveUnitsStruct];
830
964
  KICK_UNIT: [
831
- apiId: string,
965
+ apiId: string | undefined,
832
966
  reason: string,
833
967
  serverId: number
834
968
  ];
@@ -862,7 +996,7 @@ export interface RESTTypedAPIDataStructs {
862
996
  serverId: number,
863
997
  callId: number
864
998
  ];
865
- 'CALL_911': [
999
+ '911_CALL': [
866
1000
  serverId: number,
867
1001
  isEmergency: boolean,
868
1002
  caller: string,
@@ -893,6 +1027,24 @@ export interface RESTTypedAPIDataStructs {
893
1027
  uniqueId?: string
894
1028
  ];
895
1029
  GET_SUB_VERSION: [];
1030
+ GET_CURRENT_CLOCK_IN: [
1031
+ apiId?: string,
1032
+ username?: string,
1033
+ accId?: string,
1034
+ discord?: string,
1035
+ uniqueId?: string
1036
+ ];
1037
+ GET_ACCOUNTS: [
1038
+ options?: {
1039
+ skip?: number,
1040
+ take?: number,
1041
+ sysStatus?: boolean,
1042
+ comStatus?: boolean,
1043
+ banned?: boolean,
1044
+ archived?: boolean
1045
+ }
1046
+ ];
1047
+ GET_PROFILE_FIELDS: [];
896
1048
  CHECK_COM_APIID: [apiId: string];
897
1049
  CLOCK_IN_OUT: [
898
1050
  apiId?: string,
@@ -934,8 +1086,13 @@ export interface RESTTypedAPIDataStructs {
934
1086
  discordId: string | undefined,
935
1087
  uniqueId: string | undefined,
936
1088
  ],
1089
+ TRIGGER_PROMOTION_FLOWS: [
1090
+ data: CMSTriggerPromotionFlowPayload[]
1091
+ ];
1092
+ GET_PROMOTION_FLOWS: [];
937
1093
  // CMS - Servers
938
1094
  GET_GAME_SERVERS: [];
1095
+ SET_GAME_SERVERS: [servers: CMSSetGameServerStruct[]];
939
1096
  VERIFY_WHITELIST: [
940
1097
  apiId: string | undefined,
941
1098
  accId: string | undefined,
@@ -955,23 +1112,28 @@ export interface RESTTypedAPIDataStructs {
955
1112
  uniqueId: string | undefined
956
1113
  ],
957
1114
  EDIT_ACC_PROFLIE_FIELDS : [
958
- apiId: string,
959
- username: string,
960
- accId: string,
961
- discord: string,
962
- uniqueId: string,
963
- profileFields : CMSProfileField[]
1115
+ apiId: string | undefined,
1116
+ username: string | undefined,
1117
+ accId: string | undefined,
1118
+ discord: string | undefined,
1119
+ uniqueId: string | undefined,
1120
+ profileFields : CMSProfileFieldUpdate[]
964
1121
  ]
965
1122
  // CMS - Forms
966
1123
  CHANGE_FORM_STAGE: [
967
- accId: string,
1124
+ accId: string | undefined,
968
1125
  formId: number,
969
1126
  newStageId: string,
970
- apiId: string,
971
- username: string,
972
- discord: string,
1127
+ apiId: string | undefined,
1128
+ username: string | undefined,
1129
+ discord: string | undefined,
973
1130
  uniqueId: number,
974
1131
  ]
1132
+ GET_FORM_TEMPLATE_SUBMISSIONS: [
1133
+ templateId: number,
1134
+ skip?: number,
1135
+ take?: number,
1136
+ ]
975
1137
  BAN_ACCOUNT: [
976
1138
  apiId: string | undefined,
977
1139
  username: string | undefined,
@@ -1002,17 +1164,48 @@ export interface RESTTypedAPIDataStructs {
1002
1164
  playerRobloxId?: string | number,
1003
1165
  points?: number,
1004
1166
  ]
1167
+ // Radio
1168
+ RADIO_GET_COMMUNITY_CHANNELS: [];
1169
+ RADIO_GET_CONNECTED_USERS: [];
1170
+ RADIO_GET_CONNECTED_USER: [
1171
+ roomId: number,
1172
+ identity: string
1173
+ ];
1174
+ RADIO_SET_USER_CHANNELS: [
1175
+ identity: string,
1176
+ options?: RadioSetUserChannelsOptions
1177
+ ];
1178
+ RADIO_SET_USER_DISPLAY_NAME: [
1179
+ accId: string | undefined,
1180
+ displayName: string
1181
+ ];
1182
+ RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP: [];
1183
+ RADIO_SET_SERVER_IP: [
1184
+ pushUrl: string
1185
+ ];
1186
+ RADIO_SET_IN_GAME_SPEAKER_LOCATIONS: [
1187
+ locations: RadioSpeakerLocation[],
1188
+ token?: string
1189
+ ];
1005
1190
  }
1006
1191
 
1007
1192
  export type PossibleRequestData =
1008
1193
  undefined |
1009
1194
  {
1010
- data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct
1195
+ data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[]
1011
1196
  } |
1012
1197
  {
1013
1198
  servers: CADServerAPIStruct[];
1014
1199
  deployMap: boolean;
1015
1200
  } |
1201
+ {
1202
+ data: {
1203
+ serverId: number;
1204
+ currentUtc: string;
1205
+ currentGame: string;
1206
+ secondsPerHour: number;
1207
+ }
1208
+ } |
1016
1209
  {
1017
1210
  id: number;
1018
1211
  } |
@@ -1109,6 +1302,10 @@ export type PossibleRequestData =
1109
1302
  text3: string;
1110
1303
  }
1111
1304
  } |
1305
+ {
1306
+ internalKey: string;
1307
+ accounts: { account: string }[];
1308
+ } |
1112
1309
  {
1113
1310
  apiId?: string;
1114
1311
  username?: string;
@@ -2,6 +2,8 @@
2
2
 
3
3
  // import { CADActiveUnitFetchOptions } from '../constants';
4
4
  import { Instance } from '../instance/Instance';
5
+ import * as globalTypes from '../constants';
6
+ import type { CADGetActiveUnitsStruct } from '../libs/rest/src';
5
7
  import { CADActiveUnit, CADActiveUnitResolvable, CADActiveUnitStruct } from '../structures/CADActiveUnit';
6
8
  import { CacheManager } from './CacheManager';
7
9
 
@@ -27,6 +29,20 @@ export class CADActiveUnitsManager extends CacheManager<number, CADActiveUnit, C
27
29
  });
28
30
  }
29
31
 
32
+ public async getActiveUnits(options: Partial<CADGetActiveUnitsStruct> = {}): Promise<globalTypes.CADStandardResponse> {
33
+ if (!this.instance.cad) {
34
+ throw new Error('CAD manager is not initialized.');
35
+ }
36
+ const payload: CADGetActiveUnitsStruct = {
37
+ serverId: options.serverId ?? this.serverId,
38
+ includeOffline: options.includeOffline ?? false,
39
+ onlyUnits: options.onlyUnits,
40
+ limit: options.limit,
41
+ offset: options.offset
42
+ };
43
+ return this.instance.cad.getActiveUnits(payload);
44
+ }
45
+
30
46
  async _fetchSingle({
31
47
  unit,
32
48
  includeOffline = false,
@@ -41,10 +57,7 @@ export class CADActiveUnitsManager extends CacheManager<number, CADActiveUnit, C
41
57
  if (existing) return existing;
42
58
  }
43
59
 
44
- const data = await this.instance.cad?.rest?.request('GET_ACTIVE_UNITS', {
45
- serverId: this.serverId,
46
- includeOffline
47
- });
48
- console.log(data);
60
+ const result = await this.getActiveUnits({ includeOffline });
61
+ console.log(result);
49
62
  }
50
- }
63
+ }