class TelegramResponse (View source)

Class TelegramResponse.

Handles the response from Telegram API.

Methods

__construct( TelegramRequest $request, ResponseInterface|PromiseInterface $response)

Gets the relevant data from the Http client.

getRequest()

Return the original request that returned this response.

null|int
getHttpStatusCode()

Gets the HTTP status code.

string
getEndpoint()

Gets the Request Endpoint used to get the response.

string|null
getAccessToken()

Return the bot access token that was used for this request.

array
getHeaders()

Return the HTTP headers for this response.

string
getBody()

Return the raw body response.

array
getDecodedBody()

Return the decoded body response.

bool
isError()

Checks if response is an error.

throwException()

Throws the exception.

makeException()

Instantiates an exception to be thrown later.

getThrownException()

Returns the exception that was thrown for this request.

decodeBody()

Converts raw API response to proper decoded response.

Details

at line 58
__construct( TelegramRequest $request, ResponseInterface|PromiseInterface $response)

Gets the relevant data from the Http client.

Parameters

TelegramRequest $request
ResponseInterface|PromiseInterface $response

at line 83
TelegramRequest getRequest()

Return the original request that returned this response.

Return Value

TelegramRequest

at line 94
null|int getHttpStatusCode()

Gets the HTTP status code.

Returns NULL if the request was asynchronous since we are not waiting for the response.

Return Value

null|int

at line 104
string getEndpoint()

Gets the Request Endpoint used to get the response.

Return Value

string

at line 114
string|null getAccessToken()

Return the bot access token that was used for this request.

Return Value

string|null

at line 124
array getHeaders()

Return the HTTP headers for this response.

Return Value

array

at line 134
string getBody()

Return the raw body response.

Return Value

string

at line 144
array getDecodedBody()

Return the decoded body response.

Return Value

array

at line 154
bool isError()

Checks if response is an error.

Return Value

bool

at line 164
throwException()

Throws the exception.

at line 172
makeException()

Instantiates an exception to be thrown later.

at line 182
TelegramSDKException getThrownException()

Returns the exception that was thrown for this request.

Return Value

TelegramSDKException

at line 190
decodeBody()

Converts raw API response to proper decoded response.