/// <summary> /// Sets the preferred relationship for the specified person. /// </summary> /// <param name="rel">The rel name of the link to use to perform this operation.</param> /// <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="personId">The person ID for which the preferred 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 relationship preferences; therefore, this method will only set what the specified user prefers to /// see for the specified relationship. /// </remarks> protected FamilyTreePersonState UpdatePreferredRelationship(String rel, String treeUserId, String personId, IPreferredRelationshipState relationshipState, IStateTransitionOption[] options) { Link link = GetLink(rel); if (link == null || link.Template == null) { return(null); } String template = link.Template; String uri = new UriTemplate(template).AddParameter("pid", personId).AddParameter("uid", treeUserId).Resolve(); IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedRequest()).AddHeader("Location", relationshipState.GetSelfUri()).Build(uri, Method.PUT); return((FamilyTreePersonState)((FamilyTreeStateFactory)this.stateFactory).NewPersonStateInt(request, Invoke(request, options), this.Client, this.CurrentAccessToken)); }
/// <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="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="personId">The person ID 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, String personId, IPreferredRelationshipState relationshipState, params IStateTransitionOption[] options) { return(UpdatePreferredRelationship(Rel.PREFERRED_PARENT_RELATIONSHIP, treeUserId, personId, 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> /// Sets the preferred relationship for the specified person. /// </summary> /// <param name="rel">The rel name of the link to use to perform this operation.</param> /// <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="personId">The person ID for which the preferred 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 relationship preferences; therefore, this method will only set what the specified user prefers to /// see for the specified relationship. /// </remarks> protected FamilyTreePersonState UpdatePreferredRelationship(String rel, String treeUserId, String personId, IPreferredRelationshipState relationshipState, IStateTransitionOption[] options) { Link link = GetLink(rel); if (link == null || link.Template == null) { return null; } String template = link.Template; String uri = new UriTemplate(template).AddParameter("pid", personId).AddParameter("uid", treeUserId).Resolve(); IRestRequest request = RequestUtil.ApplyFamilySearchConneg(CreateAuthenticatedRequest()).AddHeader("Location", relationshipState.GetSelfUri()).Build(uri, Method.PUT); return (FamilyTreePersonState)((FamilyTreeStateFactory)this.stateFactory).NewPersonStateInt(request, Invoke(request, options), this.Client, this.CurrentAccessToken); }
/// <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="personId">The person ID 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, String personId, IPreferredRelationshipState relationshipState, params IStateTransitionOption[] options) { return UpdatePreferredRelationship(Rel.PREFERRED_PARENT_RELATIONSHIP, treeUserId, personId, relationshipState, 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); }