Skip to main content

trieve_client/models/
ctr_data_request_body.rs

1/*
2 * Trieve API
3 *
4 * Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5 *
6 * The version of the OpenAPI document: 0.11.7
7 * Contact: developers@trieve.ai
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
14pub struct CtrDataRequestBody {
15    /// The ID of chunk that was clicked
16    #[serde(rename = "clicked_chunk_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17    pub clicked_chunk_id: Option<Option<uuid::Uuid>>,
18    /// The tracking ID of the chunk that was clicked
19    #[serde(rename = "clicked_chunk_tracking_id", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
20    pub clicked_chunk_tracking_id: Option<Option<String>>,
21    #[serde(rename = "ctr_type")]
22    pub ctr_type: models::CtrType,
23    /// Any metadata you want to include with the event i.e. action, user_id, etc.
24    #[serde(rename = "metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub metadata: Option<Option<serde_json::Value>>,
26    /// The position of the clicked chunk
27    #[serde(rename = "position")]
28    pub position: i32,
29    /// The request id for the CTR data
30    #[serde(rename = "request_id")]
31    pub request_id: uuid::Uuid,
32}
33
34impl CtrDataRequestBody {
35    pub fn new(ctr_type: models::CtrType, position: i32, request_id: uuid::Uuid) -> CtrDataRequestBody {
36        CtrDataRequestBody {
37            clicked_chunk_id: None,
38            clicked_chunk_tracking_id: None,
39            ctr_type,
40            metadata: None,
41            position,
42            request_id,
43        }
44    }
45}
46