コード例 #1
0
        /// <summary>
        /// Deletes the specified discussion reference from the current person.
        /// </summary>
        /// <param name="reference">The discussion reference to delete.</param>
        /// <param name="options">The options to apply before executing the REST API call.</param>
        /// <returns>
        /// A <see cref="FamilyTreePersonState"/> instance containing the REST API response.
        /// </returns>
        /// <exception cref="GedcomxApplicationException">Discussion reference cannot be deleted: missing link.</exception>
        public FamilyTreePersonState DeleteDiscussionReference(DiscussionReference reference, params IStateTransitionOption[] options)
        {
            Link link = reference.GetLink(Rel.DISCUSSION_REFERENCE);
            link = link == null ? reference.GetLink(Rel.SELF) : link;
            if (link == null || link.Href == null)
            {
                throw new GedcomxApplicationException("Discussion reference cannot be deleted: missing link.");
            }

            IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedGedcomxRequest()).Build(link.Href, Method.DELETE);
            return (FamilyTreePersonState)((FamilyTreeStateFactory)this.stateFactory).NewPersonStateInt(request, Invoke(request, options), this.Client, this.CurrentAccessToken);
        }