@sonoransoftware/sonoran.js 1.0.2 → 1.0.3
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 +28 -10
- package/dist/index.d.ts +1 -2
- package/dist/index.js +1 -1
- package/dist/libs/rest/src/lib/REST.js +5 -0
- package/dist/libs/rest/src/lib/utils/constants.d.ts +9 -1
- package/dist/libs/rest/src/lib/utils/constants.js +12 -0
- package/dist/managers/CMSManager.d.ts +21 -2
- package/dist/managers/CMSManager.js +49 -2
- package/package.json +1 -1
- package/src/constants.ts +27 -10
- package/src/index.ts +1 -9
- package/src/libs/rest/src/lib/REST.ts +5 -0
- package/src/libs/rest/src/lib/utils/constants.ts +21 -1
- package/src/managers/CMSManager.ts +45 -2
package/dist/constants.d.ts
CHANGED
|
@@ -61,26 +61,42 @@ export interface CMSVerifyWhitelistPromiseResult {
|
|
|
61
61
|
success: boolean;
|
|
62
62
|
reason?: string;
|
|
63
63
|
}
|
|
64
|
+
export interface CMSGetFullWhitelistPromiseResult {
|
|
65
|
+
success: boolean;
|
|
66
|
+
reason?: string;
|
|
67
|
+
data?: {
|
|
68
|
+
name: string;
|
|
69
|
+
apiIds: string[];
|
|
70
|
+
}[];
|
|
71
|
+
}
|
|
72
|
+
export interface CMSGetAccountRanksPromiseResult {
|
|
73
|
+
success: boolean;
|
|
74
|
+
reason?: string;
|
|
75
|
+
data?: string[];
|
|
76
|
+
}
|
|
64
77
|
export interface CMSGetComAccountPromiseResult {
|
|
65
78
|
success: boolean;
|
|
66
79
|
reason?: string;
|
|
67
80
|
data?: {
|
|
68
81
|
accId: string;
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
82
|
+
sysStatus: boolean;
|
|
83
|
+
comStatus: boolean;
|
|
84
|
+
joinDate: string;
|
|
85
|
+
lastLogin: string;
|
|
86
|
+
owner: boolean;
|
|
87
|
+
banned: boolean;
|
|
88
|
+
activeApiIds: string[];
|
|
72
89
|
primaryIdentifier: string;
|
|
73
|
-
secondaryIdentifiers:
|
|
90
|
+
secondaryIdentifiers: {
|
|
91
|
+
identifiers: {
|
|
92
|
+
id: string;
|
|
93
|
+
label: string;
|
|
94
|
+
}[];
|
|
95
|
+
};
|
|
74
96
|
primaryRank: string;
|
|
75
97
|
secondaryRanks: string[];
|
|
76
98
|
primaryDepartment: string;
|
|
77
99
|
secondaryDepartments: string[];
|
|
78
|
-
joinDate: string;
|
|
79
|
-
totalRankPower: number;
|
|
80
|
-
comOwner: boolean;
|
|
81
|
-
isBanned: boolean;
|
|
82
|
-
lastLogin: string;
|
|
83
|
-
activeApiIds: string[];
|
|
84
100
|
};
|
|
85
101
|
}
|
|
86
102
|
export declare const uuidRegex: RegExp;
|
|
@@ -124,6 +140,7 @@ export interface CADGetAccountPromiseResult {
|
|
|
124
140
|
polEditUnit: boolean;
|
|
125
141
|
polEditOtherUnit: boolean;
|
|
126
142
|
selfDispatch: boolean;
|
|
143
|
+
liveMap: boolean;
|
|
127
144
|
medRecAdd: boolean;
|
|
128
145
|
medRecEdit: boolean;
|
|
129
146
|
medRecRemove: boolean;
|
|
@@ -136,6 +153,7 @@ export interface CADGetAccountPromiseResult {
|
|
|
136
153
|
dmvRecEdit: boolean;
|
|
137
154
|
dmvRecRemove: boolean;
|
|
138
155
|
dmvSuper: boolean;
|
|
156
|
+
modifyStreetSigns: boolean;
|
|
139
157
|
lawRecAdd: boolean;
|
|
140
158
|
lawRecEdit: boolean;
|
|
141
159
|
lawRecRemove: boolean;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export * from './instance/Instance';
|
|
2
2
|
export * from './builders';
|
|
3
3
|
export * from './libs/rest/src';
|
|
4
|
-
|
|
5
|
-
export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum };
|
|
4
|
+
export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum } from './constants';
|
package/dist/index.js
CHANGED
|
@@ -18,7 +18,7 @@ exports.CMSSubscriptionVersionEnum = exports.CADSubscriptionVersionEnum = export
|
|
|
18
18
|
__exportStar(require("./instance/Instance"), exports);
|
|
19
19
|
__exportStar(require("./builders"), exports);
|
|
20
20
|
__exportStar(require("./libs/rest/src"), exports);
|
|
21
|
-
|
|
21
|
+
var constants_1 = require("./constants");
|
|
22
22
|
Object.defineProperty(exports, "productEnums", { enumerable: true, get: function () { return constants_1.productEnums; } });
|
|
23
23
|
Object.defineProperty(exports, "CADSubscriptionVersionEnum", { enumerable: true, get: function () { return constants_1.CADSubscriptionVersionEnum; } });
|
|
24
24
|
Object.defineProperty(exports, "CMSSubscriptionVersionEnum", { enumerable: true, get: function () { return constants_1.CMSSubscriptionVersionEnum; } });
|
|
@@ -32,7 +32,7 @@ export declare const EmergencyCADAPITypes: APITypeData[];
|
|
|
32
32
|
export declare const GeneralCMSAPITypes: APITypeData[];
|
|
33
33
|
export declare const ServersCMSAPITypes: APITypeData[];
|
|
34
34
|
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_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT';
|
|
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_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS';
|
|
36
36
|
export interface CMSServerAPIStruct {
|
|
37
37
|
id: number;
|
|
38
38
|
name: string;
|
|
@@ -395,12 +395,20 @@ export interface RESTTypedAPIDataStructs {
|
|
|
395
395
|
accId?: string,
|
|
396
396
|
forceClockIn?: boolean
|
|
397
397
|
];
|
|
398
|
+
GET_ACCOUNT_RANKS: [
|
|
399
|
+
apiId?: string,
|
|
400
|
+
username?: string,
|
|
401
|
+
accId?: string
|
|
402
|
+
];
|
|
398
403
|
GET_GAME_SERVERS: [];
|
|
399
404
|
VERIFY_WHITELIST: [
|
|
400
405
|
apiId: string | undefined,
|
|
401
406
|
accId: string | undefined,
|
|
402
407
|
serverId: number
|
|
403
408
|
];
|
|
409
|
+
FULL_WHITELIST: [
|
|
410
|
+
serverId?: number
|
|
411
|
+
];
|
|
404
412
|
}
|
|
405
413
|
export declare type PossibleRequestData = undefined | {
|
|
406
414
|
data: CADPenalCodeStruct[] | CADSetAPIIDStruct | CADNewEditRecordOptionOneStruct | CADNewEditRecordOptionTwoStruct | CADLookupByIntStruct | CADLookupStruct | CADModifyAccountPermsStruct | CADKickBanUserStruct | CADSetPostalStruct[] | CADModifyIdentifierStruct | CADAddBlipStruct[] | CADModifyBlipStruct[] | CADGetCallsStruct | CADGetActiveUnitsStruct | CADNewDispatchStruct;
|
|
@@ -316,6 +316,12 @@ exports.GeneralCMSAPITypes = [
|
|
|
316
316
|
method: 'POST',
|
|
317
317
|
minVersion: 3
|
|
318
318
|
},
|
|
319
|
+
{
|
|
320
|
+
type: 'GET_ACCOUNT_RANKS',
|
|
321
|
+
path: 'general/get_account_ranks',
|
|
322
|
+
method: 'POST',
|
|
323
|
+
minVersion: 2,
|
|
324
|
+
},
|
|
319
325
|
{
|
|
320
326
|
type: 'GET_SUB_VERSION',
|
|
321
327
|
path: 'general/get_sub_version',
|
|
@@ -347,6 +353,12 @@ exports.ServersCMSAPITypes = [
|
|
|
347
353
|
path: 'servers/verify_whitelist',
|
|
348
354
|
method: 'POST',
|
|
349
355
|
minVersion: 3
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
type: 'FULL_WHITELIST',
|
|
359
|
+
path: 'servers/full_whitelist',
|
|
360
|
+
method: 'POST',
|
|
361
|
+
minVersion: 3
|
|
350
362
|
}
|
|
351
363
|
];
|
|
352
364
|
function formatForAll(array, product) {
|
|
@@ -27,6 +27,12 @@ export declare class CMSManager extends BaseManager {
|
|
|
27
27
|
apiId?: string;
|
|
28
28
|
serverId?: number;
|
|
29
29
|
} | string): Promise<globalTypes.CMSVerifyWhitelistPromiseResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Gets a full whitelist allowed list for a specific server.
|
|
32
|
+
* @param {number} serverId (Optional) Server ID to get the whole allow list for, if not specified it will grab the default server ID that is set.
|
|
33
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
34
|
+
*/
|
|
35
|
+
getFullWhitelist(serverId?: number): Promise<globalTypes.CMSGetFullWhitelistPromiseResult>;
|
|
30
36
|
/**
|
|
31
37
|
* Gets a community account by `accId`, `apiId`, or `username`.
|
|
32
38
|
* @param {Object} params The object that contains parameters to get a community account.
|
|
@@ -40,11 +46,24 @@ export declare class CMSManager extends BaseManager {
|
|
|
40
46
|
apiId?: string;
|
|
41
47
|
username?: string;
|
|
42
48
|
}): Promise<globalTypes.CMSGetComAccountPromiseResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Gets a community account by `accId`, `apiId`, or `username`.
|
|
51
|
+
* @param {Object} params The object that contains parameters to get a community account.
|
|
52
|
+
* @param {string} [data.accId] (Optional) The account id to find a community account.
|
|
53
|
+
* @param {string} [data.apiId] (Optional) The api id to find a community account.
|
|
54
|
+
* @param {string} [data.username] (Optional) The username to find a community account.
|
|
55
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
56
|
+
*/
|
|
57
|
+
getAccountRanks(params: {
|
|
58
|
+
accId?: string;
|
|
59
|
+
apiId?: string;
|
|
60
|
+
username?: string;
|
|
61
|
+
}): Promise<globalTypes.CMSGetAccountRanksPromiseResult>;
|
|
43
62
|
/**
|
|
44
63
|
* Clocks in or out an account by `accId` or `apiId`.
|
|
45
64
|
* @param {Object} data The object that contains critical data to clock in or out an account.
|
|
46
|
-
* @param {string} [data.accId] The account id to clock in or out.
|
|
47
|
-
* @param {string} [data.apiId] The api id to clock in or out.
|
|
65
|
+
* @param {string} [data.accId] (Optional) The account id to clock in or out.
|
|
66
|
+
* @param {string} [data.apiId] (Optional) The api id to clock in or out.
|
|
48
67
|
* @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
|
|
49
68
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
50
69
|
*/
|
|
@@ -88,6 +88,28 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
88
88
|
}
|
|
89
89
|
});
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Gets a full whitelist allowed list for a specific server.
|
|
93
|
+
* @param {number} serverId (Optional) Server ID to get the whole allow list for, if not specified it will grab the default server ID that is set.
|
|
94
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
95
|
+
*/
|
|
96
|
+
async getFullWhitelist(serverId) {
|
|
97
|
+
return new Promise(async (resolve, reject) => {
|
|
98
|
+
var _a;
|
|
99
|
+
try {
|
|
100
|
+
const getFullWhitelistRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('FULL_WHITELIST', serverId !== null && serverId !== void 0 ? serverId : this.instance.cmsDefaultServerId));
|
|
101
|
+
resolve({ success: true, data: getFullWhitelistRequest });
|
|
102
|
+
}
|
|
103
|
+
catch (err) {
|
|
104
|
+
if (err instanceof src_1.APIError) {
|
|
105
|
+
resolve({ success: false, reason: err.response });
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
reject(err);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
91
113
|
/**
|
|
92
114
|
* Gets a community account by `accId`, `apiId`, or `username`.
|
|
93
115
|
* @param {Object} params The object that contains parameters to get a community account.
|
|
@@ -113,11 +135,36 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
113
135
|
}
|
|
114
136
|
});
|
|
115
137
|
}
|
|
138
|
+
/**
|
|
139
|
+
* Gets a community account by `accId`, `apiId`, or `username`.
|
|
140
|
+
* @param {Object} params The object that contains parameters to get a community account.
|
|
141
|
+
* @param {string} [data.accId] (Optional) The account id to find a community account.
|
|
142
|
+
* @param {string} [data.apiId] (Optional) The api id to find a community account.
|
|
143
|
+
* @param {string} [data.username] (Optional) The username to find a community account.
|
|
144
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
145
|
+
*/
|
|
146
|
+
async getAccountRanks(params) {
|
|
147
|
+
return new Promise(async (resolve, reject) => {
|
|
148
|
+
var _a;
|
|
149
|
+
try {
|
|
150
|
+
const getAccountRanksRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_ACCOUNT_RANKS', params.apiId, params.username, params.accId));
|
|
151
|
+
resolve({ success: true, data: getAccountRanksRequest });
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
if (err instanceof src_1.APIError) {
|
|
155
|
+
resolve({ success: false, reason: err.response });
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
reject(err);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
116
163
|
/**
|
|
117
164
|
* Clocks in or out an account by `accId` or `apiId`.
|
|
118
165
|
* @param {Object} data The object that contains critical data to clock in or out an account.
|
|
119
|
-
* @param {string} [data.accId] The account id to clock in or out.
|
|
120
|
-
* @param {string} [data.apiId] The api id to clock in or out.
|
|
166
|
+
* @param {string} [data.accId] (Optional) The account id to clock in or out.
|
|
167
|
+
* @param {string} [data.apiId] (Optional) The api id to clock in or out.
|
|
121
168
|
* @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
|
|
122
169
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
123
170
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonoransoftware/sonoran.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
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
|
@@ -74,26 +74,41 @@ export interface CMSVerifyWhitelistPromiseResult {
|
|
|
74
74
|
reason?: string;
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
export interface CMSGetFullWhitelistPromiseResult {
|
|
78
|
+
success: boolean;
|
|
79
|
+
reason?: string;
|
|
80
|
+
data?: {
|
|
81
|
+
name: string;
|
|
82
|
+
apiIds: string[];
|
|
83
|
+
}[];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface CMSGetAccountRanksPromiseResult {
|
|
87
|
+
success: boolean;
|
|
88
|
+
reason?: string;
|
|
89
|
+
data?: string[];
|
|
90
|
+
}
|
|
91
|
+
|
|
77
92
|
export interface CMSGetComAccountPromiseResult {
|
|
78
93
|
success: boolean;
|
|
79
94
|
reason?: string;
|
|
80
95
|
data?: {
|
|
81
96
|
accId: string;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
97
|
+
sysStatus: boolean;
|
|
98
|
+
comStatus: boolean;
|
|
99
|
+
joinDate: string;
|
|
100
|
+
lastLogin: string;
|
|
101
|
+
owner: boolean;
|
|
102
|
+
banned: boolean;
|
|
103
|
+
activeApiIds: string[];
|
|
85
104
|
primaryIdentifier: string;
|
|
86
|
-
secondaryIdentifiers:
|
|
105
|
+
secondaryIdentifiers: {
|
|
106
|
+
identifiers: { id: string; label: string; }[];
|
|
107
|
+
}
|
|
87
108
|
primaryRank: string;
|
|
88
109
|
secondaryRanks: string[];
|
|
89
110
|
primaryDepartment: string;
|
|
90
111
|
secondaryDepartments: string[];
|
|
91
|
-
joinDate: string;
|
|
92
|
-
totalRankPower: number;
|
|
93
|
-
comOwner: boolean;
|
|
94
|
-
isBanned: boolean;
|
|
95
|
-
lastLogin: string;
|
|
96
|
-
activeApiIds: string[];
|
|
97
112
|
}
|
|
98
113
|
}
|
|
99
114
|
|
|
@@ -142,6 +157,7 @@ export interface CADGetAccountPromiseResult {
|
|
|
142
157
|
polEditUnit: boolean;
|
|
143
158
|
polEditOtherUnit: boolean;
|
|
144
159
|
selfDispatch: boolean;
|
|
160
|
+
liveMap: boolean;
|
|
145
161
|
medRecAdd: boolean;
|
|
146
162
|
medRecEdit: boolean;
|
|
147
163
|
medRecRemove: boolean;
|
|
@@ -154,6 +170,7 @@ export interface CADGetAccountPromiseResult {
|
|
|
154
170
|
dmvRecEdit: boolean;
|
|
155
171
|
dmvRecRemove: boolean;
|
|
156
172
|
dmvSuper: boolean;
|
|
173
|
+
modifyStreetSigns: boolean;
|
|
157
174
|
lawRecAdd: boolean;
|
|
158
175
|
lawRecEdit: boolean;
|
|
159
176
|
lawRecRemove: boolean;
|
package/src/index.ts
CHANGED
|
@@ -1,12 +1,4 @@
|
|
|
1
1
|
export * from './instance/Instance';
|
|
2
2
|
export * from './builders';
|
|
3
3
|
export * from './libs/rest/src';
|
|
4
|
-
|
|
5
|
-
import { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum } from './constants';
|
|
6
|
-
|
|
7
|
-
export {
|
|
8
|
-
productEnums,
|
|
9
|
-
CADNewDispatchBuilderOptions,
|
|
10
|
-
CADSubscriptionVersionEnum,
|
|
11
|
-
CMSSubscriptionVersionEnum
|
|
12
|
-
}
|
|
4
|
+
export { productEnums, CADNewDispatchBuilderOptions, CADSubscriptionVersionEnum, CMSSubscriptionVersionEnum } from './constants';
|
|
@@ -347,6 +347,12 @@ export const GeneralCMSAPITypes: APITypeData[] = [
|
|
|
347
347
|
method: 'POST', // Would've been 'GET' but fetch doesn't allow body with GET requests.
|
|
348
348
|
minVersion: 3
|
|
349
349
|
},
|
|
350
|
+
{
|
|
351
|
+
type: 'GET_ACCOUNT_RANKS',
|
|
352
|
+
path: 'general/get_account_ranks',
|
|
353
|
+
method: 'POST', // Would've been 'GET' but fetch doesn't allow body with GET requests.
|
|
354
|
+
minVersion: 2,
|
|
355
|
+
},
|
|
350
356
|
{
|
|
351
357
|
type: 'GET_SUB_VERSION',
|
|
352
358
|
path: 'general/get_sub_version',
|
|
@@ -379,6 +385,12 @@ export const ServersCMSAPITypes: APITypeData[] = [
|
|
|
379
385
|
path: 'servers/verify_whitelist',
|
|
380
386
|
method: 'POST',
|
|
381
387
|
minVersion: 3
|
|
388
|
+
},
|
|
389
|
+
{
|
|
390
|
+
type: 'FULL_WHITELIST',
|
|
391
|
+
path: 'servers/full_whitelist',
|
|
392
|
+
method: 'POST',
|
|
393
|
+
minVersion: 3
|
|
382
394
|
}
|
|
383
395
|
];
|
|
384
396
|
|
|
@@ -393,7 +405,7 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
393
405
|
|
|
394
406
|
export const AllAPITypes: AllAPITypeData[] = [ ...formatForAll(GeneralCADAPITypes, productEnums.CAD), ...formatForAll(CivilianCADAPITypes, productEnums.CAD), ...formatForAll(EmergencyCADAPITypes, productEnums.CAD), ...formatForAll(GeneralCMSAPITypes, productEnums.CMS), ...formatForAll(ServersCMSAPITypes, productEnums.CMS) ];
|
|
395
407
|
|
|
396
|
-
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_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT';
|
|
408
|
+
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_SUB_VERSION' | 'CHECK_COM_APIID' | 'VERIFY_WHITELIST' | 'CLOCK_IN_OUT' | 'FULL_WHITELIST' | 'GET_ACCOUNT_RANKS';
|
|
397
409
|
|
|
398
410
|
export interface CMSServerAPIStruct {
|
|
399
411
|
id: number;
|
|
@@ -791,6 +803,11 @@ export interface RESTTypedAPIDataStructs {
|
|
|
791
803
|
accId?: string,
|
|
792
804
|
forceClockIn?: boolean
|
|
793
805
|
];
|
|
806
|
+
GET_ACCOUNT_RANKS: [
|
|
807
|
+
apiId?: string,
|
|
808
|
+
username?: string,
|
|
809
|
+
accId?: string,
|
|
810
|
+
],
|
|
794
811
|
// CMS - Servers
|
|
795
812
|
GET_GAME_SERVERS: [];
|
|
796
813
|
VERIFY_WHITELIST: [
|
|
@@ -798,6 +815,9 @@ export interface RESTTypedAPIDataStructs {
|
|
|
798
815
|
accId: string | undefined,
|
|
799
816
|
serverId: number
|
|
800
817
|
];
|
|
818
|
+
FULL_WHITELIST: [
|
|
819
|
+
serverId?: number,
|
|
820
|
+
]
|
|
801
821
|
}
|
|
802
822
|
|
|
803
823
|
export type PossibleRequestData =
|
|
@@ -67,6 +67,26 @@ export class CMSManager extends BaseManager {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Gets a full whitelist allowed list for a specific server.
|
|
72
|
+
* @param {number} serverId (Optional) Server ID to get the whole allow list for, if not specified it will grab the default server ID that is set.
|
|
73
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
74
|
+
*/
|
|
75
|
+
public async getFullWhitelist(serverId?: number): Promise<globalTypes.CMSGetFullWhitelistPromiseResult> {
|
|
76
|
+
return new Promise(async (resolve, reject) => {
|
|
77
|
+
try {
|
|
78
|
+
const getFullWhitelistRequest: any = await this.rest?.request('FULL_WHITELIST', serverId ?? this.instance.cmsDefaultServerId);
|
|
79
|
+
resolve({ success: true, data: getFullWhitelistRequest });
|
|
80
|
+
} catch (err) {
|
|
81
|
+
if (err instanceof APIError) {
|
|
82
|
+
resolve({ success: false, reason: err.response });
|
|
83
|
+
} else {
|
|
84
|
+
reject(err);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
70
90
|
/**
|
|
71
91
|
* Gets a community account by `accId`, `apiId`, or `username`.
|
|
72
92
|
* @param {Object} params The object that contains parameters to get a community account.
|
|
@@ -90,11 +110,34 @@ export class CMSManager extends BaseManager {
|
|
|
90
110
|
});
|
|
91
111
|
}
|
|
92
112
|
|
|
113
|
+
/**
|
|
114
|
+
* Gets a community account by `accId`, `apiId`, or `username`.
|
|
115
|
+
* @param {Object} params The object that contains parameters to get a community account.
|
|
116
|
+
* @param {string} [data.accId] (Optional) The account id to find a community account.
|
|
117
|
+
* @param {string} [data.apiId] (Optional) The api id to find a community account.
|
|
118
|
+
* @param {string} [data.username] (Optional) The username to find a community account.
|
|
119
|
+
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
120
|
+
*/
|
|
121
|
+
public async getAccountRanks(params: { accId?: string, apiId?: string, username?: string }): Promise<globalTypes.CMSGetAccountRanksPromiseResult> {
|
|
122
|
+
return new Promise(async (resolve, reject) => {
|
|
123
|
+
try {
|
|
124
|
+
const getAccountRanksRequest: any = await this.rest?.request('GET_ACCOUNT_RANKS', params.apiId, params.username, params.accId);
|
|
125
|
+
resolve({ success: true, data: getAccountRanksRequest });
|
|
126
|
+
} catch (err) {
|
|
127
|
+
if (err instanceof APIError) {
|
|
128
|
+
resolve({ success: false, reason: err.response });
|
|
129
|
+
} else {
|
|
130
|
+
reject(err);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
93
136
|
/**
|
|
94
137
|
* Clocks in or out an account by `accId` or `apiId`.
|
|
95
138
|
* @param {Object} data The object that contains critical data to clock in or out an account.
|
|
96
|
-
* @param {string} [data.accId] The account id to clock in or out.
|
|
97
|
-
* @param {string} [data.apiId] The api id to clock in or out.
|
|
139
|
+
* @param {string} [data.accId] (Optional) The account id to clock in or out.
|
|
140
|
+
* @param {string} [data.apiId] (Optional) The api id to clock in or out.
|
|
98
141
|
* @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
|
|
99
142
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
100
143
|
*/
|