gedcomx-php-client
  • Namespace
  • Class

Namespaces

  • Gedcomx
    • Agent
    • Atom
    • Common
    • Conclusion
    • Extensions
      • FamilySearch
        • Platform
          • Artifacts
          • Discussions
          • Tree
          • Users
        • Rs
          • Client
            • FamilyTree
            • Helpers
            • Memories
            • Util
        • Rt
        • Types
    • GedcomxFile
    • Links
    • Records
    • Rs
      • Client
        • Exception
        • Options
        • Util
    • Rt
    • Search
    • Source
    • Support
    • Types
    • Util
    • Vocab

Classes

  • AgentState
  • AncestryResultsState
  • CollectionsState
  • CollectionState
  • DescendancyResultsState
  • GedcomxApplicationState
  • GedcomxSearchQuery
  • PersonChildrenState
  • PersonParentsState
  • PersonSearchResultsState
  • PersonSpousesState
  • PersonsState
  • PersonState
  • PlaceDescriptionsState
  • PlaceDescriptionState
  • PlaceGroupState
  • PlaceSearchResultsState
  • RecordsState
  • RecordState
  • Rel
  • RelationshipsState
  • RelationshipState
  • SearchParameter
  • SourceDescriptionsState
  • SourceDescriptionState
  • StateFactory
  • VocabConstants
  • VocabElementListState
  • VocabElementState

Interfaces

  • SupportsExtensionElements

Class GedcomxApplicationState

This is the base class for all state instances.

Class GedcomxApplicationState

Direct known subclasses

Gedcomx\Extensions\FamilySearch\Rs\Client\DiscussionsState, Gedcomx\Extensions\FamilySearch\Rs\Client\DiscussionState, Gedcomx\Rs\Client\PersonState, Gedcomx\Rs\Client\PlaceDescriptionsState, Gedcomx\Rs\Client\PlaceDescriptionState, Gedcomx\Rs\Client\PlaceGroupState, Gedcomx\Rs\Client\PlaceSearchResultsState, Gedcomx\Rs\Client\RecordsState, Gedcomx\Rs\Client\RecordState, Gedcomx\Rs\Client\RelationshipsState, Gedcomx\Rs\Client\RelationshipState, Gedcomx\Rs\Client\SourceDescriptionsState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\ChangeHistoryState, Gedcomx\Rs\Client\SourceDescriptionState, Gedcomx\Rs\Client\VocabElementListState, Gedcomx\Rs\Client\VocabElementState, Gedcomx\Rs\Client\AgentState, Gedcomx\Rs\Client\AncestryResultsState, Gedcomx\Rs\Client\CollectionsState, Gedcomx\Rs\Client\CollectionState, Gedcomx\Rs\Client\DescendancyResultsState, Gedcomx\Rs\Client\PersonSearchResultsState, Gedcomx\Rs\Client\PersonsState

Indirect known subclasses

Gedcomx\Extensions\FamilySearch\Rs\Client\FamilySearchCollectionState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilySearchPlaceDescriptionState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\FamilyTreeRelationshipsState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\FamilyTreeRelationshipState, Gedcomx\Extensions\FamilySearch\Rs\Client\Memories\FamilySearchMemories, Gedcomx\Extensions\FamilySearch\Rs\Client\PersonMatchResultsState, Gedcomx\Extensions\FamilySearch\Rs\Client\PersonMergeState, Gedcomx\Extensions\FamilySearch\Rs\Client\PersonNonMatchesState, Gedcomx\Extensions\FamilySearch\Rs\Client\UserHistoryState, Gedcomx\Extensions\FamilySearch\Rs\Client\UserState, Gedcomx\Rs\Client\PersonChildrenState, Gedcomx\Rs\Client\PersonParentsState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilySearchPlaces, Gedcomx\Rs\Client\PersonSpousesState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilySearchPlaceState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilySearchSourceDescriptionState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\ChildAndParentsRelationshipState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\FamilyTreeCollectionState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\FamilyTreePersonChildrenState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\FamilyTreePersonParentsState, Gedcomx\Extensions\FamilySearch\Rs\Client\FamilyTree\FamilyTreePersonState

