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

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

            RaiseExceptionOnFault(task);
            return(task.Result);
        }
        public void TestListUserBookmarks()
        {
            ListUserBookmarks      req;
            Request                req2;
            IEnumerable <Bookmark> resp;

            // it 'lists user interactions'
            req  = new ListUserBookmarks("user");
            resp = client.Send(req);
            Assert.Equal(1, resp.Count());
            Assert.Equal("item", resp.ElementAt(0).ItemId);
            Assert.Equal("user", resp.ElementAt(0).UserId);
        }
Beispiel #4
0
        public async void TestListUserBookmarks()
        {
            ListUserBookmarks      req;
            Request                req2;
            IEnumerable <Bookmark> resp;

            // it 'lists user interactions'
            req  = new ListUserBookmarks("user");
            resp = await client.SendAsync(req);

            Assert.Single(resp);
            Assert.Equal("item", resp.ElementAt(0).ItemId);
            Assert.Equal("user", resp.ElementAt(0).UserId);
        }
        public async void TestListUserBookmarksAsync()
        {
            ListUserBookmarks      req;
            Request                req2;
            IEnumerable <Bookmark> resp;

            // it 'lists user interactions'
            req = new ListUserBookmarks("user");
            System.Threading.Thread.Sleep(10000);
            resp = await client.SendAsync(req);

            Assert.Equal(1, resp.Count());
            Assert.Equal("item", resp.ElementAt(0).ItemId);
            Assert.Equal("user", resp.ElementAt(0).UserId);
        }
        /// <summary>Send the ListUserBookmarks request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public async Task <IEnumerable <Bookmark> > SendAsync(ListUserBookmarks 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 <Bookmark> ParseResponse(string json, ListUserBookmarks request)
 {
     return(JsonConvert.DeserializeObject <Bookmark[]>(json));
 }
        /// <summary>Send the ListUserBookmarks request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public IEnumerable <Bookmark> Send(ListUserBookmarks request)
        {
            var json = SendRequest(request);

            return(ParseResponse(json, request));
        }