Beispiel #1
0
        /// <summary>Synchronously send the ListSeriesItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public IEnumerable <SeriesItem> Send(ListSeriesItems request)
        {
            var task   = Task.Run(async() => await SendAsync(request));
            var result = task.WaitAndUnwrapException();

            return(result);
        }
        /// <summary>Synchronously send the ListSeriesItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public IEnumerable <SeriesItem> Send(ListSeriesItems request)
        {
            var task = SendAsync(request);

            RaiseExceptionOnFault(task);
            return(task.Result);
        }
Beispiel #3
0
        public void TestListSeriesItems()
        {
            ListSeriesItems          req;
            Request                  req2;
            IEnumerable <SeriesItem> resp;

            // it 'lists set items'
            req  = new ListSeriesItems("entity_id");
            resp = client.Send(req);
            Assert.Equal(1, resp.Count());
            Assert.Equal("entity_id", resp.ElementAt(0).ItemId);
            Assert.Equal("item", resp.ElementAt(0).ItemType);
        }
        public async void TestListSeriesItems()
        {
            ListSeriesItems          req;
            Request                  req2;
            IEnumerable <SeriesItem> resp;

            // it 'lists set items'
            req  = new ListSeriesItems("entity_id");
            resp = await client.SendAsync(req);

            Assert.Single(resp);
            Assert.Equal("entity_id", resp.ElementAt(0).ItemId);
            Assert.Equal("item", resp.ElementAt(0).ItemType);
        }
        public async void TestListSeriesItemsAsync()
        {
            ListSeriesItems          req;
            Request                  req2;
            IEnumerable <SeriesItem> resp;

            // it 'lists set items'
            req = new ListSeriesItems("entity_id");
            System.Threading.Thread.Sleep(10000);
            resp = await client.SendAsync(req);

            Assert.Equal(1, resp.Count());
            Assert.Equal("entity_id", resp.ElementAt(0).ItemId);
            Assert.Equal("item", resp.ElementAt(0).ItemType);
        }
        /// <summary>Send the ListSeriesItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public async Task <IEnumerable <SeriesItem> > SendAsync(ListSeriesItems request)
        {
            var json = await SendRequestAsync(request).ConfigureAwait(false);

            return(ParseResponse(json, request));
        }
 /// <summary>Parse JSON response</summary>
 /// <param name="json">JSON string from the API</param>
 /// <param name="request">Request sent to the API</param>
 /// <returns>Parsed response</returns>
 protected IEnumerable <SeriesItem> ParseResponse(string json, ListSeriesItems request)
 {
     return(JsonConvert.DeserializeObject <SeriesItem[]>(json));
 }
        /// <summary>Send the ListSeriesItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public IEnumerable <SeriesItem> Send(ListSeriesItems request)
        {
            var json = SendRequest(request);

            return(ParseResponse(json, request));
        }