/** * Reads the place description described by a single entry from the results. * * @param \Gedcomx\Atom\Entry $place * @param \Gedcomx\Rs\Client\Options\StateTransitionOption $option,... * * @return \Gedcomx\Rs\Client\PlaceDescriptionState|null */ public function readPlaceDescription(Entry $place, StateTransitionOption $option = null) { $link = $place->getLink(Rel::DESCRIPTION); $link = $link == null ? $place->getLink(Rel::SELF) : $link; if ($link == null || $link->getHref() == null) { return null; } $request = $this->createAuthenticatedGedcomxRequest('GET', $link->getHref()); return $this->stateFactory->createState('PlaceDescriptionState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Restores the specified change if it had been reverted. * * @param \Gedcomx\Atom\Entry $change * @param \Gedcomx\Rs\Client\Options\StateTransitionOption $option,... * * @throws \Gedcomx\Rs\Client\Exception\GedcomxApplicationException * @return ChangeHistoryState | null */ public function restoreChange(Entry $change, StateTransitionOption $option = null) { $link = $change->getLink(Rel::RESTORE); if ($link == null || $link->getHref() == null) { throw new GedcomxApplicationException("Unrestorable change: " . $change->getId()); } $request = $this->createAuthenticatedRequest('POST', $link->getHref(), FamilySearchRequest::getMediaTypes()); return $this->stateFactory->createState('ChangeHistoryState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Creates a merge analysis for the current person and the potential duplicate person specified by the search result * entry. * * @param Entry $entry * @param StateTransitionOption $options * @return PersonMergeState */ public function readMergeAnalysis(Entry $entry, StateTransitionOption $options = null) { $link = $entry->getLink(Rel::MERGE); if ($link == null || $link->getHref() == null) { return null; } $request = $this->createAuthenticatedRequest('GET', $link->getHref(), FamilySearchRequest::getMediaTypes()); return $this->stateFactory->createState("PersonMergeState", $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Reads the person record from the specified atom feed entry. * * @param \Gedcomx\Atom\Entry $person * @param \Gedcomx\Rs\Client\Options\StateTransitionOption $option,... * * @return RecordState|null */ public function readRecord(Entry $person, StateTransitionOption $option = null) { $link = $person->getLink(Rel::RECORD); if ($link === null) { $link = $person->getLink(Rel::SELF); } if ($link === null || $link->getHref() === null) { return null; } $request = $this->createAuthenticatedGedcomxRequest("GET", $link->getHref()); return $this->stateFactory->createState("RecordState", $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }