@sonoransoftware/sonoran.js 1.0.32 → 1.0.33
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/constants.d.ts +15 -0
- package/dist/libs/rest/src/lib/REST.js +16 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +14 -1
- package/dist/libs/rest/src/lib/utils/constants.js +16 -2
- package/dist/managers/CMSManager.d.ts +27 -0
- package/dist/managers/CMSManager.js +51 -0
- package/package.json +1 -1
- package/src/constants.ts +17 -0
- package/src/libs/rest/src/lib/REST.ts +16 -0
- package/src/libs/rest/src/lib/utils/constants.ts +30 -2
- package/src/managers/CMSManager.ts +47 -0
package/dist/constants.d.ts
CHANGED
|
@@ -243,3 +243,18 @@ export interface CMSForceSyncPromiseResult {
|
|
|
243
243
|
success: boolean;
|
|
244
244
|
reason?: string;
|
|
245
245
|
}
|
|
246
|
+
export interface CMSERLCGetOnlinePlayersPromiseResult {
|
|
247
|
+
success: boolean;
|
|
248
|
+
reason?: string;
|
|
249
|
+
data?: {
|
|
250
|
+
Player: string;
|
|
251
|
+
Permission: string;
|
|
252
|
+
Callsingn?: string;
|
|
253
|
+
Team?: string;
|
|
254
|
+
}[];
|
|
255
|
+
}
|
|
256
|
+
export interface CMSERLCAddNewRecordPromiseResult {
|
|
257
|
+
success: boolean;
|
|
258
|
+
reason?: string;
|
|
259
|
+
logId?: string;
|
|
260
|
+
}
|
|
@@ -195,6 +195,22 @@ class REST extends events_1.EventEmitter {
|
|
|
195
195
|
uniqueId: args[4],
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
+
case 'ERLC_GET_ONLINE_PLAYERS': {
|
|
199
|
+
return {
|
|
200
|
+
robloxJoinCode: args[0]
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
case 'ERLC_ADD_NEW_RECORD': {
|
|
204
|
+
return {
|
|
205
|
+
robloxJoinCode: args[0],
|
|
206
|
+
executerDiscordId: args[1],
|
|
207
|
+
type: args[2],
|
|
208
|
+
reason: args[3],
|
|
209
|
+
playerDiscordId: args[4],
|
|
210
|
+
playerRobloxId: args[5],
|
|
211
|
+
points: args[6],
|
|
212
|
+
};
|
|
213
|
+
}
|
|
198
214
|
default: {
|
|
199
215
|
return args;
|
|
200
216
|
}
|
|
@@ -34,8 +34,9 @@ export declare const ServersCMSAPITypes: APITypeData[];
|
|
|
34
34
|
export declare const EventsCMSAPITypes: APITypeData[];
|
|
35
35
|
export declare const FormsCMSAPITypes: APITypeData[];
|
|
36
36
|
export declare const CommunitiesCMSAPITypes: APITypeData[];
|
|
37
|
+
export declare const ERLCMSAPITypes: APITypeData[];
|
|
37
38
|
export declare const AllAPITypes: AllAPITypeData[];
|
|
38
|
-
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC';
|
|
39
|
+
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | "ERLC_GET_ONLINE_PLAYERS" | "ERLC_ADD_NEW_RECORD";
|
|
39
40
|
export interface CMSServerAPIStruct {
|
|
40
41
|
id: number;
|
|
41
42
|
name: string;
|
|
@@ -489,6 +490,18 @@ export interface RESTTypedAPIDataStructs {
|
|
|
489
490
|
discord: string | undefined,
|
|
490
491
|
uniqueId: string | undefined
|
|
491
492
|
];
|
|
493
|
+
ERLC_GET_ONLINE_PLAYERS: [
|
|
494
|
+
robloxJoinCode: string
|
|
495
|
+
];
|
|
496
|
+
ERLC_ADD_NEW_RECORD: [
|
|
497
|
+
robloxJoinCode: string,
|
|
498
|
+
executerDiscordId: string | number,
|
|
499
|
+
type: string,
|
|
500
|
+
reason: string,
|
|
501
|
+
playerDiscordId?: string | number,
|
|
502
|
+
playerRobloxId?: string | number,
|
|
503
|
+
points?: number
|
|
504
|
+
];
|
|
492
505
|
}
|
|
493
506
|
export type PossibleRequestData = undefined | {
|
|
494
507
|
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CADDispatchStatusEnums = exports.CADDispatchOriginEnums = exports.CADModifyIdentifierActionEnums = exports.CADLookupByIntSearchTypeEnums = exports.CADRecordSectionCategoryEnums = exports.CADRecordTypeEnums = exports.AllAPITypes = exports.CommunitiesCMSAPITypes = exports.FormsCMSAPITypes = exports.EventsCMSAPITypes = exports.ServersCMSAPITypes = exports.GeneralCMSAPITypes = exports.EmergencyCADAPITypes = exports.CivilianCADAPITypes = exports.GeneralCADAPITypes = exports.DefaultCMSRestOptions = exports.DefaultCADRestOptions = exports.DefaultUserAgent = void 0;
|
|
3
|
+
exports.CADDispatchStatusEnums = exports.CADDispatchOriginEnums = exports.CADModifyIdentifierActionEnums = exports.CADLookupByIntSearchTypeEnums = exports.CADRecordSectionCategoryEnums = exports.CADRecordTypeEnums = exports.AllAPITypes = exports.ERLCMSAPITypes = exports.CommunitiesCMSAPITypes = exports.FormsCMSAPITypes = exports.EventsCMSAPITypes = exports.ServersCMSAPITypes = exports.GeneralCMSAPITypes = exports.EmergencyCADAPITypes = exports.CivilianCADAPITypes = exports.GeneralCADAPITypes = exports.DefaultCMSRestOptions = exports.DefaultCADRestOptions = exports.DefaultUserAgent = void 0;
|
|
4
4
|
const constants_1 = require("../../../../../constants");
|
|
5
5
|
exports.DefaultUserAgent = 'Sonoran.js NPM Module';
|
|
6
6
|
exports.DefaultCADRestOptions = {
|
|
@@ -427,6 +427,20 @@ exports.CommunitiesCMSAPITypes = [
|
|
|
427
427
|
minVersion: 0
|
|
428
428
|
},
|
|
429
429
|
];
|
|
430
|
+
exports.ERLCMSAPITypes = [
|
|
431
|
+
{
|
|
432
|
+
type: "ERLC_GET_ONLINE_PLAYERS",
|
|
433
|
+
path: "erlc/get_online_players",
|
|
434
|
+
method: "POST",
|
|
435
|
+
minVersion: 0
|
|
436
|
+
},
|
|
437
|
+
{
|
|
438
|
+
type: "ERLC_ADD_NEW_RECORD",
|
|
439
|
+
path: "erlc/add_new_record",
|
|
440
|
+
method: "POST",
|
|
441
|
+
minVersion: 0
|
|
442
|
+
}
|
|
443
|
+
];
|
|
430
444
|
function formatForAll(array, product) {
|
|
431
445
|
return array.map((val) => {
|
|
432
446
|
return {
|
|
@@ -435,7 +449,7 @@ function formatForAll(array, product) {
|
|
|
435
449
|
};
|
|
436
450
|
});
|
|
437
451
|
}
|
|
438
|
-
exports.AllAPITypes = [...formatForAll(exports.GeneralCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.CivilianCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.EmergencyCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.GeneralCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ServersCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.EventsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.FormsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.CommunitiesCMSAPITypes, constants_1.productEnums.CMS)];
|
|
452
|
+
exports.AllAPITypes = [...formatForAll(exports.GeneralCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.CivilianCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.EmergencyCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.GeneralCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ServersCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.EventsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.FormsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.CommunitiesCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ERLCMSAPITypes, constants_1.productEnums.CMS)];
|
|
439
453
|
var CADRecordTypeEnums;
|
|
440
454
|
(function (CADRecordTypeEnums) {
|
|
441
455
|
CADRecordTypeEnums[CADRecordTypeEnums["Warrant"] = 2] = "Warrant";
|
|
@@ -170,4 +170,31 @@ export declare class CMSManager extends BaseManager {
|
|
|
170
170
|
discordId?: string;
|
|
171
171
|
uniqueId?: string;
|
|
172
172
|
}): Promise<globalTypes.CMSForceSyncPromiseResult>;
|
|
173
|
+
/**
|
|
174
|
+
* Gets a list of online ERLC players for the given roblox join code.
|
|
175
|
+
* @param {string} robloxJoinCode The roblox join code to get the online players for.
|
|
176
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the list of online players if successful.
|
|
177
|
+
*/
|
|
178
|
+
erlcGetOnlinePlayers(robloxJoinCode: string): Promise<globalTypes.CMSERLCGetOnlinePlayersPromiseResult>;
|
|
179
|
+
/**
|
|
180
|
+
* Adds a new ERLC record for a player.
|
|
181
|
+
* @param {Object} data The object that contains critical data to add a new ERLC record.
|
|
182
|
+
* @param {string} data.robloxJoinCode The roblox join code to add the record to.
|
|
183
|
+
* @param {string|number} data.executerDiscordId The discord ID of the person executing the record addition.
|
|
184
|
+
* @param {string} data.type The type of record being added (e.g., "Warning", "Infraction").
|
|
185
|
+
* @param {string} data.reason The reason for the record being added.
|
|
186
|
+
* @param {string|number} [data.playerDiscordId] (Optional) The discord ID of the player receiving the record.
|
|
187
|
+
* @param {string|number} [data.playerRobloxId] (Optional) The roblox ID of the player receiving the record.
|
|
188
|
+
* @param {number} [data.points] (Optional) The points associated with the record being added.
|
|
189
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
190
|
+
* */
|
|
191
|
+
erlcAddNewRecord(data: {
|
|
192
|
+
robloxJoinCode: string;
|
|
193
|
+
executerDiscordId: string | number;
|
|
194
|
+
type: string;
|
|
195
|
+
reason: string;
|
|
196
|
+
playerDiscordId?: string | number;
|
|
197
|
+
playerRobloxId?: string | number;
|
|
198
|
+
points?: number;
|
|
199
|
+
}): Promise<globalTypes.CMSERLCAddNewRecordPromiseResult>;
|
|
173
200
|
}
|
|
@@ -373,5 +373,56 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
373
373
|
}
|
|
374
374
|
});
|
|
375
375
|
}
|
|
376
|
+
/**
|
|
377
|
+
* Gets a list of online ERLC players for the given roblox join code.
|
|
378
|
+
* @param {string} robloxJoinCode The roblox join code to get the online players for.
|
|
379
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the list of online players if successful.
|
|
380
|
+
*/
|
|
381
|
+
async erlcGetOnlinePlayers(robloxJoinCode) {
|
|
382
|
+
return new Promise(async (resolve, reject) => {
|
|
383
|
+
var _a;
|
|
384
|
+
try {
|
|
385
|
+
const erlcGetOnlinePlayersRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('ERLC_GET_ONLINE_PLAYERS', robloxJoinCode));
|
|
386
|
+
resolve({ success: true, data: erlcGetOnlinePlayersRequest });
|
|
387
|
+
}
|
|
388
|
+
catch (err) {
|
|
389
|
+
if (err instanceof src_1.APIError) {
|
|
390
|
+
resolve({ success: false, reason: err.response });
|
|
391
|
+
}
|
|
392
|
+
else {
|
|
393
|
+
reject(err);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
});
|
|
397
|
+
}
|
|
398
|
+
/**
|
|
399
|
+
* Adds a new ERLC record for a player.
|
|
400
|
+
* @param {Object} data The object that contains critical data to add a new ERLC record.
|
|
401
|
+
* @param {string} data.robloxJoinCode The roblox join code to add the record to.
|
|
402
|
+
* @param {string|number} data.executerDiscordId The discord ID of the person executing the record addition.
|
|
403
|
+
* @param {string} data.type The type of record being added (e.g., "Warning", "Infraction").
|
|
404
|
+
* @param {string} data.reason The reason for the record being added.
|
|
405
|
+
* @param {string|number} [data.playerDiscordId] (Optional) The discord ID of the player receiving the record.
|
|
406
|
+
* @param {string|number} [data.playerRobloxId] (Optional) The roblox ID of the player receiving the record.
|
|
407
|
+
* @param {number} [data.points] (Optional) The points associated with the record being added.
|
|
408
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
409
|
+
* */
|
|
410
|
+
async erlcAddNewRecord(data) {
|
|
411
|
+
return new Promise(async (resolve, reject) => {
|
|
412
|
+
var _a;
|
|
413
|
+
try {
|
|
414
|
+
const erlcAddNewRecordRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('ERLC_ADD_NEW_RECORD', data.robloxJoinCode, data.executerDiscordId, data.type, data.reason, data.playerDiscordId, data.playerRobloxId, data.points));
|
|
415
|
+
resolve({ success: true, reason: erlcAddNewRecordRequest });
|
|
416
|
+
}
|
|
417
|
+
catch (err) {
|
|
418
|
+
if (err instanceof src_1.APIError) {
|
|
419
|
+
resolve({ success: false, reason: err.response });
|
|
420
|
+
}
|
|
421
|
+
else {
|
|
422
|
+
reject(err);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
});
|
|
426
|
+
}
|
|
376
427
|
}
|
|
377
428
|
exports.CMSManager = CMSManager;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonoransoftware/sonoran.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.33",
|
|
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
|
@@ -265,4 +265,21 @@ export interface CMSBanAccountPromiseResult {
|
|
|
265
265
|
export interface CMSForceSyncPromiseResult {
|
|
266
266
|
success: boolean;
|
|
267
267
|
reason?: string;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface CMSERLCGetOnlinePlayersPromiseResult {
|
|
271
|
+
success: boolean;
|
|
272
|
+
reason?: string;
|
|
273
|
+
data?: {
|
|
274
|
+
Player: string;
|
|
275
|
+
Permission: string;
|
|
276
|
+
Callsingn?: string;
|
|
277
|
+
Team?: string;
|
|
278
|
+
}[];
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export interface CMSERLCAddNewRecordPromiseResult {
|
|
282
|
+
success: boolean;
|
|
283
|
+
reason?: string;
|
|
284
|
+
logId?: string;
|
|
268
285
|
}
|
|
@@ -301,6 +301,22 @@ export class REST extends EventEmitter {
|
|
|
301
301
|
uniqueId: args[4],
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
|
+
case 'ERLC_GET_ONLINE_PLAYERS': {
|
|
305
|
+
return {
|
|
306
|
+
robloxJoinCode: args[0]
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
case 'ERLC_ADD_NEW_RECORD': {
|
|
310
|
+
return {
|
|
311
|
+
robloxJoinCode: args[0],
|
|
312
|
+
executerDiscordId: args[1],
|
|
313
|
+
type: args[2],
|
|
314
|
+
reason: args[3],
|
|
315
|
+
playerDiscordId: args[4],
|
|
316
|
+
playerRobloxId: args[5],
|
|
317
|
+
points: args[6],
|
|
318
|
+
}
|
|
319
|
+
}
|
|
304
320
|
default: {
|
|
305
321
|
return args;
|
|
306
322
|
}
|
|
@@ -463,6 +463,21 @@ export const CommunitiesCMSAPITypes: APITypeData[] = [
|
|
|
463
463
|
},
|
|
464
464
|
];
|
|
465
465
|
|
|
466
|
+
export const ERLCMSAPITypes: APITypeData[] = [
|
|
467
|
+
{
|
|
468
|
+
type: "ERLC_GET_ONLINE_PLAYERS",
|
|
469
|
+
path: "erlc/get_online_players",
|
|
470
|
+
method: "POST",
|
|
471
|
+
minVersion: 0
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
type: "ERLC_ADD_NEW_RECORD",
|
|
475
|
+
path: "erlc/add_new_record",
|
|
476
|
+
method: "POST",
|
|
477
|
+
minVersion: 0
|
|
478
|
+
}
|
|
479
|
+
];
|
|
480
|
+
|
|
466
481
|
function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeData[] {
|
|
467
482
|
return array.map((val) => {
|
|
468
483
|
return {
|
|
@@ -472,9 +487,9 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
472
487
|
});
|
|
473
488
|
}
|
|
474
489
|
|
|
475
|
-
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) ];
|
|
490
|
+
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) ];
|
|
476
491
|
|
|
477
|
-
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC';
|
|
492
|
+
export type AllAPITypesType = 'GET_SERVERS' | 'SET_SERVERS' | 'GET_VERSION' | 'SET_PENAL_CODES' | 'SET_API_ID' | 'GET_TEMPLATES' | 'NEW_RECORD' | 'EDIT_RECORD' | 'REMOVE_RECORD' | 'LOOKUP_INT' | 'LOOKUP' | 'GET_ACCOUNT' | 'CHECK_APIID' | 'APPLY_PERMISSION_KEY' | 'SET_ACCOUNT_PERMISSIONS' | 'BAN_USER' | 'VERIFY_SECRET' | 'AUTH_STREETSIGNS' | 'SET_POSTALS' | 'SEND_PHOTO' | 'GET_CHARACTERS' | 'NEW_CHARACTER' | 'EDIT_CHARACTER' | 'REMOVE_CHARACTER' | 'GET_IDENTIFIERS' | 'MODIFY_IDENTIFIER' | 'SET_IDENTIFIER' | 'UNIT_PANIC' | 'UNIT_STATUS' | 'GET_BLIPS' | 'ADD_BLIP' | 'MODIFY_BLIP' | 'REMOVE_BLIP' | '911_CALL' | 'REMOVE_911' | 'GET_CALLS' | 'GET_ACTIVE_UNITS' | 'KICK_UNIT' | 'NEW_DISPATCH' | 'ATTACH_UNIT' | 'DETACH_UNIT' | 'SET_CALL_POSTAL' | 'SET_CALL_PRIMARY' | 'ADD_CALL_NOTE' | 'CLOSE_CALL' | 'UNIT_LOCATION' | 'SET_STREETSIGN_CONFIG' | 'UPDATE_STREETSIGN' | 'GET_COM_ACCOUNT' | 'GET_DEPARTMENTS' | 'GET_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS' | 'SET_ACCOUNT_RANKS' | 'RSVP' | 'CHANGE_FORM_STAGE' | 'KICK_ACCOUNT' | 'BAN_ACCOUNT' | 'LOOKUP' | 'EDIT_ACC_PROFLIE_FIELDS' | 'SET_ACCOUNT_NAME' | 'FORCE_SYNC' | "ERLC_GET_ONLINE_PLAYERS" | "ERLC_ADD_NEW_RECORD";
|
|
478
493
|
|
|
479
494
|
export interface CMSServerAPIStruct {
|
|
480
495
|
id: number;
|
|
@@ -965,6 +980,19 @@ export interface RESTTypedAPIDataStructs {
|
|
|
965
980
|
discord: string | undefined,
|
|
966
981
|
uniqueId: string | undefined,
|
|
967
982
|
]
|
|
983
|
+
// CMS - ERLC
|
|
984
|
+
ERLC_GET_ONLINE_PLAYERS: [
|
|
985
|
+
robloxJoinCode: string
|
|
986
|
+
]
|
|
987
|
+
ERLC_ADD_NEW_RECORD: [
|
|
988
|
+
robloxJoinCode: string,
|
|
989
|
+
executerDiscordId: string | number,
|
|
990
|
+
type: string,
|
|
991
|
+
reason: string,
|
|
992
|
+
playerDiscordId?: string | number,
|
|
993
|
+
playerRobloxId?: string | number,
|
|
994
|
+
points?: number,
|
|
995
|
+
]
|
|
968
996
|
}
|
|
969
997
|
|
|
970
998
|
export type PossibleRequestData =
|
|
@@ -327,4 +327,51 @@ export class CMSManager extends BaseManager {
|
|
|
327
327
|
}
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Gets a list of online ERLC players for the given roblox join code.
|
|
333
|
+
* @param {string} robloxJoinCode The roblox join code to get the online players for.
|
|
334
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the list of online players if successful.
|
|
335
|
+
*/
|
|
336
|
+
public async erlcGetOnlinePlayers(robloxJoinCode: string): Promise<globalTypes.CMSERLCGetOnlinePlayersPromiseResult> {
|
|
337
|
+
return new Promise(async (resolve, reject) => {
|
|
338
|
+
try {
|
|
339
|
+
const erlcGetOnlinePlayersRequest: any = await this.rest?.request('ERLC_GET_ONLINE_PLAYERS', robloxJoinCode);
|
|
340
|
+
resolve({ success: true, data: erlcGetOnlinePlayersRequest });
|
|
341
|
+
} catch (err) {
|
|
342
|
+
if (err instanceof APIError) {
|
|
343
|
+
resolve({ success: false, reason: err.response });
|
|
344
|
+
} else {
|
|
345
|
+
reject(err);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Adds a new ERLC record for a player.
|
|
353
|
+
* @param {Object} data The object that contains critical data to add a new ERLC record.
|
|
354
|
+
* @param {string} data.robloxJoinCode The roblox join code to add the record to.
|
|
355
|
+
* @param {string|number} data.executerDiscordId The discord ID of the person executing the record addition.
|
|
356
|
+
* @param {string} data.type The type of record being added (e.g., "Warning", "Infraction").
|
|
357
|
+
* @param {string} data.reason The reason for the record being added.
|
|
358
|
+
* @param {string|number} [data.playerDiscordId] (Optional) The discord ID of the player receiving the record.
|
|
359
|
+
* @param {string|number} [data.playerRobloxId] (Optional) The roblox ID of the player receiving the record.
|
|
360
|
+
* @param {number} [data.points] (Optional) The points associated with the record being added.
|
|
361
|
+
* @return {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
362
|
+
* */
|
|
363
|
+
public async erlcAddNewRecord(data: { robloxJoinCode: string, executerDiscordId: string | number, type: string, reason: string, playerDiscordId?: string | number, playerRobloxId?: string | number, points?: number }): Promise<globalTypes.CMSERLCAddNewRecordPromiseResult> {
|
|
364
|
+
return new Promise(async (resolve, reject) => {
|
|
365
|
+
try {
|
|
366
|
+
const erlcAddNewRecordRequest: any = await this.rest?.request('ERLC_ADD_NEW_RECORD', data.robloxJoinCode, data.executerDiscordId, data.type, data.reason, data.playerDiscordId, data.playerRobloxId, data.points);
|
|
367
|
+
resolve({ success: true, reason: erlcAddNewRecordRequest });
|
|
368
|
+
} catch (err) {
|
|
369
|
+
if (err instanceof APIError) {
|
|
370
|
+
resolve({ success: false, reason: err.response });
|
|
371
|
+
} else {
|
|
372
|
+
reject(err);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
}
|
|
330
377
|
}
|