コード例 #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);
        }
コード例 #2
0
 /// <summary>
 /// Updates the specified discussion reference for the current person.
 /// </summary>
 /// <param name="reference">The discussion reference to update.</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>
 public FamilyTreePersonState UpdateDiscussionReference(DiscussionReference reference, params IStateTransitionOption[] options)
 {
     return UpdateDiscussionReference(new DiscussionReference[] { reference }, options);
 }
コード例 #3
0
 /// <summary>
 /// Update the discussion references for the current person.
 /// </summary>
 /// <param name="refs">The discussion references to update.</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>
 public FamilyTreePersonState UpdateDiscussionReference(DiscussionReference[] refs, params IStateTransitionOption[] options)
 {
     Person person = CreateEmptySelf();
     foreach (DiscussionReference @ref in refs)
     {
         person.AddExtensionElement(@ref, "discussion-references", true);
     }
     return UpdateDiscussionReference(person, options);
 }
コード例 #4
0
 /// <summary>
 /// Adds a discussion reference to the current person.
 /// </summary>
 /// <param name="discussion">The discussion state with a discussion reference to add.</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>
 public FamilyTreePersonState AddDiscussionReference(DiscussionState discussion, params IStateTransitionOption[] options)
 {
     DiscussionReference reference = new DiscussionReference();
     reference.Resource = discussion.GetSelfUri();
     return AddDiscussionReference(reference, options);
 }