@sonoransoftware/sonoran.js 1.0.30 → 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.
@@ -238,3 +238,7 @@ export interface CMSBanAccountPromiseResult {
238
238
  success: boolean;
239
239
  reason?: string;
240
240
  }
241
+ export interface CMSForceSyncPromiseResult {
242
+ success: boolean;
243
+ reason?: string;
244
+ }
@@ -186,6 +186,15 @@ class REST extends events_1.EventEmitter {
186
186
  newName: args[5]
187
187
  };
188
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
+ }
189
198
  default: {
190
199
  return args;
191
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,
@@ -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 = [
@@ -153,4 +153,21 @@ export declare class CMSManager extends BaseManager {
153
153
  discord?: string;
154
154
  uniqueId?: string;
155
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>;
156
173
  }
@@ -346,5 +346,32 @@ class CMSManager extends BaseManager_1.BaseManager {
346
346
  }
347
347
  });
348
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
+ }
349
376
  }
350
377
  exports.CMSManager = CMSManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.30",
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
@@ -259,4 +259,9 @@ export interface CMSKickAccountPromiseResult {
259
259
  export interface CMSBanAccountPromiseResult {
260
260
  success: boolean;
261
261
  reason?: string;
262
+ }
263
+
264
+ export interface CMSForceSyncPromiseResult {
265
+ success: boolean;
266
+ reason?: string;
262
267
  }
@@ -292,6 +292,15 @@ export class REST extends EventEmitter {
292
292
  newName: args[5]
293
293
  }
294
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
+ }
295
304
  default: {
296
305
  return args;
297
306
  }
@@ -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: [
@@ -302,4 +302,29 @@ export class CMSManager extends BaseManager {
302
302
  }
303
303
  });
304
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
+ }
305
330
  }