HapiClientInterface
in
The HAPI Client interface.
Table of Contents
- getApiUrl() : string
- getAuthenticationMethod() : AuthenticationMethodInterface
- getClient() : ClientInterface
- The HAPI Client uses a Guzzle client internally to send all the HTTP requests.
- getEntryPointResource() : ResourceInterface
- Sends a request to the API entry point URL ("/" by default) and returns its Resource object.
- getEntryPointUrl() : string
- getProfile() : string
- refresh() : ResourceInterface
- Attempts to refresh the Resource by sending a GET request to the URL referenced by the "self" relation type.
- sendFollow() : ResourceInterface
- sendRequest() : ResourceInterface
Methods
getApiUrl()
public
getApiUrl() : string
Return values
string —the URL pointing to the API server
getAuthenticationMethod()
public
getAuthenticationMethod() : AuthenticationMethodInterface
Return values
AuthenticationMethodInterface —The authentication method
getClient()
The HAPI Client uses a Guzzle client internally to send all the HTTP requests.
public
& getClient() : ClientInterface
Return values
ClientInterface —The Guzzle client (passed by reference)
getEntryPointResource()
Sends a request to the API entry point URL ("/" by default) and returns its Resource object.
public
getEntryPointResource() : ResourceInterface
The entry point Resource is only retrieved if needed and only once per HapiClient instance.
Tags
Return values
ResourceInterface —the entry point Resource
getEntryPointUrl()
public
getEntryPointUrl() : string
Return values
string —the URL to the entry point Resource
getProfile()
public
getProfile() : string
Return values
string —the URL pointing to the HAL profile
refresh()
Attempts to refresh the Resource by sending a GET request to the URL referenced by the "self" relation type.
public
refresh(ResourceInterface $resource) : ResourceInterface
If the resource doesn't have such relation type or the request fails, the same resource is returned.
Parameters
- $resource : ResourceInterface
-
The Resource to refresh
Return values
ResourceInterface —The refreshed or the same Resource if failed to refresh it
sendFollow()
public
sendFollow(array<string|int, mixed>|FollowInterface $follow[, ResourceInterface|null $resource = null ]) : ResourceInterface
Parameters
- $follow : array<string|int, mixed>|FollowInterface
-
The Follow object or an array of Follow objects containing the parameters necessary for the HTTP request(s)
- $resource : ResourceInterface|null = null
-
The resource containing the link you want to follow. If null, the entry point Resource will be used.
Return values
ResourceInterface —the Resource object contained in the last response
sendRequest()
public
sendRequest(RequestInterface $request) : ResourceInterface
Parameters
- $request : RequestInterface
-
The Request object containing all the parameters necessary for the HTTP request
Return values
ResourceInterface —the Resource object returned by the server