langfuse_client_base/models/
trace.rs

1/*
2 * langfuse
3 *
4 * ## Authentication  Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:  - username: Langfuse Public Key - password: Langfuse Secret Key  ## Exports  - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml - Postman collection: https://cloud.langfuse.com/generated/postman/collection.json
5 *
6 * The version of the OpenAPI document:
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 Trace {
16    /// The unique identifier of a trace
17    #[serde(rename = "id")]
18    pub id: String,
19    /// The timestamp when the trace was created
20    #[serde(rename = "timestamp")]
21    pub timestamp: String,
22    /// The name of the trace
23    #[serde(
24        rename = "name",
25        default,
26        with = "::serde_with::rust::double_option",
27        skip_serializing_if = "Option::is_none"
28    )]
29    pub name: Option<Option<String>>,
30    /// The input data of the trace. Can be any JSON.
31    #[serde(
32        rename = "input",
33        default,
34        with = "::serde_with::rust::double_option",
35        skip_serializing_if = "Option::is_none"
36    )]
37    pub input: Option<Option<serde_json::Value>>,
38    /// The output data of the trace. Can be any JSON.
39    #[serde(
40        rename = "output",
41        default,
42        with = "::serde_with::rust::double_option",
43        skip_serializing_if = "Option::is_none"
44    )]
45    pub output: Option<Option<serde_json::Value>>,
46    /// The session identifier associated with the trace
47    #[serde(
48        rename = "sessionId",
49        default,
50        with = "::serde_with::rust::double_option",
51        skip_serializing_if = "Option::is_none"
52    )]
53    pub session_id: Option<Option<String>>,
54    /// The release version of the application when the trace was created
55    #[serde(
56        rename = "release",
57        default,
58        with = "::serde_with::rust::double_option",
59        skip_serializing_if = "Option::is_none"
60    )]
61    pub release: Option<Option<String>>,
62    /// The version of the trace
63    #[serde(
64        rename = "version",
65        default,
66        with = "::serde_with::rust::double_option",
67        skip_serializing_if = "Option::is_none"
68    )]
69    pub version: Option<Option<String>>,
70    /// The user identifier associated with the trace
71    #[serde(
72        rename = "userId",
73        default,
74        with = "::serde_with::rust::double_option",
75        skip_serializing_if = "Option::is_none"
76    )]
77    pub user_id: Option<Option<String>>,
78    /// The metadata associated with the trace. Can be any JSON.
79    #[serde(
80        rename = "metadata",
81        default,
82        with = "::serde_with::rust::double_option",
83        skip_serializing_if = "Option::is_none"
84    )]
85    pub metadata: Option<Option<serde_json::Value>>,
86    /// The tags associated with the trace. Can be an array of strings or null.
87    #[serde(
88        rename = "tags",
89        default,
90        with = "::serde_with::rust::double_option",
91        skip_serializing_if = "Option::is_none"
92    )]
93    pub tags: Option<Option<Vec<String>>>,
94    /// Public traces are accessible via url without login
95    #[serde(
96        rename = "public",
97        default,
98        with = "::serde_with::rust::double_option",
99        skip_serializing_if = "Option::is_none"
100    )]
101    pub public: Option<Option<bool>>,
102    /// The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
103    #[serde(
104        rename = "environment",
105        default,
106        with = "::serde_with::rust::double_option",
107        skip_serializing_if = "Option::is_none"
108    )]
109    pub environment: Option<Option<String>>,
110}
111
112impl Trace {
113    pub fn new(id: String, timestamp: String) -> Trace {
114        Trace {
115            id,
116            timestamp,
117            name: None,
118            input: None,
119            output: None,
120            session_id: None,
121            release: None,
122            version: None,
123            user_id: None,
124            metadata: None,
125            tags: None,
126            public: None,
127            environment: None,
128        }
129    }
130}