@sonoransoftware/sonoran.js 1.0.42 → 1.0.45
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/libs/rest/src/lib/REST.js +15 -2
- package/dist/libs/rest/src/lib/RequestManager.js +12 -4
- package/dist/libs/rest/src/lib/utils/constants.d.ts +11 -1
- package/dist/managers/CADManager.d.ts +6 -0
- package/dist/managers/CADManager.js +22 -6
- package/dist/managers/RadioManager.d.ts +2 -1
- package/dist/managers/RadioManager.js +3 -2
- package/package.json +1 -1
- package/readme.md +11 -4
- package/src/libs/rest/src/lib/REST.ts +20 -2
- package/src/libs/rest/src/lib/RequestManager.ts +9 -1
- package/src/libs/rest/src/lib/utils/constants.ts +13 -2
- package/src/managers/CADManager.ts +29 -4
- package/src/managers/RadioManager.ts +3 -2
|
@@ -195,6 +195,18 @@ class REST extends events_1.EventEmitter {
|
|
|
195
195
|
type: args[5]
|
|
196
196
|
};
|
|
197
197
|
}
|
|
198
|
+
case 'UNIT_STATUS': {
|
|
199
|
+
const payload = args[0];
|
|
200
|
+
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
201
|
+
const { apiId, account, status, serverId } = payload;
|
|
202
|
+
return { apiId, account, status, serverId };
|
|
203
|
+
}
|
|
204
|
+
return {
|
|
205
|
+
apiId: args[0],
|
|
206
|
+
status: args[1],
|
|
207
|
+
serverId: args[2]
|
|
208
|
+
};
|
|
209
|
+
}
|
|
198
210
|
case 'CHECK_COM_APIID': {
|
|
199
211
|
return {
|
|
200
212
|
apiId: args[0]
|
|
@@ -348,8 +360,9 @@ class REST extends events_1.EventEmitter {
|
|
|
348
360
|
}
|
|
349
361
|
case 'RADIO_SET_USER_CHANNELS': {
|
|
350
362
|
return {
|
|
351
|
-
|
|
352
|
-
|
|
363
|
+
roomId: args[0],
|
|
364
|
+
identity: args[1],
|
|
365
|
+
options: (_c = args[2]) !== null && _c !== void 0 ? _c : {}
|
|
353
366
|
};
|
|
354
367
|
}
|
|
355
368
|
case 'RADIO_SET_USER_DISPLAY_NAME': {
|
|
@@ -238,7 +238,7 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
238
238
|
return apiData;
|
|
239
239
|
}
|
|
240
240
|
static resolveRadioRequest(instance, apiURL, apiType, request, apiData) {
|
|
241
|
-
var _a, _b, _c;
|
|
241
|
+
var _a, _b, _c, _d;
|
|
242
242
|
if (!apiURL || typeof apiURL !== 'string') {
|
|
243
243
|
throw new Error('Radio API URL could not be resolved for request.');
|
|
244
244
|
}
|
|
@@ -313,12 +313,20 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
313
313
|
}
|
|
314
314
|
case 'RADIO_SET_USER_CHANNELS': {
|
|
315
315
|
const auth = ensureAuth();
|
|
316
|
+
const roomIdRaw = (_b = payload === null || payload === void 0 ? void 0 : payload.roomId) !== null && _b !== void 0 ? _b : payload === null || payload === void 0 ? void 0 : payload.roomID;
|
|
317
|
+
if (roomIdRaw === undefined) {
|
|
318
|
+
throw new Error('roomId is required for RADIO_SET_USER_CHANNELS requests.');
|
|
319
|
+
}
|
|
320
|
+
const roomIdNumeric = typeof roomIdRaw === 'number' ? roomIdRaw : Number(roomIdRaw);
|
|
321
|
+
if (Number.isNaN(roomIdNumeric)) {
|
|
322
|
+
throw new Error('roomId must be a number for RADIO_SET_USER_CHANNELS requests.');
|
|
323
|
+
}
|
|
316
324
|
const identity = payload === null || payload === void 0 ? void 0 : payload.identity;
|
|
317
325
|
if (!identity) {
|
|
318
326
|
throw new Error('identity is required for RADIO_SET_USER_CHANNELS requests.');
|
|
319
327
|
}
|
|
320
|
-
const options = (
|
|
321
|
-
path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}/${encodeSegment(identity)}`;
|
|
328
|
+
const options = (_c = payload === null || payload === void 0 ? void 0 : payload.options) !== null && _c !== void 0 ? _c : {};
|
|
329
|
+
path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}/${encodeSegment(roomIdNumeric)}/${encodeSegment(identity)}`;
|
|
322
330
|
method = 'POST';
|
|
323
331
|
const requestBody = {};
|
|
324
332
|
if ((options === null || options === void 0 ? void 0 : options.transmit) !== undefined) {
|
|
@@ -379,7 +387,7 @@ class RequestManager extends events_1.EventEmitter {
|
|
|
379
387
|
key: auth.key,
|
|
380
388
|
locations
|
|
381
389
|
};
|
|
382
|
-
const token = (
|
|
390
|
+
const token = (_d = payload === null || payload === void 0 ? void 0 : payload.token) !== null && _d !== void 0 ? _d : auth.key;
|
|
383
391
|
if (token) {
|
|
384
392
|
headers.Authorization = `Bearer ${token}`;
|
|
385
393
|
}
|
|
@@ -273,6 +273,12 @@ export interface CADUnitLocationStruct {
|
|
|
273
273
|
apiId: string;
|
|
274
274
|
location: string;
|
|
275
275
|
}
|
|
276
|
+
export interface CADUnitStatusStruct {
|
|
277
|
+
apiId?: string;
|
|
278
|
+
account?: string;
|
|
279
|
+
status: number;
|
|
280
|
+
serverId: number;
|
|
281
|
+
}
|
|
276
282
|
export interface RESTTypedAPIDataStructs {
|
|
277
283
|
GET_SERVERS: [];
|
|
278
284
|
SET_SERVERS: [
|
|
@@ -348,6 +354,8 @@ export interface RESTTypedAPIDataStructs {
|
|
|
348
354
|
apiId: string | undefined,
|
|
349
355
|
status: number,
|
|
350
356
|
serverId: number
|
|
357
|
+
] | [
|
|
358
|
+
data: CADUnitStatusStruct
|
|
351
359
|
];
|
|
352
360
|
GET_BLIPS: [serverId: number];
|
|
353
361
|
ADD_BLIP: [data: CADAddBlipStruct[]];
|
|
@@ -575,6 +583,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
575
583
|
identity: string
|
|
576
584
|
];
|
|
577
585
|
RADIO_SET_USER_CHANNELS: [
|
|
586
|
+
roomId: number,
|
|
578
587
|
identity: string,
|
|
579
588
|
options?: RadioSetUserChannelsOptions
|
|
580
589
|
];
|
|
@@ -636,7 +645,8 @@ export type PossibleRequestData = undefined | {
|
|
|
636
645
|
apiId: string;
|
|
637
646
|
isPanic: boolean;
|
|
638
647
|
} | {
|
|
639
|
-
apiId
|
|
648
|
+
apiId?: string;
|
|
649
|
+
account?: string;
|
|
640
650
|
status: number;
|
|
641
651
|
serverId: number;
|
|
642
652
|
} | {
|
|
@@ -160,6 +160,12 @@ export declare class CADManager extends BaseManager {
|
|
|
160
160
|
* Updates a unit's status.
|
|
161
161
|
*/
|
|
162
162
|
setUnitStatus(apiId: string | undefined, status: number, serverId: number): Promise<globalTypes.CADStandardResponse>;
|
|
163
|
+
setUnitStatus(params: {
|
|
164
|
+
apiId?: string;
|
|
165
|
+
account?: string;
|
|
166
|
+
status: number;
|
|
167
|
+
serverId: number;
|
|
168
|
+
}): Promise<globalTypes.CADStandardResponse>;
|
|
163
169
|
/**
|
|
164
170
|
* Retrieves live map blips for a CAD server.
|
|
165
171
|
*/
|
|
@@ -382,14 +382,30 @@ class CADManager extends BaseManager_1.BaseManager {
|
|
|
382
382
|
async setUnitPanic(apiId, isPanic) {
|
|
383
383
|
return this.executeCadRequest('UNIT_PANIC', apiId, isPanic);
|
|
384
384
|
}
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
385
|
+
async setUnitStatus(apiIdOrParams, status, serverId) {
|
|
386
|
+
let payload;
|
|
387
|
+
if (apiIdOrParams && typeof apiIdOrParams === 'object' && !Array.isArray(apiIdOrParams)) {
|
|
388
|
+
payload = {
|
|
389
|
+
apiId: apiIdOrParams.apiId,
|
|
390
|
+
account: apiIdOrParams.account,
|
|
391
|
+
status: apiIdOrParams.status,
|
|
392
|
+
serverId: apiIdOrParams.serverId
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
payload = { apiId: apiIdOrParams, status: status, serverId: serverId };
|
|
397
|
+
}
|
|
398
|
+
const { apiId, account, status: resolvedStatus, serverId: resolvedServerId } = payload;
|
|
399
|
+
if (!Number.isInteger(resolvedServerId)) {
|
|
390
400
|
throw new Error('serverId must be an integer when updating unit status.');
|
|
391
401
|
}
|
|
392
|
-
|
|
402
|
+
if (resolvedStatus === undefined) {
|
|
403
|
+
throw new Error('status is required when updating unit status.');
|
|
404
|
+
}
|
|
405
|
+
if (!apiId && !account) {
|
|
406
|
+
throw new Error('Either apiId or account is required when updating unit status.');
|
|
407
|
+
}
|
|
408
|
+
return this.executeCadRequest('UNIT_STATUS', { apiId, account, status: resolvedStatus, serverId: resolvedServerId });
|
|
393
409
|
}
|
|
394
410
|
/**
|
|
395
411
|
* Retrieves live map blips for a CAD server.
|
|
@@ -27,10 +27,11 @@ export declare class RadioManager extends BaseManager {
|
|
|
27
27
|
getConnectedUser(roomId: number, identity: string): Promise<globalTypes.RadioGetConnectedUserPromiseResult>;
|
|
28
28
|
/**
|
|
29
29
|
* Updates a user's transmit and scanned channel configuration.
|
|
30
|
+
* @param {number} roomId Multi-server room id.
|
|
30
31
|
* @param {string} identity The user's UUID.
|
|
31
32
|
* @param {RadioSetUserChannelsOptions} options Transmit and scan channel configuration.
|
|
32
33
|
*/
|
|
33
|
-
setUserChannels(identity: string, options?: globalTypes.RadioSetUserChannelsOptions): Promise<globalTypes.RadioSetUserChannelsPromiseResult>;
|
|
34
|
+
setUserChannels(roomId: number, identity: string, options?: globalTypes.RadioSetUserChannelsOptions): Promise<globalTypes.RadioSetUserChannelsPromiseResult>;
|
|
34
35
|
/**
|
|
35
36
|
* Updates a user's display name.
|
|
36
37
|
* @param {string} accId The user's account UUID.
|
|
@@ -115,14 +115,15 @@ class RadioManager extends BaseManager_1.BaseManager {
|
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* Updates a user's transmit and scanned channel configuration.
|
|
118
|
+
* @param {number} roomId Multi-server room id.
|
|
118
119
|
* @param {string} identity The user's UUID.
|
|
119
120
|
* @param {RadioSetUserChannelsOptions} options Transmit and scan channel configuration.
|
|
120
121
|
*/
|
|
121
|
-
async setUserChannels(identity, options = {}) {
|
|
122
|
+
async setUserChannels(roomId, identity, options = {}) {
|
|
122
123
|
return new Promise(async (resolve, reject) => {
|
|
123
124
|
var _a, _b;
|
|
124
125
|
try {
|
|
125
|
-
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('RADIO_SET_USER_CHANNELS', identity, options));
|
|
126
|
+
const response = await ((_a = this.rest) === null || _a === void 0 ? void 0 : _a.request('RADIO_SET_USER_CHANNELS', roomId, identity, options));
|
|
126
127
|
resolve({ success: true, result: (_b = response === null || response === void 0 ? void 0 : response.result) !== null && _b !== void 0 ? _b : response });
|
|
127
128
|
}
|
|
128
129
|
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.45",
|
|
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/readme.md
CHANGED
|
@@ -103,11 +103,18 @@ const lookup = await instance.cad.lookupRecords({ apiId: '1234567890', types: [2
|
|
|
103
103
|
### Identifiers & Units
|
|
104
104
|
- **`getIdentifiers(apiId)`**
|
|
105
105
|
- **`modifyIdentifier(change)`** / **`setIdentifier(apiId?, identId)`**
|
|
106
|
-
- **`setUnitPanic(apiId?, isPanic)`** / **`setUnitStatus(
|
|
106
|
+
- **`setUnitPanic(apiId?, isPanic)`** / **`setUnitStatus({ status, serverId, apiId?, account? })`**
|
|
107
107
|
- **`getActiveUnits(options)`** - direct CAD fetch for active units.
|
|
108
108
|
- **`kickUnit(apiId?, reason, serverId)`**
|
|
109
109
|
- **`updateUnitLocations(locations)`**
|
|
110
110
|
|
|
111
|
+
```js
|
|
112
|
+
// Update a unit's status using an account UUID
|
|
113
|
+
await instance.cad.setUnitStatus({ account: 'd5663516-ee35-11e9-9714-5600023b2434', status: 2, serverId: 1 });
|
|
114
|
+
// Legacy positional call using an API ID
|
|
115
|
+
await instance.cad.setUnitStatus('1234567890', 2, 1);
|
|
116
|
+
```
|
|
117
|
+
|
|
111
118
|
### Map & Streetsigns
|
|
112
119
|
- **`getBlips(serverId)`**
|
|
113
120
|
- **`addBlips(blips)`** / **`updateBlips(blips)`** / **`removeBlip(id)`**
|
|
@@ -448,10 +455,10 @@ Fetches a specific connected radio user by room and identity.
|
|
|
448
455
|
const user = await instance.radio.getConnectedUser(1, 'account-uuid');
|
|
449
456
|
```
|
|
450
457
|
|
|
451
|
-
### setUserChannels(identity, options)
|
|
452
|
-
Updates a user's transmit or scan channels.
|
|
458
|
+
### setUserChannels(roomId, identity, options)
|
|
459
|
+
Updates a user's transmit or scan channels for a specific radio room.
|
|
453
460
|
```js
|
|
454
|
-
await instance.radio.setUserChannels('account-uuid', { transmit: 12, scan: [10, 11, 12] });
|
|
461
|
+
await instance.radio.setUserChannels(1, 'account-uuid', { transmit: 12, scan: [10, 11, 12] });
|
|
455
462
|
```
|
|
456
463
|
|
|
457
464
|
### setUserDisplayName(accId, displayName)
|
|
@@ -299,6 +299,23 @@ export class REST extends EventEmitter {
|
|
|
299
299
|
type: args[5]
|
|
300
300
|
};
|
|
301
301
|
}
|
|
302
|
+
case 'UNIT_STATUS': {
|
|
303
|
+
const payload = args[0];
|
|
304
|
+
if (payload && typeof payload === 'object' && !Array.isArray(payload)) {
|
|
305
|
+
const { apiId, account, status, serverId } = payload as {
|
|
306
|
+
apiId?: string;
|
|
307
|
+
account?: string;
|
|
308
|
+
status: number;
|
|
309
|
+
serverId: number;
|
|
310
|
+
};
|
|
311
|
+
return { apiId, account, status, serverId };
|
|
312
|
+
}
|
|
313
|
+
return {
|
|
314
|
+
apiId: args[0],
|
|
315
|
+
status: args[1],
|
|
316
|
+
serverId: args[2]
|
|
317
|
+
};
|
|
318
|
+
}
|
|
302
319
|
case 'CHECK_COM_APIID': {
|
|
303
320
|
return {
|
|
304
321
|
apiId: args[0]
|
|
@@ -452,8 +469,9 @@ export class REST extends EventEmitter {
|
|
|
452
469
|
}
|
|
453
470
|
case 'RADIO_SET_USER_CHANNELS': {
|
|
454
471
|
return {
|
|
455
|
-
|
|
456
|
-
|
|
472
|
+
roomId: args[0],
|
|
473
|
+
identity: args[1],
|
|
474
|
+
options: args[2] ?? {}
|
|
457
475
|
}
|
|
458
476
|
}
|
|
459
477
|
case 'RADIO_SET_USER_DISPLAY_NAME': {
|
|
@@ -392,12 +392,20 @@ export class RequestManager extends EventEmitter {
|
|
|
392
392
|
}
|
|
393
393
|
case 'RADIO_SET_USER_CHANNELS': {
|
|
394
394
|
const auth = ensureAuth();
|
|
395
|
+
const roomIdRaw = payload?.roomId ?? payload?.roomID;
|
|
396
|
+
if (roomIdRaw === undefined) {
|
|
397
|
+
throw new Error('roomId is required for RADIO_SET_USER_CHANNELS requests.');
|
|
398
|
+
}
|
|
399
|
+
const roomIdNumeric = typeof roomIdRaw === 'number' ? roomIdRaw : Number(roomIdRaw);
|
|
400
|
+
if (Number.isNaN(roomIdNumeric)) {
|
|
401
|
+
throw new Error('roomId must be a number for RADIO_SET_USER_CHANNELS requests.');
|
|
402
|
+
}
|
|
395
403
|
const identity = payload?.identity;
|
|
396
404
|
if (!identity) {
|
|
397
405
|
throw new Error('identity is required for RADIO_SET_USER_CHANNELS requests.');
|
|
398
406
|
}
|
|
399
407
|
const options = payload?.options ?? {};
|
|
400
|
-
path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}/${encodeSegment(identity)}`;
|
|
408
|
+
path = `${apiType.path}/${auth.encodedId}/${auth.encodedKey}/${encodeSegment(roomIdNumeric)}/${encodeSegment(identity)}`;
|
|
401
409
|
method = 'POST';
|
|
402
410
|
const requestBody: Record<string, unknown> = {};
|
|
403
411
|
if (options?.transmit !== undefined) {
|
|
@@ -900,7 +900,14 @@ export interface CADStreetSignStruct {
|
|
|
900
900
|
|
|
901
901
|
export interface CADUnitLocationStruct {
|
|
902
902
|
apiId: string;
|
|
903
|
-
location: string;
|
|
903
|
+
location: string;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
export interface CADUnitStatusStruct {
|
|
907
|
+
apiId?: string;
|
|
908
|
+
account?: string;
|
|
909
|
+
status: number;
|
|
910
|
+
serverId: number;
|
|
904
911
|
}
|
|
905
912
|
|
|
906
913
|
export interface RESTTypedAPIDataStructs {
|
|
@@ -977,6 +984,8 @@ export interface RESTTypedAPIDataStructs {
|
|
|
977
984
|
apiId: string | undefined,
|
|
978
985
|
status: number,
|
|
979
986
|
serverId: number
|
|
987
|
+
] | [
|
|
988
|
+
data: CADUnitStatusStruct
|
|
980
989
|
];
|
|
981
990
|
GET_BLIPS: [serverId: number];
|
|
982
991
|
ADD_BLIP: [data: CADAddBlipStruct[]];
|
|
@@ -1209,6 +1218,7 @@ export interface RESTTypedAPIDataStructs {
|
|
|
1209
1218
|
identity: string
|
|
1210
1219
|
];
|
|
1211
1220
|
RADIO_SET_USER_CHANNELS: [
|
|
1221
|
+
roomId: number,
|
|
1212
1222
|
identity: string,
|
|
1213
1223
|
options?: RadioSetUserChannelsOptions
|
|
1214
1224
|
];
|
|
@@ -1287,7 +1297,8 @@ export type PossibleRequestData =
|
|
|
1287
1297
|
isPanic: boolean;
|
|
1288
1298
|
} |
|
|
1289
1299
|
{
|
|
1290
|
-
apiId
|
|
1300
|
+
apiId?: string;
|
|
1301
|
+
account?: string;
|
|
1291
1302
|
status: number;
|
|
1292
1303
|
serverId: number;
|
|
1293
1304
|
} |
|
|
@@ -19,7 +19,8 @@ import type {
|
|
|
19
19
|
CADGetActiveUnitsStruct,
|
|
20
20
|
CADNewDispatchStruct,
|
|
21
21
|
CADStreetSignStruct,
|
|
22
|
-
CADUnitLocationStruct
|
|
22
|
+
CADUnitLocationStruct,
|
|
23
|
+
CADUnitStatusStruct
|
|
23
24
|
} from '../libs/rest/src';
|
|
24
25
|
import { BaseManager } from './BaseManager';
|
|
25
26
|
import * as globalTypes from '../constants';
|
|
@@ -405,11 +406,35 @@ export class CADManager extends BaseManager {
|
|
|
405
406
|
/**
|
|
406
407
|
* Updates a unit's status.
|
|
407
408
|
*/
|
|
408
|
-
public async setUnitStatus(apiId: string | undefined, status: number, serverId: number): Promise<globalTypes.CADStandardResponse
|
|
409
|
-
|
|
409
|
+
public async setUnitStatus(apiId: string | undefined, status: number, serverId: number): Promise<globalTypes.CADStandardResponse>;
|
|
410
|
+
public async setUnitStatus(params: { apiId?: string; account?: string; status: number; serverId: number }): Promise<globalTypes.CADStandardResponse>;
|
|
411
|
+
public async setUnitStatus(
|
|
412
|
+
apiIdOrParams: string | undefined | { apiId?: string; account?: string; status: number; serverId: number },
|
|
413
|
+
status?: number,
|
|
414
|
+
serverId?: number
|
|
415
|
+
): Promise<globalTypes.CADStandardResponse> {
|
|
416
|
+
let payload: CADUnitStatusStruct;
|
|
417
|
+
if (apiIdOrParams && typeof apiIdOrParams === 'object' && !Array.isArray(apiIdOrParams)) {
|
|
418
|
+
payload = {
|
|
419
|
+
apiId: apiIdOrParams.apiId,
|
|
420
|
+
account: apiIdOrParams.account,
|
|
421
|
+
status: apiIdOrParams.status,
|
|
422
|
+
serverId: apiIdOrParams.serverId
|
|
423
|
+
};
|
|
424
|
+
} else {
|
|
425
|
+
payload = { apiId: apiIdOrParams as string | undefined, status: status as number, serverId: serverId as number };
|
|
426
|
+
}
|
|
427
|
+
const { apiId, account, status: resolvedStatus, serverId: resolvedServerId } = payload;
|
|
428
|
+
if (!Number.isInteger(resolvedServerId)) {
|
|
410
429
|
throw new Error('serverId must be an integer when updating unit status.');
|
|
411
430
|
}
|
|
412
|
-
|
|
431
|
+
if (resolvedStatus === undefined) {
|
|
432
|
+
throw new Error('status is required when updating unit status.');
|
|
433
|
+
}
|
|
434
|
+
if (!apiId && !account) {
|
|
435
|
+
throw new Error('Either apiId or account is required when updating unit status.');
|
|
436
|
+
}
|
|
437
|
+
return this.executeCadRequest('UNIT_STATUS', { apiId, account, status: resolvedStatus, serverId: resolvedServerId });
|
|
413
438
|
}
|
|
414
439
|
|
|
415
440
|
/**
|
|
@@ -90,13 +90,14 @@ export class RadioManager extends BaseManager {
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Updates a user's transmit and scanned channel configuration.
|
|
93
|
+
* @param {number} roomId Multi-server room id.
|
|
93
94
|
* @param {string} identity The user's UUID.
|
|
94
95
|
* @param {RadioSetUserChannelsOptions} options Transmit and scan channel configuration.
|
|
95
96
|
*/
|
|
96
|
-
public async setUserChannels(identity: string, options: globalTypes.RadioSetUserChannelsOptions = {}): Promise<globalTypes.RadioSetUserChannelsPromiseResult> {
|
|
97
|
+
public async setUserChannels(roomId: number, identity: string, options: globalTypes.RadioSetUserChannelsOptions = {}): Promise<globalTypes.RadioSetUserChannelsPromiseResult> {
|
|
97
98
|
return new Promise(async (resolve, reject) => {
|
|
98
99
|
try {
|
|
99
|
-
const response: any = await this.rest?.request('RADIO_SET_USER_CHANNELS', identity, options);
|
|
100
|
+
const response: any = await this.rest?.request('RADIO_SET_USER_CHANNELS', roomId, identity, options);
|
|
100
101
|
resolve({ success: true, result: response?.result ?? response });
|
|
101
102
|
} catch (err) {
|
|
102
103
|
if (err instanceof APIError) {
|