Exemplo n.º 1
0
 internal void AddUntilAttachParameter(HistoryRequestParams query)
 {
     if (State != ChannelState.Attached)
     {
         throw new AblyException("Channel is not attached. Cannot use untilAttach parameter");
     }
     query.ExtraParameters.Add("fromSerial", AttachedSerial);
 }
Exemplo n.º 2
0
        public Task <PaginatedResult <Message> > HistoryAsync(bool untilAttach = false)
        {
            var query = new HistoryRequestParams();

            if (untilAttach)
            {
                AddUntilAttachParameter(query);
            }
            return(RestChannel.HistoryAsync(query));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Get the presence messages history for the channel by specifying a query
        /// </summary>
        /// <returns><see cref="PaginatedResult{T}"/></returns>
        Task <PaginatedResult <PresenceMessage> > IPresence.HistoryAsync(HistoryRequestParams query)
        {
            query = query ?? new HistoryRequestParams();

            query.Validate();

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

            request.AddQueryParameters(query.GetParameters());
            return(_ablyRest.ExecutePaginatedRequest(request, Presence.HistoryAsync));
        }
Exemplo n.º 4
0
        public void GetLinkQuery_WithHeadersAndAskingForNextLink_ReturnsCorrectRequestQuery()
        {
            //Arrange

            var nextDataRequest = HistoryRequestParams.Parse(NextQueryString);

            //Act
            var actual = HistoryRequestParams.GetLinkQuery(GetSampleHistoryRequestHeaders(), "next");

            //Assert
            Assert.Equal(nextDataRequest, actual);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Return the message history of the channel
        /// </summary>
        /// <param name="query"><see cref="HistoryRequestParams"/></param>
        /// <returns><see cref="PaginatedResult{T}"/> of Messages</returns>
        public Task <PaginatedResult <Message> > HistoryAsync(HistoryRequestParams query)
        {
            query = query ?? new HistoryRequestParams();

            query.Validate();

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

            request.AddQueryParameters(query.GetParameters());

            return(_ablyRest.ExecutePaginatedRequest(request, HistoryAsync));
        }
Exemplo n.º 6
0
        Task <PaginatedResult <PresenceMessage> > IPresence.GetAsync(HistoryRequestParams query)
        {
            if (query == null) //Fall back on the default implementation
            {
                return(Presence.GetAsync());
            }

            query.Validate();

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

            request.AddQueryParameters(query.GetParameters());
            return(_ablyRest.ExecutePaginatedRequest(request, Presence.GetAsync));
        }
Exemplo n.º 7
0
 public PaginatedResult <Message> History(HistoryRequestParams query)
 {
     return(AsyncHelper.RunSync(() => HistoryAsync(query)));
 }