Documentation

TokenUpdateResponse extends ApiResponse

Response from Authlete's /api/auth/token/update API.

Authlete's /api/auth/token/update API returns JSON which can be mapped to this class. The first step that a caller should take is to retrieve the value of the action response parameter (which can be obtained by getAction() method) from the response.

When the value returned from getAction() method is TokenUpdateAction::$INTERNAL_SERVER_ERROR, it means that an error occurred on Authlete side.

When the value returned from getAction() method is TokenUpdateAction::$BAD_REQUEST, it means that the request from the caller was wrong. For example, this happens when the accessToken request parameter is missing.

When the value returned from getAction() method is TokenUpdateAction::$FORBIDDEN, it means that the request from the caller was not allowed. For example, this happens when the access token identified by the accessToken request parameter does not belong to the service identified by the API key used for the API call.

When the value returned from getAction() method is TokenUpdateAction::$NOT_FOUND, it means that the specified access token does not exist.

When the value returned from getAction() method is TokenUpdateAction::$OK, it means that the access token was updated successfully.

Table of Contents

copyFromArray()  : mixed
Copy the content of the given array into this object.
copyToArray()  : mixed
Copy the content of this object into the given array.
fromArray()  : static
Convert an array into an instance of this class.
fromJson()  : static
Convert a JSON string into an instance of this class.
getAccessToken()  : string
Get the access token which was specified by the "accessToken" request parameter of the API call.
getAccessTokenExpiresAt()  : int|string
Get the date at which the access token will expire.
getAction()  : TokenUpdateAction
Get the code which indicates how the response should be interpreted.
getProperties()  : array<string|int, Property>
Get the properties associated with the access token.
getResultCode()  : string
Get the code of the result of an Authlete API call.
getResultMessage()  : string
Get the message of the result of an Authlete API call.
getScopes()  : array<string|int, string>
Get the scopes associated with the access token.
setAccessToken()  : TokenUpdateResponse
Set the access token which was specified by the "accessToken" request parameter of the API call.
setAccessTokenExpiresAt()  : int|string
Set the date at which the access token will expire.
setAction()  : TokenUpdateResponse
Set the code which indicates how the response should be interpreted.
setProperties()  : TokenUpdateResponse
Set the properties associated with the access token.
setResultCode()  : ApiResponse
Set the code of the result of an Authlete API call.
setResultMessage()  : ApiResponse
Set the message of the result of an Authlete API call.
setScopes()  : TokenUpdateResponse
Set the scopes associated with the access token.
toArray()  : array<string|int, mixed>
Convert this object into an array.
toJson()  : string
Convert this object into a JSON string.

Methods

copyFromArray()

Copy the content of the given array into this object.

public copyFromArray(array<string|int, mixed> &$array) : mixed
Parameters
$array : array<string|int, mixed>
Return values
mixed

copyToArray()

Copy the content of this object into the given array.

public copyToArray(array<string|int, mixed> &$array) : mixed
Parameters
$array : array<string|int, mixed>
Return values
mixed

fromArray()

Convert an array into an instance of this class.

public static fromArray([array<string|int, mixed> $array = null ]) : static

This static function returns a new instance of this class. If $array is null, null is returned.

Parameters
$array : array<string|int, mixed> = null

An array

Return values
static

An instance of this class.

fromJson()

Convert a JSON string into an instance of this class.

public static fromJson(string $json) : static

This static function returns a new instance of this class. If $json is null or the type of $json is not string, null is returned.

Parameters
$json : string

A JSON string.

Return values
static

An instance of this class.

getAccessToken()

Get the access token which was specified by the "accessToken" request parameter of the API call.

public getAccessToken() : string
Return values
string

The access token.

getAccessTokenExpiresAt()

Get the date at which the access token will expire.

public getAccessTokenExpiresAt() : int|string

The value is expressed in milliseconds since the Unix epoch (1970-Jan-1).

Return values
int|string

The date at which the access token will expire.

getProperties()

Get the properties associated with the access token.

public getProperties() : array<string|int, Property>
Return values
array<string|int, Property>

The properties associated with the access token.

getResultCode()

Get the code of the result of an Authlete API call.

public getResultCode() : string
Return values
string

The result code.

getResultMessage()

Get the message of the result of an Authlete API call.

public getResultMessage() : string
Return values
string

The result message.

getScopes()

Get the scopes associated with the access token.

public getScopes() : array<string|int, string>
Return values
array<string|int, string>

The scopes associated with the access token.

setAccessToken()

Set the access token which was specified by the "accessToken" request parameter of the API call.

public setAccessToken(string $accessToken) : TokenUpdateResponse
Parameters
$accessToken : string

The access token.

Return values
TokenUpdateResponse

$this object.

setAccessTokenExpiresAt()

Set the date at which the access token will expire.

public setAccessTokenExpiresAt(int|string $expiresAt) : int|string
Parameters
$expiresAt : int|string

The date at which the access token will expire. The value should be expressed in milliseconds since the Unix epoch (1970-Jan-1).

Return values
int|string

$this object.

setResultCode()

Set the code of the result of an Authlete API call.

public setResultCode(string $resultCode) : ApiResponse
Parameters
$resultCode : string

The result code.

Return values
ApiResponse

$this object.

setResultMessage()

Set the message of the result of an Authlete API call.

public setResultMessage(string $resultMessage) : ApiResponse
Parameters
$resultMessage : string

The result message.

Return values
ApiResponse

$this object.

setScopes()

Set the scopes associated with the access token.

public setScopes([array<string|int, string> $scopes = null ]) : TokenUpdateResponse
Parameters
$scopes : array<string|int, string> = null

The scopes associated with the access token.

Return values
TokenUpdateResponse

$this object.

toArray()

Convert this object into an array.

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array.

toJson()

Convert this object into a JSON string.

public toJson(int $options) : string
Parameters
$options : int

Options passed to json_encode(). This parameter is optional and its default value is 0.

Return values
string

A JSON string.

Search results