/// <summary>
        /// Executes an DELETE verb request against the current REST API request and returns a state instance with the response.
        /// </summary>
        /// <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 Delete(params IStateTransitionOption[] options)
        {
            IRestRequest request = CreateAuthenticatedRequest();
            Parameter    accept  = this.Request.GetHeaders().Get("Accept").FirstOrDefault();

            if (accept != null)
            {
                request.Accept(accept.Value as string);
            }
            request.Build(GetSelfUri(), Method.DELETE);
            return(Clone(request, Invoke(request, options), this.Client));
        }
        /// <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));
        }
Exemple #4
0
 /// <summary>
 /// Returns the specified REST API request with an accept and content-type header of "application/json".
 /// </summary>
 /// <param name="request">The REST API request to be modified.</param>
 /// <returns>The specified REST API request with an accept and content-type header of "application/json".</returns>
 public static IRestRequest ApplyFamilySearchJson(IRestRequest request)
 {
     return(request.Accept(MediaTypes.APPLICATION_JSON_TYPE).ContentType(MediaTypes.APPLICATION_JSON_TYPE));
 }
Exemple #5
0
 /// <summary>
 /// Returns the specified REST API request with an accept and content-type header of "application/x-fs-v1+json".
 /// </summary>
 /// <param name="request">The REST API request to be modified.</param>
 /// <returns>The specified REST API request with an accept and content-type header of "application/x-fs-v1+json".</returns>
 public static IRestRequest ApplyFamilySearchConneg(IRestRequest request)
 {
     return(request.Accept(FamilySearchPlatform.JSON_MEDIA_TYPE).ContentType(FamilySearchPlatform.JSON_MEDIA_TYPE));
 }
 /// <summary>
 /// Returns the specified REST API request with an accept and content-type header of "application/json".
 /// </summary>
 /// <param name="request">The REST API request to be modified.</param>
 /// <returns>The specified REST API request with an accept and content-type header of "application/json".</returns>
 public static IRestRequest ApplyFamilySearchJson(IRestRequest request)
 {
     return request.Accept(MediaTypes.APPLICATION_JSON_TYPE).ContentType(MediaTypes.APPLICATION_JSON_TYPE);
 }
 /// <summary>
 /// Returns the specified REST API request with an accept and content-type header of "application/x-fs-v1+json".
 /// </summary>
 /// <param name="request">The REST API request to be modified.</param>
 /// <returns>The specified REST API request with an accept and content-type header of "application/x-fs-v1+json".</returns>
 public static IRestRequest ApplyFamilySearchConneg(IRestRequest request)
 {
     return request.Accept(FamilySearchPlatform.JSON_MEDIA_TYPE).ContentType(FamilySearchPlatform.JSON_MEDIA_TYPE);
 }