@sonoransoftware/sonoran.js 1.0.37 → 1.0.39

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.
@@ -394,6 +394,18 @@ export interface CMSERLCAddNewRecordPromiseResult {
394
394
  reason?: string;
395
395
  logId?: string;
396
396
  }
397
+ export interface CMSERLCExecuteCommandPayload {
398
+ serverId: string;
399
+ type: string;
400
+ args: unknown;
401
+ discordId: string | number;
402
+ includesPlayerNameOrId: boolean;
403
+ }
404
+ export interface CMSERLCExecuteCommandPromiseResult {
405
+ success: boolean;
406
+ reason?: string;
407
+ data?: unknown;
408
+ }
397
409
  export interface RadioChannelGroup {
398
410
  id: number;
399
411
  name: string;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './instance/Instance';
2
2
  export * from './builders';
3
3
  export * from './libs/rest/src';
4
- export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum, RadioSubscriptionLevel, RadioSetUserChannelsOptions, RadioChannel, RadioChannelGroup, RadioConnectedUser, RadioSpeakerLocation, RadioGetCommunityChannelsPromiseResult, RadioGetConnectedUsersPromiseResult, RadioGetConnectedUserPromiseResult, RadioSetUserChannelsPromiseResult, RadioSetUserDisplayNamePromiseResult, RadioGetServerSubscriptionFromIpPromiseResult, RadioSetServerIpPromiseResult, RadioSetInGameSpeakerLocationsPromiseResult, CADSetClockTimePromiseResult, CADJoinCommunityPromiseResult, CADLeaveCommunityPromiseResult, CADStandardResponse, CMSProfileField, CMSGetCurrentClockInPromiseResult, CMSAccountsPage, CMSAccountSummary, CMSGetAccountsPromiseResult, CMSGetProfileFieldsPromiseResult, CMSProfileFieldUpdate, CMSEditAccountProfileFieldsPromiseResult, CMSRsvpPromiseResult, CMSChangeFormStagePromiseResult, CMSSetGameServerStruct, CMSSetGameServersPromiseResult, CMSExecuteRankPromotionResult, CMSTriggerPromotionFlowPayload, CMSPromotionFlow, CMSTriggerPromotionFlowsPromiseResult, CMSGetPromotionFlowsPromiseResult, CMSGetFormSubmissionsPromiseResult } from './constants';
4
+ export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum, RadioSubscriptionLevel, RadioSetUserChannelsOptions, RadioChannel, RadioChannelGroup, RadioConnectedUser, RadioSpeakerLocation, RadioGetCommunityChannelsPromiseResult, RadioGetConnectedUsersPromiseResult, RadioGetConnectedUserPromiseResult, RadioSetUserChannelsPromiseResult, RadioSetUserDisplayNamePromiseResult, RadioGetServerSubscriptionFromIpPromiseResult, RadioSetServerIpPromiseResult, RadioSetInGameSpeakerLocationsPromiseResult, CADSetClockTimePromiseResult, CADJoinCommunityPromiseResult, CADLeaveCommunityPromiseResult, CADStandardResponse, CMSProfileField, CMSGetCurrentClockInPromiseResult, CMSAccountsPage, CMSAccountSummary, CMSGetAccountsPromiseResult, CMSGetProfileFieldsPromiseResult, CMSProfileFieldUpdate, CMSEditAccountProfileFieldsPromiseResult, CMSRsvpPromiseResult, CMSChangeFormStagePromiseResult, CMSSetGameServerStruct, CMSSetGameServersPromiseResult, CMSExecuteRankPromotionResult, CMSTriggerPromotionFlowPayload, CMSPromotionFlow, CMSTriggerPromotionFlowsPromiseResult, CMSGetPromotionFlowsPromiseResult, CMSGetFormSubmissionsPromiseResult, CMSERLCGetOnlinePlayersPromiseResult, CMSERLCGetPlayerQueuePromiseResult, CMSERLCAddNewRecordPromiseResult, CMSERLCExecuteCommandPayload, CMSERLCExecuteCommandPromiseResult } from './constants';
@@ -300,6 +300,22 @@ class REST extends events_1.EventEmitter {
300
300
  points: args[6],
301
301
  };
