@sonoransoftware/sonoran.js 1.0.29 → 1.0.30

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.
@@ -230,3 +230,11 @@ 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
+ }
@@ -145,17 +145,19 @@ class REST extends events_1.EventEmitter {
145
145
  case 'BAN_ACCOUNT': {
146
146
  return {
147
147
  apiId: args[0],
148
- accId: args[1],
149
- discord: args[2],
150
- uniqueId: args[3]
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
- accId: args[1],
157
- discord: args[2],
158
- uniqueId: args[3]
157
+ username: args[1],
158
+ accId: args[2],
159
+ discord: args[3],
160
+ uniqueId: args[4]
159
161
  };
160
162
  }
161
163
  case 'LOOKUP': {
@@ -468,6 +468,20 @@ export interface RESTTypedAPIDataStructs {
468
468
  discord: string,
469
469
  uniqueId: number
470
470
  ];
471
+ BAN_ACCOUNT: [
472
+ apiId: string | undefined,
473
+ username: string | undefined,
474
+ accId: string | undefined,
475
+ discord: string | undefined,
476
+ uniqueId: string | undefined
477
+ ];
478
+ KICK_ACCOUNT: [
479
+ apiId: string | undefined,
480
+ username: string | undefined,
481
+ accId: string | undefined,
482
+ discord: string | undefined,
483
+ uniqueId: string | undefined
484
+ ];
471
485
  }
472
486
  export type PossibleRequestData = undefined | {
473
487
  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: 3
359
+ minVersion: 0
360
360
  },
361
361
  {
362
362
  type: 'BAN_ACCOUNT',
363
363
  path: 'general/ban_account',
364
364
  method: 'POST',
365
- minVersion: 3
365
+ minVersion: 0
366
366
  },
367
367
  {
368
368
  type: 'EDIT_ACC_PROFLIE_FIELDS',
@@ -119,4 +119,38 @@ 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>;
122
156
  }
@@ -292,5 +292,59 @@ 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
+ }
295
349
  }
296
350
  exports.CMSManager = CMSManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.29",
3
+ "version": "1.0.30",
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,14 @@ 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;
252
262
  }
@@ -251,17 +251,19 @@ export class REST extends EventEmitter {
251
251
  case 'BAN_ACCOUNT': {
252
252
  return {
253
253
  apiId: args[0],
254
- accId: args[1],
255
- discord: args[2],
256
- uniqueId: args[3]
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
- accId: args[1],
263
- discord: args[2],
264
- uniqueId: args[3]
263
+ username: args[1],
264
+ accId: args[2],
265
+ discord: args[3],
266
+ uniqueId: args[4]
265
267
  };
266
268
  }
267
269
  case 'LOOKUP': {
@@ -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: 3
390
+ minVersion: 0
391
391
  },
392
392
  {
393
393
  type: 'BAN_ACCOUNT',
394
394
  path: 'general/ban_account',
395
395
  method: 'POST',
396
- minVersion: 3
396
+ minVersion: 0
397
397
  },
398
398
  {
399
399
  type: 'EDIT_ACC_PROFLIE_FIELDS',
@@ -938,6 +938,20 @@ export interface RESTTypedAPIDataStructs {
938
938
  discord: string,
939
939
  uniqueId: number,
940
940
  ]
941
+ BAN_ACCOUNT: [
942
+ apiId: string | undefined,
943
+ username: string | undefined,
944
+ accId: string | undefined,
945
+ discord: string | undefined,
946
+ uniqueId: string | undefined,
947
+ ]
948
+ KICK_ACCOUNT: [
949
+ apiId: string | undefined,
950
+ username: string | undefined,
951
+ accId: string | undefined,
952
+ discord: string | undefined,
953
+ uniqueId: string | undefined,
954
+ ]
941
955
  }
942
956
 
943
957
  export type PossibleRequestData =
@@ -252,4 +252,54 @@ 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
+ }
255
305
  }