/// <summary> /// Prepares a merge state for the specified person and the current person. /// </summary> /// <param name="method">The HTTP method to use for the operation.</param> /// <param name="candidate">The person which will be merged with the current person.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="PersonMergeState"/> instance containing the REST API response. /// </returns> /// <exception cref="System.ArgumentException"> /// The current <see cref="P:FamilyTreePersonState.Person"/> or <see cref="P:Person.Id"/> was null. /// or /// The specified candidate.Person or candidate.Person.Id was null. /// </exception> protected PersonMergeState TransitionToPersonMerge(Method method, FamilyTreePersonState candidate, params IStateTransitionOption[] options) { Link link = GetLink(Rel.MERGE); if (link == null || link.Template == null) { return(null); } Person person = Person; if (person == null || person.Id == null) { throw new ArgumentException("Cannot read merge options: no person id available."); } String personId = person.Id; person = candidate.Person; if (person == null || person.Id == null) { throw new ArgumentException("Cannot read merge options: no person id provided on the candidate."); } String candidateId = person.Id; String template = link.Template; String uri = new UriTemplate(template).AddParameter("pid", personId).AddParameter("dpid", candidateId).Resolve(); IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedRequest()).Build(uri, method); return(((FamilyTreeStateFactory)this.stateFactory).NewPersonMergeState(request, Invoke(request, options), this.Client, this.CurrentAccessToken)); }
/// <summary> /// Deletes the preferred parent relationship for the specified person. /// </summary> /// <param name="treeUserId">The <see cref="P:User.TreeUserId"/> for which the preference will be set. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred parent relationship will be read.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState" /> instance containing the REST API response. /// </returns> /// <remarks> /// Tree users can have varying parent relationship preferences; therefore, this method will only delete what the specified user prefers to /// see for the specified relationship. /// </remarks> public FamilyTreePersonState DeletePreferredParentRelationship(String treeUserId, FamilyTreePersonState person, params IStateTransitionOption[] options) { return(DeletePreferredRelationship(treeUserId, person.Person.Id, Rel.PREFERRED_PARENT_RELATIONSHIP, options)); }
/// <summary> /// Deletes the preferred spouse relationship for the specified person. /// </summary> /// <param name="user">The user for which the preference will be set. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred spouse relationship will be read.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState" /> instance containing the REST API response. /// </returns> /// <remarks> /// Tree users can have varying spouse relationship preferences; therefore, this method will only delete what the specified user prefers to /// see for the specified relationship. /// </remarks> public FamilyTreePersonState DeletePreferredSpouseRelationship(UserState user, FamilyTreePersonState person, params IStateTransitionOption[] options) { return(DeletePreferredRelationship(user.User.TreeUserId, person.Person.Id, Rel.PREFERRED_SPOUSE_RELATIONSHIP, options)); }
/// <summary> /// Sets the preferred spouse relationship for the specified person. /// </summary> /// <param name="treeUserId">The <see cref="P:User.TreeUserId"/> for which the preference will be set. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred spouse relationship will be read.</param> /// <param name="relationshipState">The relationship state instance with the relationship to set as the preferred relationship.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState" /> instance containing the REST API response. /// </returns> /// <remarks> /// Tree users can have varying spouse relationship preferences; therefore, this method will only set what the specified user prefers to /// see for the specified relationship. /// </remarks> public FamilyTreePersonState UpdatePreferredSpouseRelationship(String treeUserId, FamilyTreePersonState person, IPreferredRelationshipState relationshipState, params IStateTransitionOption[] options) { return(UpdatePreferredRelationship(Rel.PREFERRED_SPOUSE_RELATIONSHIP, treeUserId, person.Person.Id, relationshipState, options)); }
/// <summary> /// Sets the preferred parent relationship for the specified person. /// </summary> /// <param name="user">The user for which the preference will be set. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred parent relationship will be read.</param> /// <param name="relationshipState">The relationship state instance with the relationship to set as the preferred relationship.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState" /> instance containing the REST API response. /// </returns> /// <remarks> /// Tree users can have varying parent relationship preferences; therefore, this method will only set what the specified user prefers to /// see for the specified relationship. /// </remarks> public FamilyTreePersonState UpdatePreferredParentRelationship(UserState user, FamilyTreePersonState person, IPreferredRelationshipState relationshipState, params IStateTransitionOption[] options) { return(UpdatePreferredRelationship(Rel.PREFERRED_PARENT_RELATIONSHIP, user.User.TreeUserId, person.Person.Id, relationshipState, options)); }
/// <summary> /// Declares a possible duplicate of the current person as not a duplicate. /// </summary> /// <param name="person">The <see cref="FamilyTreePersonState"/> with a person that was possibly a duplicate of the current person.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="PersonNonMatchesState"/> instance containing the REST API response. /// </returns> public PersonNonMatchesState AddNonMatch(FamilyTreePersonState person, params IStateTransitionOption[] options) { return(AddNonMatch(person.Person, options)); }
/// <summary> /// Reads the merge analysis of the specified person, after already having been merged with the current person. /// </summary> /// <param name="candidate">The candidate that was merged with the current person.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="PersonMergeState"/> instance containing the REST API response. /// </returns> public PersonMergeState ReadMergeAnalysis(FamilyTreePersonState candidate, params IStateTransitionOption[] options) { return(TransitionToPersonMerge(Method.GET, candidate, options)); }
/// <summary> /// Deletes the preferred spouse relationship for the specified person. /// </summary> /// <param name="user">The user for which the preference will be set. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred spouse relationship will be read.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState" /> instance containing the REST API response. /// </returns> /// <remarks> /// Tree users can have varying spouse relationship preferences; therefore, this method will only delete what the specified user prefers to /// see for the specified relationship. /// </remarks> public FamilyTreePersonState DeletePreferredSpouseRelationship(UserState user, FamilyTreePersonState person, params IStateTransitionOption[] options) { return DeletePreferredRelationship(user.User.TreeUserId, person.Person.Id, Rel.PREFERRED_SPOUSE_RELATIONSHIP, options); }
/// <summary> /// Deletes the preferred parent relationship for the specified person. /// </summary> /// <param name="treeUserId">The <see cref="P:User.TreeUserId"/> for which the preference will be set. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred parent relationship will be read.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState" /> instance containing the REST API response. /// </returns> /// <remarks> /// Tree users can have varying parent relationship preferences; therefore, this method will only delete what the specified user prefers to /// see for the specified relationship. /// </remarks> public FamilyTreePersonState DeletePreferredParentRelationship(String treeUserId, FamilyTreePersonState person, params IStateTransitionOption[] options) { return DeletePreferredRelationship(treeUserId, person.Person.Id, Rel.PREFERRED_PARENT_RELATIONSHIP, options); }
/// <summary> /// Reads the preferred spouse relationship for the specified person. /// </summary> /// <param name="treeUserId">The <see cref="P:User.TreeUserId"/> for which the preference will be read. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred spouse relationship will be read.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState"/> instance containing the REST API response. /// </returns> /// <remarks>Tree users can have varying spouse relationship preferences; therefore, this method will only read what the specified user prefers to /// see for the specified relationship.</remarks> public IPreferredRelationshipState ReadPreferredSpouseRelationship(String treeUserId, FamilyTreePersonState person, params IStateTransitionOption[] options) { return ReadPreferredRelationship(Rel.PREFERRED_SPOUSE_RELATIONSHIP, treeUserId, person.Person.Id, options); }
/// <summary> /// Sets the preferred parent relationship for the specified person. /// </summary> /// <param name="treeUserId">The <see cref="P:User.TreeUserId"/> for which the preference will be set. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred parent relationship will be read.</param> /// <param name="relationshipState">The relationship state instance with the relationship to set as the preferred relationship.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState" /> instance containing the REST API response. /// </returns> /// <remarks> /// Tree users can have varying parent relationship preferences; therefore, this method will only set what the specified user prefers to /// see for the specified relationship. /// </remarks> public FamilyTreePersonState UpdatePreferredParentRelationship(String treeUserId, FamilyTreePersonState person, IPreferredRelationshipState relationshipState, params IStateTransitionOption[] options) { return UpdatePreferredRelationship(Rel.PREFERRED_PARENT_RELATIONSHIP, treeUserId, person.Person.Id, relationshipState, options); }
/// <summary> /// Reads the preferred parent relationship for the specified person. /// </summary> /// <param name="user">The user for which the preference will be read. This is typically the current tree user. An API error may result if the user specified /// is someone other than the current tree user (due to a lack of permissions).</param> /// <param name="person">The person, represented by the FamilyTreePersonState, for which the preferred parent relationship will be read.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="IPreferredRelationshipState"/> instance containing the REST API response. /// </returns> /// <remarks>Tree users can have varying parent relationship preferences; therefore, this method will only read what the specified user prefers to /// see for the specified relationship.</remarks> public IPreferredRelationshipState ReadPreferredParentRelationship(UserState user, FamilyTreePersonState person, params IStateTransitionOption[] options) { return ReadPreferredRelationship(Rel.PREFERRED_PARENT_RELATIONSHIP, user.User.TreeUserId, person.Person.Id, options); }
/// <summary> /// Declares a possible duplicate of the current person as not a duplicate. /// </summary> /// <param name="person">The <see cref="FamilyTreePersonState"/> with a person that was possibly a duplicate of the current person.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="PersonNonMatchesState"/> instance containing the REST API response. /// </returns> public PersonNonMatchesState AddNonMatch(FamilyTreePersonState person, params IStateTransitionOption[] options) { return AddNonMatch(person.Person, options); }
/// <summary> /// Prepares a merge state for the specified person and the current person. /// </summary> /// <param name="method">The HTTP method to use for the operation.</param> /// <param name="candidate">The person which will be merged with the current person.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="PersonMergeState"/> instance containing the REST API response. /// </returns> /// <exception cref="System.ArgumentException"> /// The current <see cref="P:FamilyTreePersonState.Person"/> or <see cref="P:Person.Id"/> was null. /// or /// The specified candidate.Person or candidate.Person.Id was null. /// </exception> protected PersonMergeState TransitionToPersonMerge(Method method, FamilyTreePersonState candidate, params IStateTransitionOption[] options) { Link link = GetLink(Rel.MERGE); if (link == null || link.Template == null) { return null; } Person person = Person; if (person == null || person.Id == null) { throw new ArgumentException("Cannot read merge options: no person id available."); } String personId = person.Id; person = candidate.Person; if (person == null || person.Id == null) { throw new ArgumentException("Cannot read merge options: no person id provided on the candidate."); } String candidateId = person.Id; String template = link.Template; String uri = new UriTemplate(template).AddParameter("pid", personId).AddParameter("dpid", candidateId).Resolve(); IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedRequest()).Build(uri, method); return ((FamilyTreeStateFactory)this.stateFactory).NewPersonMergeState(request, Invoke(request, options), this.Client, this.CurrentAccessToken); }
/// <summary> /// Reads the merge analysis of the specified person, after already having been merged with the current person. /// </summary> /// <param name="candidate">The candidate that was merged with the current person.</param> /// <param name="options">The options to apply before executing the REST API call.</param> /// <returns> /// A <see cref="PersonMergeState"/> instance containing the REST API response. /// </returns> public PersonMergeState ReadMergeAnalysis(FamilyTreePersonState candidate, params IStateTransitionOption[] options) { return TransitionToPersonMerge(Method.GET, candidate, options); }
public bool HELPER_Add_portrait(FamilyTreePersonState personState, int treePersonIndex) { var response = personState.ReadPortrait(); if (!response.HasClientError() && !response.HasServerError()) { // NOTE: The READ_PERSON_ID user does not have images, but a default is specified, thus the response should be 307. if (response.StatusCode == HttpStatusCode.TemporaryRedirect) { var any = response.Headers.Get("Location").Any(); var single = response.Headers.Get("Location").Single().Value; var location = response.Headers.Get("Location").Single().Value.ToString(); _courtHouse.myPeople.allPeople[treePersonIndex].PortraitURI = location; // var wc = new WebClient(); // Image x = Image.FromStream(wc.OpenRead(location)); return true; } } return false; }