spotify_confidence_sdk

Crates.iospotify_confidence_sdk
lib.rsspotify_confidence_sdk
version0.1.2
sourcesrc
created_at2024-06-05 11:35:50.336448
updated_at2024-07-08 12:26:31.999621
descriptionConfidence SDK for Rust
homepagehttps://confidence.spotify.com/
repositoryhttps://github.com/spotify/confidence-sdk-rust
max_upload_size
id1262679
size57,092
Nicklas Lundin (nicklasl)

documentation

README

Rust Confidence SDK

Rust implementation of the Confidence.

Usage

Instantiating the Confidence

first, we need to setup the api config which contains a api_key and a region:

let api_config = APIConfig { api_key: "YOUR_API_KEY".to_string(), region: YOUR_REGION };

let confidence = Confidence::new(api_config)

after this initial setup we can start accessing the flags. Every time any of flags are asked, the sdk fetches them from the network and resolve the asked property.

The schema of the property plays a crucial role in resolving the property, if the schema type matches the asked type, the value will be returned otherwise we expect an MismatchType error from the EvaluationError.

// wrong type, should return error
let details_string = confidence.get_flag("hawkflag.message", "default".to_string()).await;
println!("details string -> {:?}", details_string);

Send custom Events

we can send custom events to the confidence sdk like following:

confidence.track("[EVENT-NAME]", HashMap::new());
Commit count: 47

cargo fmt