@sonoransoftware/sonoran.js 1.0.24 → 1.0.26
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 +3 -6
- package/dist/libs/rest/src/lib/REST.js +40 -5
- package/dist/libs/rest/src/lib/utils/constants.d.ts +40 -13
- package/dist/libs/rest/src/lib/utils/constants.js +16 -2
- package/dist/managers/CMSManager.d.ts +11 -2
- package/dist/managers/CMSManager.js +9 -7
- package/package.json +1 -1
- package/src/constants.ts +3 -6
- package/src/libs/rest/src/lib/REST.ts +40 -5
- package/src/libs/rest/src/lib/utils/constants.ts +51 -10
- package/src/managers/CMSManager.ts +14 -12
package/dist/constants.d.ts
CHANGED
|
@@ -146,12 +146,9 @@ export interface CMSSetAccountRanksPromiseResult {
|
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
export interface CMSSetAccountRanksChangesObject {
|
|
149
|
-
set?:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
};
|
|
153
|
-
add: string[];
|
|
154
|
-
remove: string[];
|
|
149
|
+
set?: string[];
|
|
150
|
+
add?: string[];
|
|
151
|
+
remove?: string[];
|
|
155
152
|
}
|
|
156
153
|
export interface CMSDepartment {
|
|
157
154
|
uuid: string;
|
|
@@ -64,7 +64,8 @@ class REST extends events_1.EventEmitter {
|
|
|
64
64
|
return {
|
|
65
65
|
apiId: args[0],
|
|
66
66
|
accId: constants_2.uuidRegex.test(args[1]) ? args[1] : undefined,
|
|
67
|
-
serverId: args[2]
|
|
67
|
+
serverId: args[2],
|
|
68
|
+
discord: args[3]
|
|
68
69
|
};
|
|
69
70
|
}
|
|
70
71
|
case 'FULL_WHITELIST': {
|
|
@@ -77,6 +78,8 @@ class REST extends events_1.EventEmitter {
|
|
|
77
78
|
eventId: args[0],
|
|
78
79
|
apiId: args[1],
|
|
79
80
|
accId: args[2],
|
|
81
|
+
discord: args[3],
|
|
82
|
+
uniqueId: args[4]
|
|
80
83
|
};
|
|
81
84
|
}
|
|
82
85
|
case 'GET_COM_ACCOUNT': {
|
|
@@ -84,7 +87,8 @@ class REST extends events_1.EventEmitter {
|
|
|
84
87
|
apiId: args[0],
|
|
85
88
|
username: args[1],
|
|
86
89
|
accId: args[2],
|
|
87
|
-
discord: args[3]
|
|
90
|
+
discord: args[3],
|
|
91
|
+
uniqueId: args[4]
|
|
88
92
|
};
|
|
89
93
|
}
|
|
90
94
|
case 'GET_ACCOUNT_RANKS': {
|
|
@@ -92,14 +96,17 @@ class REST extends events_1.EventEmitter {
|
|
|
92
96
|
apiId: args[0],
|
|
93
97
|
username: args[1],
|
|
94
98
|
accId: args[2],
|
|
95
|
-
discord: args[3]
|
|
99
|
+
discord: args[3],
|
|
100
|
+
uniqueId: args[4]
|
|
96
101
|
};
|
|
97
102
|
}
|
|
98
103
|
case 'CLOCK_IN_OUT': {
|
|
99
104
|
return {
|
|
100
105
|
apiId: args[0],
|
|
101
106
|
accId: args[1],
|
|
102
|
-
forceClockIn: args[2]
|
|
107
|
+
forceClockIn: args[2],
|
|
108
|
+
discord: args[3],
|
|
109
|
+
uniqueId: args[4]
|
|
103
110
|
};
|
|
104
111
|
}
|
|
105
112
|
case 'CHECK_COM_APIID': {
|
|
@@ -109,10 +116,14 @@ class REST extends events_1.EventEmitter {
|
|
|
109
116
|
}
|
|
110
117
|
case 'SET_ACCOUNT_RANKS': {
|
|
111
118
|
return {
|
|
112
|
-
|
|
119
|
+
accId: args[0],
|
|
113
120
|
set: args[1],
|
|
114
121
|
add: args[2],
|
|
115
122
|
remove: args[3],
|
|
123
|
+
apiId: args[4],
|
|
124
|
+
username: args[5],
|
|
125
|
+
discord: args[6],
|
|
126
|
+
uniqueId: args[7],
|
|
116
127
|
};
|
|
117
128
|
}
|
|
118
129
|
case 'VERIFY_SECRET': {
|
|
@@ -125,18 +136,42 @@ class REST extends events_1.EventEmitter {
|
|
|
125
136
|
accId: args[0],
|
|
126
137
|
formId: args[1],
|
|
127
138
|
newStageId: args[2],
|
|
139
|
+
apiId: args[3],
|
|
140
|
+
username: args[4],
|
|
141
|
+
discord: args[5],
|
|
142
|
+
uniqueId: args[6],
|
|
128
143
|
};
|
|
129
144
|
}
|
|
130
145
|
case 'BAN_ACCOUNT': {
|
|
131
146
|
return {
|
|
132
147
|
apiId: args[0],
|
|
133
148
|
accId: args[1],
|
|
149
|
+
discord: args[2],
|
|
150
|
+
uniqueId: args[3]
|
|
134
151
|
};
|
|
135
152
|
}
|
|
136
153
|
case 'KICK_ACCOUNT': {
|
|
137
154
|
return {
|
|
138
155
|
apiId: args[0],
|
|
139
156
|
accId: args[1],
|
|
157
|
+
discord: args[2],
|
|
158
|
+
uniqueId: args[3]
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
case 'LOOKUP': {
|
|
162
|
+
return {
|
|
163
|
+
id: args[0],
|
|
164
|
+
uuid: args[1]
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
case 'EDIT_ACC_PROFLIE_FIELDS': {
|
|
168
|
+
return {
|
|
169
|
+
apiId: args[0],
|
|
170
|
+
username: args[1],
|
|
171
|
+
accId: args[2],
|
|
172
|
+
discord: args[3],
|
|
173
|
+
uniqueId: args[4],
|
|
174
|
+
profileFields: args[5]
|
|
140
175
|
};
|
|
141
176
|
}
|
|
142
177
|
default: {
|
|
@@ -33,8 +33,9 @@ export declare const GeneralCMSAPITypes: APITypeData[];
|
|
|
33
33
|
export declare const ServersCMSAPITypes: APITypeData[];
|
|
34
34
|
export declare const EventsCMSAPITypes: APITypeData[];
|
|
35
35
|
export declare const FormsCMSAPITypes: APITypeData[];
|
|
36
|
+
export declare const CommunitiesCMSAPITypes: APITypeData[];
|
|
36
37
|
export declare const AllAPITypes: AllAPITypeData[];
|
|
37
|
-
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';
|
|
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
39
|
export interface CMSServerAPIStruct {
|
|
39
40
|
id: number;
|
|
40
41
|
name: string;
|
|
@@ -269,6 +270,10 @@ export interface CADUnitLocationStruct {
|
|
|
269
270
|
apiId: string;
|
|
270
271
|
location: string;
|
|
271
272
|
}
|
|
273
|
+
export interface CMSProfileField {
|
|
274
|
+
id: string;
|
|
275
|
+
value: string;
|
|
276
|
+
}
|
|
272
277
|
export interface RESTTypedAPIDataStructs {
|
|
273
278
|
GET_SERVERS: [];
|
|
274
279
|
SET_SERVERS: [
|
|
@@ -389,36 +394,44 @@ export interface RESTTypedAPIDataStructs {
|
|
|
389
394
|
apiId?: string,
|
|
390
395
|
username?: string,
|
|
391
396
|
accId?: string,
|
|
392
|
-
discord?: string
|
|
397
|
+
discord?: string,
|
|
398
|
+
uniqueId?: string
|
|
393
399
|
];
|
|
394
400
|
GET_SUB_VERSION: [];
|
|
395
401
|
CHECK_COM_APIID: [apiId: string];
|
|
396
402
|
CLOCK_IN_OUT: [
|
|
397
403
|
apiId?: string,
|
|
398
404
|
accId?: string,
|
|
399
|
-
forceClockIn?: boolean
|
|
405
|
+
forceClockIn?: boolean,
|
|
406
|
+
discord?: string,
|
|
407
|
+
uniqueId?: string
|
|
400
408
|
];
|
|
401
409
|
GET_DEPARTMENTS: [];
|
|
402
410
|
GET_ACCOUNT_RANKS: [
|
|
403
411
|
apiId?: string,
|
|
404
412
|
username?: string,
|
|
405
413
|
accId?: string,
|
|
406
|
-
discord?: string
|
|
414
|
+
discord?: string,
|
|
415
|
+
uniqueId?: string
|
|
407
416
|
];
|
|
408
417
|
SET_ACCOUNT_RANKS: [
|
|
409
|
-
|
|
410
|
-
set?:
|
|
411
|
-
primary?: string | null;
|
|
412
|
-
secondary?: string[];
|
|
413
|
-
},
|
|
418
|
+
accId?: string,
|
|
419
|
+
set?: string[],
|
|
414
420
|
add?: string[],
|
|
415
|
-
remove?: string[]
|
|
421
|
+
remove?: string[],
|
|
422
|
+
apiId?: string,
|
|
423
|
+
username?: string,
|
|
424
|
+
discord?: string,
|
|
425
|
+
uniqueId?: string
|
|
416
426
|
];
|
|
417
427
|
GET_GAME_SERVERS: [];
|
|
418
428
|
VERIFY_WHITELIST: [
|
|
419
429
|
apiId: string | undefined,
|
|
420
430
|
accId: string | undefined,
|
|
421
|
-
serverId: number
|
|
431
|
+
serverId: number,
|
|
432
|
+
username: string | undefined,
|
|
433
|
+
discord: string | undefined,
|
|
434
|
+
uniqueId: number | undefined
|
|
422
435
|
];
|
|
423
436
|
FULL_WHITELIST: [
|
|
424
437
|
serverId?: number
|
|
@@ -426,12 +439,26 @@ export interface RESTTypedAPIDataStructs {
|
|
|
426
439
|
RSVP: [
|
|
427
440
|
eventId: string,
|
|
428
441
|
apiId: string | undefined,
|
|
429
|
-
accId: string | undefined
|
|
442
|
+
accId: string | undefined,
|
|
443
|
+
discord: string | undefined,
|
|
444
|
+
uniqueId: string | undefined
|
|
445
|
+
];
|
|
446
|
+
EDIT_ACC_PROFLIE_FIELDS: [
|
|
447
|
+
apiId: string,
|
|
448
|
+
username: string,
|
|
449
|
+
accId: string,
|
|
450
|
+
discord: string,
|
|
451
|
+
uniqueId: string,
|
|
452
|
+
profileFields: CMSProfileField[]
|
|
430
453
|
];
|
|
431
454
|
CHANGE_FORM_STAGE: [
|
|
432
455
|
accId: string,
|
|
433
456
|
formId: number,
|
|
434
|
-
newStageId: string
|
|
457
|
+
newStageId: string,
|
|
458
|
+
apiId: string,
|
|
459
|
+
username: string,
|
|
460
|
+
discord: string,
|
|
461
|
+
uniqueId: number
|
|
435
462
|
];
|
|
436
463
|
}
|
|
437
464
|
export type PossibleRequestData = undefined | {
|
|
@@ -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.FormsCMSAPITypes = exports.EventsCMSAPITypes = 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.CommunitiesCMSAPITypes = exports.FormsCMSAPITypes = 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 = {
|
|
@@ -363,6 +363,12 @@ exports.GeneralCMSAPITypes = [
|
|
|
363
363
|
path: 'general/ban_account',
|
|
364
364
|
method: 'POST',
|
|
365
365
|
minVersion: 3
|
|
366
|
+
},
|
|
367
|
+
{
|
|
368
|
+
type: 'EDIT_ACC_PROFLIE_FIELDS',
|
|
369
|
+
path: 'general/edit_acc_profile_fields',
|
|
370
|
+
method: 'POST',
|
|
371
|
+
minVersion: 0
|
|
366
372
|
}
|
|
367
373
|
];
|
|
368
374
|
exports.ServersCMSAPITypes = [
|
|
@@ -401,6 +407,14 @@ exports.FormsCMSAPITypes = [
|
|
|
401
407
|
minVersion: 0
|
|
402
408
|
}
|
|
403
409
|
];
|
|
410
|
+
exports.CommunitiesCMSAPITypes = [
|
|
411
|
+
{
|
|
412
|
+
type: 'LOOKUP',
|
|
413
|
+
path: 'communities/lookup',
|
|
414
|
+
method: 'POST',
|
|
415
|
+
minVersion: 0
|
|
416
|
+
},
|
|
417
|
+
];
|
|
404
418
|
function formatForAll(array, product) {
|
|
405
419
|
return array.map((val) => {
|
|
406
420
|
return {
|
|
@@ -409,7 +423,7 @@ function formatForAll(array, product) {
|
|
|
409
423
|
};
|
|
410
424
|
});
|
|
411
425
|
}
|
|
412
|
-
exports.AllAPITypes = [...formatForAll(exports.GeneralCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.CivilianCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.EmergencyCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.GeneralCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ServersCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.EventsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.FormsCMSAPITypes, constants_1.productEnums.CMS)];
|
|
426
|
+
exports.AllAPITypes = [...formatForAll(exports.GeneralCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.CivilianCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.EmergencyCADAPITypes, constants_1.productEnums.CAD), ...formatForAll(exports.GeneralCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.ServersCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.EventsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.FormsCMSAPITypes, constants_1.productEnums.CMS), ...formatForAll(exports.CommunitiesCMSAPITypes, constants_1.productEnums.CMS)];
|
|
413
427
|
var CADRecordTypeEnums;
|
|
414
428
|
(function (CADRecordTypeEnums) {
|
|
415
429
|
CADRecordTypeEnums[CADRecordTypeEnums["Warrant"] = 2] = "Warrant";
|
|
@@ -26,6 +26,9 @@ export declare class CMSManager extends BaseManager {
|
|
|
26
26
|
verifyWhitelist(data: {
|
|
27
27
|
accId?: string;
|
|
28
28
|
apiId?: string;
|
|
29
|
+
username?: string;
|
|
30
|
+
discord?: string;
|
|
31
|
+
uniqueId?: number;
|
|
29
32
|
serverId?: number;
|
|
30
33
|
} | string): Promise<globalTypes.CMSVerifyWhitelistPromiseResult>;
|
|
31
34
|
/**
|
|
@@ -47,6 +50,7 @@ export declare class CMSManager extends BaseManager {
|
|
|
47
50
|
apiId?: string;
|
|
48
51
|
username?: string;
|
|
49
52
|
discord?: string;
|
|
53
|
+
uniqueId?: string;
|
|
50
54
|
}): Promise<globalTypes.CMSGetComAccountPromiseResult>;
|
|
51
55
|
/**
|
|
52
56
|
* Gets a community account by `accId`, `apiId`, or `username`.
|
|
@@ -61,6 +65,7 @@ export declare class CMSManager extends BaseManager {
|
|
|
61
65
|
apiId?: string;
|
|
62
66
|
username?: string;
|
|
63
67
|
discord?: string;
|
|
68
|
+
uniqueId?: string;
|
|
64
69
|
}): Promise<globalTypes.CMSGetAccountRanksPromiseResult>;
|
|
65
70
|
/**
|
|
66
71
|
* Clocks in or out an account by `accId` or `apiId`.
|
|
@@ -68,12 +73,15 @@ export declare class CMSManager extends BaseManager {
|
|
|
68
73
|
* @param {string} [data.accId] (Optional) The account id to clock in or out.
|
|
69
74
|
* @param {string} [data.apiId] (Optional) The api id to clock in or out.
|
|
70
75
|
* @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
|
|
76
|
+
* @param {string} [data.discord] (Optional) The discord ID to clock in or out.
|
|
71
77
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
72
78
|
*/
|
|
73
79
|
clockInOut(data: {
|
|
74
80
|
accId?: string;
|
|
75
81
|
apiId?: string;
|
|
76
82
|
forceClockIn?: boolean;
|
|
83
|
+
discord?: string;
|
|
84
|
+
uniqueId?: string;
|
|
77
85
|
}): Promise<globalTypes.CMSClockInOutPromiseResult>;
|
|
78
86
|
/**
|
|
79
87
|
* Check if a given [apiId] is attached to any account within the community CMS.
|
|
@@ -88,14 +96,15 @@ export declare class CMSManager extends BaseManager {
|
|
|
88
96
|
getDepartments(): Promise<globalTypes.CMSGetDepartmentsPromiseResult>;
|
|
89
97
|
/**
|
|
90
98
|
* Sets a community account's ranks for the CMS community.
|
|
91
|
-
* @param {string}
|
|
99
|
+
* @param {string} accId The object that contains critical data to clock in or out an account.
|
|
92
100
|
* @param {Object} changes The object that contains change data for setting account ranks.
|
|
93
101
|
* @param {Object} [changes.set] (Optional) The object that contains primary and secondary data for setting account ranks.
|
|
94
102
|
* @param {string} [changes.set.primary] (Optional) The primary rank ID wanting to set to the account.
|
|
95
103
|
* @param {string} [changes.set.secondary] (Optional) The secondary rank ID(s) wanting to set to the account.
|
|
96
104
|
* @param {Array} [changes.add] (Optional) The secondary rank IDs wanting to add to the account.
|
|
97
105
|
* @param {Array} [changes.remove] (Optional) The secondary rank IDs wanting to remove to the account.
|
|
106
|
+
* @param {string} [discord] (Optional) The discord ID to set the ranks for.
|
|
98
107
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
99
108
|
*/
|
|
100
|
-
setAccountRanks(
|
|
109
|
+
setAccountRanks(changes: globalTypes.CMSSetAccountRanksChangesObject, apiId?: string, accId?: string, username?: string, discord?: string, uniqueId?: string): Promise<globalTypes.CMSSetAccountRanksPromiseResult>;
|
|
101
110
|
}
|
|
@@ -73,7 +73,7 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
73
73
|
var _a, _b;
|
|
74
74
|
try {
|
|
75
75
|
const isString = typeof data === 'string';
|
|
76
|
-
const whitelistRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('VERIFY_WHITELIST', isString ? data : data.apiId, isString ? data : data.accId, isString ? this.instance.cmsDefaultServerId : (_b = data.serverId) !== null && _b !== void 0 ? _b : this.instance.cmsDefaultServerId));
|
|
76
|
+
const whitelistRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('VERIFY_WHITELIST', isString ? data : data.apiId, isString ? data : data.accId, isString ? this.instance.cmsDefaultServerId : (_b = data.serverId) !== null && _b !== void 0 ? _b : this.instance.cmsDefaultServerId, isString ? undefined : data.username, isString ? undefined : data.discord, isString ? undefined : data.uniqueId));
|
|
77
77
|
if (typeof whitelistRequest === 'string') {
|
|
78
78
|
resolve({ success: true, reason: whitelistRequest });
|
|
79
79
|
}
|
|
@@ -125,7 +125,7 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
125
125
|
return new Promise(async (resolve, reject) => {
|
|
126
126
|
var _a;
|
|
127
127
|
try {
|
|
128
|
-
const getAccountRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_COM_ACCOUNT', params.apiId, params.username, params.accId, params.discord));
|
|
128
|
+
const getAccountRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_COM_ACCOUNT', params.apiId, params.username, params.accId, params.discord, params.uniqueId));
|
|
129
129
|
resolve({ success: true, data: getAccountRequest });
|
|
130
130
|
}
|
|
131
131
|
catch (err) {
|
|
@@ -150,7 +150,7 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
150
150
|
return new Promise(async (resolve, reject) => {
|
|
151
151
|
var _a;
|
|
152
152
|
try {
|
|
153
|
-
const getAccountRanksRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_ACCOUNT_RANKS', params.apiId, params.username, params.accId, params.discord));
|
|
153
|
+
const getAccountRanksRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('GET_ACCOUNT_RANKS', params.apiId, params.username, params.accId, params.discord, params.uniqueId));
|
|
154
154
|
resolve({ success: true, data: getAccountRanksRequest });
|
|
155
155
|
}
|
|
156
156
|
catch (err) {
|
|
@@ -169,13 +169,14 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
169
169
|
* @param {string} [data.accId] (Optional) The account id to clock in or out.
|
|
170
170
|
* @param {string} [data.apiId] (Optional) The api id to clock in or out.
|
|
171
171
|
* @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
|
|
172
|
+
* @param {string} [data.discord] (Optional) The discord ID to clock in or out.
|
|
172
173
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
173
174
|
*/
|
|
174
175
|
async clockInOut(data) {
|
|
175
176
|
return new Promise(async (resolve, reject) => {
|
|
176
177
|
var _a;
|
|
177
178
|
try {
|
|
178
|
-
const clockInOutRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('CLOCK_IN_OUT', data.apiId, data.accId, !!data.forceClockIn));
|
|
179
|
+
const clockInOutRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('CLOCK_IN_OUT', data.apiId, data.accId, !!data.forceClockIn, data.discord, data.uniqueId));
|
|
179
180
|
const clockInOutResponse = clockInOutRequest;
|
|
180
181
|
if (!clockInOutResponse)
|
|
181
182
|
resolve({ success: false, reason: clockInOutRequest });
|
|
@@ -236,20 +237,21 @@ class CMSManager extends BaseManager_1.BaseManager {
|
|
|
236
237
|
}
|
|
237
238
|
/**
|
|
238
239
|
* Sets a community account's ranks for the CMS community.
|
|
239
|
-
* @param {string}
|
|
240
|
+
* @param {string} accId The object that contains critical data to clock in or out an account.
|
|
240
241
|
* @param {Object} changes The object that contains change data for setting account ranks.
|
|
241
242
|
* @param {Object} [changes.set] (Optional) The object that contains primary and secondary data for setting account ranks.
|
|
242
243
|
* @param {string} [changes.set.primary] (Optional) The primary rank ID wanting to set to the account.
|
|
243
244
|
* @param {string} [changes.set.secondary] (Optional) The secondary rank ID(s) wanting to set to the account.
|
|
244
245
|
* @param {Array} [changes.add] (Optional) The secondary rank IDs wanting to add to the account.
|
|
245
246
|
* @param {Array} [changes.remove] (Optional) The secondary rank IDs wanting to remove to the account.
|
|
247
|
+
* @param {string} [discord] (Optional) The discord ID to set the ranks for.
|
|
246
248
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
247
249
|
*/
|
|
248
|
-
async setAccountRanks(
|
|
250
|
+
async setAccountRanks(changes, apiId, accId, username, discord, uniqueId) {
|
|
249
251
|
return new Promise(async (resolve, reject) => {
|
|
250
252
|
var _a;
|
|
251
253
|
try {
|
|
252
|
-
const setAccountRanksRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('SET_ACCOUNT_RANKS',
|
|
254
|
+
const setAccountRanksRequest = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('SET_ACCOUNT_RANKS', accId, changes.set, changes.add, changes.remove, apiId, username, discord, uniqueId));
|
|
253
255
|
resolve({ success: true, data: setAccountRanksRequest });
|
|
254
256
|
}
|
|
255
257
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sonoransoftware/sonoran.js",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.26",
|
|
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
|
@@ -162,12 +162,9 @@ export interface CMSSetAccountRanksPromiseResult {
|
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
export interface CMSSetAccountRanksChangesObject {
|
|
165
|
-
set?:
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
add: string[];
|
|
170
|
-
remove: string[];
|
|
165
|
+
set?: string[];
|
|
166
|
+
add?: string[];
|
|
167
|
+
remove?: string[];
|
|
171
168
|
}
|
|
172
169
|
|
|
173
170
|
export interface CMSDepartment {
|
|
@@ -170,7 +170,8 @@ export class REST extends EventEmitter {
|
|
|
170
170
|
return {
|
|
171
171
|
apiId: args[0],
|
|
172
172
|
accId: uuidRegex.test(args[1]) ? args[1] : undefined,
|
|
173
|
-
serverId: args[2]
|
|
173
|
+
serverId: args[2],
|
|
174
|
+
discord: args[3]
|
|
174
175
|
}
|
|
175
176
|
}
|
|
176
177
|
case 'FULL_WHITELIST': {
|
|
@@ -183,6 +184,8 @@ export class REST extends EventEmitter {
|
|
|
183
184
|
eventId: args[0],
|
|
184
185
|
apiId: args[1],
|
|
185
186
|
accId: args[2],
|
|
187
|
+
discord: args[3],
|
|
188
|
+
uniqueId: args[4]
|
|
186
189
|
}
|
|
187
190
|
}
|
|
188
191
|
case 'GET_COM_ACCOUNT': {
|
|
@@ -190,7 +193,8 @@ export class REST extends EventEmitter {
|
|
|
190
193
|
apiId: args[0],
|
|
191
194
|
username: args[1],
|
|
192
195
|
accId: args[2],
|
|
193
|
-
discord: args[3]
|
|
196
|
+
discord: args[3],
|
|
197
|
+
uniqueId: args[4]
|
|
194
198
|
};
|
|
195
199
|
}
|
|
196
200
|
case 'GET_ACCOUNT_RANKS': {
|
|
@@ -198,14 +202,17 @@ export class REST extends EventEmitter {
|
|
|
198
202
|
apiId: args[0],
|
|
199
203
|
username: args[1],
|
|
200
204
|
accId: args[2],
|
|
201
|
-
discord: args[3]
|
|
205
|
+
discord: args[3],
|
|
206
|
+
uniqueId: args[4]
|
|
202
207
|
};
|
|
203
208
|
}
|
|
204
209
|
case 'CLOCK_IN_OUT': {
|
|
205
210
|
return {
|
|
206
211
|
apiId: args[0],
|
|
207
212
|
accId: args[1],
|
|
208
|
-
forceClockIn: args[2]
|
|
213
|
+
forceClockIn: args[2],
|
|
214
|
+
discord: args[3],
|
|
215
|
+
uniqueId: args[4]
|
|
209
216
|
};
|
|
210
217
|
}
|
|
211
218
|
case 'CHECK_COM_APIID': {
|
|
@@ -215,10 +222,14 @@ export class REST extends EventEmitter {
|
|
|
215
222
|
}
|
|
216
223
|
case 'SET_ACCOUNT_RANKS': {
|
|
217
224
|
return {
|
|
218
|
-
|
|
225
|
+
accId: args[0],
|
|
219
226
|
set: args[1],
|
|
220
227
|
add: args[2],
|
|
221
228
|
remove: args[3],
|
|
229
|
+
apiId: args[4],
|
|
230
|
+
username: args[5],
|
|
231
|
+
discord: args[6],
|
|
232
|
+
uniqueId: args[7],
|
|
222
233
|
};
|
|
223
234
|
}
|
|
224
235
|
case 'VERIFY_SECRET': {
|
|
@@ -231,20 +242,44 @@ export class REST extends EventEmitter {
|
|
|
231
242
|
accId: args[0],
|
|
232
243
|
formId: args[1],
|
|
233
244
|
newStageId: args[2],
|
|
245
|
+
apiId: args[3],
|
|
246
|
+
username: args[4],
|
|
247
|
+
discord: args[5],
|
|
248
|
+
uniqueId: args[6],
|
|
234
249
|
};
|
|
235
250
|
}
|
|
236
251
|
case 'BAN_ACCOUNT': {
|
|
237
252
|
return {
|
|
238
253
|
apiId: args[0],
|
|
239
254
|
accId: args[1],
|
|
255
|
+
discord: args[2],
|
|
256
|
+
uniqueId: args[3]
|
|
240
257
|
};
|
|
241
258
|
}
|
|
242
259
|
case 'KICK_ACCOUNT': {
|
|
243
260
|
return {
|
|
244
261
|
apiId: args[0],
|
|
245
262
|
accId: args[1],
|
|
263
|
+
discord: args[2],
|
|
264
|
+
uniqueId: args[3]
|
|
246
265
|
};
|
|
247
266
|
}
|
|
267
|
+
case 'LOOKUP': {
|
|
268
|
+
return {
|
|
269
|
+
id: args[0],
|
|
270
|
+
uuid: args[1]
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
case 'EDIT_ACC_PROFLIE_FIELDS': {
|
|
274
|
+
return {
|
|
275
|
+
apiId: args[0],
|
|
276
|
+
username: args[1],
|
|
277
|
+
accId: args[2],
|
|
278
|
+
discord: args[3],
|
|
279
|
+
uniqueId: args[4],
|
|
280
|
+
profileFields: args[5]
|
|
281
|
+
}
|
|
282
|
+
}
|
|
248
283
|
default: {
|
|
249
284
|
return args;
|
|
250
285
|
}
|
|
@@ -394,6 +394,12 @@ export const GeneralCMSAPITypes: APITypeData[] = [
|
|
|
394
394
|
path: 'general/ban_account',
|
|
395
395
|
method: 'POST',
|
|
396
396
|
minVersion: 3
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
type: 'EDIT_ACC_PROFLIE_FIELDS',
|
|
400
|
+
path: 'general/edit_acc_profile_fields',
|
|
401
|
+
method: 'POST',
|
|
402
|
+
minVersion: 0
|
|
397
403
|
}
|
|
398
404
|
];
|
|
399
405
|
|
|
@@ -436,6 +442,15 @@ export const FormsCMSAPITypes: APITypeData[] = [
|
|
|
436
442
|
}
|
|
437
443
|
];
|
|
438
444
|
|
|
445
|
+
export const CommunitiesCMSAPITypes: APITypeData[] = [
|
|
446
|
+
{
|
|
447
|
+
type: 'LOOKUP',
|
|
448
|
+
path: 'communities/lookup',
|
|
449
|
+
method: 'POST',
|
|
450
|
+
minVersion: 0
|
|
451
|
+
},
|
|
452
|
+
];
|
|
453
|
+
|
|
439
454
|
function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeData[] {
|
|
440
455
|
return array.map((val) => {
|
|
441
456
|
return {
|
|
@@ -445,9 +460,9 @@ function formatForAll(array: APITypeData[], product: productEnums): AllAPITypeDa
|
|
|
445
460
|
});
|
|
446
461
|
}
|
|
447
462
|
|
|
448
|
-
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) ];
|
|
463
|
+
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) ];
|
|
449
464
|
|
|
450
|
-
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';
|
|
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';
|
|
451
466
|
|
|
452
467
|
export interface CMSServerAPIStruct {
|
|
453
468
|
id: number;
|
|
@@ -713,6 +728,10 @@ export interface CADUnitLocationStruct {
|
|
|
713
728
|
location: string;
|
|
714
729
|
}
|
|
715
730
|
|
|
731
|
+
export interface CMSProfileField {
|
|
732
|
+
id: string;
|
|
733
|
+
value: string;
|
|
734
|
+
}
|
|
716
735
|
export interface RESTTypedAPIDataStructs {
|
|
717
736
|
// CAD - General
|
|
718
737
|
GET_SERVERS: [];
|
|
@@ -838,13 +857,16 @@ export interface RESTTypedAPIDataStructs {
|
|
|
838
857
|
username?: string,
|
|
839
858
|
accId?: string,
|
|
840
859
|
discord?: string,
|
|
860
|
+
uniqueId?: string
|
|
841
861
|
];
|
|
842
862
|
GET_SUB_VERSION: [];
|
|
843
863
|
CHECK_COM_APIID: [apiId: string];
|
|
844
864
|
CLOCK_IN_OUT: [
|
|
845
865
|
apiId?: string,
|
|
846
866
|
accId?: string,
|
|
847
|
-
forceClockIn?: boolean
|
|
867
|
+
forceClockIn?: boolean,
|
|
868
|
+
discord?: string,
|
|
869
|
+
uniqueId?: string
|
|
848
870
|
];
|
|
849
871
|
GET_DEPARTMENTS: [];
|
|
850
872
|
GET_ACCOUNT_RANKS: [
|
|
@@ -852,22 +874,27 @@ export interface RESTTypedAPIDataStructs {
|
|
|
852
874
|
username?: string,
|
|
853
875
|
accId?: string,
|
|
854
876
|
discord?: string,
|
|
877
|
+
uniqueId?: string,
|
|
855
878
|
],
|
|
856
879
|
SET_ACCOUNT_RANKS: [
|
|
857
|
-
|
|
858
|
-
set?:
|
|
859
|
-
primary?: string | null,
|
|
860
|
-
secondary?: string[]
|
|
861
|
-
},
|
|
880
|
+
accId?: string,
|
|
881
|
+
set?: string[],
|
|
862
882
|
add?: string[],
|
|
863
883
|
remove?: string[],
|
|
884
|
+
apiId?: string,
|
|
885
|
+
username?: string,
|
|
886
|
+
discord?: string,
|
|
887
|
+
uniqueId?: string,
|
|
864
888
|
],
|
|
865
889
|
// CMS - Servers
|
|
866
890
|
GET_GAME_SERVERS: [];
|
|
867
891
|
VERIFY_WHITELIST: [
|
|
868
892
|
apiId: string | undefined,
|
|
869
893
|
accId: string | undefined,
|
|
870
|
-
serverId: number
|
|
894
|
+
serverId: number,
|
|
895
|
+
username: string | undefined,
|
|
896
|
+
discord: string | undefined,
|
|
897
|
+
uniqueId: number | undefined,
|
|
871
898
|
];
|
|
872
899
|
FULL_WHITELIST: [
|
|
873
900
|
serverId?: number,
|
|
@@ -876,12 +903,26 @@ export interface RESTTypedAPIDataStructs {
|
|
|
876
903
|
eventId: string,
|
|
877
904
|
apiId: string | undefined,
|
|
878
905
|
accId: string | undefined,
|
|
906
|
+
discord: string | undefined,
|
|
907
|
+
uniqueId: string | undefined
|
|
908
|
+
],
|
|
909
|
+
EDIT_ACC_PROFLIE_FIELDS : [
|
|
910
|
+
apiId: string,
|
|
911
|
+
username: string,
|
|
912
|
+
accId: string,
|
|
913
|
+
discord: string,
|
|
914
|
+
uniqueId: string,
|
|
915
|
+
profileFields : CMSProfileField[]
|
|
879
916
|
]
|
|
880
917
|
// CMS - Forms
|
|
881
918
|
CHANGE_FORM_STAGE: [
|
|
882
919
|
accId: string,
|
|
883
920
|
formId: number,
|
|
884
|
-
newStageId: string
|
|
921
|
+
newStageId: string,
|
|
922
|
+
apiId: string,
|
|
923
|
+
username: string,
|
|
924
|
+
discord: string,
|
|
925
|
+
uniqueId: number,
|
|
885
926
|
]
|
|
886
927
|
}
|
|
887
928
|
|
|
@@ -46,14 +46,14 @@ export class CMSManager extends BaseManager {
|
|
|
46
46
|
* @param {Object | string} data The object or [accId | apiId as a string] that contains data to get a community account to verify if it has whitelist to the specified server. *If given as a string it will default to the set or default cms server id (1).
|
|
47
47
|
* @param {string} [data.accId] The account id to find a community account.
|
|
48
48
|
* @param {string} [data.apiId] The api id to find a community account.
|
|
49
|
-
* @param {string} [data.serverId] The username to find a community account.
|
|
49
|
+
* @param {string} [data.serverId] The username to find a community account.
|
|
50
50
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
51
51
|
*/
|
|
52
|
-
public async verifyWhitelist(data: { accId?: string, apiId?: string, serverId?: number } | string): Promise<globalTypes.CMSVerifyWhitelistPromiseResult> {
|
|
52
|
+
public async verifyWhitelist(data: { accId?: string, apiId?: string, username?: string, discord?: string, uniqueId?: number, serverId?: number } | string): Promise<globalTypes.CMSVerifyWhitelistPromiseResult> {
|
|
53
53
|
return new Promise(async (resolve, reject) => {
|
|
54
54
|
try {
|
|
55
55
|
const isString = typeof data === 'string';
|
|
56
|
-
const whitelistRequest: any = await this.rest?.request('VERIFY_WHITELIST', isString ? data : data.apiId, isString ? data : data.accId, isString ? this.instance.cmsDefaultServerId : data.serverId ?? this.instance.cmsDefaultServerId);
|
|
56
|
+
const whitelistRequest: any = await this.rest?.request('VERIFY_WHITELIST', isString ? data : data.apiId, isString ? data : data.accId, isString ? this.instance.cmsDefaultServerId : data.serverId ?? this.instance.cmsDefaultServerId, isString ? undefined : data.username, isString ? undefined : data.discord, isString ? undefined : data.uniqueId);
|
|
57
57
|
if (typeof whitelistRequest === 'string') {
|
|
58
58
|
resolve({ success: true, reason: whitelistRequest });
|
|
59
59
|
} else {
|
|
@@ -97,10 +97,10 @@ export class CMSManager extends BaseManager {
|
|
|
97
97
|
* @param {string} [data.username] The username to find a community account.
|
|
98
98
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
99
99
|
*/
|
|
100
|
-
public async getComAccount(params: { accId?: string, apiId?: string, username?: string, discord?: string }): Promise<globalTypes.CMSGetComAccountPromiseResult> {
|
|
100
|
+
public async getComAccount(params: { accId?: string, apiId?: string, username?: string, discord?: string, uniqueId?: string }): Promise<globalTypes.CMSGetComAccountPromiseResult> {
|
|
101
101
|
return new Promise(async (resolve, reject) => {
|
|
102
102
|
try {
|
|
103
|
-
const getAccountRequest: any = await this.rest?.request('GET_COM_ACCOUNT', params.apiId, params.username, params.accId, params.discord);
|
|
103
|
+
const getAccountRequest: any = await this.rest?.request('GET_COM_ACCOUNT', params.apiId, params.username, params.accId, params.discord, params.uniqueId);
|
|
104
104
|
resolve({ success: true, data: getAccountRequest });
|
|
105
105
|
} catch (err) {
|
|
106
106
|
if (err instanceof APIError) {
|
|
@@ -120,10 +120,10 @@ export class CMSManager extends BaseManager {
|
|
|
120
120
|
* @param {string} [data.username] (Optional) The username to find a community account.
|
|
121
121
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed and the account data object if found.
|
|
122
122
|
*/
|
|
123
|
-
public async getAccountRanks(params: { accId?: string, apiId?: string, username?: string, discord?: string }): Promise<globalTypes.CMSGetAccountRanksPromiseResult> {
|
|
123
|
+
public async getAccountRanks(params: { accId?: string, apiId?: string, username?: string, discord?: string, uniqueId?: string }): Promise<globalTypes.CMSGetAccountRanksPromiseResult> {
|
|
124
124
|
return new Promise(async (resolve, reject) => {
|
|
125
125
|
try {
|
|
126
|
-
const getAccountRanksRequest: any = await this.rest?.request('GET_ACCOUNT_RANKS', params.apiId, params.username, params.accId, params.discord);
|
|
126
|
+
const getAccountRanksRequest: any = await this.rest?.request('GET_ACCOUNT_RANKS', params.apiId, params.username, params.accId, params.discord, params.uniqueId);
|
|
127
127
|
resolve({ success: true, data: getAccountRanksRequest });
|
|
128
128
|
} catch (err) {
|
|
129
129
|
if (err instanceof APIError) {
|
|
@@ -141,12 +141,13 @@ export class CMSManager extends BaseManager {
|
|
|
141
141
|
* @param {string} [data.accId] (Optional) The account id to clock in or out.
|
|
142
142
|
* @param {string} [data.apiId] (Optional) The api id to clock in or out.
|
|
143
143
|
* @param {boolean} [data.forceClockIn] If true, it will override any current clock in with a new clock in at the time of the request.
|
|
144
|
+
* @param {string} [data.discord] (Optional) The discord ID to clock in or out.
|
|
144
145
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
145
146
|
*/
|
|
146
|
-
public async clockInOut(data: { accId?: string, apiId?: string, forceClockIn?: boolean }): Promise<globalTypes.CMSClockInOutPromiseResult> {
|
|
147
|
+
public async clockInOut(data: { accId?: string, apiId?: string, forceClockIn?: boolean, discord?: string, uniqueId?: string }): Promise<globalTypes.CMSClockInOutPromiseResult> {
|
|
147
148
|
return new Promise(async (resolve, reject) => {
|
|
148
149
|
try {
|
|
149
|
-
const clockInOutRequest = await this.rest?.request('CLOCK_IN_OUT', data.apiId, data.accId, !!data.forceClockIn);
|
|
150
|
+
const clockInOutRequest = await this.rest?.request('CLOCK_IN_OUT', data.apiId, data.accId, !!data.forceClockIn, data.discord, data.uniqueId);
|
|
150
151
|
const clockInOutResponse = clockInOutRequest as globalTypes.clockInOutRequest;
|
|
151
152
|
if (!clockInOutResponse) resolve({ success: false, reason: clockInOutRequest as string });
|
|
152
153
|
resolve({ success: true, clockedIn: clockInOutResponse.completed });
|
|
@@ -201,19 +202,20 @@ export class CMSManager extends BaseManager {
|
|
|
201
202
|
|
|
202
203
|
/**
|
|
203
204
|
* Sets a community account's ranks for the CMS community.
|
|
204
|
-
* @param {string}
|
|
205
|
+
* @param {string} accId The object that contains critical data to clock in or out an account.
|
|
205
206
|
* @param {Object} changes The object that contains change data for setting account ranks.
|
|
206
207
|
* @param {Object} [changes.set] (Optional) The object that contains primary and secondary data for setting account ranks.
|
|
207
208
|
* @param {string} [changes.set.primary] (Optional) The primary rank ID wanting to set to the account.
|
|
208
209
|
* @param {string} [changes.set.secondary] (Optional) The secondary rank ID(s) wanting to set to the account.
|
|
209
210
|
* @param {Array} [changes.add] (Optional) The secondary rank IDs wanting to add to the account.
|
|
210
211
|
* @param {Array} [changes.remove] (Optional) The secondary rank IDs wanting to remove to the account.
|
|
212
|
+
* @param {string} [discord] (Optional) The discord ID to set the ranks for.
|
|
211
213
|
* @returns {Promise} Promise object represents if the request was successful with reason for failure if needed.
|
|
212
214
|
*/
|
|
213
|
-
public async setAccountRanks(
|
|
215
|
+
public async setAccountRanks(changes: globalTypes.CMSSetAccountRanksChangesObject, apiId?: string, accId?: string, username?: string, discord?: string, uniqueId?: string): Promise<globalTypes.CMSSetAccountRanksPromiseResult> {
|
|
214
216
|
return new Promise(async (resolve, reject) => {
|
|
215
217
|
try {
|
|
216
|
-
const setAccountRanksRequest: any = await this.rest?.request('SET_ACCOUNT_RANKS',
|
|
218
|
+
const setAccountRanksRequest: any = await this.rest?.request('SET_ACCOUNT_RANKS', accId, changes.set, changes.add, changes.remove, apiId, username, discord, uniqueId);
|
|
217
219
|
resolve({ success: true, data: setAccountRanksRequest });
|
|
218
220
|
} catch (err) {
|
|
219
221
|
if (err instanceof APIError) {
|