Skip to main content

set_entry

Function set_entry 

Source
pub async fn set_entry(set_struct: &SetEntry) -> Result<Response, Error>
Expand description

Sets the value, metadata and user IDs associated with an entry.

Examples found in repository?
examples/set-entry.rs (line 35)
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 data: String = "".to_string(); // should be json_stringify-able (upto 4MB)
14
15    let scope: Option<String> = None; // None = default to global
16                                      // see docs for info
17    let match_version: Option<String> = None;
18    let exclusive_create: Option<bool> = None;
19    let user_ids: Option<Vec<u64>> = None;
20    let attributes: Option<String> = None;
21
22    let set_struct = SetEntry {
23        universe_id,
24        api_key,
25        datastore_name,
26        scope,
27        key,
28        match_version,
29        exclusive_create,
30        data,
31        user_ids,
32        attributes,
33    };
34
35    let res: Response = set_entry(&set_struct).await?;
36    let status = res.status();
37
38    println!("Success: {}", status);
39
40    Ok(())
41}