@sonoransoftware/sonoran.js 1.0.57 → 1.0.59
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 +7 -0
- package/dist/libs/rest/src/lib/RequestManager.js +13 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +9 -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 +27 -0
- package/package.json +1 -1
- package/readme.md +1 -0
- package/src/libs/rest/src/lib/REST.ts +7 -0
- package/src/libs/rest/src/lib/RequestManager.ts +11 -0
- package/src/libs/rest/src/lib/utils/constants.ts +16 -2
- package/src/managers/CADManager.ts +29 -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)) {
|
|
@@ -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,12 @@ 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
|
+
account?: string;
|
|
208
|
+
}
|
|
203
209
|
export interface CADBlipStruct {
|
|
204
210
|
id: number;
|
|
205
211
|
coordinates: {
|
|
@@ -385,6 +391,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
385
391
|
apiId: string | undefined,
|
|
386
392
|
identId: number
|
|
387
393
|
];
|
|
394
|
+
IDENTS_TO_GROUP: [data: CADIdentsToGroupStruct[]];
|
|
388
395
|
UNIT_PANIC: [
|
|
389
396
|
apiId: string | undefined,
|
|
390
397
|
isPanic: boolean
|
|
@@ -686,7 +693,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
686
693
|
];
|
|
687
694
|
}
|
|
688
695
|
export type PossibleRequestData = undefined | {
|
|
689
|
-
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[];
|
|
696
|
+
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADIdentsToGroupStruct[] | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[];
|
|
690
697
|
} | {
|
|
691
698
|
servers: CADServerAPIStruct[];
|
|
692
699
|
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,33 @@ 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
|
+
if (entry.account !== undefined && typeof entry.account !== 'string') {
|
|
402
|
+
throw new Error(`entries[${index}].account must be a string when provided.`);
|
|
403
|
+
}
|
|
404
|
+
});
|
|
405
|
+
return this.executeCadRequest('IDENTS_TO_GROUP', payload);
|
|
406
|
+
}
|
|
380
407
|
async setUnitPanic(apiIdOrParams, isPanic) {
|
|
381
408
|
let payload;
|
|
382
409
|
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.59",
|
|
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)) {
|
|
@@ -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,13 @@ 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
|
+
account?: string;
|
|
888
|
+
}
|
|
889
|
+
|
|
877
890
|
export interface CADBlipStruct {
|
|
878
891
|
id: number;
|
|
879
892
|
coordinates: {
|
|
@@ -1072,6 +1085,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1072
1085
|
apiId: string | undefined,
|
|
1073
1086
|
identId: number
|
|
1074
1087
|
];
|
|
1088
|
+
IDENTS_TO_GROUP: [data: CADIdentsToGroupStruct[]];
|
|
1075
1089
|
UNIT_PANIC: [
|
|
1076
1090
|
apiId: string | undefined,
|
|
1077
1091
|
isPanic: boolean
|
|
@@ -1381,7 +1395,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1381
1395
|
export type PossibleRequestData =
|
|
1382
1396
|
undefined |
|
|
1383
1397
|
{
|
|
1384
|
-
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[]
|
|
1398
|
+
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADIdentsToGroupStruct[] | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct | CMSTriggerPromotionFlowPayload[]
|
|
1385
1399
|
} |
|
|
1386
1400
|
{
|
|
1387
1401
|
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,34 @@ 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
|
+
if (entry.account !== undefined && typeof entry.account !== 'string') {
|
|
428
|
+
throw new Error(`entries[${index}].account must be a string when provided.`);
|
|
429
|
+
}
|
|
430
|
+
});
|
|
431
|
+
return this.executeCadRequest('IDENTS_TO_GROUP', payload);
|
|
432
|
+
}
|
|
433
|
+
|
|
405
434
|
/**
|
|
406
435
|
* Toggles panic state for a unit.
|
|
407
436
|
*/
|