コード例 #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
ファイル: GetOptions.cs プロジェクト: vonbv/stream-net
        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
ファイル: GetOptions.cs プロジェクト: dustyray/stream-net
        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
ファイル: StreamFeed.cs プロジェクト: tbarbugli/stream-net
        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);
        }