PHP Class DataSift_User

Author: Stuart Dallas ([email protected])
Afficher le fichier Open project: datasift/datasift-php Class Usage Examples

Protected Properties

Свойство Type Description
$_api_client The class to use as the API client.
$_api_key The DataSift API Key.
$_api_url The api url of the user.
$_api_version
$_debug Boolean to represent whether this class is being used in debug mode or not
$_ingest_url The ingestion url of the user.
$_last_response The full response of the last API call, only set in debug mode.
$_rate_limit Stores the X-RateLimit-Limit value from the last API call.
$_rate_limit_remaining Stores the X-RateLimit-Remaining value from the last API call.
$_stream_url The apu url of the user.
$_use_ssl Set to true to enable SSL.
$_username The DataSift username.

Méthodes publiques

Méthode Description
__construct ( string $username, string $api_key, boolean $use_ssl = true, $debug_mode = false, $api_url = false, $api_version = false, $stream_url = false, $ingest_url = false ) Constructor. A username and API key are required when constructing an instance of this class.
createDefinition ( string $definition = '' ) : DataSift_Definition Creates and returns an empty Definition object.
createHistoric ( string $hash, integer $start, integer $end, array $sources, string $name, float $sample = DataSift_Historic::DEFAULT_SAMPLE ) : DataSift_Historic Create a historic query based on a stream hash.
createPushDefinition ( ) : DataSift_Push_Definition Creates and returns a new Push_Definition object.
delete ( string $endpoint, array $params = [], $headers = [] ) : array Make a Delete call to a DataSift API endpoint.
enableSSL ( boolean $use_ssl = true ) : void Set whether stream connections should use SSL.
get ( string $endpoint, array $params = [], $headers = [] ) : array Make a GET call to a DataSift API endpoint.
getAPIKey ( ) : string Returns the API key.
getApiUrl ( ) : string Returns API URL.
getApiVersion ( ) : string getApiVersion
getConsumer ( string $type = DataSift_StreamConsumer::TYPE_HTTP, string $hash, DataSift_IStreamConsumerEventHandler $eventHandler ) : DataSift_StreamConsumer Returns a DataSift_StreamConsumer-derived object for the given hash, for the given type.
getDebug ( ) : boolean getDebug
getHistoric ( string $playback_id ) : DataSift_Historic Get an existing historic from the API.
getIngestUrl ( ) : string Returns stream URL.
getLastResponse ( ) : array getLastResponse
getMultiConsumer ( string $type = DataSift_StreamConsumer::TYPE_HTTP, string $hashes, DataSift_IStreamConsumerEventHandler $eventHandler ) : DataSift_StreamConsumer Returns a DataSift_StreamConsumer-derived object for the given hashes, for the given type.
getPushSubscription ( string $id ) : DataSift_Push_Subscription Get a single push subscription.
getPushSubscriptionLogs ( $page = 1, $per_page = 100, $order_by = DataSift_Push_Subscription::ORDERBY_REQUEST_TIME, $order_dir = DataSift_Push_Subscription::ORDERDIR_DESC ) : ArrayList Page through recent push subscription log entries, specifying the sort order.
getRateLimit ( ) : integer Returns the rate limit returned by the last API call.
getRateLimitRemaining ( ) : integer Returns the rate limit remaining returned by the last API call.
getStreamUrl ( ) : string Returns stream URL.
getUsage ( string $period = 'hour' ) : array Returns the usage data for this user.
getUserAgent ( ) : string Returns the user agent this library should use for all API calls.
getUsername ( ) : string Returns the username.
listHistorics ( integer $page = 1, integer $per_page = 20 ) : array Get a list of Historics queries in your account.
listPushSubscriptions ( integer $page = 1, integer $per_page = 100, $order_by = DataSift_Push_Subscription::ORDERBY_CREATED_AT, $order_dir = DataSift_Push_Subscription::ORDERDIR_ASC, boolean $include_finished = false ) : array Get a list of push subscriptions in your account.
post ( string $endpoint, array $params = [], $headers = [], $ingest = false ) : array Make a call to a DataSift API endpoint.
put ( string $endpoint, array $params = [], $headers = [] ) : array Make a PUT call to a DataSift API endpoint.
setApiClient ( string $api_client ) : void Set the class to use when calling the API
setApiVersion ( string $version ) : string setApiVersion
setLastResponse ( array $last_response ) setLastResponse
useSSL ( ) : boolean Returns whether SSL should be used where supported.

