Restructure project and add examples.
This commit is contained in:
parent
b780f05f0c
commit
9f2ccc35ee
17
Cargo.toml
17
Cargo.toml
|
@ -1,12 +1,5 @@
|
|||
[package]
|
||||
authors = ["Kavin <kavin@kavin.rocks>"]
|
||||
edition = "2018"
|
||||
name = "piped-rust-sdk"
|
||||
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"
|
||||
[workspace]
|
||||
members = [
|
||||
"piped",
|
||||
"examples",
|
||||
]
|
||||
|
|
|
@ -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"
|
|
@ -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);
|
||||
}
|
|
@ -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…
Reference in New Issue