@sonoransoftware/sonoran.js 1.0.29 → 1.0.31
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 +12 -0
- package/dist/libs/rest/src/lib/REST.js +17 -6
- package/dist/libs/rest/src/lib/utils/constants.d.ts +22 -1
- package/dist/libs/rest/src/lib/utils/constants.js +8 -2
- package/dist/managers/CMSManager.d.ts +51 -0
- package/dist/managers/CMSManager.js +81 -0
- package/package.json +1 -1
- package/src/constants.ts +15 -0
- package/src/libs/rest/src/lib/REST.ts +17 -6
- package/src/libs/rest/src/lib/utils/constants.ts +30 -3
- package/src/managers/CMSManager.ts +75 -0
package/dist/constants.d.ts
CHANGED
|
@@ -230,3 +230,15 @@ export interface CMSSetAccountNamePromiseResult {
|
|
|
230
230
|
data?: string;
|
|
231
231
|
reason?: string;
|
|
232
232
|
}
|
|
233
|
+
export interface CMSKickAccountPromiseResult {
|
|
234
|
+
success: boolean;
|
|
235
|
+
reason?: string;
|
|
236
|
+
}
|
|
237
|
+
export interface CMSBanAccountPromiseResult {
|
|
238
|
+
success: boolean;
|
|
239
|
+
reason?: string;
|
|
240
|
+
}
|
|
241
|
+
export interface CMSForceSyncPromiseResult {
|
|
242
|
+
success: boolean;
|
|
243
|
+
reason?: string;
|
|
244
|
+
}
|
|
@@ -145,17 +145,19 @@ class REST extends events_1.EventEmitter {
|
|
|
145
145
|
case 'BAN_ACCOUNT': {
|
|
146
146
|
return {
|
|
147
147
|
apiId: args[0],
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
148
|
+
username: args[1],
|
|
149
|
+
accId: args[2],
|
|
150
|
+
discord: args[3],
|
|
151
|
+
uniqueId: args[4]
|
|
151
152
|
};
|
|
152
153
|
}
|
|
153
154
|
case 'KICK_ACCOUNT': {
|
|
154
155
|
return {
|
|
155
156
|
apiId: args[0],
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
username: args[1],
|
|
158
|
+
accId: args[2],
|
|
159
|
+
discord: args[3],
|
|
160
|
+
uniqueId: args[4]
|
|
159
161
|
};
|
|
160
162
|
}
|
|
161
163
|
case 'LOOKUP': {
|
|
@@ -184,6 +186,15 @@ class REST extends events_1.EventEmitter {
|
|
|
184
186
|
newName: args[5]
|
|
185
187
|
};
|
|
186
188
|
}
|
|
189
|
+
case 'FORCE_SYNC': {
|
|
190
|
+
return {
|
|
191
|
+
apiId: args[0],
|
|
192
|
+
username: args[1],
|
|
193
|
+
accId: args[2],
|
|
194
|
+
discordId: args[3],
|
|
195
|
+
uniqueId: args[4],
|
|
196
|
+
};
|
|
197
|
+
}
|
|
187
198
|
default: {
|
|
188
199
|
return args;
|
|
189
200
|
}
|
|
@@ -35,7 +35,7 @@ export declare const EventsCMSAPITypes: APITypeData[];
|
|
|
35
35
|
export declare const FormsCMSAPITypes: APITypeData[];
|
|
36
36
|
export declare const CommunitiesCMSAPITypes: APITypeData[];
|
|
37
37
|
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';
|
|
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
39
|
export interface CMSServerAPIStruct {
|
|
40
40
|
id: number;
|
|
41
41
|
name: string;
|
|
@@ -432,6 +432,13 @@ export interface RESTTypedAPIDataStructs {
|
|
|
432
432
|
uniqueId: string | undefined,
|
|
433
433
|
newName: string
|
|
434
434
|
];
|
|
435
|
+
FORCE_SYNC: [
|
|
436
|
+
apiId: string | undefined,
|
|
437
|
+
username: string | undefined,
|
|
438
|
+
accId: string | undefined,
|
|
439
|
+
discordId: string | undefined,
|
|
440
|
+
uniqueId: string | undefined
|
|
441
|
+
];
|
|
435
442
|
GET_GAME_SERVERS: [];
|
|
436
443
|
VERIFY_WHITELIST: [
|
|
437
444
|
apiId: string | undefined,
|
|
@@ -468,6 +475,20 @@ export interface RESTTypedAPIDataStructs {
|
|
|
468
475
|
discord: string,
|
|
469
476
|
uniqueId: number
|
|
470
477
|
];
|
|
478
|
+
BAN_ACCOUNT: [
|
|
479
|
+
apiId: string | undefined,
|
|
480
|
+
username: string | undefined,
|
|
481
|
+
accId: string | undefined,
|
|
482
|
+
discord: string | undefined,
|
|
483
|
+
uniqueId: string | undefined
|
|
484
|
+
];
|
|
485
|
+
KICK_ACCOUNT: [
|
|
486
|
+
apiId: string | undefined,
|
|
487
|
+
username: string | undefined,
|
|
488
|
+
accId: string | undefined,
|
|
489
|
+
discord: string | undefined,
|
|
490
|
+
uniqueId: string | undefined
|
|
491
|
+
];
|
|
471
492
|
}
|
|
472
493
|
export type PossibleRequestData = undefined | {
|
|
473
494
|
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct;
|
|
@@ -356,13 +356,13 @@ exports.GeneralCMSAPITypes = [
|
|
|
356
356
|
type: 'KICK_ACCOUNT',
|
|
357
357
|
path: 'general/kick_account',
|
|
358
358
|
method: 'POST',
|
|
359
|
-
minVersion:
|
|
359
|
+
minVersion: 0
|
|
360
360
|
},
|
|
361
361
|
{
|
|
362
362
|
type: 'BAN_ACCOUNT',
|
|
363
363
|
path: 'general/ban_account',
|
|
364
364
|
method: 'POST',
|
|
365
|
-
minVersion:
|
|
365
|
+
minVersion: 0
|
|
366
366
|
},
|
|
367
367
|
{
|
|
368
368
|
type: 'EDIT_ACC_PROFLIE_FIELDS',
|
|
@@ -375,6 +375,12 @@ exports.GeneralCMSAPITypes = [
|
|
|
375
375
|
path: 'general/set_account_name',
|
|
376
376
|
method: 'POST',
|
|
377
377
|
minVersion: 0
|
|
378
|
+
},
|
|
379
|
+
{
|
|
380
|
+
type: 'FORCE_SYNC',
|
|
381
|
+
path: 'general/force_sync',
|
|
382
|
+
method: 'POST',
|
|
383
|
+
minVersion: 0
|
|
378
384
|
}
|
|
379
385
|
];
|
|
380
386
|
exports.ServersCMSAPITypes = [
|
|
@@ -119,4 +119,55 @@ export declare class CMSManager extends BaseManager {
|
|
|
119
119
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
120
120
|
*/
|
|
121
121
|
setAccountName(apiId: string | undefined, username: string | undefined, accId: string | undefined, discord: string | undefined, uniqueId: string | undefined, newName: string): Promise<globalTypes.CMSSetAccountNamePromiseResult>;
|
|
122
|
+
/**
|
|
123
|
+
*
|
|
124
|
+
* @param {Object} params The object that contains parameters to ban an account.
|
|
125
|
+
* @param {string} [params.apiId] (Optional) The api id to ban the account.
|
|
126
|
+
* @param {string} [params.username] (Optional) The username to ban the account.
|
|
127
|
+
* @param {string} [params.accId] (Optional) The account id to ban the account.
|
|
128
|
+
* @param {string} [params.discord] (Optional) The discord id to ban the account.
|
|
129
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to ban the account.
|
|
130
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
131
|
+
*/
|
|
132
|
+
cmsBanAccount(params: {
|
|
133
|
+
apiId?: string;
|
|
134
|
+
username?: string;
|
|
135
|
+
accId?: string;
|
|
136
|
+
discord?: string;
|
|
137
|
+
uniqueId?: string;
|
|
138
|
+
}): Promise<globalTypes.CMSBanAccountPromiseResult>;
|
|
139
|
+
/**
|
|
140
|
+
*
|
|
141
|
+
* @param {Object} params The object that contains parameters to kick an account.
|
|
142
|
+
* @param {string} [params.apiId] (Optional) The api id to kick the account.
|
|
143
|
+
* @param {string} [params.username] (Optional) The username to kick the account.
|
|
144
|
+
* @param {string} [params.accId] (Optional) The account id to kick the account.
|
|
145
|
+
* @param {string} [params.discord] (Optional) The discord id to kick the account.
|
|
146
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to kick the account.
|
|
147
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
148
|
+
*/
|
|
149
|
+
cmsKickAccount(params: {
|
|
150
|
+
apiId?: string;
|
|
151
|
+
username?: string;
|
|
152
|
+
accId?: string;
|
|
153
|
+
discord?: string;
|
|
154
|
+
uniqueId?: string;
|
|
155
|
+
}): Promise<globalTypes.CMSKickAccountPromiseResult>;
|
|
156
|
+
/**
|
|
157
|
+
*
|
|
158
|
+
* @param {Object} params The object that contains parameters to kick an account.
|
|
159
|
+
* @param {string} [params.apiId] (Optional) The api id to kick the account.
|
|
160
|
+
* @param {string} [params.username] (Optional) The username to kick the account.
|
|
161
|
+
* @param {string} [params.accId] (Optional) The account id to kick the account.
|
|
162
|
+
* @param {string} [params.discordId] (Optional) The discord id to kick the account.
|
|
163
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to kick the account.
|
|
164
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
165
|
+
*/
|
|
166
|
+
forceSync(params: {
|
|
167
|
+
apiId?: string;
|
|
168
|
+
username?: string;
|
|
169
|
+
accId?: string;
|
|
170
|
+
discordId?: string;
|
|
171
|
+
uniqueId?: string;
|
|
172
|
+
}): Promise<globalTypes.CMSForceSyncPromiseResult>;
|
|
122
173
|
}
|
|
@@ -292,5 +292,86 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
292
292
|
}
|
|
293
293
|
});
|
|
294
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
*
|
|
297
|
+
* @param {Object} params The object that contains parameters to ban an account.
|
|
298
|
+
* @param {string} [params.apiId] (Optional) The api id to ban the account.
|
|
299
|
+
* @param {string} [params.username] (Optional) The username to ban the account.
|
|
300
|
+
* @param {string} [params.accId] (Optional) The account id to ban the account.
|
|
301
|
+
* @param {string} [params.discord] (Optional) The discord id to ban the account.
|
|
302
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to ban the account.
|
|
303
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
304
|
+
*/
|
|
305
|
+
async cmsBanAccount(params) {
|
|
306
|
+
return new Promise(async (resolve, reject) => {
|
|
307
|
+
var _a;
|
|
308
|
+
try {
|
|
309
|
+
const banAccountRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('BAN_ACCOUNT', params.apiId, params.username, params.accId, params.discord, params.uniqueId));
|
|
310
|
+
resolve({ success: true, reason: banAccountRequest });
|
|
311
|
+
}
|
|
312
|
+
catch (err) {
|
|
313
|
+
if (err instanceof src_1.APIError) {
|
|
314
|
+
resolve({ success: false, reason: err.response });
|
|
315
|
+
}
|
|
316
|
+
else {
|
|
317
|
+
reject(err);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
});
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
*
|
|
324
|
+
* @param {Object} params The object that contains parameters to kick an account.
|
|
325
|
+
* @param {string} [params.apiId] (Optional) The api id to kick the account.
|
|
326
|
+
* @param {string} [params.username] (Optional) The username to kick the account.
|
|
327
|
+
* @param {string} [params.accId] (Optional) The account id to kick the account.
|
|
328
|
+
* @param {string} [params.discord] (Optional) The discord id to kick the account.
|
|
329
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to kick the account.
|
|
330
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
331
|
+
*/
|
|
332
|
+
async cmsKickAccount(params) {
|
|
333
|
+
return new Promise(async (resolve, reject) => {
|
|
334
|
+
var _a;
|
|
335
|
+
try {
|
|
336
|
+
const kickAccountRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('KICK_ACCOUNT', params.apiId, params.username, params.accId, params.discord, params.uniqueId));
|
|
337
|
+
resolve({ success: true, reason: kickAccountRequest });
|
|
338
|
+
}
|
|
339
|
+
catch (err) {
|
|
340
|
+
if (err instanceof src_1.APIError) {
|
|
341
|
+
resolve({ success: false, reason: err.response });
|
|
342
|
+
}
|
|
343
|
+
else {
|
|
344
|
+
reject(err);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
*
|
|
351
|
+
* @param {Object} params The object that contains parameters to kick an account.
|
|
352
|
+
* @param {string} [params.apiId] (Optional) The api id to kick the account.
|
|
353
|
+
* @param {string} [params.username] (Optional) The username to kick the account.
|
|
354
|
+
* @param {string} [params.accId] (Optional) The account id to kick the account.
|
|
355
|
+
* @param {string} [params.discordId] (Optional) The discord id to kick the account.
|
|
356
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to kick the account.
|
|
357
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
358
|
+
*/
|
|
359
|
+
async forceSync(params) {
|
|
360
|
+
return new Promise(async (resolve, reject) => {
|
|
361
|
+
var _a;
|
|
362
|
+
try {
|
|
363
|
+
const forceSyncRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('FORCE_SYNC', params.apiId, params.username, params.accId, params.discordId, params.uniqueId));
|
|
364
|
+
resolve({ success: true, reason: forceSyncRequest });
|
|
365
|
+
}
|
|
366
|
+
catch (err) {
|
|
367
|
+
if (err instanceof src_1.APIError) {
|
|
368
|
+
resolve({ success: false, reason: err.response });
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
reject(err);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
});
|
|
375
|
+
}
|
|
295
376
|
}
|
|
296
377
|
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.31",
|
|
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
|
@@ -249,4 +249,19 @@ export interface CMSSetAccountNamePromiseResult {
|
|
|
249
249
|
success: boolean;
|
|
250
250
|
data?: string;
|
|
251
251
|
reason?: string;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
export interface CMSKickAccountPromiseResult {
|
|
255
|
+
success: boolean;
|
|
256
|
+
reason?: string;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface CMSBanAccountPromiseResult {
|
|
260
|
+
success: boolean;
|
|
261
|
+
reason?: string;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export interface CMSForceSyncPromiseResult {
|
|
265
|
+
success: boolean;
|
|
266
|
+
reason?: string;
|
|
252
267
|
}
|
|
@@ -251,17 +251,19 @@ export class REST extends EventEmitter {
|
|
|
251
251
|
case 'BAN_ACCOUNT': {
|
|
252
252
|
return {
|
|
253
253
|
apiId: args[0],
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
username: args[1],
|
|
255
|
+
accId: args[2],
|
|
256
|
+
discord: args[3],
|
|
257
|
+
uniqueId: args[4]
|
|
257
258
|
};
|
|
258
259
|
}
|
|
259
260
|
case 'KICK_ACCOUNT': {
|
|
260
261
|
return {
|
|
261
262
|
apiId: args[0],
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
263
|
+
username: args[1],
|
|
264
|
+
accId: args[2],
|
|
265
|
+
discord: args[3],
|
|
266
|
+
uniqueId: args[4]
|
|
265
267
|
};
|
|
266
268
|
}
|
|
267
269
|
case 'LOOKUP': {
|
|
@@ -290,6 +292,15 @@ export class REST extends EventEmitter {
|
|
|
290
292
|
newName: args[5]
|
|
291
293
|
}
|
|
292
294
|
}
|
|
295
|
+
case 'FORCE_SYNC': {
|
|
296
|
+
return {
|
|
297
|
+
apiId: args[0],
|
|
298
|
+
username: args[1],
|
|
299
|
+
accId: args[2],
|
|
300
|
+
discordId: args[3],
|
|
301
|
+
uniqueId: args[4],
|
|
302
|
+
}
|
|
303
|
+
}
|
|
293
304
|
default: {
|
|
294
305
|
return args;
|
|
295
306
|
}
|
|
@@ -387,13 +387,13 @@ export const GeneralCMSAPITypes: APITypeData[] = [
|
|
|
387
387
|
type: 'KICK_ACCOUNT',
|
|
388
388
|
path: 'general/kick_account',
|
|
389
389
|
method: 'POST',
|
|
390
|
-
minVersion:
|
|
390
|
+
minVersion: 0
|
|
391
391
|
},
|
|
392
392
|
{
|
|
393
393
|
type: 'BAN_ACCOUNT',
|
|
394
394
|
path: 'general/ban_account',
|
|
395
395
|
method: 'POST',
|
|
396
|
-
minVersion:
|
|
396
|
+
minVersion: 0
|
|
397
397
|
},
|
|
398
398
|
{
|
|
399
399
|
type: 'EDIT_ACC_PROFLIE_FIELDS',
|
|
@@ -406,6 +406,12 @@ export const GeneralCMSAPITypes: APITypeData[] = [
|
|
|
406
406
|
path: 'general/set_account_name',
|
|
407
407
|
method: 'POST',
|
|
408
408
|
minVersion: 0
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
type: 'FORCE_SYNC',
|
|
412
|
+
path: 'general/force_sync',
|
|
413
|
+
method: 'POST',
|
|
414
|
+
minVersion: 0
|
|
409
415
|
}
|
|
410
416
|
];
|
|
411
417
|
|
|
@@ -468,7 +474,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
468
474
|
|
|
469
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) ];
|
|
470
476
|
|
|
471
|
-
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';
|
|
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';
|
|
472
478
|
|
|
473
479
|
export interface CMSServerAPIStruct {
|
|
474
480
|
id: number;
|
|
@@ -900,6 +906,13 @@ export interface RESTTypedAPIDataStructs {
|
|
|
900
906
|
uniqueId: string | undefined,
|
|
901
907
|
newName: string,
|
|
902
908
|
],
|
|
909
|
+
FORCE_SYNC: [
|
|
910
|
+
apiId: string | undefined,
|
|
911
|
+
username: string | undefined,
|
|
912
|
+
accId: string | undefined,
|
|
913
|
+
discordId: string | undefined,
|
|
914
|
+
uniqueId: string | undefined,
|
|
915
|
+
],
|
|
903
916
|
// CMS - Servers
|
|
904
917
|
GET_GAME_SERVERS: [];
|
|
905
918
|
VERIFY_WHITELIST: [
|
|
@@ -938,6 +951,20 @@ export interface RESTTypedAPIDataStructs {
|
|
|
938
951
|
discord: string,
|
|
939
952
|
uniqueId: number,
|
|
940
953
|
]
|
|
954
|
+
BAN_ACCOUNT: [
|
|
955
|
+
apiId: string | undefined,
|
|
956
|
+
username: string | undefined,
|
|
957
|
+
accId: string | undefined,
|
|
958
|
+
discord: string | undefined,
|
|
959
|
+
uniqueId: string | undefined,
|
|
960
|
+
]
|
|
961
|
+
KICK_ACCOUNT: [
|
|
962
|
+
apiId: string | undefined,
|
|
963
|
+
username: string | undefined,
|
|
964
|
+
accId: string | undefined,
|
|
965
|
+
discord: string | undefined,
|
|
966
|
+
uniqueId: string | undefined,
|
|
967
|
+
]
|
|
941
968
|
}
|
|
942
969
|
|
|
943
970
|
export type PossibleRequestData =
|
|
@@ -252,4 +252,79 @@ export class CMSManager extends BaseManager {
|
|
|
252
252
|
}
|
|
253
253
|
});
|
|
254
254
|
}
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
*
|
|
258
|
+
* @param {Object} params The object that contains parameters to ban an account.
|
|
259
|
+
* @param {string} [params.apiId] (Optional) The api id to ban the account.
|
|
260
|
+
* @param {string} [params.username] (Optional) The username to ban the account.
|
|
261
|
+
* @param {string} [params.accId] (Optional) The account id to ban the account.
|
|
262
|
+
* @param {string} [params.discord] (Optional) The discord id to ban the account.
|
|
263
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to ban the account.
|
|
264
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
265
|
+
*/
|
|
266
|
+
public async cmsBanAccount(params: {apiId?: string, username?: string, accId?: string, discord?: string, uniqueId?: string}): Promise<globalTypes.CMSBanAccountPromiseResult> {
|
|
267
|
+
return new Promise(async (resolve, reject) => {
|
|
268
|
+
try {
|
|
269
|
+
const banAccountRequest: any = await this.rest?.request('BAN_ACCOUNT', params.apiId, params.username, params.accId, params.discord, params.uniqueId);
|
|
270
|
+
resolve({ success: true, reason: banAccountRequest });
|
|
271
|
+
} catch (err) {
|
|
272
|
+
if (err instanceof APIError) {
|
|
273
|
+
resolve({ success: false, reason: err.response });
|
|
274
|
+
} else {
|
|
275
|
+
reject(err);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
*
|
|
283
|
+
* @param {Object} params The object that contains parameters to kick an account.
|
|
284
|
+
* @param {string} [params.apiId] (Optional) The api id to kick the account.
|
|
285
|
+
* @param {string} [params.username] (Optional) The username to kick the account.
|
|
286
|
+
* @param {string} [params.accId] (Optional) The account id to kick the account.
|
|
287
|
+
* @param {string} [params.discord] (Optional) The discord id to kick the account.
|
|
288
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to kick the account.
|
|
289
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
290
|
+
*/
|
|
291
|
+
public async cmsKickAccount(params: {apiId?: string, username?: string, accId?: string, discord?: string, uniqueId?: string}): Promise<globalTypes.CMSKickAccountPromiseResult> {
|
|
292
|
+
return new Promise(async (resolve, reject) => {
|
|
293
|
+
try {
|
|
294
|
+
const kickAccountRequest: any = await this.rest?.request('KICK_ACCOUNT', params.apiId, params.username, params.accId, params.discord, params.uniqueId);
|
|
295
|
+
resolve({ success: true, reason: kickAccountRequest });
|
|
296
|
+
} catch (err) {
|
|
297
|
+
if (err instanceof APIError) {
|
|
298
|
+
resolve({ success: false, reason: err.response });
|
|
299
|
+
} else {
|
|
300
|
+
reject(err);
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
*
|
|
308
|
+
* @param {Object} params The object that contains parameters to kick an account.
|
|
309
|
+
* @param {string} [params.apiId] (Optional) The api id to kick the account.
|
|
310
|
+
* @param {string} [params.username] (Optional) The username to kick the account.
|
|
311
|
+
* @param {string} [params.accId] (Optional) The account id to kick the account.
|
|
312
|
+
* @param {string} [params.discordId] (Optional) The discord id to kick the account.
|
|
313
|
+
* @param {string} [params.uniqueId] (Optional) The unique id to kick the account.
|
|
314
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
315
|
+
*/
|
|
316
|
+
public async forceSync(params: {apiId?: string, username?: string, accId?: string, discordId?: string, uniqueId?: string}): Promise<globalTypes.CMSForceSyncPromiseResult> {
|
|
317
|
+
return new Promise(async (resolve, reject) => {
|
|
318
|
+
try {
|
|
319
|
+
const forceSyncRequest: any = await this.rest?.request('FORCE_SYNC', params.apiId, params.username, params.accId, params.discordId, params.uniqueId);
|
|
320
|
+
resolve({ success: true, reason: forceSyncRequest });
|
|
321
|
+
} catch (err) {
|
|
322
|
+
if (err instanceof APIError) {
|
|
323
|
+
resolve({ success: false, reason: err.response });
|
|
324
|
+
} else {
|
|
325
|
+
reject(err);
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
});
|
|
329
|
+
}
|
|
255
330
|
}
|