基于tokioå¼€å‘的拼多多开å‘å¹³å°sdk,支æŒæ¶ˆæ¯æŽ¨é€
1.æ·»åŠ ä¾èµ–
toml
[dependencies]
pdd = "0.1"
tokio = { version = "1", features = ["full"] }
futures-util = "0.3"
serde_json = "1"
2.设置环境å˜é‡
```bash set PDDCLIENTID=youclientid set PDDCLIENTSECRET=you_secret
set PDDACCESSTOKEN=youaccesstoken ```
rust
let client = Client::from_env()?;
let req = PddOrderListGet {
start_confirm_at: Some(1689250974),
end_confirm_at: Some(1689260974),
use_has_next: Some(true),
order_status: Some(1),
..Default::default()
};
client.send(req).await?;
需è¦å¼€å¯pmc-native-tls
feature
toml
[dependencies]
pdd = { "0.1" , features=["pmc-native-tls"] }
tokio = { version = "1", features = ["full"] }
futures-util = "0.3"
serde_json = "1"
```rust let client = PmcClient::new(Config::from_env()?); let mut s = client.connect().await?;
while let Some(msg) = s.next().await {
let msg = msg.unwrap();
println!("{:?}", msg);
//ack消æ¯
s.ack(&msg).await;
}
```
rust
let client = Client::from_env()?;
let req = PddGoodsFilespaceImageUpload {
file: Some(PddFile::from_file("examples/1.jpg").await?),
};
let rsp = client.file_upload(req).await?;