@sonoransoftware/sonoran.js 1.0.56 → 1.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/libs/rest/src/lib/REST.js +16 -28
- package/dist/libs/rest/src/lib/RequestManager.js +13 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +8 -2
- package/dist/libs/rest/src/lib/utils/constants.js +6 -0
- package/dist/managers/CADManager.d.ts +5 -1
- package/dist/managers/CADManager.js +24 -0
- package/package.json +1 -1
- package/readme.md +1 -0
- package/src/libs/rest/src/lib/REST.ts +14 -26
- package/src/libs/rest/src/lib/RequestManager.ts +11 -0
- package/src/libs/rest/src/lib/utils/constants.ts +15 -2
- package/src/managers/CADManager.ts +26 -0
|
@@ -271,6 +271,13 @@ class REST extends events_1.EventEmitter {
|
|
|
271
271
|
isPanic: args[1]
|
|
272
272
|
};
|
|
273
273
|
}
|
|
274
|
+
case 'IDENTS_TO_GROUP': {
|
|
275
|
+
const payload = args[0];
|
|
276
|
+
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
277
|
+
return payload;
|
|
278
|
+
}
|
|
279
|
+
return payload !== null && payload !== void 0 ? payload : [];
|
|
280
|
+
}
|
|
274
281
|
case 'ATTACH_UNIT': {
|
|
275
282
|
const payload = args[0];
|
|
276
283
|
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
@@ -456,36 +463,17 @@ class REST extends events_1.EventEmitter {
|
|
|
456
463
|
});
|
|
457
464
|
}
|
|
458
465
|
case 'ERLC_TEAMS_LOCK': {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
const robloxJoinCode = cmd.robloxJoinCode;
|
|
465
|
-
if (typeof robloxJoinCode !== 'string' || robloxJoinCode.length === 0) {
|
|
466
|
-
throw new Error('ERLC_TEAMS_LOCK requires each command to include a valid robloxJoinCode.');
|
|
467
|
-
}
|
|
468
|
-
return {
|
|
469
|
-
...cmd,
|
|
470
|
-
robloxJoinCode
|
|
471
|
-
};
|
|
472
|
-
});
|
|
466
|
+
return {
|
|
467
|
+
robloxJoinCode: args[0],
|
|
468
|
+
team: args[1],
|
|
469
|
+
maxPlayers: args[2],
|
|
470
|
+
};
|
|
473
471
|
}
|
|
474
472
|
case 'ERLC_TEAMS_UNLOCK': {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
}
|
|
479
|
-
return payload.map((cmd) => {
|
|
480
|
-
const robloxJoinCode = cmd.robloxJoinCode;
|
|
481
|
-
if (typeof robloxJoinCode !== 'string' || robloxJoinCode.length === 0) {
|
|
482
|
-
throw new Error('ERLC_TEAMS_UNLOCK requires each command to include a valid robloxJoinCode.');
|
|
483
|
-
}
|
|
484
|
-
return {
|
|
485
|
-
...cmd,
|
|
486
|
-
robloxJoinCode
|
|
487
|
-
};
|
|
488
|
-
});
|
|
473
|
+
return {
|
|
474
|
+
robloxJoinCode: args[0],
|
|
475
|
+
team: args[1],
|
|
476
|
+
};
|
|
489
477
|
}
|
|
490
478
|
case 'RADIO_GET_COMMUNITY_CHANNELS':
|
|
491
479
|
case 'RADIO_GET_CONNECTED_USERS':
|
|
@@ -201,6 +201,19 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
201
201
|
apiData.data.data = [clonedData[0]];
|
|
202
202
|
break;
|
|
203
203
|
}
|
|
204
|
+
case 'IDENTS_TO_GROUP': {
|
|
205
|
+
const payload = data.data;
|
|
206
|
+
if (Array.isArray(payload)) {
|
|
207
|
+
apiData.data.data = payload;
|
|
208
|
+
}
|
|
209
|
+
else if (payload !== undefined && payload !== null) {
|
|
210
|
+
apiData.data.data = [payload];
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
apiData.data.data = [];
|
|
214
|
+
}
|
|
215
|
+
break;
|
|
216
|
+
}
|
|
204
217
|
case 'ADD_BLIP': {
|
|
205
218
|
apiData.data.data = [clonedData[0]];
|
|
206
219
|
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_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' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | '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' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | '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' | 'IDENTS_TO_GROUP' | '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' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | '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' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | '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;
|
|
@@ -200,6 +200,11 @@ export interface CADModifyIdentifierStruct {
|
|
|
200
200
|
identifier?: Record<string, string>;
|
|
201
201
|
identId?: number;
|
|
202
202
|
}
|
|
203
|
+
export interface CADIdentsToGroupStruct {
|
|
204
|
+
serverId: number;
|
|
205
|
+
identIds: number[];
|
|
206
|
+
groupName: string;
|
|
207
|
+
}
|
|
203
208
|
export interface CADBlipStruct {
|
|
204
209
|
id: number;
|
|
205
210
|
coordinates: {
|
|
@@ -385,6 +390,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
385
390
|
apiId: string | undefined,
|
|
386
391
|
identId: number
|
|
387
392
|
];
|
|
393
|
+
IDENTS_TO_GROUP: [data: CADIdentsToGroupStruct[]];
|
|
388
394
|
UNIT_PANIC: [
|
|
389
395
|
apiId: string | undefined,
|
|
390
396
|
isPanic: boolean
|
|
@@ -686,7 +692,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
686
692
|
];
|
|
687
693
|
}
|
|
688
694
|
export type PossibleRequestData = undefined | {
|
|
689
|
-
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[];
|
|
695
|
+
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADIdentsToGroupStruct[] | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[];
|
|
690
696
|
} | {
|
|
691
697
|
servers: CADServerAPIStruct[];
|
|
692
698
|
deployMap: boolean;
|
|
@@ -206,6 +206,12 @@ exports.EmergencyCADAPITypes = [
|
|
|
206
206
|
method: 'POST',
|
|
207
207
|
minVersion: 3
|
|
208
208
|
},
|
|
209
|
+
{
|
|
210
|
+
type: 'IDENTS_TO_GROUP',
|
|
211
|
+
path: 'emergency/idents_to_group',
|
|
212
|
+
method: 'POST',
|
|
213
|
+
minVersion: 4
|
|
214
|
+
},
|
|
209
215
|
{
|
|
210
216
|
type: 'UNIT_PANIC',
|
|
211
217
|
path: 'emergency/unit_panic',
|
|
@@ -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, CADGetMyCallStruct, CADAddCallNoteStruct, CADGetActiveUnitsStruct, CADNewDispatchStruct, CADAttachUnitsStruct, CADDetachUnitsStruct, CADStreetSignStruct, CADUnitLocationStruct, CADUnitPanicStruct } from '../libs/rest/src';
|
|
4
|
+
import type { CADPenalCodeStruct, CADSetAPIIDStruct, CADNewEditRecordOptionOneStruct, CADNewEditRecordOptionTwoStruct, CADLookupByIntStruct, CADLookupStruct, CADModifyAccountPermsStruct, CADKickBanUserStruct, CADSetPostalStruct, CADModifyIdentifierStruct, CADIdentsToGroupStruct, 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';
|
|
@@ -153,6 +153,10 @@ export declare class CADManager extends BaseManager {
|
|
|
153
153
|
* Sets the active identifier by identifier ID.
|
|
154
154
|
*/
|
|
155
155
|
setIdentifier(apiId: string | undefined, identId: number): Promise<globalTypes.CADStandardResponse>;
|
|
156
|
+
/**
|
|
157
|
+
* Assigns identifiers to a group name.
|
|
158
|
+
*/
|
|
159
|
+
setIdentifiersToGroup(entries: CADIdentsToGroupStruct | CADIdentsToGroupStruct[]): Promise<globalTypes.CADStandardResponse>;
|
|
156
160
|
/**
|
|
157
161
|
* Toggles panic state for a unit.
|
|
158
162
|
*/
|
|
@@ -377,6 +377,30 @@ class CADManager extends BaseManager_1.BaseManager {
|
|
|
377
377
|
}
|
|
378
378
|
return this.executeCadRequest('SET_IDENTIFIER', apiId, identId);
|
|
379
379
|
}
|
|
380
|
+
/**
|
|
381
|
+
* Assigns identifiers to a group name.
|
|
382
|
+
*/
|
|
383
|
+
async setIdentifiersToGroup(entries) {
|
|
384
|
+
const payload = Array.isArray(entries) ? entries : [entries];
|
|
385
|
+
if (payload.length === 0) {
|
|
386
|
+
throw new Error('entries must include at least one identifier group update.');
|
|
387
|
+
}
|
|
388
|
+
payload.forEach((entry, index) => {
|
|
389
|
+
if (!entry) {
|
|
390
|
+
throw new Error(`entries[${index}] is required.`);
|
|
391
|
+
}
|
|
392
|
+
if (!Number.isInteger(entry.serverId)) {
|
|
393
|
+
throw new Error(`entries[${index}].serverId must be an integer.`);
|
|
394
|
+
}
|
|
395
|
+
if (!Array.isArray(entry.identIds) || entry.identIds.length === 0 || entry.identIds.some((id) => !Number.isInteger(id))) {
|
|
396
|
+
throw new Error(`entries[${index}].identIds must be an array of integers.`);
|
|
397
|
+
}
|
|
398
|
+
if (typeof entry.groupName !== 'string') {
|
|
399
|
+
throw new Error(`entries[${index}].groupName must be a string (use '' to clear).`);
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
return this.executeCadRequest('IDENTS_TO_GROUP', payload);
|
|
403
|
+
}
|
|
380
404
|
async setUnitPanic(apiIdOrParams, isPanic) {
|
|
381
405
|
let payload;
|
|
382
406
|
if (apiIdOrParams && typeof apiIdOrParams === 'object') {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonoransoftware/sonoran.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.58",
|
|
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/readme.md
CHANGED
|
@@ -104,6 +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
|
+
- **`setIdentifiersToGroup(entries)`** - assigns identifiers to a group name (empty string clears).
|
|
107
108
|
- **`setUnitPanic({ apiId?, account?, isPanic })`** / **`setUnitStatus({ status, serverId, apiId?, account? })`**
|
|
108
109
|
- **`getActiveUnits(options)`** - direct CAD fetch for active units.
|
|
109
110
|
- **`kickUnit(apiId?, reason, serverId)`**
|
|
@@ -380,6 +380,13 @@ export class REST extends EventEmitter {
|
|
|
380
380
|
isPanic: args[1]
|
|
381
381
|
};
|
|
382
382
|
}
|
|
383
|
+
case 'IDENTS_TO_GROUP': {
|
|
384
|
+
const payload = args[0];
|
|
385
|
+
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
386
|
+
return payload;
|
|
387
|
+
}
|
|
388
|
+
return payload ?? [];
|
|
389
|
+
}
|
|
383
390
|
case 'ATTACH_UNIT': {
|
|
384
391
|
const payload = args[0];
|
|
385
392
|
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
@@ -565,36 +572,17 @@ export class REST extends EventEmitter {
|
|
|
565
572
|
});
|
|
566
573
|
}
|
|
567
574
|
case 'ERLC_TEAMS_LOCK': {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
575
|
+
return {
|
|
576
|
+
robloxJoinCode: args[0],
|
|
577
|
+
team: args[1],
|
|
578
|
+
maxPlayers: args[2],
|
|
571
579
|
}
|
|
572
|
-
return payload.map((cmd) => {
|
|
573
|
-
const robloxJoinCode = cmd.robloxJoinCode;
|
|
574
|
-
if (typeof robloxJoinCode !== 'string' || robloxJoinCode.length === 0) {
|
|
575
|
-
throw new Error('ERLC_TEAMS_LOCK requires each command to include a valid robloxJoinCode.');
|
|
576
|
-
}
|
|
577
|
-
return {
|
|
578
|
-
...cmd,
|
|
579
|
-
robloxJoinCode
|
|
580
|
-
};
|
|
581
|
-
});
|
|
582
580
|
}
|
|
583
581
|
case 'ERLC_TEAMS_UNLOCK': {
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
582
|
+
return {
|
|
583
|
+
robloxJoinCode: args[0],
|
|
584
|
+
team: args[1],
|
|
587
585
|
}
|
|
588
|
-
return payload.map((cmd) => {
|
|
589
|
-
const robloxJoinCode = cmd.robloxJoinCode;
|
|
590
|
-
if (typeof robloxJoinCode !== 'string' || robloxJoinCode.length === 0) {
|
|
591
|
-
throw new Error('ERLC_TEAMS_UNLOCK requires each command to include a valid robloxJoinCode.');
|
|
592
|
-
}
|
|
593
|
-
return {
|
|
594
|
-
...cmd,
|
|
595
|
-
robloxJoinCode
|
|
596
|
-
};
|
|
597
|
-
});
|
|
598
586
|
}
|
|
599
587
|
case 'RADIO_GET_COMMUNITY_CHANNELS':
|
|
600
588
|
case 'RADIO_GET_CONNECTED_USERS':
|
|
@@ -272,6 +272,17 @@ export class RequestManager extends EventEmitter {
|
|
|
272
272
|
apiData.data.data = [clonedData[0]];
|
|
273
273
|
break;
|
|
274
274
|
}
|
|
275
|
+
case 'IDENTS_TO_GROUP': {
|
|
276
|
+
const payload = data.data;
|
|
277
|
+
if (Array.isArray(payload)) {
|
|
278
|
+
apiData.data.data = payload;
|
|
279
|
+
} else if (payload !== undefined && payload !== null) {
|
|
280
|
+
apiData.data.data = [payload];
|
|
281
|
+
} else {
|
|
282
|
+
apiData.data.data = [];
|
|
283
|
+
}
|
|
284
|
+
break;
|
|
285
|
+
}
|
|
275
286
|
case 'ADD_BLIP': {
|
|
276
287
|
apiData.data.data = [clonedData[0]];
|
|
277
288
|
break;
|
|
@@ -237,6 +237,12 @@ export const EmergencyCADAPITypes: APITypeData[] = [
|
|
|
237
237
|
method: 'POST',
|
|
238
238
|
minVersion: 3
|
|
239
239
|
},
|
|
240
|
+
{
|
|
241
|
+
type: 'IDENTS_TO_GROUP',
|
|
242
|
+
path: 'emergency/idents_to_group',
|
|
243
|
+
method: 'POST',
|
|
244
|
+
minVersion: 4
|
|
245
|
+
},
|
|
240
246
|
{
|
|
241
247
|
type: 'UNIT_PANIC',
|
|
242
248
|
path: 'emergency/unit_panic',
|
|
@@ -691,7 +697,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
691
697
|
|
|
692
698
|
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) ];
|
|
693
699
|
|
|
694
|
-
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' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | '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' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | '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';
|
|
700
|
+
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' | 'IDENTS_TO_GROUP' | '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' | 'GET_FORM_LOCK_STATUS' | 'SET_FORM_LOCK_STATUS' | 'GET_CURRENT_SESSION' | 'START_SESSION' | 'STOP_SESSION' | 'CANCEL_SESSION' | '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' | 'ERLC_TEAMS_LOCK' | 'ERLC_TEAMS_UNLOCK' | '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';
|
|
695
701
|
|
|
696
702
|
export interface CMSServerAPIStruct {
|
|
697
703
|
id: number;
|
|
@@ -874,6 +880,12 @@ export interface CADModifyIdentifierStruct {
|
|
|
874
880
|
identId?: number;
|
|
875
881
|
}
|
|
876
882
|
|
|
883
|
+
export interface CADIdentsToGroupStruct {
|
|
884
|
+
serverId: number;
|
|
885
|
+
identIds: number[];
|
|
886
|
+
groupName: string;
|
|
887
|
+
}
|
|
888
|
+
|
|
877
889
|
export interface CADBlipStruct {
|
|
878
890
|
id: number;
|
|
879
891
|
coordinates: {
|
|
@@ -1072,6 +1084,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1072
1084
|
apiId: string | undefined,
|
|
1073
1085
|
identId: number
|
|
1074
1086
|
];
|
|
1087
|
+
IDENTS_TO_GROUP: [data: CADIdentsToGroupStruct[]];
|
|
1075
1088
|
UNIT_PANIC: [
|
|
1076
1089
|
apiId: string | undefined,
|
|
1077
1090
|
isPanic: boolean
|
|
@@ -1381,7 +1394,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1381
1394
|
export type PossibleRequestData =
|
|
1382
1395
|
undefined |
|
|
1383
1396
|
{
|
|
1384
|
-
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[]
|
|
1397
|
+
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADIdentsToGroupStruct[] | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[]
|
|
1385
1398
|
} |
|
|
1386
1399
|
{
|
|
1387
1400
|
servers: CADServerAPIStruct[];
|
|
@@ -13,6 +13,7 @@ import type {
|
|
|
13
13
|
CADKickBanUserStruct,
|
|
14
14
|
CADSetPostalStruct,
|
|
15
15
|
CADModifyIdentifierStruct,
|
|
16
|
+
CADIdentsToGroupStruct,
|
|
16
17
|
CADAddBlipStruct,
|
|
17
18
|
CADModifyBlipStruct,
|
|
18
19
|
CADGetCallsStruct,
|
|
@@ -402,6 +403,31 @@ export class CADManager extends BaseManager {
|
|
|
402
403
|
return this.executeCadRequest('SET_IDENTIFIER', apiId, identId);
|
|
403
404
|
}
|
|
404
405
|
|
|
406
|
+
/**
|
|
407
|
+
* Assigns identifiers to a group name.
|
|
408
|
+
*/
|
|
409
|
+
public async setIdentifiersToGroup(entries: CADIdentsToGroupStruct | CADIdentsToGroupStruct[]): Promise<globalTypes.CADStandardResponse> {
|
|
410
|
+
const payload = Array.isArray(entries) ? entries : [entries];
|
|
411
|
+
if (payload.length === 0) {
|
|
412
|
+
throw new Error('entries must include at least one identifier group update.');
|
|
413
|
+
}
|
|
414
|
+
payload.forEach((entry, index) => {
|
|
415
|
+
if (!entry) {
|
|
416
|
+
throw new Error(`entries[${index}] is required.`);
|
|
417
|
+
}
|
|
418
|
+
if (!Number.isInteger(entry.serverId)) {
|
|
419
|
+
throw new Error(`entries[${index}].serverId must be an integer.`);
|
|
420
|
+
}
|
|
421
|
+
if (!Array.isArray(entry.identIds) || entry.identIds.length === 0 || entry.identIds.some((id) => !Number.isInteger(id))) {
|
|
422
|
+
throw new Error(`entries[${index}].identIds must be an array of integers.`);
|
|
423
|
+
}
|
|
424
|
+
if (typeof entry.groupName !== 'string') {
|
|
425
|
+
throw new Error(`entries[${index}].groupName must be a string (use '' to clear).`);
|
|
426
|
+
}
|
|
427
|
+
});
|
|
428
|
+
return this.executeCadRequest('IDENTS_TO_GROUP', payload);
|
|
429
|
+
}
|
|
430
|
+
|
|
405
431
|
/**
|
|
406
432
|
* Toggles panic state for a unit.
|
|
407
433
|
*/
|