PHP Class DataSift_Source

Author: Christopher Hoult ([email protected])
Show file Open project: datasift/datasift-php Class Usage Examples

Public Methods

Method Description
__construct ( DataSift_User $user, array $data = [] ) Constructs a new DataSift_Source
addAuth ( array $auth, $validate = false ) Adds authorization credentials for this DataSift_Source using the auth/add
addResource ( array $resources, $validate = false ) Adds resources for this DataSift_Source using the resource/add
delete ( ) : DataSift_Source Delete this Source.
fromArray ( array $data ) : DataSift_Source Hydrates this Source from an array of API responses
get ( DataSift_User $user, string $id ) : DataSift_Source Gets a single DataSift_Source object by ID
getAuth ( ) : array Sets the authorization credentials for this DataSift_Source
getCreatedAt ( ) : integer Gets the created-at timestamp
getId ( ) : string Gets this DataSift_Source's unique identifier
getLogs ( integer $page = 1, integer $perPage = 20 ) : array Returns the logs for this source
getName ( ) : string Gets the name of this DataSift_Source
getParameters ( ) : array Gets the parameters for this DataSift_Source
getResources ( ) : array Gets the resources for this DataSift_Source
getSourceType ( ) : string Gets the type of this DataSift_Source
getStatus ( ) : string Gets the status of this DataSift_Source
getUser ( ) : DataSift_User Gets the user this DataSift_Source belongs to
getValidate ( ) : boolean Ssets the validate status
listSources ( DataSift_User $user, integer $page = 1, integer $perPage = 25, string | false $sourceType = false ) : array Gets a page of Sources where each page contains up to $perPage items.
removeAuth ( array $authIds ) Removes authorization credentials for this DataSift_Source using the auth/remove
removeResource ( array $resourceIds ) Removes resources for this DataSift_Source using the resource/remove
save ( boolean $validate = true ) : DataSift_Source Save this Source
setAuth ( array $auth ) Sets the authorization credentials for this DataSift_Source
setCreatedAt ( integer $createdAt ) Sets the created-at timestamp
setId ( string $id ) Sets this DataSift_Source's unique identifier
setName ( string $name ) Sets the name of this DataSift_Source
setParameters ( array $parameters ) Sets the parameters for this DataSift_Source, appropriate to the Source type
setResources ( array $resources ) Sets the resources for this DataSift_Source
setSourceType ( string $sourceType ) Sets the type of this DataSift_Source
setStatus ( string $status ) Sets the status of this DataSift_Source
setUser ( DataSift_User $user ) Sets the user this DataSift_Source belongs to
setValidate ( boolean $validate ) Ssets the validate status
start ( ) : DataSift_Source Start this Source
stop ( ) : DataSift_Source Stop this Source
toArray ( ) : array Converts this Source to an array suitable for transmission to the API

Method Details

__construct() public method

Constructs a new DataSift_Source
public __construct ( DataSift_User $user, array $data = [] )
$user DataSift_User
$data array

addAuth() public method

Adds authorization credentials for this DataSift_Source using the auth/add
public addAuth ( array $auth, $validate = false )
$auth array An array of authorization credentials, appropriate to the Source type

addResource() public method

Adds resources for this DataSift_Source using the resource/add
public addResource ( array $resources, $validate = false )
$resources array An array of authorization credentials, appropriate to the Source type

delete() public method

Delete this Source.
public delete ( ) : DataSift_Source
return DataSift_Source

fromArray() public method

Hydrates this Source from an array of API responses
public fromArray ( array $data ) : DataSift_Source
$data array
return DataSift_Source

get() public static method

Gets a single DataSift_Source object by ID
public static get ( DataSift_User $user, string $id ) : DataSift_Source
$user DataSift_User The user making the request.
$id string The id of the Source to fetch
return DataSift_Source

getAuth() public method

Sets the authorization credentials for this DataSift_Source
public getAuth ( ) : array
return array

getCreatedAt() public method

Gets the created-at timestamp
public getCreatedAt ( ) : integer
return integer A UNIX timestamp

getId() public method

Gets this DataSift_Source's unique identifier
public getId ( ) : string
return string

getLogs() public method

Returns the logs for this source
public getLogs ( integer $page = 1, integer $perPage = 20 ) : array
$page integer
$perPage integer
return array

getName() public method

Gets the name of this DataSift_Source
public getName ( ) : string
return string

getParameters() public method

Gets the parameters for this DataSift_Source
public getParameters ( ) : array
return array

getResources() public method

Gets the resources for this DataSift_Source
public getResources ( ) : array
return array

getSourceType() public method

Gets the type of this DataSift_Source
public getSourceType ( ) : string
return string

getStatus() public method

Gets the status of this DataSift_Source
public getStatus ( ) : string
return string

getUser() public method

Gets the user this DataSift_Source belongs to
public getUser ( ) : DataSift_User
return DataSift_User

getValidate() public method

Ssets the validate status
public getValidate ( ) : boolean
return boolean

listSources() public static method

Gets a page of Sources where each page contains up to $perPage items.
public static listSources ( DataSift_User $user, integer $page = 1, integer $perPage = 25, string | false $sourceType = false ) : array
$user DataSift_User The user making the request.
$page integer The page number to fetch.
$perPage integer The number of items per page.
$sourceType string | false The type of source to filter by; false for no filter
return array An array containing the number of sources returned in 'count' and a list of DataSift_Sources in 'sources'

removeAuth() public method

Removes authorization credentials for this DataSift_Source using the auth/remove
public removeAuth ( array $authIds )
$authIds array An array of authorization IDs to be removed

removeResource() public method

Removes resources for this DataSift_Source using the resource/remove
public removeResource ( array $resourceIds )
$resourceIds array An array of resource IDs to be removed

save() public method

Save this Source
public save ( boolean $validate = true ) : DataSift_Source
$validate boolean
return DataSift_Source

setAuth() public method

Sets the authorization credentials for this DataSift_Source
public setAuth ( array $auth )
$auth array An array of authorization credentials, appropriate to the Source type

setCreatedAt() public method

Sets the created-at timestamp
public setCreatedAt ( integer $createdAt )
$createdAt integer

setId() public method

Sets this DataSift_Source's unique identifier
public setId ( string $id )
$id string

setName() public method

Sets the name of this DataSift_Source
public setName ( string $name )
$name string

setParameters() public method

Sets the parameters for this DataSift_Source, appropriate to the Source type
public setParameters ( array $parameters )
$parameters array

setResources() public method

Sets the resources for this DataSift_Source
public setResources ( array $resources )
$resources array An array of resource definitions, appropriate to the Source type

setSourceType() public method

Sets the type of this DataSift_Source
public setSourceType ( string $sourceType )
$sourceType string

setStatus() public method

Sets the status of this DataSift_Source
public setStatus ( string $status )
$status string A status from one of the allowed Source statuses

setUser() public method

Sets the user this DataSift_Source belongs to
public setUser ( DataSift_User $user )
$user DataSift_User

setValidate() public method

Ssets the validate status
public setValidate ( boolean $validate )
$validate boolean

start() public method

Start this Source
public start ( ) : DataSift_Source
return DataSift_Source

stop() public method

Stop this Source
public stop ( ) : DataSift_Source
return DataSift_Source

toArray() public method

Converts this Source to an array suitable for transmission to the API
public toArray ( ) : array
return array