302
302
  }
303
+ case 'ERLC_EXECUTE_COMMAND': {
304
+ const payload = args[0];
305
+ if (!Array.isArray(payload)) {
306
+ throw new Error('ERLC_EXECUTE_COMMAND requires an array of command payloads.');
307
+ }
308
+ return payload.map((cmd) => {
309
+ const serverId = cmd.serverId;
310
+ if (typeof serverId !== 'string' || serverId.length === 0) {
311
+ throw new Error('ERLC_EXECUTE_COMMAND requires each command to include a valid serverId.');
312
+ }
313
+ return {
314
+ ...cmd,
315
+ serverId
316
+ };
317
+ });
318
+ }
303
319
  case 'RADIO_GET_COMMUNITY_CHANNELS':
304
320
  case 'RADIO_GET_CONNECTED_USERS':
305
321
  case 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP': {
@@ -101,6 +101,10 @@ class RequestManager extends events_1.EventEmitter {
101
101
  apiData.data.data = [];
102
102
  break;
103
103
  }
104
+ case 'ERLC_EXECUTE_COMMAND': {
105
+ apiData.data.data = clonedData;
106
+ break;
107
+ }
104
108
  case 'SET_PENAL_CODES': {
105
109
  apiData.data.data = [clonedData[0]];
106
110
  break;
@@ -1,4 +1,4 @@
1
- import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload } from '../../../../../constants';
1
+ import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload, CMSERLCExecuteCommandPayload } from '../../../../../constants';
2
2
  import type { RESTOptions } from '../REST';
3
3
  export declare const DefaultUserAgent = "Sonoran.js NPM Module";
4
4
  export declare const DefaultCADRestOptions: Required<RESTOptions>;
@@ -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_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' | '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_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' | '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;
@@ -555,6 +555,9 @@ export interface RESTTypedAPIDataStructs {
555
555
  playerRobloxId?: string | number,
556
556
  points?: number
557
557
  ];
558
+ ERLC_EXECUTE_COMMAND: [
559
+ commands: CMSERLCExecuteCommandPayload[]
560
+ ];
558
561
  RADIO_GET_COMMUNITY_CHANNELS: [];
559
562
  RADIO_GET_CONNECTED_USERS: [];
560
563
  RADIO_GET_CONNECTED_USER: [
@@ -511,6 +511,12 @@ exports.ERLCMSAPITypes = [
511
511
  path: "erlc/add_new_record",
512
512
  method: "POST",
513
513
  minVersion: 0
514
+ },
515
+ {
516
+ type: "ERLC_EXECUTE_COMMAND",
517
+ path: "erlc/command",
518
+ method: "POST",
519
+ minVersion: 0
514
520
  }
515
521
  ];
