class TelegramRequest (View source)

Class TelegramRequest

Builds Telegram Bot API Request Entity.

Methods

__construct( string|null $accessToken = null, string|null $method = null, string|null $endpoint = null, array $params = array(), bool $isAsyncRequest = false)

Creates a new Request entity.

setAccessToken( string $accessToken)

Set the bot access token for this request.

string|null
getAccessToken()

Return the bot access token for this request.

validateAccessToken()

Validate that bot access token exists for this request.

setMethod( string $method)

Set the HTTP method for this request.

string
getMethod()

Return the HTTP method for this request.

validateMethod()

Validate that the HTTP method is set.

setEndpoint( string $endpoint)

Set the endpoint for this request.

string
getEndpoint()

Return the API Endpoint for this request.

setParams( array $params = array())

Set the params for this request.

array
getParams()

Return the params for this request.

setHeaders( array $headers)

Set the headers for this request.

array
getHeaders()

Return the headers for this request.

setAsyncRequest($isAsyncRequest)

Make this request asynchronous (non-blocking).

bool
isAsyncRequest()

Check if this is an asynchronous request (non-blocking).

array
getPostParams()

Only return params on POST requests.

array
getDefaultHeaders()

The default headers used with every request.

Details

at line 62
__construct( string|null $accessToken = null, string|null $method = null, string|null $endpoint = null, array $params = array(), bool $isAsyncRequest = false)

Creates a new Request entity.

Parameters

string|null $accessToken
string|null $method
string|null $endpoint
array $params
bool $isAsyncRequest

at line 83
TelegramRequest setAccessToken( string $accessToken)

Set the bot access token for this request.

Parameters

string $accessToken

Return Value

TelegramRequest

at line 95
string|null getAccessToken()

Return the bot access token for this request.

Return Value

string|null

at line 105
validateAccessToken()

Validate that bot access token exists for this request.

at line 120
TelegramRequest setMethod( string $method)

Set the HTTP method for this request.

Parameters

string $method

Return Value

TelegramRequest

at line 132
string getMethod()

Return the HTTP method for this request.

Return Value

string

at line 142
validateMethod()

Validate that the HTTP method is set.

at line 160
TelegramRequest setEndpoint( string $endpoint)

Set the endpoint for this request.

Parameters

string $endpoint

Return Value

TelegramRequest

at line 172
string getEndpoint()

Return the API Endpoint for this request.

Return Value

string

at line 184
TelegramRequest setParams( array $params = array())

Set the params for this request.

Parameters

array $params

Return Value

TelegramRequest

at line 196
array getParams()

Return the params for this request.

Return Value

array

at line 208
TelegramRequest setHeaders( array $headers)

Set the headers for this request.

Parameters

array $headers

Return Value

TelegramRequest

at line 220
array getHeaders()

Return the headers for this request.

Return Value

array

at line 234
TelegramRequest setAsyncRequest($isAsyncRequest)

Make this request asynchronous (non-blocking).

Parameters

$isAsyncRequest

Return Value

TelegramRequest

at line 246
bool isAsyncRequest()

Check if this is an asynchronous request (non-blocking).

Return Value

bool

at line 256
array getPostParams()

Only return params on POST requests.

Return Value

array

at line 270
array getDefaultHeaders()

The default headers used with every request.

Return Value

array