mirror of
https://github.com/TeamPiped/piped-rust-sdk.git
synced 2024-08-14 23:56:06 +00:00
Restructure project and add examples.
This commit is contained in:
parent
b780f05f0c
commit
9f2ccc35ee
5 changed files with 56 additions and 12 deletions
17
Cargo.toml
17
Cargo.toml
|
@ -1,12 +1,5 @@
|
||||||
[package]
|
[workspace]
|
||||||
authors = ["Kavin <kavin@kavin.rocks>"]
|
members = [
|
||||||
edition = "2018"
|
"piped",
|
||||||
name = "piped-rust-sdk"
|
"examples",
|
||||||
version = "0.1.0"
|
]
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
||||||
|
|
||||||
[dependencies]
|
|
||||||
reqwest = "0.11.3"
|
|
||||||
serde = {version = "1.0.125", features = ["derive"]}
|
|
||||||
serde_json = "1.0.64"
|
|
||||||
|
|
14
examples/Cargo.toml
Normal file
14
examples/Cargo.toml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[package]
|
||||||
|
edition = "2018"
|
||||||
|
name = "examples"
|
||||||
|
publish = false
|
||||||
|
version = "0.0.0"
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
piped = {path = "../piped"}
|
||||||
|
reqwest = "0.11.3"
|
||||||
|
tokio = {version = "1.5.0", features = ["macros", "rt-multi-thread"]}
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "channel"
|
||||||
|
path = "channel.rs"
|
21
examples/channel.rs
Normal file
21
examples/channel.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
use piped::piped::PipedClient;
|
||||||
|
use reqwest::ClientBuilder;
|
||||||
|
|
||||||
|
#[tokio::main]
|
||||||
|
async fn main() {
|
||||||
|
let httpclient = ClientBuilder::new()
|
||||||
|
.user_agent("Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0")
|
||||||
|
.build()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let instance = "https://pipedapi.kavin.rocks".to_string();
|
||||||
|
|
||||||
|
let client = PipedClient::new(httpclient, instance);
|
||||||
|
|
||||||
|
let channel = client
|
||||||
|
.get_channel_from_id("UCXuqSBlHAE6Xw-yeJA0Tunw".to_string())
|
||||||
|
.await
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
println!("{:?}", channel);
|
||||||
|
}
|
16
piped/Cargo.toml
Normal file
16
piped/Cargo.toml
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
[package]
|
||||||
|
authors = ["Kavin <kavin@kavin.rocks>"]
|
||||||
|
edition = "2018"
|
||||||
|
include = [
|
||||||
|
"src/*.rs",
|
||||||
|
"Cargo.toml",
|
||||||
|
]
|
||||||
|
name = "piped"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
reqwest = "0.11.3"
|
||||||
|
serde = {version = "1.0.125", features = ["derive"]}
|
||||||
|
serde_json = "1.0.64"
|
Loading…
Add table
Add a link
Reference in a new issue