1 unstable release

0.1.2 May 27, 2024
0.1.1 May 27, 2024
0.1.0 May 12, 2024

#13 in #query-parameters

Download history 1/week @ 2024-09-17 16/week @ 2024-09-24

92 downloads per month

MIT license

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

~7–18MB
~240K SLoC