vika

Crates.iovika
lib.rsvika
version0.1.2
sourcesrc
created_at2024-05-12 01:35:00.189247
updated_at2024-05-27 11:42:26.684842
descriptionA Rust API for Vika.
homepage
repository
max_upload_size
id1237181
size75,400
(ZacRenis)

documentation

README

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(())
}

Commit count: 0

cargo fmt