/** * 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); }
/** * 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); }
/** * Declares the match status for the current person the specified search result entry. * * @param Entry $entry * @param string $status * @param StateTransitionOption $options * @return PersonMatchResultsState */ public function updateMatchStatus(Entry $entry, $status, StateTransitionOption $options = null) { $updateStatusUri = $this->getSelfUri(); $entity = new Gedcomx(); $person = new Person(); $id = new Identifier(); $id->setType(IdentifierType::PERSISTENT); $id->setValue($entry->getId()); $person->setIdentifiers(array($id)); $entity->setPersons(array($person)); $request = $this->createAuthenticatedGedcomxRequest("POST", $updateStatusUri, [], null, $entity->toJson()); $request = $request->withoutHeader("Accept"); return $this->stateFactory->createState("PersonMatchResultsState", $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); }