meteroid-rs 0.31.4

Official Rust SDK for Meteroid, the open-source billing platform: subscriptions, invoicing, usage-based billing and webhooks.
Documentation
// this file is @generated
use serde::{Deserialize, Serialize};

use super::event::Event;

#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)]
pub struct IngestEventsRequest {
    /// Allow events with timestamps more than 1 day in the past. Defaults to `false`.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub allow_backfilling: Option<bool>,

    /// Accept the batch even if some events fail validation. Defaults to `false`.
    /// When `true`, valid events are ingested and failures are reported in the response body.
    /// When `false` (default), any invalid event rejects the entire batch.
    #[serde(skip_serializing_if = "Option::is_none")]
    pub allow_partial_failures: Option<bool>,

    /// 1–100 events per request.
    pub events: Vec<Event>,

    /// Properties this version of the SDK does not know, sent back as received.
    #[serde(flatten)]
    pub extra: serde_json::Map<String, serde_json::Value>,
}

impl IngestEventsRequest {
    /// Creates a value from its required fields.
    #[must_use]
    pub fn new(events: Vec<Event>) -> Self {
        Self {
            allow_backfilling: None,
            allow_partial_failures: None,
            events,
            extra: serde_json::Map::new(),
        }
    }

    /// Sets `allow_backfilling`.
    #[must_use]
    pub fn allow_backfilling(mut self, allow_backfilling: impl Into<bool>) -> Self {
        self.allow_backfilling = Some(allow_backfilling.into());
        self
    }

    /// Sets `allow_partial_failures`.
    #[must_use]
    pub fn allow_partial_failures(mut self, allow_partial_failures: impl Into<bool>) -> Self {
        self.allow_partial_failures = Some(allow_partial_failures.into());
        self
    }
}