/** * Ensure the treeState propery exists */ private function createTreeState() { $this->createHomeState(); $this->treeState = $this->stateFactory->newCollectionState($this->homeState->getCollection()->getLink('family-tree')->getHref(), 'GET', $this->client); }
/** * Moves the current source description to the specified collection. * * @param CollectionState $collection * @param StateTransitionOption $options,... * @return FamilySearchSourceDescriptionState|null */ public function moveToCollection(CollectionState $collection, StateTransitionOption $options = null) { $link = $collection->getLink(Rel::SOURCE_DESCRIPTIONS); if ($link == null || $link->getHref() == null) { return null; } /** @var SourceDescription $me */ $me = $this->getSourceDescription(); if ($me == null || $me->getId() == null) { return null; } /** @var Gedcomx $gx */ $gx = new Gedcomx(); $sd = new SourceDescription(); $sd->setId($me->getId()); $gx->setSourceDescriptions(array($sd)); $request = $this->createAuthenticatedRequest('POST', $link->getHref(), FamilySearchRequest::getMediaTypes(), null, $gx->toJson()); return $this->stateFactory->createState('SourceDescriptionState', $this->client, $request, $this->passOptionsTo('invoke', array($request), func_get_args()), $this->accessToken); }
/** * Constructs a new FamilySearch collection state using the specified client, request, response, access token, and state factory. * * @param \GuzzleHttp\Client $client * @param \GuzzleHttp\Psr7\Request $request * @param \GuzzleHttp\Psr7\Response $response * @param string $accessToken * @param \Gedcomx\Extensions\FamilySearch\Rs\Client\FamilySearchStateFactory $stateFactory */ function __construct(Client $client, Request $request, Response $response, $accessToken, FamilySearchStateFactory $stateFactory) { parent::__construct($client, $request, $response, $accessToken, $stateFactory); }