Abstract
Namespace: Gedcomx\Rs\Client
Package: Gedcomx\Rs\Client
Located at Rs/Client/GedcomxApplicationState.php

Methods summary

public
# __construct( GuzzleHttp\Client $client, GuzzleHttp\Psr7\Request $request, GuzzleHttp\Psr7\Response $response, string $accessToken, Gedcomx\Rs\Client\StateFactory $stateFactory )

Constructs a new GedcomxApplicationState using the specified client, request, response, access token, and state factory.

Constructs a new GedcomxApplicationState using the specified client, request, response, access token, and state factory.

Parameters

$client
$request
$response
$accessToken
$stateFactory
public mixed
# inject( GuzzleHttp\Psr7\Request $request )

Invokes the specified REST API request and returns a state instance of the REST API response.

Invokes the specified REST API request and returns a state instance of the REST API response.

Parameters

$request

Returns

mixed
public GuzzleHttp\Client
# getClient( )

Gets sets the main REST API client to use with all API calls.

Gets sets the main REST API client to use with all API calls.

Returns

GuzzleHttp\Client
public string
# getAccessToken( )

Gets the current access token (the OAuth2 token), see https://familysearch.org/developers/docs/api/authentication/Access_Token_resource.

Gets the current access token (the OAuth2 token), see https://familysearch.org/developers/docs/api/authentication/Access_Token_resource.

Returns

string
public GuzzleHttp\Psr7\Request
# getRequest( )

Gets the REST API request.

Gets the REST API request.

Returns

GuzzleHttp\Psr7\Request
public GuzzleHttp\Psr7\Response
# getResponse( )

Gets the REST API response.

Gets the REST API response.

Returns

GuzzleHttp\Psr7\Response
public GuzzleHttp\Psr7\Request
# getLastEmbeddedRequest( )

Gets the last embedded request (from a previous call to GedcomxApplicationState embed()).

Gets the last embedded request (from a previous call to GedcomxApplicationState embed()).

Returns

GuzzleHttp\Psr7\Request
public GuzzleHttp\Psr7\Response
# getLastEmbeddedResponse( )

Gets the last embedded response (from a previous call to GedcomxApplicationState embed()).

Gets the last embedded response (from a previous call to GedcomxApplicationState embed()).

Returns

GuzzleHttp\Psr7\Response
public object
# getEntity( )

Gets the entity represented by this state (if applicable). Not all responses produce entities.

Gets the entity represented by this state (if applicable). Not all responses produce entities.

Returns

object
public boolean
# isAuthenticated( )

Gets a value indicating whether this instance is authenticated.

Gets a value indicating whether this instance is authenticated.

Returns

boolean
whether this state is authenticated.
public string
# getUri( )

Gets the URI of the REST API request associated to this state instance.

Gets the URI of the REST API request associated to this state instance.

Returns

string
The URI for this application state.
public boolean
# hasClientError( )

Determines whether the server response status code indicates a client side error (status code >= 400 and < 500).

Determines whether the server response status code indicates a client side error (status code >= 400 and < 500).

Returns

boolean
Whether this state is a client-side error.
public boolean
# hasServerError( )

Determines whether the server response status code indicates a server side error (status code >= 500 and < 600).

Determines whether the server response status code indicates a server side error (status code >= 500 and < 600).

Returns

boolean
Whether this state is a server-side error.
public boolean
# hasError( )

Determines whether this instance has error (server [code >= 500 and < 600] or client [code >= 400 and < 500]).

Determines whether this instance has error (server [code >= 500 and < 600] or client [code >= 400 and < 500]).

Returns

boolean
Whether this state has an error.
public boolean
# hasStatus( integer $status )

Determines whether the current REST API response has the specified status.

Determines whether the current REST API response has the specified status.

Parameters

$status

Returns

boolean
public integer
# getStatus( )

Get the HTTP status code of the response.

Get the HTTP status code of the response.

Returns

integer
public array
# getHeaders( )

Gets the collection of REST API response headers.

