Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 497 Bytes

custom-requests.md

File metadata and controls

21 lines (16 loc) · 497 Bytes

Custom requests

You can make custom requests to API using the call() method and CustomMethod object:

use Vjik\TelegramBot\Api\CustomMethod;

/** 
 * @var \Vjik\TelegramBot\Api\TelegramBotApi $api 
 */

$method = new CustomMethod(
    apiMethod: 'getChat',
    data: ['chat_id' => '@sergei_predvoditelev'],
    resultType: ChatFullInfo::class,
    httpMethod: HttpMethod::GET,
);

// Result is an object of `Vjik\TelegramBot\Api\Type\ChatFullInfo`
$result = $api->call($method);