PHP Class TTools\TTools

Afficher le fichier Open project: ttools/ttools Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( array $config )
getAccessTokens ( string $request_token, string $request_secret, string $oauth_verifier ) : array Makes a Request to get the user access tokens
getAuthorizeUrl ( array $params = [] ) : array Gets the authorization url.
getLastReqInfo ( ) : array
getUserTokens ( ) : array Gets the current user tokens
handleError ( OAuthResponse $response ) : array
makeRequest ( $url, array $params = [], string $method = 'GET', boolean $multipart = false ) : array | mixed
setUserTokens ( string $at, string $ats ) Sets the current user tokens
uploadMedia ( string $image ) : array | mixed

Private Methods

Méthode Description
OAuthRequest ( $url, array $params = [], string $method = 'GET', null $callback = null, boolean $multipart = false ) : array | OAuthResponse
parseResponse ( $string ) : array

Method Details

__construct() public méthode

public __construct ( array $config )
$config array

getAccessTokens() public méthode

Makes a Request to get the user access tokens
public getAccessTokens ( string $request_token, string $request_secret, string $oauth_verifier ) : array
$request_token string
$request_secret string
$oauth_verifier string
Résultat array Returns an array with the user data and tokens, or an error array with code and message

getAuthorizeUrl() public méthode

Gets the authorization url.
public getAuthorizeUrl ( array $params = [] ) : array
$params array Custom parameters passed to the OAuth request
Résultat array If successful, returns an array with 'auth_url', 'secret' and 'token'; otherwise, returns an array with error code and message.

getLastReqInfo() public méthode

public getLastReqInfo ( ) : array
Résultat array

getUserTokens() public méthode

Gets the current user tokens
public getUserTokens ( ) : array
Résultat array Returns an array where the first position is the Access Token and the second position is the Access Token Secret

handleError() public méthode

public handleError ( OAuthResponse $response ) : array
$response OAuthResponse
Résultat array

makeRequest() public méthode

public makeRequest ( $url, array $params = [], string $method = 'GET', boolean $multipart = false ) : array | mixed
$url
$params array
$method string
$multipart boolean
Résultat array | mixed

setUserTokens() public méthode

Sets the current user tokens
public setUserTokens ( string $at, string $ats )
$at string Access Token
$ats string Access Token Secret

uploadMedia() public méthode

public uploadMedia ( string $image ) : array | mixed
$image string Path to the image
Résultat array | mixed