Private Methods

Méthode Description
handleResponse ( $res )

Method Details

__construct() public méthode

Constructor. A username and API key are required when constructing an instance of this class.
public __construct ( string $username, string $api_key, boolean $use_ssl = true, $debug_mode = false, $api_url = false, $api_version = false, $stream_url = false, $ingest_url = false )
$username string The user's username.
$api_key string The user's API key.
$use_ssl boolean Set to true to enable SSL.

createDefinition() public méthode

Creates and returns an empty Definition object.
public createDefinition ( string $definition = '' ) : DataSift_Definition
$definition string Optional definition with which to prime the object.
Résultat DataSift_Definition A definition object tied to this user.

createHistoric() public méthode

Create a historic query based on a stream hash.
public createHistoric ( string $hash, integer $start, integer $end, array $sources, string $name, float $sample = DataSift_Historic::DEFAULT_SAMPLE ) : DataSift_Historic
$hash string The stream hash.
$start integer The timestamp from which to start the query.
$end integer The timestamp at which to end the query.
$sources array An array of sources required.
$name string A friendly name for this query.
$sample float An optional sample rate for this query.
Résultat DataSift_Historic

createPushDefinition() public méthode

Creates and returns a new Push_Definition object.
public createPushDefinition ( ) : DataSift_Push_Definition
Résultat DataSift_Push_Definition

delete() public méthode

Make a Delete call to a DataSift API endpoint.
public delete ( string $endpoint, array $params = [], $headers = [] ) : array
$endpoint string The endpoint of the API call.
$params array The parameters to be passed along with the request.
Résultat array The response from the server.

enableSSL() public méthode

Set whether stream connections should use SSL.
public enableSSL ( boolean $use_ssl = true ) : void
$use_ssl boolean Set to true to enable SSL.
Résultat void

get() public méthode

Make a GET call to a DataSift API endpoint.
public get ( string $endpoint, array $params = [], $headers = [] ) : array
$endpoint string The endpoint of the API call.
$params array The parameters to be passed along with the request.
Résultat array The response from the server.

getAPIKey() public méthode

Returns the API key.
public getAPIKey ( ) : string
Résultat string The API key.

getApiUrl() public méthode

Returns API URL.
public getApiUrl ( ) : string
Résultat string

getApiVersion() public méthode

getApiVersion
public getApiVersion ( ) : string
Résultat string

getConsumer() public méthode

Returns a DataSift_StreamConsumer-derived object for the given hash, for the given type.
See also: DataSift_StreamConsumer
public getConsumer ( string $type = DataSift_StreamConsumer::TYPE_HTTP, string $hash, DataSift_IStreamConsumerEventHandler $eventHandler ) : DataSift_StreamConsumer
$type string The consumer type for which to construct a consumer.
$hash string The hash to be consumed.
$eventHandler DataSift_IStreamConsumerEventHandler The object that will receive events.
Résultat DataSift_StreamConsumer The consumer object.

getDebug() public méthode

getDebug
public getDebug ( ) : boolean
Résultat boolean

getHistoric() public méthode

Get an existing historic from the API.
public getHistoric ( string $playback_id ) : DataSift_Historic
$playback_id string The historic playback ID.
Résultat DataSift_Historic

getIngestUrl() public méthode

Returns stream URL.
public getIngestUrl ( ) : string
Résultat string

getLastResponse() public méthode

getLastResponse
public getLastResponse ( ) : array
Résultat array

getMultiConsumer() public méthode

Returns a DataSift_StreamConsumer-derived object for the given hashes, for the given type.
See also: DataSift_StreamConsumer
public getMultiConsumer ( string $type = DataSift_StreamConsumer::TYPE_HTTP, string $hashes, DataSift_IStreamConsumerEventHandler $eventHandler ) : DataSift_StreamConsumer
$type string The consumer type for which to construct a consumer.
$hashes string An array containing hashes and/or Definition objects to be consumed.
$eventHandler DataSift_IStreamConsumerEventHandler The object that will receive events.
Résultat DataSift_StreamConsumer The consumer object.

getPushSubscription() public méthode