Gets the collection of REST API response headers.

Returns

array
The headers for this state.
public array
# getHeader( string $name )

Gets the REST API response header (by name) if present.

Gets the REST API response header (by name) if present.

Parameters

$name
The name of the header to retrieve.

Returns

array
return a specific header for this state.
public string
# getSelfUri( )

Gets the URI representing this current state instance.

Gets the URI representing this current state instance.

Returns

string
The self-URI for this state.
public null
# getSelfRel( )

Gets the rel name for the current state instance. This is expected to be overridden.

Gets the rel name for the current state instance. This is expected to be overridden.

Returns

null
public array
# getETag( )

Gets the entity tag of the entity represented by this instance.

Gets the entity tag of the entity represented by this instance.

Returns

array
public array
# getLastModified( )

Gets the last modified date of the entity represented by this instance.

Gets the last modified date of the entity represented by this instance.

Returns

array
public Gedcomx\Common\ResourceReference
# getResourceReference( )

Gets the resource reference represented by this instance.

Gets the resource reference represented by this instance.

Returns

Gedcomx\Common\ResourceReference
public Gedcomx\Rs\Client\GedcomxApplicationState
# head( Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Executes a HEAD verb request against the current REST API request and returns a state instance with the response.

Executes a HEAD verb request against the current REST API request and returns a state instance with the response.

Parameters

$option

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
public mixed
# get( Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Executes a'GET' verb request against the current REST API request and returns a state instance with the response.

Executes a'GET' verb request against the current REST API request and returns a state instance with the response.

Parameters

$option

Returns

mixed
public Gedcomx\Rs\Client\GedcomxApplicationState
# delete( Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Executes an DELETE verb request against the current REST API request and returns a state instance with the response.

Executes an DELETE verb request against the current REST API request and returns a state instance with the response.

Parameters

$option

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
public Gedcomx\Rs\Client\GedcomxApplicationState
# options( Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Executes an OPTIONS verb request against the current REST API request and returns a state instance with the response.

Executes an OPTIONS verb request against the current REST API request and returns a state instance with the response.

Parameters

$option

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
public Gedcomx\Rs\Client\GedcomxApplicationState
# put( $entity, Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Executes a PUT verb request against the current REST API request and returns a state instance with the response.

Executes a PUT verb request against the current REST API request and returns a state instance with the response.

Parameters

$entity
$option

Returns

Gedcomx\Rs\Client\GedcomxApplicationState

Throws

Gedcomx\Rs\Client\Exception\GedcomxApplicationException
public mixed
# post( Gedcomx\Gedcomx $entity, Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Executes a POST verb request against the current REST API request and returns a state instance with the response.

Executes a POST verb request against the current REST API request and returns a state instance with the response.

Parameters

$entity
$option

Returns

mixed
public Gedcomx\Links\Link
# getLink( string $rel )

Get a link by its rel. Links are not specified by GEDCOM X core, but as extension elements by GEDCOM X RS.

Get a link by its rel. Links are not specified by GEDCOM X core, but as extension elements by GEDCOM X RS.

Parameters

$rel
The link rel.

Returns

Gedcomx\Links\Link
public array
# getLinks( )

Gets the list of hypermedia links. Links are not specified by GEDCOM X core, but as extension elements by GEDCOM X RS.

Gets the list of hypermedia links. Links are not specified by GEDCOM X core, but as extension elements by GEDCOM X RS.

Returns

array
public Gedcomx\Rs\Client\GedcomxApplicationState
# ifSuccessful( )

Returns the current state instance if there are no errors in the current REST API response; otherwise, it throws an exception with the response details.

Returns the current state instance if there are no errors in the current REST API response; otherwise, it throws an exception with the response details.

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
$this

Throws

Gedcomx\Rs\Client\Exception\GedcomxApplicationException
If this state captures an error.
public
# authenticateWithAccessToken( $accessToken )

Sets the current access token to the one specified. The server is not contacted during this operation.

Sets the current access token to the one specified. The server is not contacted during this operation.

Parameters

$accessToken

Returns


