PHP Класс DataSift_Push_Subscription

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

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

Свойство Тип Описание
$_created_at The timestamp when this subscription was created.
$_deleted True if this subscription has been deleted (becomes read-only).
$_hash The hash to which this subscription is subscribed.
$_hash_type "stream" or "historic"
$_id The subscription ID.
$_last_request The timestamp of the last push request.
$_last_success The timestamp of the last successful push request.
$_name The name of this subscription.
$_status The current status of this subscription.

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

Метод Описание
__construct ( DataSift_User $user, array $data ) Construct a DataSift_Push_Subscription object from an array.
delete ( ) Delete this subscription.
get ( DataSift_User $user, string $id ) : DataSift_Push_Subscription Get a push subscription by ID.
getCreatedAt ( ) : integer Get the timestamp when this subscription was created.
getHash ( ) : string Get the hash or playback ID to which this subscription is subscribed.
getHashType ( ) : string Get the hash type to which this subscription is subscribed.
getId ( ) : string Get the subscription ID.
getLastRequest ( ) : integer Get the timestamp of the last push request.
getLastSuccess ( ) : integer Get the timestamp of the last successful push request.
getLog ( integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_REQUEST_TIME, string $order_dir = self::ORDERDIR_DESC ) : array Get a page of the log for this subscription order as specified.
getLogs ( DataSift_User $user, integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_REQUEST_TIME, string $order_dir = self::ORDERDIR_ASC, string $id = false ) : array Page through recent push subscription log entries, specifying the sort order.
getName ( ) : string Get the subscription name.
getOutputType ( ) : string Get the output type.
getStatus ( ) : string Get the current status of this subscription. Make sure you call reload to get the latest data for this subscription first.
isDeleted ( ) : boolean Returns true if this subscription has been deleted.
listByPlaybackId ( DataSift_User $user, string $playback_id, integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_CREATED_AT, string $order_dir = self::ORDERDIR_ASC, boolean $include_finished = false, string $hash_type = false, string $hash = false ) : array Get a page of push subscriptions to the given stream playback_id, where each page contains up to per_page items. Results will be ordered according to the supplied ordering parameters.
listByStreamHash ( DataSift_User $user, string $hash, integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_CREATED_AT, string $order_dir = self::ORDERDIR_ASC, boolean $include_finished = false, string $hash_type = false ) : array Get a page of push subscriptions to the given stream hash, where each page contains up to per_page items. Results will be ordered according to the supplied ordering parameters.
listSubscriptions ( DataSift_User $user, integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_CREATED_AT, string $order_dir = self::ORDERDIR_ASC, boolean $include_finished = false, string $hash_type = false, string $hash = false ) : array Get a page of push subscriptions in the given user's account, where each page contains up to per_page items. Results will be ordered according to the supplied ordering parameters.
pause ( ) Pause this subscription.
pull ( integer $size = 20971520, string $cursor = false ) : array Pull data from this subscription.
reload ( ) Re-fetch this subscription from the API.
resume ( ) Resume this subscription.
save ( ) Save changes to the name and output_parameters of this subscription.
setOutputParam ( string $key, string $val ) Set an output parameter. Checks to see if the subscription has been deleted, and if not calls the base class to set the parameter.
stop ( ) Stop this subscription.

Защищенные методы

Метод Описание
init ( array $data ) Extract data from an array.
parseOutputParams ( array $params, string $prefix = '' ) : array Recursive method to parse the output_params as received from the API into the flattened, dot-notation used by the client libraries.

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

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

Construct a DataSift_Push_Subscription object from an array.
public __construct ( DataSift_User $user, array $data )
$user DataSift_User The user that owns this subscription.
$data array The JSON object containing the subscription details.

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

Delete this subscription.
public delete ( )

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

Get a push subscription by ID.
public static get ( DataSift_User $user, string $id ) : DataSift_Push_Subscription
$user DataSift_User The user who owns the subscription.
$id string The subscription ID.
Результат DataSift_Push_Subscription

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

Get the timestamp when this subscription was created.
public getCreatedAt ( ) : integer
Результат integer

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

Get the hash or playback ID to which this subscription is subscribed.
public getHash ( ) : string
Результат string

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

Get the hash type to which this subscription is subscribed.
public getHashType ( ) : string
Результат string

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

Get the subscription ID.
public getId ( ) : string
Результат string

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

Get the timestamp of the last push request.
public getLastRequest ( ) : integer
Результат integer

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

Get the timestamp of the last successful push request.
public getLastSuccess ( ) : integer
Результат integer

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

Get a page of the log for this subscription order as specified.
public getLog ( integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_REQUEST_TIME, string $order_dir = self::ORDERDIR_DESC ) : array
$page integer The page to get.
$per_page integer The number of entries per page.
$order_by string By which field to order the entries.
$order_dir string The direction of the sorting ("asc" or "desc").
Результат array

getLogs() публичный статический Метод

