hanzo_client/models/create_body.rs
1/*
2 * Hanzo Cloud API
3 *
4 * The Hanzo Cloud API as a customer calls it: every operation under /v1/ except the operator's admin product, relay routes, legacy spellings and capabilities still reached by flag. Tagged by product: the first path segment after /v1/.
5 *
6 * The version of the OpenAPI document: v1
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct CreateBody {
16 /// ExposureEvent is the event that marks a subject as enrolled — the analysis denominator — defaulting to the SDK's $feature_flag_called marker.
17 #[serde(rename = "exposureEvent", skip_serializing_if = "Option::is_none")]
18 pub exposure_event: Option<String>,
19 /// FlagKey names the assignment flag this experiment writes, defaulting to exp_<id>. It must be a slug.
20 #[serde(rename = "flagKey", skip_serializing_if = "Option::is_none")]
21 pub flag_key: Option<String>,
22 /// ID is the experiment's slug, claimed once per project. It must match [A-Za-z0-9][A-Za-z0-9._-]{0,127}.
23 #[serde(rename = "id")]
24 pub id: String,
25 /// MetricEvent is the event that counts as a conversion — the analysis numerator.
26 #[serde(rename = "metricEvent")]
27 pub metric_event: String,
28 /// Name is free text for a reader; the id is what addresses the experiment.
29 #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
30 pub name: Option<String>,
31 /// SubjectKind is the unit assigned and measured: user (the default), org, session or audience.
32 #[serde(rename = "subjectKind", skip_serializing_if = "Option::is_none")]
33 pub subject_kind: Option<String>,
34 /// Arms are the arms, at least two. Weights that are all zero become an even split; otherwise they must sum to 100, and at most one arm may be flagged control.
35 #[serde(rename = "variants")]
36 pub variants: Vec<models::Arm>,
37}
38
39impl CreateBody {
40 pub fn new(id: String, metric_event: String, variants: Vec<models::Arm>) -> CreateBody {
41 CreateBody {
42 exposure_event: None,
43 flag_key: None,
44 id,
45 metric_event,
46 name: None,
47 subject_kind: None,
48 variants,
49 }
50 }
51}
52