Exemplo n.º 1
0
 /// <summary>
 /// Gets a <see cref="IFeedService"/>.
 /// </summary>
 /// <param name="parent">the parent feed</param>
 public IFeedService Feed(Feed parent)
 {
     return new FeedServiceImpl(this, parent == null ? null : ("/feeds/" + parent.Path));
 }
Exemplo n.º 2
0
            public Boolean Update(Feed feed)
            {
                ServiceRequestImpl request = _service.NewRequest();
                request.Method = "PUT";
                request.Resource = _context + "/" + feed.Name;

                using (StringWriter writer = new StringWriter())
                {
                    GetFormatter(request.Format).Format(writer, feed, FormatOption.All);
                    request.BodyString = writer.ToString();
                }

                IServiceResponse response = null;
                try
                {
                    response = _service.Execute(request);
                    if (response == null)
                        ServiceException.ThrowTimeout(null);
                    else if (response.StatusCode == 200 || response.StatusCode == 204)
                        return true;
                    else if (response.StatusCode != 404)
                        ServiceException.Throw(response.StatusCode);
                }
                catch (ServiceException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    ServiceException.ThrowError(e);
                }
                finally
                {
                    if (response != null)
                        Dispose(response);
                }

                return false;
            }
Exemplo n.º 3
0
 /// <summary>
 /// Adds a child feed.
 /// </summary>
 /// <param name="child">the child feed to add</param>
 public void AddChild(Feed child)
 {
     child.Parent = this;
     _children.Add(child);
 }