mirror of
https://github.com/TeamPiped/piped-rust-sdk.git
synced 2024-08-14 23:56:06 +00:00
Add trending example.
This commit is contained in:
parent
2915672444
commit
b5964484ca
2 changed files with 22 additions and 0 deletions
|
@ -12,3 +12,7 @@ tokio = {version = "1.5.0", features = ["macros", "rt-multi-thread"]}
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "channel"
|
name = "channel"
|
||||||
path = "channel.rs"
|
path = "channel.rs"
|
||||||
|
|
||||||
|
[[example]]
|
||||||
|
name = "trending"
|
||||||
|
path = "trending.rs"
|
||||||
|
|
18
examples/trending.rs
Normal file
18
examples/trending.rs
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
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_trending().await.unwrap();
|
||||||
|
|
||||||
|
println!("{:?}", channel);
|
||||||
|
}
|
Loading…
Reference in a new issue