1 unstable release
0.1.2 | May 27, 2024 |
---|---|
0.1.1 |
|
0.1.0 |
|
#9 in #query-parameters
40KB
1K
SLoC
use vika::{record::QueryParameters, Vika};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
//create vika api
let vika = Vika::new("api.vika.cn", "usk1234567890");
// get spaces list
let spaces = vika.spaces.query_all().await?;
println!("{:#?}", spaces);
//get nodes belong spaces
let sm = vika.spaces.space("spcnYxNW7xxLa");
println!("{:#?}", &sm.nodes.query_all().await?);
println!("{:#?}", &sm.nodes.node("fodfwXDrcac53").await?);
//get a specific fields of datasheet
let flds = vika
.spaces
.space("spcnYxNW7xxLa")
.datasheets
.datasheet("dstyc7DlpKFenubN2L")
.fields
.query_all()
.await?;
println!("{:#?}", flds);
// query all reords
let rcd = vika
.spaces
.space("spcnYxNW7xxLa")
.datasheets
.datasheet("dstyc7DlpKFenubN2L")
.records
.query_all()
.await?;
println!("{:#?}", rcd);
//query records by parameter
let rcd = vika
.spaces
.space("spcnYxNW7xxLa")
.datasheets
.datasheet("dstyc7DlpKFenubN2L")
.records
.query_with_params(&QueryParameters {
field_key: vika::record::FieldKey::Id,
..Default::default()
})
.await?;
println!("{:#?}", rcd);
//query records by parameter
let viw = vika
.spaces
.space("spcnYxNW7xxLa")
.datasheets
.datasheet("dstyc7DlpKFenubN2L")
.views
.query_all()
.await?;
println!("{:#?}", viw);
anyhow::Ok(())
}
Dependencies
~6–17MB
~236K SLoC