コード例 #1
0
        public async Task <PartnerFeedResponse> GetFeedStatus(string feedId, bool includeDetails = false, int offset = 0, int limit = 0)
        {
            // to avoid deadlock if this method is executed synchronously
            await new ContextRemover();

            var request = CreateRequest();

            request.EndpointUri = string.Format("/v2/feeds/{0}", feedId);

            request.QueryParams.Add("feedId", feedId);
            if (includeDetails)
            {
                request.QueryParams.Add("includeDetails", "true");
                if (offset > 0)
                {
                    request.QueryParams.Add("offset", offset.ToString());
                }
                if (limit > 0)
                {
                    if (limit > 1000)
                    {
                        throw new System.Exception("Parameter 'limit' can't be more than 1000!");
                    }
                    request.QueryParams.Add("limit", limit.ToString());
                }
            }

            var response = await client.GetAsync(request);

            PartnerFeedResponse result = await ProcessResponse <PartnerFeedResponse>(response);

            return(result);
        }
コード例 #2
0
        public async Task FeedStatusReturnsResult()
        {
            PartnerFeedResponse result = await feedApi.GetFeedStatus("test");

            Assert.IsType <PartnerFeedResponse>(result);
            Assert.NotEmpty(result.FeedId);
        }
コード例 #3
0
        public async Task <PartnerFeedResponse> GetFeedStatus(string feedId, bool includeDetails = false, int offset = 0, int limit = 0)
        {
            // to avoid deadlock if this method is executed synchronously
            await new ContextRemover();

            Base.Http.Request request = CreateRequest();
            request.EndpointUri = string.Format("/v3/feeds/{0}", feedId);

            // by default it's false and we don't need to send it
            if (includeDetails)
            {
                request.QueryParams.Add("includeDetails", "true");
            }

            if (offset > 0)
            {
                request.QueryParams.Add("offset", offset.ToString());
            }

            if (limit > 0)
            {
                request.QueryParams.Add("limit", limit.ToString());
            }

            Base.Http.IResponse response = await client.GetAsync(request);

            PartnerFeedResponse result = await ProcessResponse <PartnerFeedResponse>(response);

            return(result);
        }
コード例 #4
0
        public async Task CanCheckFeedStatus()
        {
            FeedRecordResponse feeds = await feedApi.GetAllFeedStatuses();

            Assert.IsType <FeedRecordResponse>(feeds);
            Assert.NotEmpty(feeds.Results);
            var feedId = feeds.Results[0].FeedId;
            PartnerFeedResponse result = await feedApi.GetFeedStatus(feedId, true);

            Assert.IsType <PartnerFeedResponse>(result);
            Assert.True(result.FeedId == feedId);
        }