rocketchat

Rust API wrapper for the RocketChat API

crates.io MIT

Example

The library uses asynchronous HTTP client reqwest, so your Cargo.toml could look like this:

toml rocketchat = "0.4.0" tokio = { version = "1", features = ["full"] }

When calling methods, you need to pass settings that can be created as follows:

Using username and password

```rust,no_run use rocketchat::{LoginSettings, Settings};

let settings = Settings::Login(LoginSettings { username: "chucknorris".tostring(), password: "supersecret".tostring(), domain: "https://mydomain.com".tostring(), }); ```

Using auth token and user ID

```rust,no_run use rocketchat::{AuthSettings, Settings};

let settings = Settings::Auth(AuthSettings { authtoken: "someauthtoken".tostring(), userid: "someuserid".tostring(), domain: "https://mydomain.com".to_string(), }); ```

Available API methods

Post Message

rust,no_run let result = PostMessageMethod { settings: &settings, room_id: "#channel".to_string(), text: Some("Some message with star emoji :star:".to_string()), ..Default::default() }.call().await;

License

MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)