Exemplo n.º 1
0
        /// <inheritdoc />
        async Task <PaginatedResult <PushChannelSubscription> > IPushChannelSubscriptions.ListAsync(ListSubscriptionsRequest requestFilter)
        {
            var request = _restClient.CreateGetRequest(ChannelSubUrl);

            request.AddQueryParameters(requestFilter.ToQueryParams());

            return(await _restClient.ExecutePaginatedRequest(request, ListChannelSubscriptions));

            async Task <PaginatedResult <PushChannelSubscription> > ListChannelSubscriptions(PaginatedRequestParams requestParams)
            {
                var paginatedRequest = _restClient.CreateGetRequest(ChannelSubUrl);

                paginatedRequest.AddQueryParameters(requestParams.GetParameters());
                return(await _restClient.ExecutePaginatedRequest(paginatedRequest, ListChannelSubscriptions));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Obtain the set of members currently present for a channel
        /// </summary>
        /// <returns><see cref="PaginatedResult{T}"/> of the PresenseMessages</returns>
        Task <PaginatedResult <PresenceMessage> > IPresence.GetAsync(int?limit, string clientId, string connectionId)
        {
            if (limit.HasValue && (limit < 0 || limit > 1000))
            {
                throw new ArgumentException("Limit must be between 0 and 1000", nameof(limit));
            }

            var presenceLimit = limit ?? Defaults.QueryLimit;

            var request = _ablyRest.CreateGetRequest(_basePath + "/presence", Options);

            request.QueryParameters.Add("limit", presenceLimit.ToString());
            if (clientId.IsNotEmpty())
            {
                request.QueryParameters.Add("clientId", clientId);
            }
            if (connectionId.IsNotEmpty())
            {
                request.QueryParameters.Add("connectionId", connectionId);
            }

            return(_ablyRest.ExecutePaginatedRequest(request, Presence.GetAsync));
        }