Get a single push subscription.
public getPushSubscription ( string $id ) : DataSift_Push_Subscription
$id string The ID of the subscription to fetch.
Résultat DataSift_Push_Subscription

getPushSubscriptionLogs() public méthode

Page through recent push subscription log entries, specifying the sort order.
public getPushSubscriptionLogs ( $page = 1, $per_page = 100, $order_by = DataSift_Push_Subscription::ORDERBY_REQUEST_TIME, $order_dir = DataSift_Push_Subscription::ORDERDIR_DESC ) : ArrayList
Résultat ArrayList

getRateLimit() public méthode

Returns the rate limit returned by the last API call.
public getRateLimit ( ) : integer
Résultat integer The rate limit.

getRateLimitRemaining() public méthode

Returns the rate limit remaining returned by the last API call.
public getRateLimitRemaining ( ) : integer
Résultat integer The rate limit remaining.

getStreamUrl() public méthode

Returns stream URL.
public getStreamUrl ( ) : string
Résultat string

getUsage() public méthode

Returns the usage data for this user.
public getUsage ( string $period = 'hour' ) : array
$period string Either 'hour' or 'day'.
Résultat array The usage data from the API.

getUserAgent() public méthode

Returns the user agent this library should use for all API calls.
public getUserAgent ( ) : string
Résultat string

getUsername() public méthode

Returns the username.
public getUsername ( ) : string
Résultat string The username.

listHistorics() public méthode

Get a list of Historics queries in your account.
public listHistorics ( integer $page = 1, integer $per_page = 20 ) : array
$page integer The page number to get.
$per_page integer The number of items per page.
Résultat array Of DataSift_Historic objects.

listPushSubscriptions() public méthode

Get a list of push subscriptions in your account.
public listPushSubscriptions ( integer $page = 1, integer $per_page = 100, $order_by = DataSift_Push_Subscription::ORDERBY_CREATED_AT, $order_dir = DataSift_Push_Subscription::ORDERDIR_ASC, boolean $include_finished = false ) : array
$page integer The page number to get.
$per_page integer The number of items per page.
$include_finished boolean Set to true when you want to include finished subscription in the results.
Résultat array Of DataSift_Push_Subscription objects.

post() public méthode

Make a call to a DataSift API endpoint.
public post ( string $endpoint, array $params = [], $headers = [], $ingest = false ) : array
$endpoint string The endpoint of the API call.
$params array The parameters to be passed along with the request.
Résultat array The response from the server.

put() public méthode

Make a PUT call to a DataSift API endpoint.
public put ( string $endpoint, array $params = [], $headers = [] ) : array
$endpoint string The endpoint of the API call.
$params array The parameters to be passed along with the request.
Résultat array The response from the server.

setApiClient() public méthode

Set the class to use when calling the API
public setApiClient ( string $api_client ) : void
$api_client string The class to use.
Résultat void

setApiVersion() public méthode

setApiVersion
public setApiVersion ( string $version ) : string
$version string
Résultat string

setLastResponse() public méthode

setLastResponse
public setLastResponse ( array $last_response )
$last_response array

useSSL() public méthode

Returns whether SSL should be used where supported.
public useSSL ( ) : boolean
Résultat boolean True if SSL should be used.

Property Details

$_api_client protected_oe property

The class to use as the API client.
protected $_api_client

$_api_key protected_oe property

The DataSift API Key.
protected $_api_key

$_api_url protected_oe property

The api url of the user.
protected $_api_url

$_api_version protected_oe property

protected $_api_version

$_debug protected_oe property

Boolean to represent whether this class is being used in debug mode or not
protected $_debug

$_ingest_url protected_oe property

The ingestion url of the user.
protected $_ingest_url

$_last_response protected_oe property

The full response of the last API call, only set in debug mode.
protected $_last_response

$_rate_limit protected_oe property

Stores the X-RateLimit-Limit value from the last API call.
protected $_rate_limit

$_rate_limit_remaining protected_oe property

Stores the X-RateLimit-Remaining value from the last API call.
protected $_rate_limit_remaining

$_stream_url protected_oe property

The apu url of the user.
protected $_stream_url

$_use_ssl protected_oe property

Set to true to enable SSL.
protected $_use_ssl

$_username protected_oe property

The DataSift username.
protected $_username