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 60
__construct( TelegramRequest $request, ResponseInterface|PromiseInterface $response)

Gets the relevant data from the Http client.

Parameters

TelegramRequest $request
ResponseInterface|PromiseInterface $response

at line 85
TelegramRequest getRequest()

Return the original request that returned this response.

Return Value

TelegramRequest

at line 96
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 106
string getEndpoint()

Gets the Request Endpoint used to get the response.

Return Value

string

at line 116
string|null getAccessToken()

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

Return Value

string|null

at line 126
array getHeaders()

Return the HTTP headers for this response.

Return Value

array

at line 136
string getBody()

Return the raw body response.

Return Value

string

at line 146
array getDecodedBody()

Return the decoded body response.

Return Value

array

at line 156
bool isError()

Checks if response is an error.

Return Value

bool

at line 166
throwException()

Throws the exception.

at line 174
makeException()

Instantiates an exception to be thrown later.

at line 184
TelegramSDKException|null getThrownException()

Returns the exception that was thrown for this request.

Return Value

TelegramSDKException|null

at line 192
decodeBody()

Converts raw API response to proper decoded response.