PHP Класс DataSift_User

Автор: Stuart Dallas ([email protected])
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$_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.

Открытые методы

Метод Описание
__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.

Приватные методы

Метод Описание
handleResponse ( $res )

Описание методов

__construct() публичный Метод

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() публичный Метод

Creates and returns an empty Definition object.
public createDefinition ( string $definition = '' ) : DataSift_Definition
$definition string Optional definition with which to prime the object.
Результат DataSift_Definition A definition object tied to this user.

createHistoric() публичный Метод

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.
Результат DataSift_Historic

createPushDefinition() публичный Метод

Creates and returns a new Push_Definition object.
public createPushDefinition ( ) : DataSift_Push_Definition
Результат DataSift_Push_Definition

delete() публичный Метод

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.
Результат array The response from the server.

enableSSL() публичный Метод

Set whether stream connections should use SSL.
public enableSSL ( boolean $use_ssl = true ) : void
$use_ssl boolean Set to true to enable SSL.
Результат void

get() публичный Метод

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.
Результат array The response from the server.

getAPIKey() публичный Метод

Returns the API key.
public getAPIKey ( ) : string
Результат string The API key.

getApiUrl() публичный Метод

Returns API URL.
public getApiUrl ( ) : string
Результат string

getApiVersion() публичный Метод

getApiVersion
public getApiVersion ( ) : string
Результат string

getConsumer() публичный Метод

Returns a DataSift_StreamConsumer-derived object for the given hash, for the given type.
См. также: 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.
Результат DataSift_StreamConsumer The consumer object.

getDebug() публичный Метод

getDebug
public getDebug ( ) : boolean
Результат boolean

getHistoric() публичный Метод

Get an existing historic from the API.
public getHistoric ( string $playback_id ) : DataSift_Historic
$playback_id string The historic playback ID.
Результат DataSift_Historic

getIngestUrl() публичный Метод

Returns stream URL.
public getIngestUrl ( ) : string
Результат string

getLastResponse() публичный Метод

getLastResponse
public getLastResponse ( ) : array
Результат array

getMultiConsumer() публичный Метод

Returns a DataSift_StreamConsumer-derived object for the given hashes, for the given type.
См. также: 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.
Результат DataSift_StreamConsumer The consumer object.

getPushSubscription() публичный Метод

Get a single push subscription.
public getPushSubscription ( string $id ) : DataSift_Push_Subscription
$id string The ID of the subscription to fetch.
Результат DataSift_Push_Subscription

getPushSubscriptionLogs() публичный Метод

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
Результат ArrayList

getRateLimit() публичный Метод

Returns the rate limit returned by the last API call.
public getRateLimit ( ) : integer
Результат integer The rate limit.

getRateLimitRemaining() публичный Метод

Returns the rate limit remaining returned by the last API call.
public getRateLimitRemaining ( ) : integer
Результат integer The rate limit remaining.

getStreamUrl() публичный Метод

Returns stream URL.
public getStreamUrl ( ) : string
Результат string

getUsage() публичный Метод

Returns the usage data for this user.
public getUsage ( string $period = 'hour' ) : array
$period string Either 'hour' or 'day'.
Результат array The usage data from the API.

getUserAgent() публичный Метод

Returns the user agent this library should use for all API calls.
public getUserAgent ( ) : string
Результат string

getUsername() публичный Метод

Returns the username.
public getUsername ( ) : string
Результат string The username.

listHistorics() публичный Метод

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.
Результат array Of DataSift_Historic objects.

listPushSubscriptions() публичный Метод

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.
Результат array Of DataSift_Push_Subscription objects.

post() публичный Метод

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.
Результат array The response from the server.

put() публичный Метод

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.
Результат array The response from the server.

setApiClient() публичный Метод

Set the class to use when calling the API
public setApiClient ( string $api_client ) : void
$api_client string The class to use.
Результат void

setApiVersion() публичный Метод

setApiVersion
public setApiVersion ( string $version ) : string
$version string
Результат string

setLastResponse() публичный Метод

setLastResponse
public setLastResponse ( array $last_response )
$last_response array

useSSL() публичный Метод

Returns whether SSL should be used where supported.
public useSSL ( ) : boolean
Результат boolean True if SSL should be used.

Описание свойств

$_api_client защищенное свойство

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

$_api_key защищенное свойство

The DataSift API Key.
protected $_api_key

$_api_url защищенное свойство

The api url of the user.
protected $_api_url

$_api_version защищенное свойство

protected $_api_version

$_debug защищенное свойство

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

$_ingest_url защищенное свойство

The ingestion url of the user.
protected $_ingest_url

$_last_response защищенное свойство

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

$_rate_limit защищенное свойство

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

$_rate_limit_remaining защищенное свойство

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

$_stream_url защищенное свойство

The apu url of the user.
protected $_stream_url

$_use_ssl защищенное свойство

Set to true to enable SSL.
protected $_use_ssl

$_username защищенное свойство

The DataSift username.
protected $_username