brevo/models/
event.rs

1/*
2 * Brevo API
3 *
4 * Brevo provide a RESTFul API that can be used with any languages. With this API, you will be able to :   - Manage your campaigns and get the statistics   - Manage your contacts   - Send transactional Emails and SMS   - and much more...  You can download our wrappers at https://github.com/orgs/brevo  **Possible responses**   | Code | Message |   | :-------------: | ------------- |   | 200  | OK. Successful Request  |   | 201  | OK. Successful Creation |   | 202  | OK. Request accepted |   | 204  | OK. Successful Update/Deletion  |   | 400  | Error. Bad Request  |   | 401  | Error. Authentication Needed  |   | 402  | Error. Not enough credit, plan upgrade needed  |   | 403  | Error. Permission denied  |   | 404  | Error. Object does not exist |   | 405  | Error. Method not allowed  |   | 406  | Error. Not Acceptable  |   | 422  | Error. Unprocessable Entity |
5 *
6 * The version of the OpenAPI document: 3.0.0
7 * Contact: contact@brevo.com
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 Event {
16    /// The name of the event that occurred. This is how you will find your event in Brevo. Limited to 255 characters, alphanumerical characters and - _ only.
17    #[serde(rename = "event_name")]
18    pub event_name: String,
19    /// Timestamp of when the event occurred (e.g. \"2024-01-24T17:39:57+01:00\"). If no value is passed, the timestamp of the event creation is used.
20    #[serde(rename = "event_date", skip_serializing_if = "Option::is_none")]
21    pub event_date: Option<String>,
22    #[serde(rename = "identifiers")]
23    pub identifiers: Box<models::EventIdentifiers>,
24    /// Properties defining the state of the contact associated to this event. Useful to update contact attributes defined in your contacts database while passing the event. For example: **\"FIRSTNAME\": \"Jane\" , \"AGE\": 37**
25    #[serde(rename = "contact_properties", skip_serializing_if = "Option::is_none")]
26    pub contact_properties:
27        Option<std::collections::HashMap<String, models::EventContactPropertiesValue>>,
28    /// Properties of the event. Top level properties and nested properties can be used to better segment contacts and personalise workflow conditions. The following field type are supported: string, number, boolean (true/false), date (Timestamp e.g. \"2024-01-24T17:39:57+01:00\"). Keys are limited to 255 characters, alphanumerical characters and - _ only. Size is limited to 50Kb.
29    #[serde(rename = "event_properties", skip_serializing_if = "Option::is_none")]
30    pub event_properties:
31        Option<std::collections::HashMap<String, models::EventEventPropertiesValue>>,
32}
33
34impl Event {
35    pub fn new(event_name: String, identifiers: models::EventIdentifiers) -> Event {
36        Event {
37            event_name,
38            event_date: None,
39            identifiers: Box::new(identifiers),
40            contact_properties: None,
41            event_properties: None,
42        }
43    }
44}