Commit graph

22 commits

Author SHA1 Message Date
liushuyu
414ce2c3a6
telegram_response: fix issue with handling ...
... `retry_after` and `migrate_to_chat_id`
2021-06-19 03:16:30 -06:00
Waffle
7c18750a8f Remove dbg! print 2021-02-17 14:23:13 +03:00
Waffle
8abf3863e5 Future proof multipart requests 2021-02-16 17:16:20 +03:00
Waffle
55c02e3311 Use edition-2018 style modules
Use `module_name.rs` instead of `module_name/mod.rs`.

Pros:
- It's easier to find the module file (especially for modules with lots of
  submodules like `types`)
- Module file name is not 'magical'
2021-01-23 15:56:22 +03:00
Waffle
2ee7bb22a1 Move client_from_env from root into net 2021-01-13 16:14:02 +03:00
Waffle
56d546215a fix clippy: impl From instead of Into 2021-01-07 16:01:46 +03:00
Waffle
71d90002ce update dependencies 2021-01-07 15:58:51 +03:00
Waffle
50d3d67f93 fmt 2020-12-28 19:06:46 +03:00
Temirkhan Myrzamadi
f5d9cb1a73 Documentation gardening 2020-12-23 22:24:31 +06:00
Waffle
290258cd1f Small fixes: fmt & import in test 2020-12-12 17:59:45 +03:00
Waffle
445c42b585 Refactor file downloading
- Make `net` module public
- Move `Bot::download_file{,_stream}` methods to a new `Download` trait
  - Add `download_forward` macro to forward `Download` impls (priv)
  - Impl `Download` for all bot adaptors & the `Bot` itself
- Change return type of `download_file_stream` — return `Stream<Result<Bytes>>``,
  instead of `Future<Result<Stream<Result<Bytes>>>>``
- Add `api_url` param to standalone versions of `download_file{,_stream}`
- Make `net::{TELEGRAM_API_URL, download_file{,_stream}}` pub
- Small documentation changes
2020-12-12 15:52:47 +03:00
Waffle
84ac0212e8 Remove legacy code 2020-12-06 16:31:28 +03:00
Waffle
17b44db578 Add ApiUrl
Add `ApiUrl` and also use `Url` instead of `&str` for urls to clean code
2020-11-17 22:38:30 +03:00
Waffle
fa0e86c547 Add internal ability to change API url
Recently, telegram has published [Telegram Bot API Server] - HTTP API <->
MTPROTO proxy which is used internally by telegram. Now it's possible to run
the server locally.

However currently it's not possible to use teloxide with such local server,
because API url is hardcoded into teloxide.

This commit makes _internall_ changes to allow setting the API url. It doesn't
yet allow to set the url from user code (i.e.: no changes in public API), in my
opinion such additions are blocked on some bot refactorings.

`Bot::api_url` is made `Option<Arc<str>>` to minimize costs in case of 'default
url' (probably the most common case).

Progress of this issue is tracked in https://github.com/teloxide/teloxide/issues/317

[Telegram Bot API Server]: https://github.com/tdlib/telegram-bot-api
2020-11-16 14:14:00 +03:00
Temirkhan Myrzamadi
2e88ba3002
Merge pull request #19 from teloxide/fix_telegram_response
Fix telegram response
2020-10-25 00:19:45 +06:00
Waffle
fe9314f87c serde-rename TelegramResponse::reponse to result 2020-10-24 09:23:28 +03:00
Waffle
d2b97b2120 Use #[serde(field_identifier)] instead of hand-made workarounds
This attribute doesn't seem to be documented btw...
2020-10-22 00:42:06 +03:00
Waffle
9bf8c02c9d doc & feature fixes
- Remove `unstable-stream` feature
- Doc fixes
2020-10-21 05:17:35 +03:00
Waffle
193dd69265 Cleanup errors 2020-10-20 15:07:10 +03:00
Waffle
07a403c279 implement default Bot's {Json,Multipart}Request 2020-09-19 20:30:36 +03:00
Waffle
5afe72b368 rewrite requests to use serde-multipart
Rewrite multipart requests to use serde_multipart instead of FromBuilder
2020-08-16 00:21:55 +03:00
Waffle
a70cb4e008 Move core code from teloxide 2020-08-12 19:39:40 +03:00