# Class RESTian

Located at restian.php

Methods summary
`public static` | # `register_client( mixed $client_name, string|array $client )` #### Parameters $client_name `mixed` $client_name $client `string|array` $client If string then the class name of the RESTian client. If array, $args to find it. #### Notes $client_name can be any of the following format: 'local_short_code' - If all code it local 'github_user_name/github_repo_name' - If code is on GitHub, master branch latest commit (not smart) 'github_user_name/github_repo_name/tag_name' - If code is on GitHub, tagged commit 'repo_host/user_name/repo_name' - If code is on GitHub or BitBucket, master branch latest commit (not smart) 'repo_host/user_name/repo_name/tag_name' - If code is on GitHub or BitBucket, tagged commit 'repo_host' => 'github.com' or 'bitbucket.org'
`public static` | # `get_new_client( mixed $client_name )` #### Parameters $client_name `mixed` $client_name
`public static` | # `register_parser( string $content_type, boolean|string $class_name = false, boolean|string $filepath = false )` Registers a result parser class based on the mime type. Registers a result parser class based on the mime type. #### Parameters $content_type `string` $content_type valid mime type of RESTian shortcut (xml,json,html,plain,csv) $class_name `boolean|string` $class_name Name of class that defines this Parser $filepath `boolean|string` $filepath Full local file path for the file containing the class. #### See: https://www.iana.org/assignments/media-types/index.html
`public static RESTian_Parser` | # `get_new_parser( string $content_type, `RESTian_Request` $request, `RESTian_Response` $response, array $args = array() )` Constructs a new Parser instance Constructs a new Parser instance #### Parameters $content_type `string` $content_type $request ``RESTian_Request`` $request $response ``RESTian_Response`` $response $args `array` $args #### Returns `RESTian_Parser`
`public static` | # `register_auth_provider( string $provider_type, boolean|string $class_name = false, boolean|string $filepath = false )` Registers an Auth Provider type Registers an Auth Provider type #### Parameters $provider_type `string` $provider_type RESTian-specific type of Auth Provider $class_name `boolean|string` $class_name Name of class that defines this Auth Provider $filepath `boolean|string` $filepath Full local file path for the file containing the class.
`public static `RESTian_Auth_Provider_Base`` | # `get_new_auth_provider( string $auth_type, boolean|`RESTian_Client` $api = false )` Constructs a new Auth Provider instance Constructs a new Auth Provider instance #### Parameters $auth_type `string` $auth_type RESTian-specific type of auth providers $api `boolean|`RESTian_Client`` $api - The API that's dping the calling #### Returns ``RESTian_Auth_Provider_Base``
`public static` | # `register_http_agent( string $agent_type, boolean|string $class_name = false, boolean|string $filepath = false )` Registers an HTTP Agent type Registers an HTTP Agent type #### Parameters $agent_type `string` $agent_type RESTian-specific type of HTTP agent $class_name `boolean|string` $class_name Name of class that defines this HTTP agent $filepath `boolean|string` $filepath Full local file path for the file containing the class.
`public static `RESTian_Http_Agent_Base`` | # `get_new_http_agent( string $agent_type )` Constructs a new HTTP Agent instance Constructs a new HTTP Agent instance #### Parameters $agent_type `string` $agent_type RESTian-specific type of HTTP agent #### Returns ``RESTian_Http_Agent_Base``
`public static string` | # `expand_content_type( string $content_type )` Expands the following shortcut content types to their valid mime type: Expands the following shortcut content types to their valid mime type: #### Parameters $content_type `string` $content_type #### Returns `string` #### See: https://www.iana.org/assignments/media-types/index.html xml => application/xml json => application/json form => application/x-www-form-urlencoded html => text/html plain => text/plain csv => text/csv
`public static array` | # `parse_args( mixed $args )` Parses a string of arguments using a data format optimized for the use-case. Parses a string of arguments using a data format optimized for the use-case. The data format is similar to URL query string format but it uses vertical bars ('|') as seperators instead of ampersands ('&') because ampersands are frequently used in URLs. Names without no equals sign ('=') following are set to boolean true. Names prefixed with exclamation point ('!') will negate the value they would otherwise have, so a name with an exclamation point and no equals sign will be set to boolean false which is the primary use case for the ('!') syntax. #### Parameters $args `mixed` $args #### Returns `array` #### Example 'foo|!bar|baz=zoom' parses to array( 'foo' => true, 'bar' => false, 'baz' => 'zoom', )
`public static array` | # `parse_string( string $string, string $separator = ',' )` Takes a like this 'color,type=all,size' and translates into an array that looks like this: Takes a like this 'color,type=all,size' and translates into an array that looks like this: array( 'color' => true, 'type' => 'all' 'size' => true ); #### Parameters $string `string` $string $separator `string` $separator #### Returns `array`
`public static array` | # `parse_transforms( string $string, string $separator = ',' )` Parses comma seperated transforms like this: Parses comma seperated transforms like this: fill[/],replace[a][b],trim To this: array( 'fill' => '/' 'replace' => array( 'a','b' ), 'trim' => true, ) #### Parameters $string `string` $string $separator `string` $separator #### Returns `array`
`public static array` | # `expand_shortnames( array $args, array $shortnames = array() )` #### Parameters $args `array` $args $shortnames `array` $shortnames #### Returns `array`
`public static mixed` | # `add_filter( string $filter_name, array|string $callable, integer $priority = 10 )` Adds a filter hook for an object Adds a filter hook for an object RESTian::add_filter( 'filter_data', array( $this, 'filter_data' ) ); RESTian::add_filter( 'filter_data', array( $this, 'filter_data' ), 11 ); RESTian::add_filter( 'filter_data', 'special_func' ); RESTian::add_filter( 'filter_data', 'special_func', 11 ); RESTian::add_filter( 'filter_data', array( __CLASS__, 'filter_data' ) ); RESTian::add_filter( 'filter_data', array( __CLASS__, 'filter_data' ), 11 ); RESTian::add_filter( 'filter_data', array( new SpecialClass(), 'filter_data' ) ); RESTian::add_filter( 'filter_data', array( new SpecialClass(), 'filter_data' ), 11 ); #### Parameters $filter_name `string` $filter_name $callable `array|string` $callable $priority `integer` $priority #### Returns `mixed`
`public static mixed` | # `add_action( string $action_name, array|string $callable, integer $priority = 10 )` Adds a filter hook for an object Adds a filter hook for an object RESTian::add_action( 'process_action', array( $this, 'process_action' ) ); RESTian::add_action( 'process_action', array( $this, 'process_action' ), 11 ); RESTian::add_action( 'process_action', 'special_func' ); RESTian::add_action( 'process_action', 'special_func', 11 ); RESTian::add_action( 'process_action', array( __CLASS__, 'process_action' ) ); RESTian::add_action( 'process_action', array( __CLASS__, 'process_action' ), 11 ); RESTian::add_action( 'process_action', array( new SpecialClass(), 'process_action' ) ); RESTian::add_action( 'process_action', array( new SpecialClass(), 'process_action' ), 11 ); #### Parameters $action_name `string` $action_name $callable `array|string` $callable $priority `integer` $priority #### Returns `mixed`
`public static mixed` | # `get_filters( string $filter_name )` Return a list of filters Return a list of filters #### Parameters $filter_name `string` $filter_name #### Returns `mixed`

Properties summary
`protected static array` | $_clients | `array()` | #
`protected static array` | $_auth_providers | `array()` | #
`protected static array` | $_parsers | `array()` | #
`protected static array` | $_http_agents | `array()` | #
`protected static array` | $_filters | `array()` | #