PHP 클래스 DataSift_User

저자: Stuart Dallas ([email protected])
파일 보기 프로젝트 열기: datasift/datasift-php 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$_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