@sonoransoftware/sonoran.js 1.0.27 → 1.0.28

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.
@@ -225,3 +225,8 @@ export interface clockInOutRequest {
225
225
  completed: boolean;
226
226
  startTime: string;
227
227
  }
228
+ export interface CMSSetAccountNamePromiseResult {
229
+ success: boolean;
230
+ data?: string;
231
+ reason?: string;
232
+ }
@@ -174,6 +174,16 @@ class REST extends events_1.EventEmitter {
174
174
  profileFields: args[5]
175
175
  };
176
176
  }
177
+ case 'SET_ACCOUNT_NAME': {
178
+ return {
179
+ apiId: args[0],
180
+ username: args[1],
181
+ accId: args[2],
182
+ discordId: args[3],
183
+ uniqueId: args[4],
184
+ newName: args[5]
185
+ };
186
+ }
177
187
  default: {
178
188
  return args;
179
189
  }
@@ -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';
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';
39
39
  export interface CMSServerAPIStruct {
40
40
  id: number;
41
41
  name: string;
@@ -424,6 +424,14 @@ export interface RESTTypedAPIDataStructs {
424
424
  discord?: string,
425
425
  uniqueId?: string
426
426
  ];
427
+ SET_ACCOUNT_NAME: [
428
+ apiId: string | undefined,
429
+ username: string | undefined,
430
+ accId: string | undefined,
431
+ discordId: string | undefined,
432
+ uniqueId: string | undefined,
433
+ newName: string
434
+ ];
427
435
  GET_GAME_SERVERS: [];
428
436
  VERIFY_WHITELIST: [
429
437
  apiId: string | undefined,
@@ -369,6 +369,12 @@ exports.GeneralCMSAPITypes = [
369
369
  path: 'general/edit_acc_profile_fields',
370
370
  method: 'POST',
371
371
  minVersion: 0
372
+ },
373
+ {
374
+ type: 'SET_ACCOUNT_NAME',
375
+ path: 'general/set_account_name',
376
+ method: 'POST',
377
+ minVersion: 0
372
378
  }
373
379
  ];
374
380
  exports.ServersCMSAPITypes = [
@@ -107,4 +107,16 @@ export declare class CMSManager extends BaseManager {
107
107
  * @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
108
108
  */
109
109
  setAccountRanks(changes: globalTypes.CMSSetAccountRanksChangesObject, apiId?: string, accId?: string, username?: string, discord?: string, uniqueId?: string): Promise<globalTypes.CMSSetAccountRanksPromiseResult>;
110
+ /**
111
+ * Sets a community account's name for the CMS community.
112
+ * @param {Object} data The object that contains critical data to set an account's name.
113
+ * @param {string} [data.apiId] (Optional) The api id to set the account name.
114
+ * @param {string} [data.username] (Optional) The username to set the account name.
115
+ * @param {string} [data.accId] (Optional) The account id to set the account name.
116
+ * @param {string} [data.discordId] (Optional) The discord id to set the account name.
117
+ * @param {string} [data.uniqueId] (Optional) The unique id to set the account name.
118
+ * @param {string} [data.newName] (Optional) The new name to set the account name.
119
+ * @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
120
+ */
121
+ setAccountName(apiId: string | undefined, username: string | undefined, accId: string | undefined, discordId: string | undefined, uniqueId: string | undefined, newName: string): Promise<globalTypes.CMSSetAccountNamePromiseResult>;
110
122
  }
@@ -264,5 +264,33 @@ class CMSManager extends BaseManager_1.BaseManager {
264
264
  }
265
265
  });
266
266
  }
267
+ /**
268
+ * Sets a community account's name for the CMS community.
269
+ * @param {Object} data The object that contains critical data to set an account's name.
270
+ * @param {string} [data.apiId] (Optional) The api id to set the account name.
271
+ * @param {string} [data.username] (Optional) The username to set the account name.
272
+ * @param {string} [data.accId] (Optional) The account id to set the account name.
273
+ * @param {string} [data.discordId] (Optional) The discord id to set the account name.
274
+ * @param {string} [data.uniqueId] (Optional) The unique id to set the account name.
275
+ * @param {string} [data.newName] (Optional) The new name to set the account name.
276
+ * @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
277
+ */
278
+ async setAccountName(apiId, username, accId, discordId, uniqueId, newName) {
279
+ return new Promise(async (resolve, reject) => {
280
+ var _a;
281
+ try {
282
+ const setAccountNameRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('SET_ACCOUNT_NAME', apiId, username, accId, discordId, uniqueId, newName));
283
+ resolve({ success: true, data: setAccountNameRequest });
284
+ }
285
+ catch (err) {
286
+ if (err instanceof src_1.APIError) {
287
+ resolve({ success: false, reason: err.response });
288
+ }
289
+ else {
290
+ reject(err);
291
+ }
292
+ }
293
+ });
294
+ }
267
295
  }
