examples: Move all examples to the root folder
This commit is contained in:
parent
5cc3656c27
commit
2621dced1b
@ -173,20 +173,4 @@ ruma-identity-service-api = { version = "0.4.0", path = "../ruma-identity-servic
|
||||
ruma-push-gateway-api = { version = "0.4.0", path = "../ruma-push-gateway-api", optional = true }
|
||||
|
||||
[dev-dependencies]
|
||||
anyhow = "1.0.37"
|
||||
isahc = "1.3.1"
|
||||
serde = { version = "1.0.118", features = ["derive"] }
|
||||
tokio = { version = "1.0.1", features = ["macros", "rt"] }
|
||||
tokio-stream = { version = "0.1.1", default-features = false }
|
||||
|
||||
[[example]]
|
||||
name = "hello_world"
|
||||
required-features = ["client-api-c", "client-ext-client-api", "client-hyper-native-tls", "rand"]
|
||||
|
||||
[[example]]
|
||||
name = "hello_isahc"
|
||||
required-features = ["client-api-c", "client-ext-client-api", "client-isahc", "rand"]
|
||||
|
||||
[[example]]
|
||||
name = "message_log"
|
||||
required-features = ["client-api-c", "client-ext-client-api", "client-hyper-native-tls"]
|
||||
|
@ -2,5 +2,3 @@
|
||||
|
||||
These are example projects showcasing how to use the various crates in this repository. You can use
|
||||
these as a base for starting your own project.
|
||||
|
||||
Other examples can be found in the [examples directory of the `ruma` crate](../crates/ruma/examples).
|
||||
|
13
examples/hello_isahc/Cargo.toml
Normal file
13
examples/hello_isahc/Cargo.toml
Normal file
@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "hello_isahc"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
ruma = { version = "0.5.0", path = "../../crates/ruma", features = ["client-api-c", "client-ext-client-api", "client-isahc", "rand"] }
|
||||
|
||||
anyhow = "1.0.37"
|
||||
isahc = "1.3.1"
|
||||
tokio = { version = "1.0.1", features = ["macros", "rt"] }
|
13
examples/hello_isahc/README.md
Normal file
13
examples/hello_isahc/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
Same as the [hello_world](../hello_world) example, but using the
|
||||
[isahc](https://crates.io/crates/isahc) HTTP client (a Rust wrapper around libcurl).
|
||||
|
||||
# Usage
|
||||
|
||||
You will need to use an existing account on a homeserver that allows login with
|
||||
a password.
|
||||
|
||||
In this folder, you can run it with this command:
|
||||
|
||||
```shell
|
||||
cargo run <homeserver_url> <username> <password> <room>
|
||||
```
|
@ -1,6 +1,3 @@
|
||||
//! Same as the hello_world example, but using the isahc http client (a Rust wrapper around
|
||||
//! libcurl).
|
||||
|
||||
use std::{convert::TryFrom, env, process::exit};
|
||||
|
||||
use ruma::{
|
12
examples/hello_world/Cargo.toml
Normal file
12
examples/hello_world/Cargo.toml
Normal file
@ -0,0 +1,12 @@
|
||||
[package]
|
||||
name = "hello_world"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
ruma = { version = "0.5.0", path = "../../crates/ruma", features = ["client-api-c", "client-ext-client-api", "client-hyper-native-tls", "rand"] }
|
||||
|
||||
anyhow = "1.0.37"
|
||||
tokio = { version = "1.0.1", features = ["macros", "rt"] }
|
13
examples/hello_world/README.md
Normal file
13
examples/hello_world/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
A simple example to demonstrate `ruma-client` functionality. Sends "Hello
|
||||
World!" to the given room.
|
||||
|
||||
# Usage
|
||||
|
||||
You will need to use an existing account on a homeserver that allows login with
|
||||
a password.
|
||||
|
||||
In this folder, you can run it with this command:
|
||||
|
||||
```shell
|
||||
cargo run <homeserver_url> <username> <password> <room>
|
||||
```
|
@ -2,10 +2,10 @@ use std::{convert::TryFrom, env, process::exit};
|
||||
|
||||
use ruma::{
|
||||
api::client::{alias::get_alias, membership::join_room_by_id, message::send_message_event},
|
||||
common::TransactionId,
|
||||
events::room::message::RoomMessageEventContent,
|
||||
RoomAliasId,
|
||||
};
|
||||
use ruma_common::TransactionId;
|
||||
|
||||
type HttpClient = ruma::client::http_client::HyperNativeTls;
|
||||
|
@ -6,7 +6,7 @@ edition = "2018"
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
ruma = { version = "0.5.0", path = "../../crates/ruma", features = ["client", "client-api-c", "client-ext-client-api", "client-hyper-native-tls", "events", "rand"] }
|
||||
ruma = { version = "0.5.0", path = "../../crates/ruma", features = ["client-api-c", "client-ext-client-api", "client-hyper-native-tls", "rand"] }
|
||||
# For building locally: use the git dependencies below.
|
||||
# Browse the source at this revision here: https://github.com/ruma/ruma/tree/f161c8117c706fc52089999e1f406cf34276ec9d
|
||||
# ruma = { git = "https://github.com/ruma/ruma", rev = "f161c8117c706fc52089999e1f406cf34276ec9d", features = ["client-api-c", "client", "client-hyper-native-tls", "events"] }
|
||||
|
14
examples/message_log/Cargo.toml
Normal file
14
examples/message_log/Cargo.toml
Normal file
@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "message_log"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
ruma = { version = "0.5.0", path = "../../crates/ruma", features = ["client-api-c", "client-ext-client-api", "client-hyper-native-tls"] }
|
||||
|
||||
anyhow = "1.0.37"
|
||||
assign = "1.1.1"
|
||||
tokio = { version = "1.0.1", features = ["macros", "rt"] }
|
||||
tokio-stream = { version = "0.1.1", default-features = false }
|
13
examples/message_log/README.md
Normal file
13
examples/message_log/README.md
Normal file
@ -0,0 +1,13 @@
|
||||
A simple example to demonstrate `ruma-client` functionality. Prints all the
|
||||
received text messages to stdout.
|
||||
|
||||
# Usage
|
||||
|
||||
You will need to use an existing account on a homeserver that allows login with
|
||||
a password.
|
||||
|
||||
In this folder, you can run it with this command:
|
||||
|
||||
```shell
|
||||
cargo run <homeserver_url> <username> <password>
|
||||
```
|
Loading…
x
Reference in New Issue
Block a user