requestForm method

Future<Map> requestForm(
  1. String method, {
  2. Map parameters = const {},
  3. bool is_form = false,
  4. String? tokenBot,
  5. String? urlApi,
  6. String? clientType,
  7. void onUploadProgress(
    1. int bytesCount,
    2. int totalBytes
    )?,
  8. bool isAutoExtendMessage = false,
  9. bool isThrowOnError = true,
  10. Client? httpClient,
})

call api latest bot api with upload file example:

requestForm("sendDocument",  parameters: {
  "chat_id": 123456,
  "document": tg.file("./doc.json"),
  "parse_mode": "html"
});

Implementation

Future<Map> requestForm(
  String method, {
  Map parameters = const {},
  bool is_form = false,
  String? tokenBot,
  String? urlApi,
  String? clientType,
  void Function(int bytesCount, int totalBytes)? onUploadProgress,
  bool isAutoExtendMessage = false,
  bool isThrowOnError = true,
  Client? httpClient,
}) async {
  tokenBot ??= token_bot;
  return await request(
    method,
    parameters: parameters,
    is_form: true,
    tokenBot: tokenBot,
    urlApi: urlApi,
    clientType: clientType,
    onUploadProgress: onUploadProgress,
    isAutoExtendMessage: isAutoExtendMessage,
    isThrowOnError: isThrowOnError,
    httpClient: httpClient,
  );
}