516
522
  exports.RadioAPITypes = [
@@ -260,6 +260,10 @@ export declare class CMSManager extends BaseManager {
260
260
  * @returns {Promise} Promise object indicates success and includes the queue count when successful.
261
261
  */
262
262
  erlcGetPlayerQueue(robloxJoinCode: string): Promise<globalTypes.CMSERLCGetPlayerQueuePromiseResult>;
263
+ /**
264
+ * Sends an ERLC command payload to CMS.
265
+ */
266
+ erlcExecuteCommand(commands: globalTypes.CMSERLCExecuteCommandPayload[]): Promise<globalTypes.CMSERLCExecuteCommandPromiseResult>;
263
267
  /**
264
268
  * Adds a new ERLC record for a player.
265
269
  * @param {Object} data The object that contains critical data to add a new ERLC record.
@@ -627,6 +627,53 @@ class CMSManager extends BaseManager_1.BaseManager {
627
627
  }
628
628
  });
629
629
  }
630
+ /**
631
+ * Sends an ERLC command payload to CMS.
632
+ */
633
+ async erlcExecuteCommand(commands) {
634
+ if (!Array.isArray(commands) || commands.length === 0) {
635
+ throw new Error('ERLC execute command requires at least one command payload.');
636
+ }
637
+ const normalizedCommands = commands.map((cmd) => {
638
+ const type = cmd.type;
639
+ const args = cmd.args;
640
+ const discordId = cmd.discordId;
641
+ const includesPlayerNameOrId = cmd.includesPlayerNameOrId;
642
+ const serverId = cmd.serverId;
643
+ if (!type) {
644
+ throw new Error('Each ERLC command requires a type.');
645
+ }
646
+ if (!discordId) {
647
+ throw new Error('Each ERLC command requires a discordId.');
648
+ }
649
+ if (typeof serverId !== 'string' || serverId.length === 0) {
650
+ throw new Error('Each ERLC command requires a serverId.');
651
+ }
652
+ return {
653
+ ...cmd,
654
+ type,
655
+ args,
656
+ discordId,
657
+ includesPlayerNameOrId,
658
+ serverId,
659
+ };
660
+ });
661
+ return new Promise(async (resolve, reject) => {
662
+ var _a;
663
+ try {
664
+ const erlcExecuteCommandRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('ERLC_EXECUTE_COMMAND', normalizedCommands));
665
+ resolve({ success: true, data: erlcExecuteCommandRequest });
666
+ }
667
+ catch (err) {
668
+ if (err instanceof src_1.APIError) {
669
+ resolve({ success: false, reason: err.response });
670
+ }
671
+ else {
672
+ reject(err);
673
+ }
674
+ }
675
+ });
676
+ }
630
677
  /**
631
678
  * Adds a new ERLC record for a player.
632
679
  * @param {Object} data The object that contains critical data to add a new ERLC record.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.37",
3
+ "version": "1.0.39",
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",
package/src/constants.ts CHANGED
@@ -443,6 +443,20 @@ export interface CMSERLCAddNewRecordPromiseResult {
443
443
  logId?: string;
444
444
  }
445
445
 
446
+ export interface CMSERLCExecuteCommandPayload {
447
+ serverId: string;
448
+ type: string;
449
+ args: unknown;
450
+ discordId: string | number;
451
+ includesPlayerNameOrId: boolean;
452
+ }
453
+
454
+ export interface CMSERLCExecuteCommandPromiseResult {
455
+ success: boolean;
456
+ reason?: string;
457
+ data?: unknown;
458
+ }
459
+
446
460
  export interface RadioChannelGroup {
447
461
  id: number;
448
462
  name: string;
package/src/index.ts CHANGED
@@ -41,5 +41,10 @@ export {
41
41
  CMSPromotionFlow,
42
42
  CMSTriggerPromotionFlowsPromiseResult,
43
43
  CMSGetPromotionFlowsPromiseResult,
44
- CMSGetFormSubmissionsPromiseResult
44
+ CMSGetFormSubmissionsPromiseResult,
45
+ CMSERLCGetOnlinePlayersPromiseResult,
46
+ CMSERLCGetPlayerQueuePromiseResult,
47
+ CMSERLCAddNewRecordPromiseResult,
48
+ CMSERLCExecuteCommandPayload,
49
+ CMSERLCExecuteCommandPromiseResult
45
50
  } from './constants';
@@ -404,6 +404,22 @@ export class REST extends EventEmitter {
404
404
  points: args[6],
405
405
  }
406
406
  }
407
+ case 'ERLC_EXECUTE_COMMAND': {
408
+ const payload = args[0];
409
+ if (!Array.isArray(payload)) {
410
+ throw new Error('ERLC_EXECUTE_COMMAND requires an array of command payloads.');
411
+ }
412
+ return payload.map((cmd) => {
413
+ const serverId = cmd.serverId;
414
+ if (typeof serverId !== 'string' || serverId.length === 0) {
415
+ throw new Error('ERLC_EXECUTE_COMMAND requires each command to include a valid serverId.');
416
+ }
417
+ return {
418
+ ...cmd,
419
+ serverId
420
+ };
421
+ });
422
+ }
407
423
  case 'RADIO_GET_COMMUNITY_CHANNELS':
408
424
  case 'RADIO_GET_CONNECTED_USERS':
409
425
  case 'RADIO_GET_SERVER_SUBSCRIPTION_FROM_IP': {
@@ -174,6 +174,10 @@ export class RequestManager extends EventEmitter {
174
174
  apiData.data.data = [];
175
175
  break;
176
176
  }
177
+ case 'ERLC_EXECUTE_COMMAND': {
178
+ apiData.data.data = clonedData;
179
+ break;
180
+ }
177
181
  case 'SET_PENAL_CODES': {
178
182
  apiData.data.data = [clonedData[0]];
179
183
  break;
@@ -1,4 +1,4 @@
1
- import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload } from '../../../../../constants';
1
+ import { productEnums, RadioSetUserChannelsOptions, RadioSpeakerLocation, RadioTonePlayTarget, CMSProfileFieldUpdate, CMSSetGameServerStruct, CMSTriggerPromotionFlowPayload, CMSERLCExecuteCommandPayload } from '../../../../../constants';
2
2
  import type { RESTOptions } from '../REST';
3
3
 
4
4
  export const DefaultUserAgent = 'Sonoran.js NPM Module';
@@ -548,6 +548,12 @@ export const ERLCMSAPITypes: APITypeData[] = [
548
548
  path: "erlc/add_new_record",
549
549
  method: "POST",
550
550
  minVersion: 0
551
+ },
552
+ {
553
+ type: "ERLC_EXECUTE_COMMAND",
554
+ path: "erlc/command",
555
+ method: "POST",
556
+ minVersion: 0
551
557
  }
552
558
  ];
553
559
 
@@ -619,7 +625,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
619
625
 
620
626
  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) ];
621
627
 
622
- 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' | 'PLAY_TONE';
628
+ 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' | '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';
623
629
 
624
630
  export interface CMSServerAPIStruct {
625
631
  id: number;
@@ -1170,6 +1176,9 @@ export interface RESTTypedAPIDataStructs {
1170
1176
  playerRobloxId?: string | number,
1171
1177
  points?: number,
1172
1178
  ]
1179
+ ERLC_EXECUTE_COMMAND: [
1180
+ commands: CMSERLCExecuteCommandPayload[]
1181
+ ]
1173
1182
  // Radio
1174
1183
  RADIO_GET_COMMUNITY_CHANNELS: [];
1175
1184
  RADIO_GET_CONNECTED_USERS: [];
@@ -562,6 +562,55 @@ export class CMSManager extends BaseManager {
562
562
  });
563
563
  }
564
564
 
565
+ /**
566
+ * Sends an ERLC command payload to CMS.
567
+ */
568
+ public async erlcExecuteCommand(commands: globalTypes.CMSERLCExecuteCommandPayload[]): Promise<globalTypes.CMSERLCExecuteCommandPromiseResult> {
569
+ if (!Array.isArray(commands) || commands.length === 0) {
570
+ throw new Error('ERLC execute command requires at least one command payload.');
571
+ }
572
+
573
+ const normalizedCommands = commands.map((cmd) => {
574
+ const type = cmd.type;
575
+ const args = cmd.args;
576
+ const discordId = cmd.discordId;
577
+ const includesPlayerNameOrId = cmd.includesPlayerNameOrId;
578
+ const serverId = cmd.serverId;
579
+
580
+ if (!type) {
581
+ throw new Error('Each ERLC command requires a type.');
582
+ }
583
+ if (!discordId) {
584
+ throw new Error('Each ERLC command requires a discordId.');
585
+ }
586
+ if (typeof serverId !== 'string' || serverId.length === 0) {
587
+ throw new Error('Each ERLC command requires a serverId.');
588
+ }
589
+
590
+ return {
591
+ ...cmd,
592
+ type,
593
+ args,
594
+ discordId,
595
+ includesPlayerNameOrId,
596
+ serverId,
597
+ };
598
+ });
599
+
600
+ return new Promise(async (resolve, reject) => {
601
+ try {
602
+ const erlcExecuteCommandRequest: any = await this.rest?.request('ERLC_EXECUTE_COMMAND', normalizedCommands);
603
+ resolve({ success: true, data: erlcExecuteCommandRequest });
604
+ } catch (err) {
605
+ if (err instanceof APIError) {
606
+ resolve({ success: false, reason: err.response });
607
+ } else {
608
+ reject(err);
609
+ }
610
+ }
611
+ });
612
+ }
613
+
565
614
  /**
566
615
  * Adds a new ERLC record for a player.
567
616
  * @param {Object} data The object that contains critical data to add a new ERLC record.