Skip to main content

increment_entry/
increment-entry.rs

1use rbx_ds_cloud::api::datastore_api::increment_entry;
2use rbx_ds_cloud::api::endpoint_structs::IncrementEntry;
3
4use reqwest::Response;
5
6#[tokio::main]
7async fn main() -> Result<(), Box<dyn std::error::Error>> {
8    let api_key = "API_KEY".to_string();
9    let universe_id: u64 = 0;
10
11    let datastore_name: String = "DATASTORE_NAME".to_string();
12    let key: String = "ENTRY_KEY".to_string();
13    let increment_by: f64 = 0.0;
14
15    let scope: Option<String> = None; // None = default to global
16    let user_ids: Option<Vec<u64>> = None;
17    let attributes: Option<String> = None;
18
19    let increment_struct = IncrementEntry {
20        api_key,
21        universe_id,
22        datastore_name,
23        key,
24        increment_by,
25        scope,
26        user_ids,
27        attributes,
28    };
29
30    let res: Response = increment_entry(&increment_struct).await?;
31    let status_code = res.status();
32
33    println!(
34        "Data has been incremented successfully! (Code: {})",
35        status_code
36    );
37
38    Ok(())
39}