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, int $timeOut = 60, int $connectTimeOut = 10)

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.

int
getTimeOut()

No description

$this
setTimeOut( int $timeOut)

No description

int
getConnectTimeOut()

No description

$this
setConnectTimeOut( int $connectTimeOut)

No description

Details

at line 76
__construct( string|null $accessToken = null, string|null $method = null, string|null $endpoint = null, array $params = array(), bool $isAsyncRequest = false, int $timeOut = 60, int $connectTimeOut = 10)

Creates a new Request entity.

Parameters

string|null $accessToken
string|null $method
string|null $endpoint
array $params
bool $isAsyncRequest
int $timeOut
int $connectTimeOut

at line 101
TelegramRequest setAccessToken( string $accessToken)

Set the bot access token for this request.

Parameters

string $accessToken

Return Value

TelegramRequest

at line 113
string|null getAccessToken()

Return the bot access token for this request.

Return Value

string|null

at line 123
validateAccessToken()

Validate that bot access token exists for this request.

at line 138
TelegramRequest setMethod( string $method)

Set the HTTP method for this request.

Parameters

string $method

Return Value

TelegramRequest

at line 150
string getMethod()

Return the HTTP method for this request.

Return Value

string

at line 160
validateMethod()

Validate that the HTTP method is set.

at line 178
TelegramRequest setEndpoint( string $endpoint)

Set the endpoint for this request.

Parameters

string $endpoint

Return Value

TelegramRequest

at line 190
string getEndpoint()

Return the API Endpoint for this request.

Return Value

string

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

Set the params for this request.

Parameters

array $params

Return Value

TelegramRequest

at line 214
array getParams()

Return the params for this request.

Return Value

array

at line 226
TelegramRequest setHeaders( array $headers)

Set the headers for this request.

Parameters

array $headers

Return Value

TelegramRequest

at line 238
array getHeaders()

Return the headers for this request.

Return Value

array

at line 252
TelegramRequest setAsyncRequest($isAsyncRequest)

Make this request asynchronous (non-blocking).

Parameters

$isAsyncRequest

Return Value

TelegramRequest

at line 264
bool isAsyncRequest()

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

Return Value

bool

at line 274
array getPostParams()

Only return params on POST requests.

Return Value

array

at line 288
array getDefaultHeaders()

The default headers used with every request.

Return Value

array

at line 298
int getTimeOut()

Return Value

int

at line 308
$this setTimeOut( int $timeOut)

Parameters

int $timeOut

Return Value

$this

at line 318
int getConnectTimeOut()

Return Value

int

at line 328
$this setConnectTimeOut( int $connectTimeOut)

Parameters

int $connectTimeOut

Return Value

$this