Page through recent push subscription log entries, specifying the sort order.
public static getLogs ( DataSift_User $user, integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_REQUEST_TIME, string $order_dir = self::ORDERDIR_ASC, string $id = false ) : array
$user DataSift_User The user making the request.
$page integer Which page to fetch.
$per_page integer Based on this page size.
$order_by string Which field to sort by.
$order_dir string In asc[ending] or desc[ending] order.
$id string Push subscription ID.
Результат array Of LogEntry objects.

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

Get the subscription name.
public getName ( ) : string
Результат string

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

Get the output type.
public getOutputType ( ) : string
Результат string

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

Get the current status of this subscription. Make sure you call reload to get the latest data for this subscription first.
public getStatus ( ) : string
Результат string

init() защищенный Метод

Extract data from an array.
protected init ( array $data )
$data array An array containing the subscription data.

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

Returns true if this subscription has been deleted.
public isDeleted ( ) : boolean
Результат boolean

listByPlaybackId() публичный статический Метод

Get a page of push subscriptions to the given stream playback_id, where each page contains up to per_page items. Results will be ordered according to the supplied ordering parameters.
public static listByPlaybackId ( DataSift_User $user, string $playback_id, integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_CREATED_AT, string $order_dir = self::ORDERDIR_ASC, boolean $include_finished = false, string $hash_type = false, string $hash = false ) : array
$user DataSift_User The user.
$playback_id string The Historics playback ID.
$page integer The page number to fetch.
$per_page integer The number of items per page.
$order_by string The field on which to order the results.
$order_dir string The direction of the ordering.
$include_finished boolean True to include subscriptions against
$hash_type string Stream hash or Historics playback id.
$hash string The stream hash. finished historic queries.
Результат array Of DataSift_Push_Subscription objects.

listByStreamHash() публичный статический Метод

Get a page of push subscriptions to the given stream hash, where each page contains up to per_page items. Results will be ordered according to the supplied ordering parameters.
public static listByStreamHash ( DataSift_User $user, string $hash, integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_CREATED_AT, string $order_dir = self::ORDERDIR_ASC, boolean $include_finished = false, string $hash_type = false ) : array
$user DataSift_User The user.
$hash string The stream hash.
$page integer The page number to fetch.
$per_page integer The number of items per page.
$order_by string The field on which to order the results.
$order_dir string The direction of the ordering.
$include_finished boolean True to include subscriptions against
$hash_type string Stream hash or Historics playback id. finished historic queries.
Результат array Of DataSift_Push_Subscription objects.

listSubscriptions() публичный статический Метод

Get a page of push subscriptions in the given user's account, where each page contains up to per_page items. Results will be ordered according to the supplied ordering parameters.
public static listSubscriptions ( DataSift_User $user, integer $page = 1, integer $per_page = 20, string $order_by = self::ORDERBY_CREATED_AT, string $order_dir = self::ORDERDIR_ASC, boolean $include_finished = false, string $hash_type = false, string $hash = false ) : array
$user DataSift_User The user.
$page integer The page number to fetch.
$per_page integer The number of items per page.
$order_by string The field on which to order the results.
$order_dir string The direction of the ordering.
$include_finished boolean True to include subscriptions against finished historic queries.
$hash_type string Stream hash or Historics playback id.
$hash string The stream hash or historics subscription id string.
Результат array Of DataSift_Push_Subscription objects.

parseOutputParams() защищенный Метод

Recursive method to parse the output_params as received from the API into the flattened, dot-notation used by the client libraries.
protected parseOutputParams ( array $params, string $prefix = '' ) : array
$params array The parameters to parse.
$prefix string The current key prefix.
Результат array

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

Pause this subscription.
public pause ( )

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

Pull data from this subscription.
public pull ( integer $size = 20971520, string $cursor = false ) : array
$size integer The maximum amount of data that DataSift will send in a single batch. Can be any value from 1 byte through 20971520 bytes.
$cursor string A pointer into the Push queue associated with the current Push subscription.
Результат array

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

Re-fetch this subscription from the API.
public reload ( )

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

Resume this subscription.
public resume ( )

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

Save changes to the name and output_parameters of this subscription.
public save ( )

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

Set an output parameter. Checks to see if the subscription has been deleted, and if not calls the base class to set the parameter.
public setOutputParam ( string $key, string $val )
$key string The output parameter to set.
$val string The value to which to set it.

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

Stop this subscription.
public stop ( )

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

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

The timestamp when this subscription was created.
protected $_created_at

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

True if this subscription has been deleted (becomes read-only).
protected $_deleted

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

The hash to which this subscription is subscribed.
protected $_hash

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

"stream" or "historic"
protected $_hash_type

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

The subscription ID.
protected $_id

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

The timestamp of the last push request.
protected $_last_request

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

The timestamp of the last successful push request.
protected $_last_success

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

The name of this subscription.
protected $_name

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

The current status of this subscription.
protected $_status