diff --git a/Cargo.toml b/Cargo.toml index bdee9206c..b5e57c990 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "bindings/matrix-sdk-ffi", "crates/*", "testing/*", + "examples/*", "labs/*", "xtask", ] diff --git a/crates/matrix-sdk/Cargo.toml b/crates/matrix-sdk/Cargo.toml index 27fa828a9..4c981b983 100644 --- a/crates/matrix-sdk/Cargo.toml +++ b/crates/matrix-sdk/Cargo.toml @@ -149,15 +149,3 @@ wasm-bindgen-test = "0.3.30" [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] tokio = { version = "1.17.0", default-features = false, features = ["rt-multi-thread", "macros"] } wiremock = "0.5.13" - -[[example]] -name = "cross_signing_bootstrap" -required-features = ["e2e-encryption"] - -[[example]] -name = "emoji_verification" -required-features = ["e2e-encryption"] - -[[example]] -name = "timeline" -required-features = ["sled", "experimental-timeline"] diff --git a/examples/autojoin/Cargo.toml b/examples/autojoin/Cargo.toml new file mode 100644 index 000000000..42aebd728 --- /dev/null +++ b/examples/autojoin/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "example-autojoin" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +tokio = { version = "1.20.1", features = ["full"] } +anyhow = "1" +tracing-subscriber = "0.3.15" + +[dependencies.matrix-sdk] +path = "../../crates/matrix-sdk" diff --git a/crates/matrix-sdk/examples/autojoin.rs b/examples/autojoin/src/main.rs similarity index 100% rename from crates/matrix-sdk/examples/autojoin.rs rename to examples/autojoin/src/main.rs diff --git a/examples/command_bot/Cargo.toml b/examples/command_bot/Cargo.toml new file mode 100644 index 000000000..ac8b169c9 --- /dev/null +++ b/examples/command_bot/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "example-command-bot" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1" +tokio = { version = "1.20.1", features = ["full"] } +tracing-subscriber = "0.3.15" +url = "2.2.2" + +[dependencies.matrix-sdk] +path = "../../crates/matrix-sdk" diff --git a/crates/matrix-sdk/examples/command_bot.rs b/examples/command_bot/src/main.rs similarity index 100% rename from crates/matrix-sdk/examples/command_bot.rs rename to examples/command_bot/src/main.rs diff --git a/examples/cross_signing_bootstrap/Cargo.toml b/examples/cross_signing_bootstrap/Cargo.toml new file mode 100644 index 000000000..bcb9d048a --- /dev/null +++ b/examples/cross_signing_bootstrap/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "example-cross-signing-bootstrap" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1" +tokio = { version = "1.20.1", features = ["full"] } +tracing-subscriber = "0.3.15" +url = "2.2.2" + +[dependencies.matrix-sdk] +path = "../../crates/matrix-sdk" +version = "0.5.0" +features = ["e2e-encryption"] diff --git a/crates/matrix-sdk/examples/cross_signing_bootstrap.rs b/examples/cross_signing_bootstrap/src/main.rs similarity index 100% rename from crates/matrix-sdk/examples/cross_signing_bootstrap.rs rename to examples/cross_signing_bootstrap/src/main.rs diff --git a/examples/emoji_verification/Cargo.toml b/examples/emoji_verification/Cargo.toml new file mode 100644 index 000000000..3620379cc --- /dev/null +++ b/examples/emoji_verification/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "example-emoji-verification" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1" +tokio = { version = "1.20.1", features = ["full"] } +tracing-subscriber = "0.3.15" +url = "2.2.2" + +[dependencies.matrix-sdk] +path = "../../crates/matrix-sdk" +version = "0.5.0" +features = ["e2e-encryption"] diff --git a/crates/matrix-sdk/examples/emoji_verification.rs b/examples/emoji_verification/src/main.rs similarity index 100% rename from crates/matrix-sdk/examples/emoji_verification.rs rename to examples/emoji_verification/src/main.rs diff --git a/examples/get_profiles/Cargo.toml b/examples/get_profiles/Cargo.toml new file mode 100644 index 000000000..55338d3e3 --- /dev/null +++ b/examples/get_profiles/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "example-get-profiles" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1" +tokio = { version = "1.20.1", features = ["full"] } +tracing-subscriber = "0.3.15" +url = "2.2.2" + +[dependencies.matrix-sdk] +path = "../../crates/matrix-sdk" diff --git a/crates/matrix-sdk/examples/get_profiles.rs b/examples/get_profiles/src/main.rs similarity index 100% rename from crates/matrix-sdk/examples/get_profiles.rs rename to examples/get_profiles/src/main.rs diff --git a/examples/image_bot/Cargo.toml b/examples/image_bot/Cargo.toml new file mode 100644 index 000000000..699b2e62f --- /dev/null +++ b/examples/image_bot/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "example-image-bot" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1" +mime = "0.3.16" +tokio = { version = "1.20.1", features = ["full"] } +tracing-subscriber = "0.3.15" +url = "2.2.2" + +[dependencies.matrix-sdk] +path = "../../crates/matrix-sdk" diff --git a/crates/matrix-sdk/examples/image_bot.rs b/examples/image_bot/src/main.rs similarity index 100% rename from crates/matrix-sdk/examples/image_bot.rs rename to examples/image_bot/src/main.rs diff --git a/examples/login/Cargo.toml b/examples/login/Cargo.toml new file mode 100644 index 000000000..f2b3e16b4 --- /dev/null +++ b/examples/login/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "example-login" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1" +tokio = { version = "1.20.1", features = ["full"] } +tracing-subscriber = "0.3.15" +url = "2.2.2" + +[dependencies.matrix-sdk] +path = "../../crates/matrix-sdk" diff --git a/crates/matrix-sdk/examples/login.rs b/examples/login/src/main.rs similarity index 100% rename from crates/matrix-sdk/examples/login.rs rename to examples/login/src/main.rs diff --git a/examples/timeline/Cargo.toml b/examples/timeline/Cargo.toml new file mode 100644 index 000000000..4e018cebc --- /dev/null +++ b/examples/timeline/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "example-timeline" +version = "0.1.0" +edition = "2021" +publish = false + +[dependencies] +anyhow = "1" +futures = "0.3" +tokio = { version = "1.20.1", features = ["full"] } +tracing-subscriber = "0.3.15" +url = "2.2.2" + +[dependencies.matrix-sdk] +path = "../../crates/matrix-sdk" +features = ["sled", "experimental-timeline"] diff --git a/crates/matrix-sdk/examples/timeline.rs b/examples/timeline/src/main.rs similarity index 100% rename from crates/matrix-sdk/examples/timeline.rs rename to examples/timeline/src/main.rs diff --git a/crates/matrix-sdk/examples/wasm_command_bot/.gitignore b/examples/wasm_command_bot/.gitignore similarity index 100% rename from crates/matrix-sdk/examples/wasm_command_bot/.gitignore rename to examples/wasm_command_bot/.gitignore diff --git a/crates/matrix-sdk/examples/wasm_command_bot/Cargo.toml b/examples/wasm_command_bot/Cargo.toml similarity index 95% rename from crates/matrix-sdk/examples/wasm_command_bot/Cargo.toml rename to examples/wasm_command_bot/Cargo.toml index be89b3c23..e5b190be6 100644 --- a/crates/matrix-sdk/examples/wasm_command_bot/Cargo.toml +++ b/examples/wasm_command_bot/Cargo.toml @@ -18,12 +18,10 @@ console_error_panic_hook = "0.1.6" web-sys = { version = "0.3.51", features = ["console"] } [dependencies.matrix-sdk] -path = "../.." +path = "../../crates/matrix-sdk" version = "0.5.0" default-features = false features = ["native-tls", "e2e-encryption", "indexeddb"] -[workspace] - [dev-dependencies] wasm-bindgen-test = "0.3.29" diff --git a/crates/matrix-sdk/examples/wasm_command_bot/README.md b/examples/wasm_command_bot/README.md similarity index 100% rename from crates/matrix-sdk/examples/wasm_command_bot/README.md rename to examples/wasm_command_bot/README.md diff --git a/crates/matrix-sdk/examples/wasm_command_bot/index.js b/examples/wasm_command_bot/index.js similarity index 100% rename from crates/matrix-sdk/examples/wasm_command_bot/index.js rename to examples/wasm_command_bot/index.js diff --git a/crates/matrix-sdk/examples/wasm_command_bot/package.json b/examples/wasm_command_bot/package.json similarity index 100% rename from crates/matrix-sdk/examples/wasm_command_bot/package.json rename to examples/wasm_command_bot/package.json diff --git a/crates/matrix-sdk/examples/wasm_command_bot/src/lib.rs b/examples/wasm_command_bot/src/lib.rs similarity index 100% rename from crates/matrix-sdk/examples/wasm_command_bot/src/lib.rs rename to examples/wasm_command_bot/src/lib.rs diff --git a/crates/matrix-sdk/examples/wasm_command_bot/webpack.config.js b/examples/wasm_command_bot/webpack.config.js similarity index 100% rename from crates/matrix-sdk/examples/wasm_command_bot/webpack.config.js rename to examples/wasm_command_bot/webpack.config.js