268
296
  exports.CMSManager = CMSManager;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
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
@@ -243,4 +243,10 @@ export interface clockInOutRequest {
243
243
  endTime: string;
244
244
  completed: boolean;
245
245
  startTime: string;
246
+ }
247
+
248
+ export interface CMSSetAccountNamePromiseResult {
249
+ success: boolean;
250
+ data?: string;
251
+ reason?: string;
246
252
  }
@@ -280,6 +280,16 @@ export class REST extends EventEmitter {
280
280
  profileFields: args[5]
281
281
  }
282
282
  }
283
+ case 'SET_ACCOUNT_NAME': {
284
+ return {
285
+ apiId: args[0],
286
+ username: args[1],
287
+ accId: args[2],
288
+ discordId: args[3],
289
+ uniqueId: args[4],
290
+ newName: args[5]
291
+ }
292
+ }
283
293
  default: {
284
294
  return args;
285
295
  }
@@ -400,6 +400,12 @@ export const GeneralCMSAPITypes: APITypeData[] = [
400
400
  path: 'general/edit_acc_profile_fields',
401
401
  method: 'POST',
402
402
  minVersion: 0
403
+ },
404
+ {
405
+ type: 'SET_ACCOUNT_NAME',
406
+ path: 'general/set_account_name',
407
+ method: 'POST',
408
+ minVersion: 0
403
409
  }
404
410
  ];
405
411
 
@@ -462,7 +468,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
462
468
 
463
469
  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) ];
464
470
 
465
- 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';
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';
466
472
 
467
473
  export interface CMSServerAPIStruct {
468
474
  id: number;
@@ -886,6 +892,14 @@ export interface RESTTypedAPIDataStructs {
886
892
  discord?: string,
887
893
  uniqueId?: string,
888
894
  ],
895
+ SET_ACCOUNT_NAME: [
896
+ apiId: string | undefined,
897
+ username: string | undefined,
898
+ accId: string | undefined,
899
+ discordId: string | undefined,
900
+ uniqueId: string | undefined,
901
+ newName: string,
902
+ ],
889
903
  // CMS - Servers
890
904
  GET_GAME_SERVERS: [];
891
905
  VERIFY_WHITELIST: [
@@ -226,4 +226,30 @@ export class CMSManager extends BaseManager {
226
226
  }
227
227
  });
228
228
  }
229
+
230
+ /**
231
+ * Sets a community account's name for the CMS community.
232
+ * @param {Object} data The object that contains critical data to set an account's name.
233
+ * @param {string} [data.apiId] (Optional) The api id to set the account name.
234
+ * @param {string} [data.username] (Optional) The username to set the account name.
235
+ * @param {string} [data.accId] (Optional) The account id to set the account name.
236
+ * @param {string} [data.discordId] (Optional) The discord id to set the account name.
237
+ * @param {string} [data.uniqueId] (Optional) The unique id to set the account name.
238
+ * @param {string} [data.newName] (Optional) The new name to set the account name.
239
+ * @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
240
+ */
241
+ public async setAccountName(apiId: string | undefined, username: string | undefined, accId: string | undefined, discordId: string | undefined, uniqueId: string | undefined, newName: string ): Promise<globalTypes.CMSSetAccountNamePromiseResult> {
242
+ return new Promise(async (resolve, reject) => {
243
+ try {
244
+ const setAccountNameRequest: any = await this.rest?.request('SET_ACCOUNT_NAME', apiId, username, accId, discordId, uniqueId, newName);
245
+ resolve({ success: true, data: setAccountNameRequest });
246
+ } catch (err) {
247
+ if (err instanceof APIError) {
248
+ resolve({ success: false, reason: err.response });
249
+ } else {
250
+ reject(err);
251
+ }
252
+ }
253
+ });
254
+ }
229
255
  }