@sonoransoftware/sonoran.js 1.0.13 → 1.0.14

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.
@@ -5,7 +5,7 @@ const events_1 = require("events");
5
5
  const RequestManager_1 = require("./RequestManager");
6
6
  const constants_1 = require("./utils/constants");
7
7
  const constants_2 = require("../../../../constants");
8
- const Utils_1 = require("./utils/Utils");
8
+ const utils_1 = require("./utils/utils");
9
9
  class REST extends events_1.EventEmitter {
10
10
  constructor(_instance, _manager, _product, options) {
11
11
  super();
@@ -49,7 +49,7 @@ class REST extends events_1.EventEmitter {
49
49
  if (!communityId || !apiKey)
50
50
  throw new Error(`Community ID or API Key could not be found for request. P${apiType.product}`);
51
51
  if (apiType.minVersion > this.manager.version)
52
- throw new Error(`[${type}] Subscription version too low for this API type request. Current Version: ${(0, Utils_1.convertSubNumToName)(this.manager.version)} Needed Version: ${(0, Utils_1.convertSubNumToName)(apiType.minVersion)}`);
52
+ throw new Error(`[${type}] Subscription version too low for this API type request. Current Version: ${(0, utils_1.convertSubNumToName)(this.manager.version)} Needed Version: ${(0, utils_1.convertSubNumToName)(apiType.minVersion)}`);
53
53
  const formattedData = this.formatDataArguments(apiType.type, args);
54
54
  const options = {
55
55
  id: communityId,
@@ -74,6 +74,13 @@ class REST extends events_1.EventEmitter {
74
74
  serverId: args[0]
75
75
  };
76
76
  }
77
+ case 'RSVP': {
78
+ return {
79
+ eventId: args[0],
80
+ apiId: args[1],
81
+ accId: args[2],
82
+ };
83
+ }
77
84
  case 'GET_COM_ACCOUNT': {
78
85
  return {
79
86
  apiId: args[0],
@@ -31,8 +31,9 @@ export declare const CivilianCADAPITypes: APITypeData[];
31
31
  export declare const EmergencyCADAPITypes: APITypeData[];
32
32
  export declare const GeneralCMSAPITypes: APITypeData[];
33
33
  export declare const ServersCMSAPITypes: APITypeData[];
34
+ export declare const EventsCMSAPITypes: APITypeData[];
34
35
  export declare const AllAPITypes: AllAPITypeData[];
35
- export declare 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';
36
+ export declare 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';
36
37
  export interface CMSServerAPIStruct {
37
38
  id: number;
38
39
  name: string;
@@ -421,6 +422,11 @@ export interface RESTTypedAPIDataStructs {
421
422
  FULL_WHITELIST: [
422
423
  serverId?: number
423
424
  ];
425
+ RSVP: [
426
+ eventId: string,
427
+ apiId: string | undefined,
428
+ accId: string | undefined
429
+ ];
424
430
  }
425
431
  export declare type PossibleRequestData = undefined | {
426
432
  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.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.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 = {
@@ -373,6 +373,14 @@ exports.ServersCMSAPITypes = [
373
373
  minVersion: 3
374
374
  }
375
375
  ];
376
+ exports.EventsCMSAPITypes = [
377
+ {
378
+ type: 'RSVP',
379
+ path: 'events/rsvp',
380
+ method: 'POST',
381
+ minVersion: 3
382
+ }
383
+ ];
376
384
  function formatForAll(array, product) {
377
385
  return array.map((val) => {
378
386
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sonoransoftware/sonoran.js",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
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",
@@ -13,7 +13,7 @@ import type { RequestInit, Response } from 'node-fetch';
13
13
  // import type Collection from '@discordjs/collection';
14
14
  import { Instance } from '../../../../instance/Instance';
15
15
  import { CADManager } from '../../../../managers/CADManager';
16
- import { convertSubNumToName } from './utils/Utils';
16
+ import { convertSubNumToName } from './utils/utils';
17
17
  import { CMSManager } from '../../../../managers/CMSManager';
18
18
 
19
19
  /**
@@ -179,6 +179,13 @@ export class REST extends EventEmitter {
179
179
  serverId: args[0]
180
180
  }
181
181
  }
182
+ case 'RSVP': {
183
+ return {
184
+ eventId: args[0],
185
+ apiId: args[1],
186
+ accId: args[2],
187
+ }
188
+ }
182
189
  case 'GET_COM_ACCOUNT': {
183
190
  return {
184
191
  apiId: args[0],
@@ -406,6 +406,15 @@ export const ServersCMSAPITypes: APITypeData[] = [
406
406
  }
407
407
  ];
408
408
 
409
+ export const EventsCMSAPITypes: APITypeData[] = [
410
+ {
411
+ type: 'RSVP',
412
+ path: 'events/rsvp',
413
+ method: 'POST',
414
+ minVersion: 3
415
+ }
416
+ ];
417
+
409
418
  function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeData[] {
410
419
  return array.map((val) => {
411
420
  return {
@@ -417,7 +426,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
417
426
 
418
427
  export const AllAPITypes: AllAPITypeData[] = [ ...formatForAll(GeneralCADAPITypes, productEnums.CAD), ...formatForAll(CivilianCADAPITypes, productEnums.CAD), ...formatForAll(EmergencyCADAPITypes, productEnums.CAD), ...formatForAll(GeneralCMSAPITypes, productEnums.CMS), ...formatForAll(ServersCMSAPITypes, productEnums.CMS) ];
419
428
 
420
- 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';
429
+ 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';
421
430
 
422
431
  export interface CMSServerAPIStruct {
423
432
  id: number;
@@ -719,7 +728,7 @@ export interface RESTTypedAPIDataStructs {
719
728
  ];
720
729
  // CAD - Civilian
721
730
  GET_CHARACTERS: [apiId: string];
722
- NEW_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
731
+ NEW_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
723
732
  EDIT_CHARACTER: [data: CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct];
724
733
  REMOVE_CHARACTER: [id: number];
725
734
  // CAD - Emergency
@@ -842,10 +851,15 @@ export interface RESTTypedAPIDataStructs {
842
851
  FULL_WHITELIST: [
843
852
  serverId?: number,
844
853
  ]
854
+ RSVP : [
855
+ eventId: string,
856
+ apiId: string | undefined,
857
+ accId: string | undefined,
858
+ ]
845
859
  }
846
860
 
847
- export type PossibleRequestData =
848
- undefined |
861
+ export type PossibleRequestData =
862
+ undefined |
849
863
  {
850
864
  data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct
851
865
  } |