hanzo-client 8.5.156

Generated client for the Hanzo API — every service, one crate.
Documentation
/*
 * Hanzo Cloud API
 *
 * 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/.
 *
 * The version of the OpenAPI document: v1
 * 
 * Generated by: https://openapi-generator.tech
 */

use crate::models;
use serde::{Deserialize, Serialize};

#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CreateBody {
    /// ExposureEvent is the event that marks a subject as enrolled — the analysis denominator — defaulting to the SDK's $feature_flag_called marker.
    #[serde(rename = "exposureEvent", skip_serializing_if = "Option::is_none")]
    pub exposure_event: Option<String>,
    /// FlagKey names the assignment flag this experiment writes, defaulting to exp_<id>. It must be a slug.
    #[serde(rename = "flagKey", skip_serializing_if = "Option::is_none")]
    pub flag_key: Option<String>,
    /// ID is the experiment's slug, claimed once per project. It must match [A-Za-z0-9][A-Za-z0-9._-]{0,127}.
    #[serde(rename = "id")]
    pub id: String,
    /// MetricEvent is the event that counts as a conversion — the analysis numerator.
    #[serde(rename = "metricEvent")]
    pub metric_event: String,
    /// Name is free text for a reader; the id is what addresses the experiment.
    #[serde(rename = "name", skip_serializing_if = "Option::is_none")]
    pub name: Option<String>,
    /// SubjectKind is the unit assigned and measured: user (the default), org, session or audience.
    #[serde(rename = "subjectKind", skip_serializing_if = "Option::is_none")]
    pub subject_kind: Option<String>,
    /// 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.
    #[serde(rename = "variants")]
    pub variants: Vec<models::Arm>,
}

impl CreateBody {
    pub fn new(id: String, metric_event: String, variants: Vec<models::Arm>) -> CreateBody {
        CreateBody {
            exposure_event: None,
            flag_key: None,
            id,
            metric_event,
            name: None,
            subject_kind: None,
            variants,
        }
    }
}