langfuse_client/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)]
15#[cfg_attr(feature="bon", derive(bon::Builder))]
16pub struct Trace {
17    /// The unique identifier of a trace
18    #[serde(rename = "id")]
19    pub id: String,
20    /// The timestamp when the trace was created
21    #[serde(rename = "timestamp")]
22    pub timestamp: String,
23    /// The name of the trace
24    #[serde(rename = "name", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25    pub name: Option<Option<String>>,
26    /// The input data of the trace. Can be any JSON.
27    #[serde(rename = "input", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
28    pub input: Option<Option<serde_json::Value>>,
29    /// The output data of the trace. Can be any JSON.
30    #[serde(rename = "output", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
31    pub output: Option<Option<serde_json::Value>>,
32    /// The session identifier associated with the trace
33    #[serde(rename = "sessionId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
34    pub session_id: Option<Option<String>>,
35    /// The release version of the application when the trace was created
36    #[serde(rename = "release", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
37    pub release: Option<Option<String>>,
38    /// The version of the trace
39    #[serde(rename = "version", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
40    pub version: Option<Option<String>>,
41    /// The user identifier associated with the trace
42    #[serde(rename = "userId", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
43    pub user_id: Option<Option<String>>,
44    /// The metadata associated with the trace. Can be any JSON.
45    #[serde(rename = "metadata", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
46    pub metadata: Option<Option<serde_json::Value>>,
47    /// The tags associated with the trace. Can be an array of strings or null.
48    #[serde(rename = "tags", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
49    pub tags: Option<Option<Vec<String>>>,
50    /// Public traces are accessible via url without login
51    #[serde(rename = "public", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
52    pub public: Option<Option<bool>>,
53    /// The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
54    #[serde(rename = "environment", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
55    pub environment: Option<Option<String>>,
56}
57
58impl Trace {
59    pub fn new(id: String, timestamp: String) -> Trace {
60        Trace {
61            id,
62            timestamp,
63            name: None,
64            input: None,
65            output: None,
66            session_id: None,
67            release: None,
68            version: None,
69            user_id: None,
70            metadata: None,
71            tags: None,
72            public: None,
73            environment: None,
74        }
75    }
76}
77