예제 #1
0
        public async Task <IEnumerable <Activity> > GetActivities(int offset = 0, int limit = 20, FeedFilter filter = null, ActivityMarker marker = null)
        {
            var request = _client.BuildRequest(this, "/", Method.GET);

            request.AddQueryParameter("offset", offset.ToString());
            request.AddQueryParameter("limit", limit.ToString());

            // filter if needed
            if (filter != null)
            {
                filter.Apply(request);
            }

            // marker if needed
            if (marker != null)
            {
                marker.Apply(request);
            }

            var response = await _client.MakeRequest(request);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return(GetResults(response.Content));
            }

            throw StreamException.FromResponse(response);
        }
예제 #2
0
        internal void Apply(RestRequest request)
        {
            // offset and and limit
            request.AddQueryParameter("offset", _offset.ToString());
            request.AddQueryParameter("limit", _limit.ToString());

            // add ranking
            if (!string.IsNullOrWhiteSpace(_ranking))
            {
                request.AddQueryParameter("ranking", _ranking);
            }

            if (!string.IsNullOrWhiteSpace(_session))
            {
                request.AddQueryParameter("session", _session);
            }

            // filter if needed
            if (_filter != null)
            {
                _filter.Apply(request);
            }

            // marker if needed
            if (_marker != null)
            {
                _marker.Apply(request);
            }

            if (_reaction != null)
            {
                _reaction.Apply(request);
            }
        }
예제 #3
0
        internal void Apply(RestRequest request)
        {
            // offset and and limit
            request.AddQueryParameter("offset", _offset.ToString());
            request.AddQueryParameter("limit", _limit.ToString());

            // filter if needed
            if (_filter != null)
            {
                _filter.Apply(request);
            }

            // marker if needed
            if (_marker != null)
            {
                _marker.Apply(request);
            }
        }
예제 #4
0
        public async Task <IEnumerable <Activity> > GetActivities(int offset = 0, int limit = 20, FeedFilter filter = null, ActivityMarker marker = null)
        {
            if (offset < 0)
            {
                throw new ArgumentOutOfRangeException("offset", "Offset must be greater than or equal to zero");
            }
            if (limit < 0)
            {
                throw new ArgumentOutOfRangeException("limit", "Limit must be greater than or equal to zero");
            }

            var request = _client.BuildFeedRequest(this, "/", HttpMethod.GET);

            request.AddQueryParameter("offset", offset.ToString());
            request.AddQueryParameter("limit", limit.ToString());

            // filter if needed
            if (filter != null)
            {
                filter.Apply(request);
            }

            // marker if needed
            if (marker != null)
            {
                marker.Apply(request);
            }

            var response = await _client.MakeRequest(request);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
            {
                return(GetResults(response.Content));
            }

            throw StreamException.FromResponse(response);
        }