Skip to content

WatsonCredential

Michael edited this page Mar 18, 2017 · 2 revisions

The common class for constructing parameters to be sent to Watson services.

class WatsonCredential

Used to initialize a WatsonCredential instance from the parameters.

function __construct($username = NULL, $password = NULL);
Parameter Description
username Username for basic authentication
password Password for basic authentication

An alternative way of initializing WatsonCredential instance.

final public static function initWithCredentials($username, $password);
Parameter Description
username Username for basic authentication
password Password for basic authentication

Use token provider to initialize a WatsonCredential instance, the token provider must implement TokenProviderInterface interface.

final public static function initWithTokenProvider(TokenProviderInterface $token_provider);
Parameter Description
token_provider An implementation of TokenProviderInterface

Get username.

public function getUsername();

Set username to be authenticated with Watson services.

public function setUsername($val);

Get password.

public function getPassword();

Set password.

public function setPassword($val);

Get token provider instance.

public function getTokenProvider();

Set token provider instance.

public function setTokenProvider(TokenProviderInterface $val);

Get token string.

public function getToken();

Set token string.

public function setToken($token);
Clone this wiki locally