Beispiel #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);
        }
Beispiel #2
0
 public GetOptions WithFilter(FeedFilter filter)
 {
     _filter = filter;
     return(this);
 }
Beispiel #3
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);
        }
Beispiel #4
0
 public GetOptions WithFilter(FeedFilter filter)
 {
     _filter = filter;
     return this;
 }