PHP Класс Telegram\Bot\TelegramResponse

Handles the response from Telegram API.
Показать файл Открыть проект Примеры использования класса

Защищенные свойства (Protected)

Свойство Тип Описание
$body The raw body of the response from API request.
$decodedBody The decoded body of the API response.
$endPoint API Endpoint used to make the request.
$headers The headers returned from API request.
$httpStatusCode The HTTP status code response from API.
$request The original request that returned this response.
$thrownException The exception thrown by this request.

Открытые методы

Метод Описание
__construct ( Telegram\Bot\TelegramRequest $request, Psr\Http\Message\ResponseInterface | GuzzleHttp\Promise\PromiseInterface $response ) Gets the relevant data from the Http client.
decodeBody ( ) Converts raw API response to proper decoded response.
getAccessToken ( ) : string | null Return the bot access token that was used for this request.
getBody ( ) : string Return the raw body response.
getDecodedBody ( ) : array Return the decoded body response.
getEndpoint ( ) : string Gets the Request Endpoint used to get the response.
getHeaders ( ) : array Return the HTTP headers for this response.
getHttpStatusCode ( ) : null | integer Gets the HTTP status code.
getRequest ( ) : Telegram\Bot\TelegramRequest Return the original request that returned this response.
getResult ( ) : mixed Helper function to return the payload of a successful response.
getThrownException ( ) : Telegram\Bot\Exceptions\TelegramSDKException Returns the exception that was thrown for this request.
isError ( ) : boolean Checks if response is an error.
makeException ( ) Instantiates an exception to be thrown later.
throwException ( ) Throws the exception.

Описание методов

__construct() публичный Метод

Gets the relevant data from the Http client.
public __construct ( Telegram\Bot\TelegramRequest $request, Psr\Http\Message\ResponseInterface | GuzzleHttp\Promise\PromiseInterface $response )
$request Telegram\Bot\TelegramRequest
$response Psr\Http\Message\ResponseInterface | GuzzleHttp\Promise\PromiseInterface

decodeBody() публичный Метод

Converts raw API response to proper decoded response.
public decodeBody ( )

getAccessToken() публичный Метод

Return the bot access token that was used for this request.
public getAccessToken ( ) : string | null
Результат string | null

getBody() публичный Метод

Return the raw body response.
public getBody ( ) : string
Результат string

getDecodedBody() публичный Метод

Return the decoded body response.
public getDecodedBody ( ) : array
Результат array

getEndpoint() публичный Метод

Gets the Request Endpoint used to get the response.
public getEndpoint ( ) : string
Результат string

getHeaders() публичный Метод

Return the HTTP headers for this response.
public getHeaders ( ) : array
Результат array

getHttpStatusCode() публичный Метод

Returns NULL if the request was asynchronous since we are not waiting for the response.
public getHttpStatusCode ( ) : null | integer
Результат null | integer

getRequest() публичный Метод

Return the original request that returned this response.
public getRequest ( ) : Telegram\Bot\TelegramRequest
Результат Telegram\Bot\TelegramRequest

getResult() публичный Метод

Helper function to return the payload of a successful response.
public getResult ( ) : mixed
Результат mixed

getThrownException() публичный Метод

Returns the exception that was thrown for this request.
public getThrownException ( ) : Telegram\Bot\Exceptions\TelegramSDKException
Результат Telegram\Bot\Exceptions\TelegramSDKException

isError() публичный Метод

Checks if response is an error.
public isError ( ) : boolean
Результат boolean

makeException() публичный Метод

Instantiates an exception to be thrown later.
public makeException ( )

throwException() публичный Метод

Throws the exception.
public throwException ( )

Описание свойств

$body защищенное свойство

The raw body of the response from API request.
protected $body

$decodedBody защищенное свойство

The decoded body of the API response.
protected $decodedBody

$endPoint защищенное свойство

API Endpoint used to make the request.
protected $endPoint

$headers защищенное свойство

The headers returned from API request.
protected $headers

$httpStatusCode защищенное свойство

The HTTP status code response from API.
protected $httpStatusCode

$request защищенное свойство

The original request that returned this response.
protected $request

$thrownException защищенное свойство

The exception thrown by this request.
protected $thrownException