@sonoransoftware/sonoran.js 1.0.47 → 1.0.49

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.
@@ -504,7 +504,7 @@ export interface RadioTonePlayTarget {
504
504
  color?: string;
505
505
  }
506
506
  export interface RadioSetUserChannelsOptions {
507
- transmit?: number;
507
+ transmit?: number[];
508
508
  scan?: number[];
509
509
  }
510
510
  export type RadioSubscriptionLevel = 0 | 1 | 2;
@@ -139,6 +139,13 @@ class REST extends events_1.EventEmitter {
139
139
  case 'GET_PROFILE_FIELDS': {
140
140
  return {};
141
141
  }
142
+ case 'GET_MY_CALL': {
143
+ const payload = args[0];
144
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
145
+ return payload;
146
+ }
147
+ return { account: args[0] };
148
+ }
142
149
  case 'SET_CLOCK': {
143
150
  if (args[0] && typeof args[0] === 'object' && !Array.isArray(args[0])) {
144
151
  return args[0];
@@ -195,6 +202,18 @@ class REST extends events_1.EventEmitter {
195
202
  type: args[5]
196
203
  };
197
204
  }
205
+ case 'ADD_CALL_NOTE': {
206
+ const payload = args[0];
207
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
208
+ return payload;
209
+ }
210
+ return {
211
+ serverId: args[0],
212
+ callId: args[1],
213
+ note: args[2],
214
+ label: args[3]
215
+ };
216
+ }
198
217
  case 'UNIT_STATUS': {
199
218
  const payload = args[0];
200
219
  if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
@@ -207,6 +226,46 @@ class REST extends events_1.EventEmitter {
207
226
  serverId: args[2]
208
227
  };
209
228
  }
