5436
5436
return base.PubNubFile;
5437
5437
},
5438
5438
get version() {
5439
- return '9.10 .0';
5439
+ return '9.11 .0';
5440
5440
},
5441
5441
getVersion() {
5442
5442
return this.version;
11420
11420
* Whether state associated with `uuid` should be included in response or not.
11421
11421
*/
11422
11422
const INCLUDE_STATE = false;
11423
+ /**
11424
+ * Maximum number of participants which can be returned with single response.
11425
+ */
11426
+ const MAXIMUM_COUNT = 1000;
11423
11427
// endregion
11424
11428
/**
11425
11429
* Channel presence request.
@@ -11428,14 +11432,19 @@
11428
11432
*/
11429
11433
class HereNowRequest extends AbstractRequest {
11430
11434
constructor(parameters) {
11431
- var _a, _b, _c;
11432
- var _d, _e, _f;
11435
+ var _a, _b, _c, _d ;
11436
+ var _e, _f, _g, _h ;
11433
11437
super();
11434
11438
this.parameters = parameters;
11435
11439
// Apply defaults.
11436
- (_a = (_d = this.parameters).queryParameters) !== null && _a !== void 0 ? _a : (_d.queryParameters = {});
11437
- (_b = (_e = this.parameters).includeUUIDs) !== null && _b !== void 0 ? _b : (_e.includeUUIDs = INCLUDE_UUID$1);
11438
- (_c = (_f = this.parameters).includeState) !== null && _c !== void 0 ? _c : (_f.includeState = INCLUDE_STATE);
11440
+ (_a = (_e = this.parameters).queryParameters) !== null && _a !== void 0 ? _a : (_e.queryParameters = {});
11441
+ (_b = (_f = this.parameters).includeUUIDs) !== null && _b !== void 0 ? _b : (_f.includeUUIDs = INCLUDE_UUID$1);
11442
+ (_c = (_g = this.parameters).includeState) !== null && _c !== void 0 ? _c : (_g.includeState = INCLUDE_STATE);
11443
+ if (this.parameters.limit)
11444
+ this.parameters.limit = Math.min(this.parameters.limit, MAXIMUM_COUNT);
11445
+ else
11446
+ this.parameters.limit = MAXIMUM_COUNT;
11447
+ (_d = (_h = this.parameters).offset) !== null && _d !== void 0 ? _d : (_h.offset = 0);
11439
11448
}
11440
11449
operation() {
11441
11450
const { channels = [], channelGroups = [] } = this.parameters;
11480
11489
return {
11481
11490
totalChannels,
11482
11491
totalOccupancy,
11492
+ next: 0,
11483
11493
channels: channelsPresence,
11484
11494
};
11485
11495
});
11492
11502
return path;
11493
11503
}
11494
11504
get queryParameters() {
11495
- const { channelGroups, includeUUIDs, includeState, queryParameters } = this.parameters;
11496
- return Object.assign(Object.assign(Object.assign(Object.assign({} , (!includeUUIDs ? { disable_uuids: '1' } : {})), ((includeState !== null && includeState !== void 0 ? includeState : false) ? { state: '1' } : {})), (channelGroups && channelGroups.length > 0 ? { 'channel-group': channelGroups.join(',') } : {})), queryParameters);
11505
+ const { channelGroups, includeUUIDs, includeState, limit, offset, queryParameters } = this.parameters;
11506
+ return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (this.operation() === RequestOperation$1.PNHereNowOperation ? { limit } : {})), (this.operation() === RequestOperation$1.PNHereNowOperation && offset > 0 ? { offset } : {})) , (!includeUUIDs ? { disable_uuids: '1' } : {})), ((includeState !== null && includeState !== void 0 ? includeState : false) ? { state: '1' } : {})), (channelGroups && channelGroups.length > 0 ? { 'channel-group': channelGroups.join(',') } : {})), queryParameters);
11497
11507
}
11498
11508
}
11499
11509
@@ -16768,10 +16778,16 @@
16768
16778
};
16769
16779
if (callback)
16770
16780
return this.sendRequest(request, (status, response) => {
16781
+ var _a;
16782
+ if (response && response.totalOccupancy === parameters.limit)
16783
+ response.next = ((_a = parameters.offset) !== null && _a !== void 0 ? _a : 0) + 1;
16771
16784
logResponse(response);
16772
16785
callback(status, response);
16773
16786
});
16774
16787
return this.sendRequest(request).then((response) => {
16788
+ var _a;
16789
+ if (response && response.totalOccupancy === parameters.limit)
16790
+ response.next = ((_a = parameters.offset) !== null && _a !== void 0 ? _a : 0) + 1;
16775
16791
logResponse(response);
16776
16792
return response;
16777
16793
});
0 commit comments