Class RESTian_Client
Base class for a simplied Web API access for PHP with emphasis on WordPress.
RESTian can be used without WordPress, but its design is WordPress influenced.
Uses Exceptions ONLY to designate obvious programming errors. IOW, callers of this client do NOT need to use try {} catch {} because RESTian_Client should only throw exceptions when there code has well understood bugs.
- RESTian_Base
- RESTian_Client
Priorart:: https://guzzlephp.org/guide/service/service_descriptions.html
Located at core-classes/class-client.php
public
|
|
public
string
|
|
public
string
|
|
public
|
|
public
|
|
public
array|boolean
|
|
public
|
|
public
|
|
public
array|boolean
|
|
public
array|boolean
|
|
public
array|boolean
|
|
public
boolean|
|
|
public
|
|
public
array|boolean
|
#
is_credentials( array|boolean $credentials )
Evaluate passed credentials to see if the auth provider considers the credentials to be valid. |
public
string
|
|
public
array|boolean
|
|
public
array
|
|
public
mixed
|
|
public
array
|
|
public
mixed
|
|
public
array
|
|
public
mixed
|
|
public
|
#
register_service( string $service_name, array|
Allow a subclass to register an API service. |
public
|
#
register_action( string $resource_name, array|
Allow a subclass to register an API action. |
public
|
#
register_resource( string $resource_name, array|
Allow a subclass to register an API resource. |
public
|
|
public
|
|
public
|
|
public
|
|
public
array
|
|
public
|
|
public
object|
|
#
get_resource( string|
|
public
object|
|
#
post_resource( string|
|
public
object|
|
#
invoke_action( string|
|
public
object|
|
#
call_service( string|
|
public
|
|
public
|
#
process_response(
Stub that allows subclass to process request, if needed. |
public
|
|
public
|
|
public
|
|
public
|
|
public
boolean|
|
|
public
string
|
|
public
boolean|string
|
|
protected
|
|
public
boolean
|
#
needs_credentials(
Returns true if a service needs credentials, false if not. Useful for Registration methods that do not require any sort of |
public
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean
|
|
public
boolean|object|
|
|
public
boolean
|
|
public
string
|
|
public
string
|
add_action(),
add_filter(),
apply_filters(),
do_action()
|
public
object
|
$caller |
|
#
Enables the caller to attach itself so subclasses can access the caller. Our use case was for the WordPress plugin class. |
protected
array
|
$_services | array() |
#
Of RESTian_Services; provides API service specific functionality |
protected
array
|
$_vars | array() |
#
Of name value pairs that can be used to query an API |
protected
array
|
$_var_sets | array() |
#
Of named var sets |
protected
array
|
$_settings | array() |
#
Of service/request/response settings |
protected
array
|
$_defaults | array(
'var' => array(),
'services' => array(),
) |
#
- |
protected
boolean
|
$_intialized | false |
#
Set to true once API is initialized. |
protected
boolean|array
|
$_credentials | false |
#
Properties needed for credentials |
protected
boolean|array
|
$_grant | false |
#
Properties needed for grant |
protected
boolean| |
$_auth_service | false |
|
protected
string
|
$_user_agent |
|
#
Description of the client used to make the request. Will default unless set. |
public
string
|
$auth_type | 'basic_http' |
#
In future might be RESTian-specific 'oauth2_auth_code', 'oauth2_password', 'oauth_1a', etc. |
public
string
|
$api_name |
|
#
Human readable name of the API - to be set by subclass. |
public
string
|
$base_url |
|
#
The API's base URL - to be set by the subclass calling this classes constructor. |
public
string
|
$api_version |
|
#
The version of the API used - to be set by the subclass calling this classes constructor. |
public
string
|
$http_agent |
|
|
public
boolean|callable
|
$cache_callback | false |
|
public
boolean
|
$use_cache | false |
|
public
|
$request |
|
|
public
|
$response |
|