$this
public Gedcomx\Rs\Client\GedcomxApplicationState
# authenticateViaOAuth2Password( string $username, string $password, string $clientId, string $clientSecret = NULL )

Authenticates this session via OAuth2 password.

Authenticates this session via OAuth2 password.

Parameters

$username
The username.
$password
The password.
$clientId
The client id.
$clientSecret
The client secret.

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
$this
public Gedcomx\Rs\Client\GedcomxApplicationState
# authenticateViaOAuth2AuthCode( string $authCode, string $redirect, string $clientId, string $clientSecret = NULL )

Authenticates this session via OAuth2 authentication code.

Authenticates this session via OAuth2 authentication code.

Parameters

$authCode
The auth code.
$redirect
The redirect URI.
$clientId
The client id.
$clientSecret
The client secret.

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
$this
public Gedcomx\Rs\Client\GedcomxApplicationState
# authenticateViaOAuth2ClientCredentials( string $clientId, string $clientSecret )

Authenticates this session via OAuth2 client credentials.

Authenticates this session via OAuth2 client credentials.

Parameters

$clientId
The client id.
$clientSecret
The client secret.

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
$this
public Gedcomx\Rs\Client\GedcomxApplicationState
# authenticateViaOAuth2WithoutCredentials( string $ipAddress, string $clientId )

Creates a state instance without authentication. It will produce an access token, but only good for requests that do not need authentication.

Creates a state instance without authentication. It will produce an access token, but only good for requests that do not need authentication.

Parameters

$ipAddress
$clientId The client id.
$clientId
$ipAddress The client's ipaddress.

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
$this
public
# generateClientSecret( mixed $key, $timestamp = null )

Generate the secret required for authentication via client credentials.

Generate the secret required for authentication via client credentials.

Parameters

$key

The key parameter of openssl_private_encrypt which is the same as documented for openssl_pkey_get_private. May be the text of a key file or a file reference.

$timestamp

Timestamp

mixed $timestamp The time in milliseconds. This parameter should only be used for testing. A current timestamp is generated when this parameter is not provided.


public Gedcomx\Rs\Client\GedcomxApplicationState
# logout( )

Invalidate the current access token and end the session.

Invalidate the current access token and end the session.

Returns

Gedcomx\Rs\Client\GedcomxApplicationState
$this
public Gedcomx\Rs\Client\PersonState
# loadAllEmbeddedResources( Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Load all external resources such as notes, media, and evidence. See EmbeddedLinkLoader for a complete list.

Load all external resources such as notes, media, and evidence. See EmbeddedLinkLoader for a complete list.

Parameters

$option

Returns

Gedcomx\Rs\Client\PersonState
$this
public Gedcomx\Rs\Client\AgentState|null
# readContributor( Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Reads the contributor for the current state instance.

Reads the contributor for the current state instance.

Parameters

$option

Returns

Gedcomx\Rs\Client\AgentState|null
public Gedcomx\Rs\Client\AgentState|null
# readAttributableContributor( Gedcomx\Common\Attributable $attributable, Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Reads the contributor for the specified attributable.

Reads the contributor for the specified attributable.

Parameters

$attributable
$option

Returns

Gedcomx\Rs\Client\AgentState|null
public Gedcomx\Rs\Client\AgentState|null
# readReferenceContributor( Gedcomx\Common\ResourceReference $contributor, Gedcomx\Rs\Client\Options\StateTransitionOption $option = null )

Reads the contributor for the specified resource reference.

Reads the contributor for the specified resource reference.

Parameters

$contributor
$option

Returns

Gedcomx\Rs\Client\AgentState|null
public static GuzzleHttp\Psr7\Response
# send( GuzzleHttp\Client $client, GuzzleHttp\Psr7\Request $request )

Sends a request via the given client. This centralizes options that all clients need such as disabling exceptions on errors and catching redirects.

Sends a request via the given client. This centralizes options that all clients need such as disabling exceptions on errors and catching redirects.

Parameters

$client
$request

Returns

GuzzleHttp\Psr7\Response
$response
gedcomx-php-client API documentation generated by ApiGen