Skip to content

Commit

Permalink
update readme, changelog; bump version (#42)
Browse files Browse the repository at this point in the history
* update readme, changelog; bump version

* fix typo
  • Loading branch information
ayrat555 authored Feb 8, 2022
1 parent 4856fe9 commit 87cd5ea
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.0 (2022-02-08)

* Add optional async api - [#38](https://github.com/ayrat555/frankenstein/pull/38)

## 0.9.5 (2022-02-02)

* Disable unused features in the multipart crate - [#41](https://github.com/ayrat555/frankenstein/pull/41)
Expand Down
36 changes: 33 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,40 @@ Add this to your Cargo.toml

```toml
[dependencies]
frankenstein = "0.9"
frankenstein = "0.10"
```

## Features

### Default features

- `http-client` - a blocking HTTP client (uses `ureq`), it's the only default feature
- `telegram-trait` - a blocking API trait, it's included in the `http-client` feature. it may be useful for people who want to create a custom blocking client (for example, replacing an HTTP client)

### Optional features

- `async-http-client` - an async HTTP client, it uses `reqwest` and it's disabled by default
- `async-telegram-trait` - an async API trait, it's used in the `async-http-client`. it may be useful for people who want to create a custom async client

To use the async client add the following line to your `Cargo.toml` file:

```toml
frankenstein = { version = "0.10", default-features = false, features = ["async-http-client"] }
```

You can also disable all features:

```toml
frankenstein = { version = "0.10", default-features = false }
```

In this case the crate will ship only with telegram types


## Usage

Examples in this section use the blocking client (`frankenstein::Api`), but async examples would look the same (just replace `frankenstein::Api` with `frankenstein::AsyncApi`)

### Data structures

All objects described in the API docs have direct counterparts in the frankenstein. For example, in the docs there is [the user type](https://core.telegram.org/bots/api#user):
Expand Down Expand Up @@ -154,18 +183,19 @@ It has two variants:

### Documentation

Frankenstein implements all telegram bot api methods. To see which parameters you should pass, check [docs.rs](https://docs.rs/frankenstein/0.9.5/frankenstein/api/trait.TelegramApi.html#provided-methods)
Frankenstein implements all telegram bot api methods. To see which parameters you should pass, check [docs.rs](https://docs.rs/frankenstein/0.10.0/frankenstein/api/trait.TelegramApi.html#provided-methods)

You can check out a real world bot created using this library - [El Monitorro](https://github.com/ayrat555/el_monitorro). El Monitorro is a feed reader bot.


## Replacing the default http client

The library uses `ureq` http client by default, but it can be easily replaced with any http client of your choice:

1. `ureq` comes with a default feature (`impl`). So the feature should be disabled:

```toml
frankenstein = { version = "0.9", default-features = false }
frankenstein = { version = "0.10", default-features = false, features = ["telegram-trait"] }
```

2. Implement `TelegramApi` trait which requires two functions:
Expand Down

0 comments on commit 87cd5ea

Please sign in to comment.