Skip to main content

langfuse_client_base/models/
public_api_error_code.rs

1#![allow(deprecated)]
2/*
3 * server
4 *
5 * ## Real-time data  The only real-time path to get tracing data is to ingest via OpenTelemetry (`POST /api/public/otel/v1/traces`) and retrieve via Observations API v2 (`GET /api/public/v2/observations`) and Metrics API v2 (`GET /api/public/v2/metrics`). Other public API write and read endpoints can delay data by about 10 minutes. Direct OpenTelemetry exporters must send the `x-langfuse-ingestion-version: 4` header; current Python and JS SDKs already do. See the [Public API docs](https://langfuse.com/docs/api-and-data-platform/features/public-api) and [real-time ingestion](https://langfuse.com/integrations/native/opentelemetry.md#real-time-ingestion).  ## 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 - Self-hosted deployments: interactive API reference at `/api/docs` and OpenAPI spec at `/api/openapi.yaml`
6 *
7 * The version of the OpenAPI document:
8 *
9 * Generated by: https://openapi-generator.tech
10 */
11
12use serde::{Deserialize, Serialize};
13
14/// PublicApiErrorCode : Stable machine-readable error code returned by the evaluators and evaluation-rules API.
15/// Stable machine-readable error code returned by the evaluators and evaluation-rules API.
16#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
17pub enum PublicApiErrorCode {
18    #[serde(rename = "authentication_failed")]
19    AuthenticationFailed,
20    #[serde(rename = "access_denied")]
21    AccessDenied,
22    #[serde(rename = "invalid_request")]
23    InvalidRequest,
24    #[serde(rename = "invalid_query")]
25    InvalidQuery,
26    #[serde(rename = "invalid_body")]
27    InvalidBody,
28    #[serde(rename = "resource_not_found")]
29    ResourceNotFound,
30    #[serde(rename = "conflict")]
31    Conflict,
32    #[serde(rename = "rate_limited")]
33    RateLimited,
34    #[serde(rename = "method_not_allowed")]
35    MethodNotAllowed,
36    #[serde(rename = "internal_error")]
37    InternalError,
38
39    /// A value this client does not know. It is not kept: this serializes as `"unknown"`, which the API does not list.
40    #[serde(rename = "unknown", other)]
41    Unknown,
42}
43
44impl std::fmt::Display for PublicApiErrorCode {
45    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
46        match self {
47            Self::AuthenticationFailed => write!(f, "authentication_failed"),
48            Self::AccessDenied => write!(f, "access_denied"),
49            Self::InvalidRequest => write!(f, "invalid_request"),
50            Self::InvalidQuery => write!(f, "invalid_query"),
51            Self::InvalidBody => write!(f, "invalid_body"),
52            Self::ResourceNotFound => write!(f, "resource_not_found"),
53            Self::Conflict => write!(f, "conflict"),
54            Self::RateLimited => write!(f, "rate_limited"),
55            Self::MethodNotAllowed => write!(f, "method_not_allowed"),
56            Self::InternalError => write!(f, "internal_error"),
57            Self::Unknown => write!(f, "unknown"),
58        }
59    }
60}
61
62impl crate::models::validation::Validate for PublicApiErrorCode {
63    fn validate_into(
64        &self,
65        _path: &crate::models::validation::Path<'_>,
66        _errors: &mut Vec<crate::models::validation::ValidationError>,
67    ) {
68    }
69}
70
71impl ::std::str::FromStr for PublicApiErrorCode {
72    type Err = crate::models::ParseEnumError;
73
74    fn from_str(value: &str) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
75        match value {
76            "authentication_failed" => Ok(Self::AuthenticationFailed),
77            "access_denied" => Ok(Self::AccessDenied),
78            "invalid_request" => Ok(Self::InvalidRequest),
79            "invalid_query" => Ok(Self::InvalidQuery),
80            "invalid_body" => Ok(Self::InvalidBody),
81            "resource_not_found" => Ok(Self::ResourceNotFound),
82            "conflict" => Ok(Self::Conflict),
83            "rate_limited" => Ok(Self::RateLimited),
84            "method_not_allowed" => Ok(Self::MethodNotAllowed),
85            "internal_error" => Ok(Self::InternalError),
86            _ => Err(crate::models::ParseEnumError::new(
87                "PublicApiErrorCode",
88                value,
89            )),
90        }
91    }
92}
93
94impl ::std::convert::TryFrom<&str> for PublicApiErrorCode {
95    type Error = crate::models::ParseEnumError;
96
97    fn try_from(value: &str) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
98        value.parse()
99    }
100}
101
102impl ::std::convert::TryFrom<&::std::string::String> for PublicApiErrorCode {
103    type Error = crate::models::ParseEnumError;
104
105    fn try_from(
106        value: &::std::string::String,
107    ) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
108        value.parse()
109    }
110}
111
112impl ::std::convert::TryFrom<::std::string::String> for PublicApiErrorCode {
113    type Error = crate::models::ParseEnumError;
114
115    fn try_from(
116        value: ::std::string::String,
117    ) -> ::std::result::Result<Self, crate::models::ParseEnumError> {
118        value.parse()
119    }
120}