Skip to content

Commit

Permalink
update README and CHANGELOG
Browse files Browse the repository at this point in the history
  • Loading branch information
adwhit committed Jan 11, 2020
1 parent 5c047e0 commit 16ea7a1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 29 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog for egg-mode

## [0.14.0] - Unreleased

### Changed
- Updated to use `std::future::Future`,`async/await`.
- This is a very **breaking change**
- Lots of dependencies updated, most notably `tokio 0.2` and `hyper 0.13`
- Thanks to @bobtwinkles for the implementation
- Various internal refactorings and simplifications

## [0.13.0] - 2019-06-16

### Added
Expand Down
34 changes: 17 additions & 17 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "egg-mode"
version = "0.13.0"
version = "0.14.0"
authors = ["QuietMisdreavus <[email protected]>", "Alex Whitney <[email protected]>"]
description = "Library to interact with the Twitter API"
documentation = "https://tonberry.quietmisdreavus.net/doc/egg_mode/"
Expand All @@ -15,23 +15,23 @@ edition = "2018"
# TODO add badge once https://github.com/rust-lang/crates.io/pull/1838 is merged

[dependencies]
base64 = "0.11.0"
chrono = { version = "0.4.10", features = ["serde"] }
base64 = "0.11"
chrono = { version = "0.4", features = ["serde"] }
futures = "0.3"
derive_more = "0.99.2"
hmac = "0.7.1"
hyper = "0.13.1"
hyper-rustls = { version = "0.19.0", optional = true }
hyper-tls = { version = "0.4.0", optional = true }
lazy_static = "1.4.0"
native-tls = { version = "0.2.3", optional = true }
mime = "0.3.16"
percent-encoding = "2.1.0"
rand = "0.7.2"
regex = "1.3.1"
serde = { version = "1.0.104", features = ["derive"] }
serde_json = "1.0.44"
sha-1 = "0.8.2"
derive_more = "0.99"
hmac = "0.7"
hyper = "0.13"
hyper-rustls = { version = "0.19", optional = true }
hyper-tls = { version = "0.4", optional = true }
lazy_static = "1.4"
native-tls = { version = "0.2", optional = true }
mime = "0.3"
percent-encoding = "2.1"
rand = "0.7"
regex = "1.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha-1 = "0.8"
tokio = { version = "0.2.8", features = ["time", "rt-core", "macros"] }
url = "2.1.1"

Expand Down
22 changes: 10 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# egg-mode

Twitter library for rust ![Build Status](https://github.com/QuietMisdreavus/twitter-rs/workflows/CI/badge.svg)
Twitter library for Rust ![Build Status](https://github.com/QuietMisdreavus/twitter-rs/workflows/CI/badge.svg)

[v0.13.0 Documentation](https://tonberry.quietmisdreavus.net/doc/egg_mode/)
[v0.14.0 Documentation](https://tonberry.quietmisdreavus.net/doc/egg_mode/)

This is a library for interacting with Twitter from Rust. You can see how much of the Public API is
available in the file [TODO.md]. In addition to eventually implementing the entire Public API, an
Expand All @@ -11,6 +11,8 @@ interact with the Twitter API. Parts of this library are added as a convenience
mechanisms; for example, cursored lists of users and tweets can be used as an iterator in addition
to being able to manually load a page at a time.

From `v0.14`, egg-mode uses the `async/await` syntax and therefore requires Rust **v1.39.0+**.

[TODO.md]: https://github.com/QuietMisdreavus/twitter-rs/blob/master/TODO.md

**NOTE**: Previous versions of egg-mode contained a port of twitter-text to use for character
Expand All @@ -19,33 +21,31 @@ counting and mention/hashtag/url extraction. That has since been extracted into

[egg-mode-text]: https://github.com/QuietMisdreavus/twitter-text-rs

Compatibility note: egg-mode is tested to run on Rust 1.27.0 and later. On Windows, both the -msvc
and -gnu environments are tested.

To start using this library, put the following into your Cargo.toml:

```TOML
[dependencies]
egg-mode = "0.13.0"
egg-mode = "0.14.0"
```

By default, `egg-mode` uses `native-tls` for encryption, but also supports `rustls`.
This may be helpful if you wish to avoid linking against `OpenSSL`.
To enable, modify your `Cargo.toml` entry:
```
egg-mode = { version = "0.13", features = ["hyper-rustls"], default-features = false }`
egg-mode = { version = "0.14", features = ["hyper-rustls"], default-features = false }`
```

See available methods and tips to get started in the [Documentation][].

To authenticate a user and request an access token:

```rust
// NOTE: this assumes you have a Tokio `core` and its `handle` sitting around already
// NOTE: this assumes you are running inside an `async` function

let con_token = egg_mode::KeyPair::new("consumer key", "consumer secret");
// "oob" is needed for PIN-based auth; see docs for `request_token` for more info
let request_token = core.run(egg_mode::request_token(&con_token, "oob", &handle)).unwrap();
let request_token = egg_mode::request_token(&con_token, "oob").await.unwrap();
let auth_url = egg_mode::authorize_url(&request_token);

// give auth_url to the user, they can sign in to Twitter and accept your app's permissions.
Expand All @@ -55,7 +55,7 @@ let verifier = "123456"; //read the PIN from the user here

// note this consumes con_token; if you want to sign in multiple accounts, clone it here
let (token, user_id, screen_name) =
core.run(egg_mode::access_token(con_token, &request_token, verifier, &handle)).unwrap();
egg_mode::access_token(con_token, &request_token, verifier).await.unwrap()

// token can be given to any egg_mode method that asks for a token
// user_id and screen_name refer to the user who signed in
Expand All @@ -67,9 +67,7 @@ with your application. With this access token, all of the other Twitter function
With this token in hand, you can get a user's profile information like this:

```rust
// NOTE: as above, this assumes you have the Tokio `core` and `handle` available

let rustlang = core.run(egg_mode::user::show("rustlang", &token, &handle)).unwrap();
let rustlang = egg_mode::user::show("rustlang", &token).await.unwrap();

println!("{} (@{})", rustlang.name, rustlang.screen_name);
```
Expand Down

0 comments on commit 16ea7a1

Please sign in to comment.