/// <summary> /// Executes a POST verb request against the current REST API request and returns a state instance with the response. /// </summary> /// <param name="entity">The entity to be used as the body of the REST API request. This is the entity to be POST.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns>A <see cref="GedcomxApplicationState{T}"/> instance containing the REST API response.</returns> public virtual GedcomxApplicationState Post(object entity, params IStateTransitionOption[] options) { IRestRequest request = CreateAuthenticatedRequest(); Parameter accept = this.Request.GetHeaders().Get("Accept").FirstOrDefault(); Parameter contentType = this.Request.GetHeaders().Get("Content-Type").FirstOrDefault(); if (accept != null) { request.Accept(accept.Value as string); } if (contentType != null) { request.ContentType(contentType.Value as string); } request.SetEntity(entity).Build(GetSelfUri(), Method.POST); return(Clone(request, Invoke(request, options), this.Client)); }
/// <summary> /// Reads a page of results (usually of type <see cref="Gx.Atom.Feed"/>). /// </summary> /// <param name="rel">The rel name to use when looking for the link.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns>A <see cref="GedcomxApplicationState{T}"/> instance containing the REST API response.</returns> public GedcomxApplicationState ReadPage(String rel, params IStateTransitionOption[] options) { Link link = GetLink(rel); if (link == null || link.Href == null) { return(null); } IRestRequest request = CreateAuthenticatedRequest(); Parameter accept = this.Request.GetHeaders().Get("Accept").FirstOrDefault(); Parameter contentType = this.Request.GetHeaders().Get("Content-Type").FirstOrDefault(); if (accept != null) { request.Accept(accept.Value as string); } if (contentType != null) { request.ContentType(contentType.Value as string); } request.Build(link.Href, Method.GET); return(Clone(request, Invoke(request, options), this.Client)); }