229
+ case 'UNIT_PANIC': {
230
+ const payload = args[0];
231
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
232
+ const { apiId, account, isPanic } = payload;
233
+ return { apiId, account, isPanic };
234
+ }
235
+ return {
236
+ apiId: args[0],
237
+ isPanic: args[1]
238
+ };
239
+ }
240
+ case 'ATTACH_UNIT': {
241
+ const payload = args[0];
242
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
243
+ return payload;
244
+ }
245
+ const unitsOrAccount = args[2];
246
+ const account = typeof unitsOrAccount === 'string' && !Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
247
+ const units = Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
248
+ return {
249
+ serverId: args[0],
250
+ callId: args[1],
251
+ units,
252
+ account
253
+ };
254
+ }
255
+ case 'DETACH_UNIT': {
256
+ const payload = args[0];
257
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
258
+ return payload;
259
+ }
260
+ const unitsOrAccount = args[1];
261
+ const account = typeof unitsOrAccount === 'string' && !Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
262
+ const units = Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
263
+ return {
264
+ serverId: args[0],
265
+ units,
266
+ account
267
+ };
268
+ }
210
269
  case 'CHECK_COM_APIID': {
211
270
  return {
212
271
  apiId: args[0]
@@ -205,6 +205,19 @@ class RequestManager extends events_1.EventEmitter {
205
205
  apiData.data.data = [clonedData[0]];
206
206
  break;
207
207
  }
208
+ case 'GET_MY_CALL': {
209
+ const payload = data.data;
210
+ if (Array.isArray(payload)) {
211
+ apiData.data.data = payload.length > 0 ? payload : [];
212
+ }
213
+ else if (payload !== undefined && payload !== null) {
214
+ apiData.data.data = [payload];
215
+ }
216
+ else {
217
+ apiData.data.data = [];
218
+ }
219
+ break;
220
+ }
208
221
  case 'GET_ACTIVE_UNITS': {
209
222
  apiData.data.data = [clonedData[0]];
210
223
  break;
@@ -213,6 +226,58 @@ class RequestManager extends events_1.EventEmitter {
213
226
  apiData.data.data = [clonedData[0]];
214
227
  break;
215
228
  }
229
+ case 'ADD_CALL_NOTE': {
230
+ const payload = data.data;
231
+ if (Array.isArray(payload)) {
232
+ apiData.data.data = payload;
233
+ }
234
+ else if (payload !== undefined && payload !== null) {
235
+ apiData.data.data = [payload];
236
+ }
237
+ else {
238
+ apiData.data.data = [];
239
+ }
240
+ break;
241
+ }
242
+ case 'UNIT_PANIC': {
243
+ const payload = data.data;
244
+ if (Array.isArray(payload)) {
245
+ apiData.data.data = payload;
246
+ }
247
+ else if (payload !== undefined && payload !== null) {
248
+ apiData.data.data = [payload];
249
+ }
250
+ else {
251
+ apiData.data.data = [];
252
+ }
253
+ break;
254
+ }
255
+ case 'ATTACH_UNIT': {
256
+ const payload = data.data;
257
+ if (Array.isArray(payload)) {
258
+ apiData.data.data = payload;
259
+ }
260
+ else if (payload !== undefined && payload !== null) {
261
+ apiData.data.data = [payload];
262
+ }
263
+ else {
264
+ apiData.data.data = [];
265
+ }
266
+ break;
267
+ }
268
+ case 'DETACH_UNIT': {
269
+ const payload = data.data;
270
+ if (Array.isArray(payload)) {
271
+ apiData.data.data = payload;
272
+ }
273
+ else if (payload !== undefined && payload !== null) {
274
+ apiData.data.data = [payload];
275
+ }
276
+ else {
277
+ apiData.data.data = [];
278
+ }
279
+ break;
280
+ }
216
281
  case 'UNIT_LOCATION': {
217
282
  apiData.data.data = [clonedData[0]];
218
283
  break;
@@ -338,11 +403,26 @@ class RequestManager extends events_1.EventEmitter {
338
403
  path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}/${encodeSegment(roomIdNumeric)}/${encodeSegment(identity)}`;
339
404
  method = 'POST';
340
405
  const requestBody = {};
341
- if ((options === null || options === void 0 ? void 0 : options.transmit) !== undefined) {
342
- requestBody.transmit = options.transmit;
406
+ const normalizeNumberArray = (label, value) => {
407
+ if (value === undefined)
408
+ return undefined;
409
+ const asArray = Array.isArray(value) ? value : [value];
410
+ const numbers = asArray.map((entry) => {
411
+ const numeric = typeof entry === 'number' ? entry : Number(entry);
412
+ if (Number.isNaN(numeric)) {
413
+ throw new Error(`${label} must be a number or array of numbers for RADIO_SET_USER_CHANNELS requests.`);
414
+ }
415
+ return numeric;
416
+ });
417
+ return numbers;
418
+ };
419
+ const transmit = normalizeNumberArray('transmit', options === null || options === void 0 ? void 0 : options.transmit);
420
+ if (transmit !== undefined) {
421
+ requestBody.transmit = transmit;
343
422
  }
344
- if ((options === null || options === void 0 ? void 0 : options.scan) !== undefined) {
345
- requestBody.scan = options.scan;
423
+ const scan = normalizeNumberArray('scan', options === null || options === void 0 ? void 0 : options.scan);
424
+ if (scan !== undefined) {
425
+ requestBody.scan = scan;
346
426
  }
347
427
  body = requestBody;
348
428
  break;
@@ -38,7 +38,7 @@ export declare const CommunitiesCMSAPITypes: APITypeData[];
38
38
  export declare const ERLCMSAPITypes: APITypeData[];
39
39
  export declare const RadioAPITypes: APITypeData[];
40
40
  export declare const AllAPITypes: AllAPITypeData[];
41
- 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_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | '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' | 'ERLC_EXECUTE_COMMAND' | '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' | 'PLAY_TONE';
41
+ 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_MY_CALL' | '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_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | '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' | 'ERLC_EXECUTE_COMMAND' | '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' | 'PLAY_TONE';
42
42
  export interface CMSServerAPIStruct {
43
43
  id: number;
44
44
  name: string;
@@ -229,6 +229,15 @@ export interface CADGetCallsStruct {
229
229
  closedLimit?: number;
230
230
  closedOffset?: number;
231
231
  }
232
+ export interface CADGetMyCallStruct {
233
+ account: string;
234
+ }
235
+ export interface CADAddCallNoteStruct {
236
+ serverId: number;
237
+ callId: number;
238
+ note: string;
239
+ label?: string;
240
+ }
232
241
  export interface CADGetActiveUnitsStruct {
233
242
  serverId?: number;
234
243
  onlyUnits?: boolean;
@@ -236,6 +245,22 @@ export interface CADGetActiveUnitsStruct {
236
245
  limit?: number;
237
246
  offset?: number;
238
247
  }
248
+ export interface CADAttachUnitsStruct {
249
+ serverId: number;
250
+ callId: number;
251
+ units?: string[];
252
+ account?: string;
253
+ }
254
+ export interface CADDetachUnitsStruct {
255
+ serverId: number;
256
+ units?: string[];
257
+ account?: string;
258
+ }
259
+ export interface CADUnitPanicStruct {
260
+ apiId?: string;
261
+ account?: string;
262
+ isPanic: boolean;
263
+ }
239
264
  export declare enum CADDispatchOriginEnums {
240
265
  Caller = 0,
241
266
  RadioDispatch = 1,
@@ -350,6 +375,8 @@ export interface RESTTypedAPIDataStructs {
350
375
  UNIT_PANIC: [
351
376
  apiId: string | undefined,
352
377
  isPanic: boolean
378
+ ] | [
379
+ data: CADUnitPanicStruct
353
380
  ];
354
381
  UNIT_STATUS: [
355
382
  apiId: string | undefined,
@@ -364,6 +391,7 @@ export interface RESTTypedAPIDataStructs {
364
391
  REMOVE_BLIP: [id: number];
365
392
  REMOVE_911: [callId: number];
366
393
  GET_CALLS: [data: CADGetCallsStruct];
394
+ GET_MY_CALL: [data: CADGetMyCallStruct];
367
395
  GET_ACTIVE_UNITS: [data: CADGetActiveUnitsStruct];
368
396
  KICK_UNIT: [
369
397
  apiId: string | undefined,
@@ -375,10 +403,14 @@ export interface RESTTypedAPIDataStructs {
375
403
  serverId: number,
376
404
  callId: number,
377
405
  units: string[]
406
+ ] | [
407
+ data: CADAttachUnitsStruct
378
408
  ];
379
409
  DETACH_UNIT: [
380
410
  serverId: number,
381
411
  units: string[]
412
+ ] | [
413
+ data: CADDetachUnitsStruct
382
414
  ];
383
415
  SET_CALL_POSTAL: [
384
416
  serverId: number,
@@ -395,6 +427,8 @@ export interface RESTTypedAPIDataStructs {
395
427
  serverId: number,
396
428
  callId: number,
397
429
  note: string
430
+ ] | [
431
+ data: CADAddCallNoteStruct
398
432
  ];
399
433
  CLOSE_CALL: [
400
434
  serverId: number,
@@ -645,6 +679,10 @@ export type PossibleRequestData = undefined | {
645
679
  } | {
646
680
  apiId: string;
647
681
  isPanic: boolean;
682
+ } | {
683
+ apiId?: string;
684
+ account?: string;
685
+ isPanic: boolean;
648
686
  } | {
649
687
  apiId?: string;
650
688
  account?: string;
@@ -655,10 +693,14 @@ export type PossibleRequestData = undefined | {
655
693
  } | {
656
694
  serverId: number;
657
695
  callId: number;
658
- units: string[];
696
+ units?: string[];
697
+ account?: string;
659
698
  } | {
660
699
  serverId: number;
661
- units: string[];
700
+ units?: string[];
701
+ account?: string;
702
+ } | {
703
+ account: string;
662
704
  } | {
663
705
  serverId: number;
664
706
  callId: number;
@@ -672,6 +714,7 @@ export type PossibleRequestData = undefined | {
672
714
  serverId: number;
673
715
  callId: number;
674
716
  note: string;
717
+ label?: string;
675
718
  } | {
676
719
  serverId: number;
677
720
  callId: number;
@@ -260,6 +260,12 @@ exports.EmergencyCADAPITypes = [
260
260
  method: 'POST',
261
261
  minVersion: 3
262
262
  },
263
+ {
264
+ type: 'GET_MY_CALL',
265
+ path: 'emergency/get_my_call',
266
+ method: 'POST',
267
+ minVersion: 3
268
+ },
263
269
  {
264
270
  type: 'GET_ACTIVE_UNITS',
265
271
  path: 'emergency/get_active_units',
@@ -1,7 +1,7 @@
1
1
  import { Instance } from '../instance/Instance';
2
2
  import { CADSubscriptionVersionEnum } from '../constants';
3
3
  import { REST } from '../libs/rest/src';
4
- import type { CADPenalCodeStruct, CADSetAPIIDStruct, CADNewEditRecordOptionOneStruct, CADNewEditRecordOptionTwoStruct, CADLookupByIntStruct, CADLookupStruct, CADModifyAccountPermsStruct, CADKickBanUserStruct, CADSetPostalStruct, CADModifyIdentifierStruct, CADAddBlipStruct, CADModifyBlipStruct, CADGetCallsStruct, CADGetActiveUnitsStruct, CADNewDispatchStruct, CADStreetSignStruct, CADUnitLocationStruct } from '../libs/rest/src';
4
+ import type { CADPenalCodeStruct, CADSetAPIIDStruct, CADNewEditRecordOptionOneStruct, CADNewEditRecordOptionTwoStruct, CADLookupByIntStruct, CADLookupStruct, CADModifyAccountPermsStruct, CADKickBanUserStruct, CADSetPostalStruct, CADModifyIdentifierStruct, CADAddBlipStruct, CADModifyBlipStruct, CADGetCallsStruct, CADGetMyCallStruct, CADAddCallNoteStruct, CADGetActiveUnitsStruct, CADNewDispatchStruct, CADAttachUnitsStruct, CADDetachUnitsStruct, CADStreetSignStruct, CADUnitLocationStruct, CADUnitPanicStruct } from '../libs/rest/src';
5
5
  import { BaseManager } from './BaseManager';
6
6
  import * as globalTypes from '../constants';
7
7
  import { CADServerManager } from './CADServerManager';
@@ -157,6 +157,7 @@ export declare class CADManager extends BaseManager {
157
157
  * Toggles panic state for a unit.
158
158
  */
159
159
  setUnitPanic(apiId: string | undefined, isPanic: boolean): Promise<globalTypes.CADStandardResponse>;
160
+ setUnitPanic(params: CADUnitPanicStruct): Promise<globalTypes.CADStandardResponse>;
160
161
  /**
161
162
  * Updates a unit's status.
162
163
  */
@@ -202,6 +203,10 @@ export declare class CADManager extends BaseManager {
202
203
  * Retrieves dispatch calls with optional pagination.
203
204
  */
204
205
  getCalls(options: CADGetCallsStruct): Promise<globalTypes.CADStandardResponse>;
206
+ /**
207
+ * Retrieves the current call associated with the given account UUID.
208
+ */
209
+ getMyCall(options: CADGetMyCallStruct): Promise<globalTypes.CADStandardResponse>;
205
210
  /**
206
211
  * Retrieves active units for the provided filters.
207
212
  */
@@ -217,11 +222,13 @@ export declare class CADManager extends BaseManager {
217
222
  /**
218
223
  * Attaches units to an existing dispatch call.
219
224
  */
220
- attachUnits(serverId: number, callId: number, units: string[]): Promise<globalTypes.CADStandardResponse>;
225
+ attachUnits(serverId: number, callId: number, unitsOrAccount: string[] | string): Promise<globalTypes.CADStandardResponse>;
226
+ attachUnits(params: CADAttachUnitsStruct): Promise<globalTypes.CADStandardResponse>;
221
227
  /**
222
228
  * Detaches units from dispatch calls.
223
229
  */
224
- detachUnits(serverId: number, units: string[]): Promise<globalTypes.CADStandardResponse>;
230
+ detachUnits(serverId: number, unitsOrAccount: string[] | string): Promise<globalTypes.CADStandardResponse>;
231
+ detachUnits(params: CADDetachUnitsStruct): Promise<globalTypes.CADStandardResponse>;
225
232
  /**
226
233
  * Updates the postal code on a call.
227
234
  */
@@ -233,7 +240,8 @@ export declare class CADManager extends BaseManager {
233
240
  /**
234
241
  * Adds a note to an active call.
235
242
  */
236
- addCallNote(serverId: number, callId: number, note: string): Promise<globalTypes.CADStandardResponse>;
243
+ addCallNote(serverId: number, callId: number, note: string, label?: string): Promise<globalTypes.CADStandardResponse>;
244
+ addCallNote(params: CADAddCallNoteStruct): Promise<globalTypes.CADStandardResponse>;
237
245
  /**
238
246
  * Closes a CAD call.
239
247
  */
@@ -377,11 +377,22 @@ class CADManager extends BaseManager_1.BaseManager {
377
377
  }
378
378
  return this.executeCadRequest('SET_IDENTIFIER', apiId, identId);
379
379
  }
380
- /**
381
- * Toggles panic state for a unit.
382
- */
383
- async setUnitPanic(apiId, isPanic) {
384
- return this.executeCadRequest('UNIT_PANIC', apiId, isPanic);
380
+ async setUnitPanic(apiIdOrParams, isPanic) {
381
+ let payload;
382
+ if (apiIdOrParams && typeof apiIdOrParams === 'object') {
383
+ payload = { ...apiIdOrParams };
384
+ }
385
+ else {
386
+ payload = { apiId: apiIdOrParams, isPanic: isPanic };
387
+ }
388
+ const { apiId, account, isPanic: resolvedPanic } = payload;
389
+ if (resolvedPanic === undefined) {
390
+ throw new Error('isPanic is required when setting unit panic.');
391
+ }
392
+ if (!apiId && !account) {
393
+ throw new Error('Either apiId or account is required when setting unit panic.');
394
+ }
395
+ return this.executeCadRequest('UNIT_PANIC', { apiId, account, isPanic: resolvedPanic });
385
396
  }
386
397
  async setUnitStatus(apiIdOrParams, status, serverId) {
387
398
  let payload;
@@ -471,6 +482,15 @@ class CADManager extends BaseManager_1.BaseManager {
471
482
  async getCalls(options) {
472
483
  return this.executeCadRequest('GET_CALLS', options);
473
484
  }
485
+ /**
486
+ * Retrieves the current call associated with the given account UUID.
487
+ */
488
+ async getMyCall(options) {
489
+ if (!(options === null || options === void 0 ? void 0 : options.account)) {
490
+ throw new Error('account is required when fetching current call.');
491
+ }
492
+ return this.executeCadRequest('GET_MY_CALL', options);
493
+ }
474
494
  /**
475
495
  * Retrieves active units for the provided filters.
476
496
  */
@@ -495,29 +515,58 @@ class CADManager extends BaseManager_1.BaseManager {
495
515
  async createDispatch(data) {
496
516
  return this.executeCadRequest('NEW_DISPATCH', data);
497
517
  }
498
- /**
499
- * Attaches units to an existing dispatch call.
500
- */
501
- async attachUnits(serverId, callId, units) {
502
- if (!Number.isInteger(serverId) || !Number.isInteger(callId)) {
518
+ async attachUnits(serverIdOrParams, callId, unitsOrAccount) {
519
+ let payload;
520
+ if (serverIdOrParams && typeof serverIdOrParams === 'object') {
521
+ payload = { ...serverIdOrParams };
522
+ }
523
+ else {
524
+ payload = {
525
+ serverId: serverIdOrParams,
526
+ callId: callId,
527
+ ...(Array.isArray(unitsOrAccount)
528
+ ? { units: unitsOrAccount }
529
+ : typeof unitsOrAccount === 'string'
530
+ ? { account: unitsOrAccount }
531
+ : {})
532
+ };
533
+ }
534
+ const { serverId, callId: resolvedCallId, units, account } = payload;
535
+ if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
503
536
  throw new Error('serverId and callId must be integers when attaching units.');
504
537
  }
505
- if (!Array.isArray(units) || units.length === 0) {
506
- throw new Error('units must include at least one entry when attaching.');
538
+ const hasUnits = Array.isArray(units) && units.length > 0;
539
+ const hasAccount = typeof account === 'string' && account.length > 0;
540
+ if (!hasUnits && !hasAccount) {
541
+ throw new Error('Either units or account is required when attaching units.');
507
542
  }
508
- return this.executeCadRequest('ATTACH_UNIT', serverId, callId, units);
543
+ return this.executeCadRequest('ATTACH_UNIT', { serverId, callId: resolvedCallId, units: hasUnits ? units : undefined, account: hasAccount ? account : undefined });
509
544
  }
510
- /**
511
- * Detaches units from dispatch calls.
512
- */
513
- async detachUnits(serverId, units) {
545
+ async detachUnits(serverIdOrParams, unitsOrAccount) {
546
+ let payload;
547
+ if (serverIdOrParams && typeof serverIdOrParams === 'object') {
548
+ payload = { ...serverIdOrParams };
549
+ }
550
+ else {
551
+ payload = {
552
+ serverId: serverIdOrParams,
553
+ ...(Array.isArray(unitsOrAccount)
554
+ ? { units: unitsOrAccount }
555
+ : typeof unitsOrAccount === 'string'
556
+ ? { account: unitsOrAccount }
557
+ : {})
558
+ };
559
+ }
560
+ const { serverId, units, account } = payload;
514
561
  if (!Number.isInteger(serverId)) {
515
562
  throw new Error('serverId must be an integer when detaching units.');
516
563
  }
517
- if (!Array.isArray(units) || units.length === 0) {
518
- throw new Error('units must include at least one entry when detaching.');
564
+ const hasUnits = Array.isArray(units) && units.length > 0;
565
+ const hasAccount = typeof account === 'string' && account.length > 0;
566
+ if (!hasUnits && !hasAccount) {
567
+ throw new Error('Either units or account is required when detaching units.');
519
568
  }
520
- return this.executeCadRequest('DETACH_UNIT', serverId, units);
569
+ return this.executeCadRequest('DETACH_UNIT', { serverId, units: hasUnits ? units : undefined, account: hasAccount ? account : undefined });
521
570
  }
522
571
  /**
523
572
  * Updates the postal code on a call.
@@ -540,17 +589,22 @@ class CADManager extends BaseManager_1.BaseManager {
540
589
  }
541
590
  return this.executeCadRequest('SET_CALL_PRIMARY', serverId, callId, primary, trackPrimary);
542
591
  }
543
- /**
544
- * Adds a note to an active call.
545
- */
546
- async addCallNote(serverId, callId, note) {
547
- if (!Number.isInteger(serverId) || !Number.isInteger(callId)) {
592
+ async addCallNote(serverIdOrParams, callId, note, label) {
593
+ let payload;
594
+ if (serverIdOrParams && typeof serverIdOrParams === 'object') {
595
+ payload = { ...serverIdOrParams };
596
+ }
597
+ else {
598
+ payload = { serverId: serverIdOrParams, callId: callId, note: note, label };
599
+ }
600
+ const { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel } = payload;
601
+ if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
548
602
  throw new Error('serverId and callId must be integers when adding a call note.');
549
603
  }
550
- if (!note) {
604
+ if (!resolvedNote) {
551
605
  throw new Error('note is required when adding a call note.');
552
606
  }
553
- return this.executeCadRequest('ADD_CALL_NOTE', serverId, callId, note);
607
+ return this.executeCadRequest('ADD_CALL_NOTE', { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel });
554
608
  }
555
609
  /**
556
610
  * Closes a CAD call.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.47",
3
+ "version": "1.0.49",
4
4
  "description": "Sonoran.js is a library that allows you to interact with the Sonoran CAD and Sonoran CMS API. Based off of and utilizes several Discord.js library techniques for ease of use.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -44,5 +44,6 @@
44
44
  "node-abort-controller": "^3.0.1",
45
45
  "node-fetch": "^2.6.5"
46
46
  },
47
- "prepublish": "npm run build"
47
+ "prepublish": "npm run build",
48
+ "packageManager": "pnpm@10.26.0+sha512.3b3f6c725ebe712506c0ab1ad4133cf86b1f4b687effce62a9b38b4d72e3954242e643190fc51fa1642949c735f403debd44f5cb0edd657abe63a8b6a7e1e402"
48
49
  }
package/readme.md CHANGED
@@ -104,7 +104,7 @@ const lookupByAccount = await instance.cad.lookupRecords({ account: 'd5663516-ee
104
104
  ### Identifiers & Units
105
105
  - **`getIdentifiers(apiId)`**
106
106
  - **`modifyIdentifier(change)`** / **`setIdentifier(apiId?, identId)`**
107
- - **`setUnitPanic(apiId?, isPanic)`** / **`setUnitStatus({ status, serverId, apiId?, account? })`**
107
+ - **`setUnitPanic({ apiId?, account?, isPanic })`** / **`setUnitStatus({ status, serverId, apiId?, account? })`**
108
108
  - **`getActiveUnits(options)`** - direct CAD fetch for active units.
109
109
  - **`kickUnit(apiId?, reason, serverId)`**
110
110
  - **`updateUnitLocations(locations)`**
@@ -114,6 +114,8 @@ const lookupByAccount = await instance.cad.lookupRecords({ account: 'd5663516-ee
114
114
  await instance.cad.setUnitStatus({ account: 'd5663516-ee35-11e9-9714-5600023b2434', status: 2, serverId: 1 });
115
115
  // Legacy positional call using an API ID
116
116
  await instance.cad.setUnitStatus('1234567890', 2, 1);
117
+ // Trigger panic using account UUID
118
+ await instance.cad.setUnitPanic({ account: '91de0ce8-c571-11e9-9714-5600023b2434', isPanic: true });
117
119
  ```
118
120
 
119
121
  ### Map & Streetsigns
@@ -125,10 +127,11 @@ await instance.cad.setUnitStatus('1234567890', 2, 1);
125
127
  ### Calls & Dispatch
126
128
  - **`create911Call(details)`** / **`remove911Call(callId)`**
127
129
  - **`getCalls(options)`**
130
+ - **`getMyCall({ account })`**
128
131
  - **`createDispatch(data)`**
129
- - **`attachUnits(serverId, callId, units)`** / **`detachUnits(serverId, units)`**
132
+ - **`attachUnits(serverId, callId, unitsOrAccount)`** / **`detachUnits(serverId, unitsOrAccount)`**
130
133
  - **`setCallPostal(serverId, callId, postal)`** / **`setCallPrimary(serverId, callId, primary, trackPrimary)`**
131
- - **`addCallNote(serverId, callId, note)`**
134
+ - **`addCallNote({ serverId, callId, note, label? })`**
132
135
  - **`closeCall(serverId, callId)`**
133
136
 
134
137
  ```js
@@ -149,6 +152,14 @@ const dispatch = await instance.cad.createDispatch({
149
152
  units: ['unit-1']
150
153
  });
151
154
  await instance.cad.attachUnits(1, 1001, ['unit-2']);
155
+ // Or attach a single unit by account UUID
156
+ await instance.cad.attachUnits({ serverId: 1, callId: 1001, account: '91de0ce8-c571-11e9-9714-5600023b2434' });
157
+ // Detach using account UUID
158
+ await instance.cad.detachUnits({ serverId: 1, account: '91de0ce8-c571-11e9-9714-5600023b2434' });
159
+ // Fetch the current call for an account UUID
160
+ const myCall = await instance.cad.getMyCall({ account: '91de0ce8-c571-11e9-9714-5600023b2434' });
161
+ // Add a call note with optional label
162
+ await instance.cad.addCallNote({ serverId: 1, callId: 1001, note: 'This is a test!', label: 'A-10' });
152
163
  ```
153
164
 
154
165
  ## CAD Server Functions
@@ -459,7 +470,7 @@ const user = await instance.radio.getConnectedUser(1, 'account-uuid');
459
470
  ### setUserChannels(roomId, identity, options)
460
471
  Updates a user's transmit or scan channels for a specific radio room.
461
472
  ```js
462
- await instance.radio.setUserChannels(1, 'account-uuid', { transmit: 12, scan: [10, 11, 12] });
473
+ await instance.radio.setUserChannels(1, 'account-uuid', { transmit: [12], scan: [10, 11, 12] });
463
474
  ```
464
475
 
465
476
  ### setUserDisplayName(accId, displayName)
package/src/constants.ts CHANGED
@@ -569,7 +569,7 @@ export interface RadioTonePlayTarget {
569
569
  }
570
570
 
571
571
  export interface RadioSetUserChannelsOptions {
572
- transmit?: number;
572
+ transmit?: number[];
573
573
  scan?: number[];
574
574
  }
575
575
 
@@ -245,6 +245,13 @@ export class REST extends EventEmitter {
245
245
  case 'GET_PROFILE_FIELDS': {
246
246
  return {};
247
247
  }
248
+ case 'GET_MY_CALL': {
249
+ const payload = args[0];
250
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
251
+ return payload;
252
+ }
253
+ return { account: args[0] };
254
+ }
248
255
  case 'SET_CLOCK': {
249
256
  if (args[0] && typeof args[0] === 'object' && !Array.isArray(args[0])) {
250
257
  return args[0];
@@ -299,6 +306,18 @@ export class REST extends EventEmitter {
299
306
  type: args[5]
300
307
  };
301
308
  }
309
+ case 'ADD_CALL_NOTE': {
310
+ const payload = args[0];
311
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
312
+ return payload;
313
+ }
314
+ return {
315
+ serverId: args[0],
316
+ callId: args[1],
317
+ note: args[2],
318
+ label: args[3]
319
+ };
320
+ }
302
321
  case 'UNIT_STATUS': {
303
322
  const payload = args[0];
304
323
  if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
@@ -316,6 +335,46 @@ export class REST extends EventEmitter {
316
335
  serverId: args[2]
317
336
  };
318
337
  }
338
+ case 'UNIT_PANIC': {
339
+ const payload = args[0];
340
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
341
+ const { apiId, account, isPanic } = payload as { apiId?: string; account?: string; isPanic: boolean };
342
+ return { apiId, account, isPanic };
343
+ }
344
+ return {
345
+ apiId: args[0],
346
+ isPanic: args[1]
347
+ };
348
+ }
349
+ case 'ATTACH_UNIT': {
350
+ const payload = args[0];
351
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
352
+ return payload;
353
+ }
354
+ const unitsOrAccount = args[2];
355
+ const account = typeof unitsOrAccount === 'string' && !Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
356
+ const units = Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
357
+ return {
358
+ serverId: args[0],
359
+ callId: args[1],
360
+ units,
361
+ account
362
+ };
363
+ }
364
+ case 'DETACH_UNIT': {
365
+ const payload = args[0];
366
+ if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
367
+ return payload;
368
+ }
369
+ const unitsOrAccount = args[1];
370
+ const account = typeof unitsOrAccount === 'string' && !Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
371
+ const units = Array.isArray(unitsOrAccount) ? unitsOrAccount : undefined;
372
+ return {
373
+ serverId: args[0],
374
+ units,
375
+ account
376
+ };
377
+ }
319
378
  case 'CHECK_COM_APIID': {
320
379
  return {
321
380
  apiId: args[0]
@@ -276,6 +276,17 @@ export class RequestManager extends EventEmitter {
276
276
  apiData.data.data = [clonedData[0]];
277
277
  break;
278
278
  }
279
+ case 'GET_MY_CALL': {
280
+ const payload = data.data;
281
+ if (Array.isArray(payload)) {
282
+ apiData.data.data = payload.length > 0 ? payload : [];
283
+ } else if (payload !== undefined && payload !== null) {
284
+ apiData.data.data = [payload];
285
+ } else {
286
+ apiData.data.data = [];
287
+ }
288
+ break;
289
+ }
279
290
  case 'GET_ACTIVE_UNITS': {
280
291
  apiData.data.data = [clonedData[0]];
281
292
  break;
@@ -284,6 +295,50 @@ export class RequestManager extends EventEmitter {
284
295
  apiData.data.data = [clonedData[0]];
285
296
  break;
286
297
  }
298
+ case 'ADD_CALL_NOTE': {
299
+ const payload = data.data;
300
+ if (Array.isArray(payload)) {
301
+ apiData.data.data = payload;
302
+ } else if (payload !== undefined && payload !== null) {
303
+ apiData.data.data = [payload];
304
+ } else {
305
+ apiData.data.data = [];
306
+ }
307
+ break;
308
+ }
309
+ case 'UNIT_PANIC': {
310
+ const payload = data.data;
311
+ if (Array.isArray(payload)) {
312
+ apiData.data.data = payload;
313
+ } else if (payload !== undefined && payload !== null) {
314
+ apiData.data.data = [payload];
315
+ } else {
316
+ apiData.data.data = [];
317
+ }
318
+ break;
319
+ }
320
+ case 'ATTACH_UNIT': {
321
+ const payload = data.data;
322
+ if (Array.isArray(payload)) {
323
+ apiData.data.data = payload;
324
+ } else if (payload !== undefined && payload !== null) {
325
+ apiData.data.data = [payload];
326
+ } else {
327
+ apiData.data.data = [];
328
+ }
329
+ break;
330
+ }
331
+ case 'DETACH_UNIT': {
332
+ const payload = data.data;
333
+ if (Array.isArray(payload)) {
334
+ apiData.data.data = payload;
335
+ } else if (payload !== undefined && payload !== null) {
336
+ apiData.data.data = [payload];
337
+ } else {
338
+ apiData.data.data = [];
339
+ }
340
+ break;
341
+ }
287
342
  case 'UNIT_LOCATION': {
288
343
  apiData.data.data = [clonedData[0]];
289
344
  break;
@@ -415,11 +470,25 @@ export class RequestManager extends EventEmitter {
415
470
  path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}/${encodeSegment(roomIdNumeric)}/${encodeSegment(identity)}`;
416
471
  method = 'POST';
417
472
  const requestBody: Record<string, unknown> = {};
418
- if (options?.transmit !== undefined) {
419
- requestBody.transmit = options.transmit;
473
+ const normalizeNumberArray = (label: string, value: unknown) => {
474
+ if (value === undefined) return undefined;
475
+ const asArray = Array.isArray(value) ? value : [value];
476
+ const numbers = asArray.map((entry) => {
477
+ const numeric = typeof entry === 'number' ? entry : Number(entry);
478
+ if (Number.isNaN(numeric)) {
479
+ throw new Error(`${label} must be a number or array of numbers for RADIO_SET_USER_CHANNELS requests.`);
480
+ }
481
+ return numeric;
482
+ });
483
+ return numbers;
484
+ };
485
+ const transmit = normalizeNumberArray('transmit', options?.transmit);
486
+ if (transmit !== undefined) {
487
+ requestBody.transmit = transmit;
420
488
  }
421
- if (options?.scan !== undefined) {
422
- requestBody.scan = options.scan;
489
+ const scan = normalizeNumberArray('scan', options?.scan);
490
+ if (scan !== undefined) {
491
+ requestBody.scan = scan;
423
492
  }
424
493
  body = requestBody;
425
494
  break;
@@ -291,6 +291,12 @@ export const EmergencyCADAPITypes: APITypeData[] = [
291
291
  method: 'POST',
292
292
  minVersion: 3
293
293
  },
294
+ {
295
+ type: 'GET_MY_CALL',
296
+ path: 'emergency/get_my_call',
297
+ method: 'POST',
298
+ minVersion: 3
299
+ },
294
300
  {
295
301
  type: 'GET_ACTIVE_UNITS',
296
302
  path: 'emergency/get_active_units',
@@ -637,7 +643,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
637
643
 
638
644
  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) ];
639
645
 
640
- 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_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | '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' | 'ERLC_EXECUTE_COMMAND' | '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' | 'PLAY_TONE';
646
+ 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_MY_CALL' | '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_CLOCKIN_TYPES' | 'GET_LATEST_ACTIVITY' | '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' | 'ERLC_EXECUTE_COMMAND' | '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' | 'PLAY_TONE';
641
647
 
642
648
  export interface CMSServerAPIStruct {
643
649
  id: number;
@@ -853,6 +859,17 @@ export interface CADGetCallsStruct {
853
859
  closedOffset?: number;
854
860
  }
855
861
 
862
+ export interface CADGetMyCallStruct {
863
+ account: string;
864
+ }
865
+
866
+ export interface CADAddCallNoteStruct {
867
+ serverId: number;
868
+ callId: number;
869
+ note: string;
870
+ label?: string;
871
+ }
872
+
856
873
  export interface CADGetActiveUnitsStruct {
857
874
  serverId?: number;
858
875
  onlyUnits?: boolean;
@@ -861,6 +878,25 @@ export interface CADGetActiveUnitsStruct {
861
878
  offset?: number;
862
879
  }
863
880
 
881
+ export interface CADAttachUnitsStruct {
882
+ serverId: number;
883
+ callId: number;
884
+ units?: string[];
885
+ account?: string;
886
+ }
887
+
888
+ export interface CADDetachUnitsStruct {
889
+ serverId: number;
890
+ units?: string[];
891
+ account?: string;
892
+ }
893
+
894
+ export interface CADUnitPanicStruct {
895
+ apiId?: string;
896
+ account?: string;
897
+ isPanic: boolean;
898
+ }
899
+
864
900
  export enum CADDispatchOriginEnums {
865
901
  Caller,
866
902
  RadioDispatch,
@@ -980,6 +1016,8 @@ export interface RESTTypedAPIDataStructs {
980
1016
  UNIT_PANIC: [
981
1017
  apiId: string | undefined,
982
1018
  isPanic: boolean
1019
+ ] | [
1020
+ data: CADUnitPanicStruct
983
1021
  ];
984
1022
  UNIT_STATUS: [
985
1023
  apiId: string | undefined,
@@ -994,6 +1032,7 @@ export interface RESTTypedAPIDataStructs {
994
1032
  REMOVE_BLIP: [id: number];
995
1033
  REMOVE_911: [callId: number];
996
1034
  GET_CALLS: [data: CADGetCallsStruct];
1035
+ GET_MY_CALL: [data: CADGetMyCallStruct];
997
1036
  GET_ACTIVE_UNITS: [data: CADGetActiveUnitsStruct];
998
1037
  KICK_UNIT: [
999
1038
  apiId: string | undefined,
@@ -1005,10 +1044,14 @@ export interface RESTTypedAPIDataStructs {
1005
1044
  serverId: number,
1006
1045
  callId: number,
1007
1046
  units: string[]
1047
+ ] | [
1048
+ data: CADAttachUnitsStruct
1008
1049
  ];
1009
1050
  DETACH_UNIT: [
1010
1051
  serverId: number,
1011
1052
  units: string[]
1053
+ ] | [
1054
+ data: CADDetachUnitsStruct
1012
1055
  ];
1013
1056
  SET_CALL_POSTAL: [
1014
1057
  serverId: number,
@@ -1025,6 +1068,8 @@ export interface RESTTypedAPIDataStructs {
1025
1068
  serverId: number,
1026
1069
  callId: number,
1027
1070
  note: string
1071
+ ] | [
1072
+ data: CADAddCallNoteStruct
1028
1073
  ];
1029
1074
  CLOSE_CALL: [
1030
1075
  serverId: number,
@@ -1297,6 +1342,11 @@ export type PossibleRequestData =
1297
1342
  apiId: string;
1298
1343
  isPanic: boolean;
1299
1344
  } |
1345
+ {
1346
+ apiId?: string;
1347
+ account?: string;
1348
+ isPanic: boolean;
1349
+ } |
1300
1350
  {
1301
1351
  apiId?: string;
1302
1352
  account?: string;
@@ -1309,11 +1359,16 @@ export type PossibleRequestData =
1309
1359
  {
1310
1360
  serverId: number;
1311
1361
  callId: number;
1312
- units: string[];
1362
+ units?: string[];
1363
+ account?: string;
1313
1364
  } |
1314
1365
  {
1315
1366
  serverId: number;
1316
- units: string[];
1367
+ units?: string[];
1368
+ account?: string;
1369
+ } |
1370
+ {
1371
+ account: string;
1317
1372
  } |
1318
1373
  {
1319
1374
  serverId: number;
@@ -1330,6 +1385,7 @@ export type PossibleRequestData =
1330
1385
  serverId: number;
1331
1386
  callId: number;
1332
1387
  note: string;
1388
+ label?: string;
1333
1389
  } |
1334
1390
  {
1335
1391
  serverId: number;
@@ -16,11 +16,16 @@ import type {
16
16
  CADAddBlipStruct,
17
17
  CADModifyBlipStruct,
18
18
  CADGetCallsStruct,
19
+ CADGetMyCallStruct,
20
+ CADAddCallNoteStruct,
19
21
  CADGetActiveUnitsStruct,
20
22
  CADNewDispatchStruct,
23
+ CADAttachUnitsStruct,
24
+ CADDetachUnitsStruct,
21
25
  CADStreetSignStruct,
22
26
  CADUnitLocationStruct,
23
- CADUnitStatusStruct
27
+ CADUnitStatusStruct,
28
+ CADUnitPanicStruct
24
29
  } from '../libs/rest/src';
25
30
  import { BaseManager } from './BaseManager';
26
31
  import * as globalTypes from '../constants';
@@ -400,8 +405,23 @@ export class CADManager extends BaseManager {
400
405
  /**
401
406
  * Toggles panic state for a unit.
402
407
  */
403
- public async setUnitPanic(apiId: string | undefined, isPanic: boolean): Promise<globalTypes.CADStandardResponse> {
404
- return this.executeCadRequest('UNIT_PANIC', apiId, isPanic);
408
+ public async setUnitPanic(apiId: string | undefined, isPanic: boolean): Promise<globalTypes.CADStandardResponse>;
409
+ public async setUnitPanic(params: CADUnitPanicStruct): Promise<globalTypes.CADStandardResponse>;
410
+ public async setUnitPanic(apiIdOrParams: string | CADUnitPanicStruct | undefined, isPanic?: boolean): Promise<globalTypes.CADStandardResponse> {
411
+ let payload: CADUnitPanicStruct;
412
+ if (apiIdOrParams && typeof apiIdOrParams === 'object') {
413
+ payload = { ...apiIdOrParams };
414
+ } else {
415
+ payload = { apiId: apiIdOrParams as string | undefined, isPanic: isPanic as boolean };
416
+ }
417
+ const { apiId, account, isPanic: resolvedPanic } = payload;
418
+ if (resolvedPanic === undefined) {
419
+ throw new Error('isPanic is required when setting unit panic.');
420
+ }
421
+ if (!apiId && !account) {
422
+ throw new Error('Either apiId or account is required when setting unit panic.');
423
+ }
424
+ return this.executeCadRequest('UNIT_PANIC', { apiId, account, isPanic: resolvedPanic });
405
425
  }
406
426
 
407
427
  /**
@@ -508,6 +528,16 @@ export class CADManager extends BaseManager {
508
528
  return this.executeCadRequest('GET_CALLS', options);
509
529
  }
510
530
 
531
+ /**
532
+ * Retrieves the current call associated with the given account UUID.
533
+ */
534
+ public async getMyCall(options: CADGetMyCallStruct): Promise<globalTypes.CADStandardResponse> {
535
+ if (!options?.account) {
536
+ throw new Error('account is required when fetching current call.');
537
+ }
538
+ return this.executeCadRequest('GET_MY_CALL', options);
539
+ }
540
+
511
541
  /**
512
542
  * Retrieves active units for the provided filters.
513
543
  */
@@ -538,27 +568,73 @@ export class CADManager extends BaseManager {
538
568
  /**
539
569
  * Attaches units to an existing dispatch call.
540
570
  */
541
- public async attachUnits(serverId: number, callId: number, units: string[]): Promise<globalTypes.CADStandardResponse> {
542
- if (!Number.isInteger(serverId) || !Number.isInteger(callId)) {
571
+ public async attachUnits(serverId: number, callId: number, unitsOrAccount: string[] | string): Promise<globalTypes.CADStandardResponse>;
572
+ public async attachUnits(params: CADAttachUnitsStruct): Promise<globalTypes.CADStandardResponse>;
573
+ public async attachUnits(
574
+ serverIdOrParams: number | CADAttachUnitsStruct,
575
+ callId?: number,
576
+ unitsOrAccount?: string[] | string
577
+ ): Promise<globalTypes.CADStandardResponse> {
578
+ let payload: CADAttachUnitsStruct;
579
+ if (serverIdOrParams && typeof serverIdOrParams === 'object') {
580
+ payload = { ...serverIdOrParams };
581
+ } else {
582
+ payload = {
583
+ serverId: serverIdOrParams as number,
584
+ callId: callId as number,
585
+ ...(Array.isArray(unitsOrAccount)
586
+ ? { units: unitsOrAccount }
587
+ : typeof unitsOrAccount === 'string'
588
+ ? { account: unitsOrAccount }
589
+ : {})
590
+ };
591
+ }
592
+
593
+ const { serverId, callId: resolvedCallId, units, account } = payload;
594
+ if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
543
595
  throw new Error('serverId and callId must be integers when attaching units.');
544
596
  }
545
- if (!Array.isArray(units) || units.length === 0) {
546
- throw new Error('units must include at least one entry when attaching.');
597
+ const hasUnits = Array.isArray(units) && units.length > 0;
598
+ const hasAccount = typeof account === 'string' && account.length > 0;
599
+ if (!hasUnits && !hasAccount) {
600
+ throw new Error('Either units or account is required when attaching units.');
547
601
  }
548
- return this.executeCadRequest('ATTACH_UNIT', serverId, callId, units);
602
+ return this.executeCadRequest('ATTACH_UNIT', { serverId, callId: resolvedCallId, units: hasUnits ? units : undefined, account: hasAccount ? account : undefined });
549
603
  }
550
604
 
551
605
  /**
552
606
  * Detaches units from dispatch calls.
553
607
  */
554
- public async detachUnits(serverId: number, units: string[]): Promise<globalTypes.CADStandardResponse> {
608
+ public async detachUnits(serverId: number, unitsOrAccount: string[] | string): Promise<globalTypes.CADStandardResponse>;
609
+ public async detachUnits(params: CADDetachUnitsStruct): Promise<globalTypes.CADStandardResponse>;
610
+ public async detachUnits(
611
+ serverIdOrParams: number | CADDetachUnitsStruct,
612
+ unitsOrAccount?: string[] | string
613
+ ): Promise<globalTypes.CADStandardResponse> {
614
+ let payload: CADDetachUnitsStruct;
615
+ if (serverIdOrParams && typeof serverIdOrParams === 'object') {
616
+ payload = { ...serverIdOrParams };
617
+ } else {
618
+ payload = {
619
+ serverId: serverIdOrParams as number,
620
+ ...(Array.isArray(unitsOrAccount)
621
+ ? { units: unitsOrAccount }
622
+ : typeof unitsOrAccount === 'string'
623
+ ? { account: unitsOrAccount }
624
+ : {})
625
+ };
626
+ }
627
+
628
+ const { serverId, units, account } = payload;
555
629
  if (!Number.isInteger(serverId)) {
556
630
  throw new Error('serverId must be an integer when detaching units.');
557
631
  }
558
- if (!Array.isArray(units) || units.length === 0) {
559
- throw new Error('units must include at least one entry when detaching.');
632
+ const hasUnits = Array.isArray(units) && units.length > 0;
633
+ const hasAccount = typeof account === 'string' && account.length > 0;
634
+ if (!hasUnits && !hasAccount) {
635
+ throw new Error('Either units or account is required when detaching units.');
560
636
  }
561
- return this.executeCadRequest('DETACH_UNIT', serverId, units);
637
+ return this.executeCadRequest('DETACH_UNIT', { serverId, units: hasUnits ? units : undefined, account: hasAccount ? account : undefined });
562
638
  }
563
639
 
564
640
  /**
@@ -587,14 +663,28 @@ export class CADManager extends BaseManager {
587
663
  /**
588
664
  * Adds a note to an active call.
589
665
  */
590
- public async addCallNote(serverId: number, callId: number, note: string): Promise<globalTypes.CADStandardResponse> {
591
- if (!Number.isInteger(serverId) || !Number.isInteger(callId)) {
666
+ public async addCallNote(serverId: number, callId: number, note: string, label?: string): Promise<globalTypes.CADStandardResponse>;
667
+ public async addCallNote(params: CADAddCallNoteStruct): Promise<globalTypes.CADStandardResponse>;
668
+ public async addCallNote(
669
+ serverIdOrParams: number | CADAddCallNoteStruct,
670
+ callId?: number,
671
+ note?: string,
672
+ label?: string
673
+ ): Promise<globalTypes.CADStandardResponse> {
674
+ let payload: CADAddCallNoteStruct;
675
+ if (serverIdOrParams && typeof serverIdOrParams === 'object') {
676
+ payload = { ...serverIdOrParams };
677
+ } else {
678
+ payload = { serverId: serverIdOrParams as number, callId: callId as number, note: note as string, label };
679
+ }
680
+ const { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel } = payload;
681
+ if (!Number.isInteger(serverId) || !Number.isInteger(resolvedCallId)) {
592
682
  throw new Error('serverId and callId must be integers when adding a call note.');
593
683
  }
594
- if (!note) {
684
+ if (!resolvedNote) {
595
685
  throw new Error('note is required when adding a call note.');
596
686
  }
597
- return this.executeCadRequest('ADD_CALL_NOTE', serverId, callId, note);
687
+ return this.executeCadRequest('ADD_CALL_NOTE', { serverId, callId: resolvedCallId, note: resolvedNote, label: resolvedLabel });
598
688
  }
599
689
 
600
690
  /**