Ejemplo n.º 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);
        }
Ejemplo n.º 2
0
 public GetOptions WithMarker(ActivityMarker marker)
 {
     _marker = marker;
     return(this);
 }
Ejemplo n.º 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);
        }
Ejemplo n.º 4
0
 public GetOptions WithMarker(ActivityMarker marker)
 {
     _marker = marker;
     return this;
 }