1 unstable release

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

#694 in Web programming

Download history 11/week @ 2024-05-15 208/week @ 2024-05-22 59/week @ 2024-05-29 2/week @ 2024-06-05

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

~6–17MB
~249K SLoC