Request
in package
FinalYes
One prepared Bot API call: the method name, the absolute URL, the encoded body, the headers, and the {@see Deferred} that {@see Http} settles with the unwrapped `result`.
The Bot API is a flat RPC surface - every method call is a POST to
/bot<token>/<method> - so a request carries no path of its own beyond the
method name. File downloads (GET /file/bot<token>/<file_path>) reuse the same
object with an explicit verb.
Tags
Table of Contents
Properties
- $attempts : int
- $content : string
- $deferred : Deferred
- $endpoint : string
- $headers : array<string|int, mixed>
- $method : string
- $url : string
Methods
- __construct() : mixed
- __toString() : string
- bumpAttempts() : int
- getAttempts() : int
- getContent() : string
- getDeferred() : Deferred
- getEndpoint() : string
- The Bot API method name, e.g. `sendMessage`.
- getHeaders() : array<string, string>
- getMethod() : string
- `POST` for every method call; `GET` for a file download.
- getUrl() : string
- The absolute URL, token included.
- setHeader() : void
Properties
$attempts
private
int
$attempts
= 0
$content read-only
private
string
$content
= ''
$deferred read-only
private
Deferred
$deferred
$endpoint read-only
private
string
$endpoint
$headers
private
array<string|int, mixed>
$headers
= []
$method read-only
private
string
$method
= 'POST'
$url read-only
private
string
$url
Methods
__construct()
public
__construct(Deferred $deferred, string $endpoint, string $url[, string $content = '' ][, array<string, string> $headers = [] ][, string $method = 'POST' ]) : mixed
Parameters
- $deferred : Deferred
- $endpoint : string
-
The Bot API method name, or the file path for a download.
- $url : string
- $content : string = ''
- $headers : array<string, string> = []
- $method : string = 'POST'
__toString()
public
__toString() : string
Return values
stringbumpAttempts()
public
bumpAttempts() : int
Return values
intgetAttempts()
public
getAttempts() : int
Return values
intgetContent()
public
getContent() : string
Return values
stringgetDeferred()
public
getDeferred() : Deferred
Return values
DeferredgetEndpoint()
The Bot API method name, e.g. `sendMessage`.
public
getEndpoint() : string
Return values
stringgetHeaders()
public
getHeaders() : array<string, string>
Return values
array<string, string>getMethod()
`POST` for every method call; `GET` for a file download.
public
getMethod() : string
Return values
stringgetUrl()
The absolute URL, token included.
public
getUrl() : string
Return values
stringsetHeader()
public
setHeader(string $name, string $value) : void
Parameters
- $name : string
- $value : string