From 85b65747caaccca3e934860182a3994f8bc78248 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Fri, 10 Jul 2026 11:49:57 +0000 Subject: [PATCH] feat: Updated OpenAPI spec --- .../Opik.ISpansClient.SpansExist.g.cs | 44 ++ .../Opik.ITracesClient.TracesExist.g.cs | 54 ++ .../Generated/Opik.JsonSerializerContext.g.cs | 3 +- .../Opik.JsonSerializerContextTypes.g.cs | 186 +++---- .../Opik.Models.ExistenceResponse.Json.g.cs | 141 +++++ .../Opik.Models.ExistenceResponse.g.cs | 46 ++ .../Opik.SpansClient.SpansExist.g.cs | 468 +++++++++++++++++ .../Opik.TracesClient.TracesExist.g.cs | 484 ++++++++++++++++++ src/libs/Opik/openapi.yaml | 80 +++ 9 files changed, 1414 insertions(+), 92 deletions(-) create mode 100644 src/libs/Opik/Generated/Opik.ISpansClient.SpansExist.g.cs create mode 100644 src/libs/Opik/Generated/Opik.ITracesClient.TracesExist.g.cs create mode 100644 src/libs/Opik/Generated/Opik.Models.ExistenceResponse.Json.g.cs create mode 100644 src/libs/Opik/Generated/Opik.Models.ExistenceResponse.g.cs create mode 100644 src/libs/Opik/Generated/Opik.SpansClient.SpansExist.g.cs create mode 100644 src/libs/Opik/Generated/Opik.TracesClient.TracesExist.g.cs diff --git a/src/libs/Opik/Generated/Opik.ISpansClient.SpansExist.g.cs b/src/libs/Opik/Generated/Opik.ISpansClient.SpansExist.g.cs new file mode 100644 index 00000000..183737f3 --- /dev/null +++ b/src/libs/Opik/Generated/Opik.ISpansClient.SpansExist.g.cs @@ -0,0 +1,44 @@ +#nullable enable + +namespace Opik +{ + public partial interface ISpansClient + { + /// + /// Check whether a project has spans
+ /// Returns whether the project has at least one span matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project. + ///
+ /// + /// + /// + /// Restrict the probe to a single ingestion source (e.g. 'sdk' for the Logs empty state), matching the rendered list's logs-source scope. Omit to probe any source. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task SpansExistAsync( + global::System.Guid? projectId = default, + string? projectName = default, + string? source = default, + global::Opik.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Check whether a project has spans
+ /// Returns whether the project has at least one span matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project. + ///
+ /// + /// + /// + /// Restrict the probe to a single ingestion source (e.g. 'sdk' for the Logs empty state), matching the rendered list's logs-source scope. Omit to probe any source. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> SpansExistAsResponseAsync( + global::System.Guid? projectId = default, + string? projectName = default, + string? source = default, + global::Opik.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Opik/Generated/Opik.ITracesClient.TracesExist.g.cs b/src/libs/Opik/Generated/Opik.ITracesClient.TracesExist.g.cs new file mode 100644 index 00000000..31fa64ae --- /dev/null +++ b/src/libs/Opik/Generated/Opik.ITracesClient.TracesExist.g.cs @@ -0,0 +1,54 @@ +#nullable enable + +namespace Opik +{ + public partial interface ITracesClient + { + /// + /// Check whether a project has traces
+ /// Returns whether the project has at least one trace matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project. + ///
+ /// + /// + /// + /// Restrict the probe to a single ingestion source (e.g. 'sdk' for the Logs empty state), matching the rendered list's logs-source scope. Omit to probe any source. + /// + /// + /// When true, only considers traces that belong to a thread (thread_id is set) — used by the Threads empty state.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task TracesExistAsync( + global::System.Guid? projectId = default, + string? projectName = default, + string? source = default, + bool? threadOnly = default, + global::Opik.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + /// + /// Check whether a project has traces
+ /// Returns whether the project has at least one trace matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project. + ///
+ /// + /// + /// + /// Restrict the probe to a single ingestion source (e.g. 'sdk' for the Logs empty state), matching the rendered list's logs-source scope. Omit to probe any source. + /// + /// + /// When true, only considers traces that belong to a thread (thread_id is set) — used by the Threads empty state.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + global::System.Threading.Tasks.Task> TracesExistAsResponseAsync( + global::System.Guid? projectId = default, + string? projectName = default, + string? source = default, + bool? threadOnly = default, + global::Opik.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default); + } +} \ No newline at end of file diff --git a/src/libs/Opik/Generated/Opik.JsonSerializerContext.g.cs b/src/libs/Opik/Generated/Opik.JsonSerializerContext.g.cs index 356b2275..1dbe3eb8 100644 --- a/src/libs/Opik/Generated/Opik.JsonSerializerContext.g.cs +++ b/src/libs/Opik/Generated/Opik.JsonSerializerContext.g.cs @@ -2860,6 +2860,7 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.SpanSearchStreamRequestPublicType), TypeInfoPropertyName = "SpanSearchStreamRequestPublicType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.SpanSearchStreamRequestPublicExcludeItem), TypeInfoPropertyName = "SpanSearchStreamRequestPublicExcludeItem2")] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.ExistenceResponse))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.TraceBatchUpdate))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.TraceUpdate))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.TraceUpdateSource), TypeInfoPropertyName = "TraceUpdateSource2")] @@ -2931,7 +2932,6 @@ internal sealed partial class SourceGenerationContextChunk0 : global::System.Tex [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.ListRunnersStatus), TypeInfoPropertyName = "ListRunnersStatus2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.FindReportFailuresType), TypeInfoPropertyName = "FindReportFailuresType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.GetSpansByProjectType), TypeInfoPropertyName = "GetSpansByProjectType2")] - [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.FindFeedbackScoreNames1Type), TypeInfoPropertyName = "FindFeedbackScoreNames1Type2")] internal sealed partial class SourceGenerationContextChunk1 : global::System.Text.Json.Serialization.JsonSerializerContext { } @@ -3897,6 +3897,7 @@ internal sealed partial class SourceGenerationContextChunk1 : global::System.Tex typeof(global::Opik.JsonConverters.UnixTimestampJsonConverter), })] + [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.FindFeedbackScoreNames1Type), TypeInfoPropertyName = "FindFeedbackScoreNames1Type2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Opik.GetSpanStatsType), TypeInfoPropertyName = "GetSpanStatsType2")] [global::System.Text.Json.Serialization.JsonSerializable(typeof(byte[]))] [global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList>))] diff --git a/src/libs/Opik/Generated/Opik.JsonSerializerContextTypes.g.cs b/src/libs/Opik/Generated/Opik.JsonSerializerContextTypes.g.cs index 303695bd..b91589cb 100644 --- a/src/libs/Opik/Generated/Opik.JsonSerializerContextTypes.g.cs +++ b/src/libs/Opik/Generated/Opik.JsonSerializerContextTypes.g.cs @@ -3736,367 +3736,371 @@ public sealed partial class JsonSerializerContextTypes /// /// /// - public global::Opik.TraceBatchUpdate? Type927 { get; set; } + public global::Opik.ExistenceResponse? Type927 { get; set; } /// /// /// - public global::Opik.TraceUpdate? Type928 { get; set; } + public global::Opik.TraceBatchUpdate? Type928 { get; set; } /// /// /// - public global::Opik.TraceUpdateSource? Type929 { get; set; } + public global::Opik.TraceUpdate? Type929 { get; set; } /// /// /// - public global::Opik.TraceThreadBatchUpdate? Type930 { get; set; } + public global::Opik.TraceUpdateSource? Type930 { get; set; } /// /// /// - public global::Opik.TraceThreadUpdate? Type931 { get; set; } + public global::Opik.TraceThreadBatchUpdate? Type931 { get; set; } /// /// /// - public global::Opik.TraceThreadBatchIdentifier? Type932 { get; set; } + public global::Opik.TraceThreadUpdate? Type932 { get; set; } /// /// /// - public global::Opik.TraceWrite? Type933 { get; set; } + public global::Opik.TraceThreadBatchIdentifier? Type933 { get; set; } /// /// /// - public global::Opik.TraceWriteSource? Type934 { get; set; } + public global::Opik.TraceWrite? Type934 { get; set; } /// /// /// - public global::Opik.TraceBatch? Type935 { get; set; } + public global::Opik.TraceWriteSource? Type935 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type936 { get; set; } + public global::Opik.TraceBatch? Type936 { get; set; } /// /// /// - public global::Opik.TraceBatchWrite? Type937 { get; set; } + public global::System.Collections.Generic.IList? Type937 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type938 { get; set; } + public global::Opik.TraceBatchWrite? Type938 { get; set; } /// /// /// - public global::Opik.DeleteThreadFeedbackScores? Type939 { get; set; } + public global::System.Collections.Generic.IList? Type939 { get; set; } /// /// /// - public global::Opik.DeleteTraceThreads? Type940 { get; set; } + public global::Opik.DeleteThreadFeedbackScores? Type940 { get; set; } /// /// /// - public global::Opik.BatchDeleteByProject? Type941 { get; set; } + public global::Opik.DeleteTraceThreads? Type941 { get; set; } /// /// /// - public global::Opik.CheckPublic? Type942 { get; set; } + public global::Opik.BatchDeleteByProject? Type942 { get; set; } /// /// /// - public global::Opik.CheckPublicName? Type943 { get; set; } + public global::Opik.CheckPublic? Type943 { get; set; } /// /// /// - public global::Opik.CheckPublicResult? Type944 { get; set; } + public global::Opik.CheckPublicName? Type944 { get; set; } /// /// /// - public global::Opik.ExperimentItemReferencePublic? Type945 { get; set; } + public global::Opik.CheckPublicResult? Type945 { get; set; } /// /// /// - public global::Opik.GuardrailsValidationPublic? Type946 { get; set; } + public global::Opik.ExperimentItemReferencePublic? Type946 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type947 { get; set; } + public global::Opik.GuardrailsValidationPublic? Type947 { get; set; } /// /// /// - public global::Opik.TracePublic? Type948 { get; set; } + public global::System.Collections.Generic.IList? Type948 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type949 { get; set; } + public global::Opik.TracePublic? Type949 { get; set; } /// /// /// - public global::Opik.TracePublicVisibilityMode? Type950 { get; set; } + public global::System.Collections.Generic.IList? Type950 { get; set; } /// /// /// - public global::Opik.TracePublicSource? Type951 { get; set; } + public global::Opik.TracePublicVisibilityMode? Type951 { get; set; } /// /// /// - public global::Opik.TraceThread? Type952 { get; set; } + public global::Opik.TracePublicSource? Type952 { get; set; } /// /// /// - public global::Opik.TraceThreadStatus? Type953 { get; set; } + public global::Opik.TraceThread? Type953 { get; set; } /// /// /// - public global::Opik.TraceThreadIdentifier? Type954 { get; set; } + public global::Opik.TraceThreadStatus? Type954 { get; set; } /// /// /// - public global::Opik.TraceThreadPage? Type955 { get; set; } + public global::Opik.TraceThreadIdentifier? Type955 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type956 { get; set; } + public global::Opik.TraceThreadPage? Type956 { get; set; } /// /// /// - public global::Opik.TracePagePublic? Type957 { get; set; } + public global::System.Collections.Generic.IList? Type957 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type958 { get; set; } + public global::Opik.TracePagePublic? Type958 { get; set; } /// /// /// - public global::Opik.FeedbackScoreBatchItemThread? Type959 { get; set; } + public global::System.Collections.Generic.IList? Type959 { get; set; } /// /// /// - public global::Opik.FeedbackScoreBatchItemThreadSource? Type960 { get; set; } + public global::Opik.FeedbackScoreBatchItemThread? Type960 { get; set; } /// /// /// - public global::Opik.FeedbackScoreBatchThread? Type961 { get; set; } + public global::Opik.FeedbackScoreBatchItemThreadSource? Type961 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type962 { get; set; } + public global::Opik.FeedbackScoreBatchThread? Type962 { get; set; } /// /// /// - public global::Opik.TraceThreadSearchStreamRequest? Type963 { get; set; } + public global::System.Collections.Generic.IList? Type963 { get; set; } /// /// /// - public global::Opik.TraceSearchStreamRequestPublic? Type964 { get; set; } + public global::Opik.TraceThreadSearchStreamRequest? Type964 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type965 { get; set; } + public global::Opik.TraceSearchStreamRequestPublic? Type965 { get; set; } /// /// /// - public global::Opik.TraceSearchStreamRequestPublicExcludeItem? Type966 { get; set; } + public global::System.Collections.Generic.IList? Type966 { get; set; } /// /// /// - public global::Opik.WelcomeWizardTracking? Type967 { get; set; } + public global::Opik.TraceSearchStreamRequestPublicExcludeItem? Type967 { get; set; } /// /// /// - public global::Opik.WelcomeWizardSubmission? Type968 { get; set; } + public global::Opik.WelcomeWizardTracking? Type968 { get; set; } /// /// /// - public global::Opik.Permission? Type969 { get; set; } + public global::Opik.WelcomeWizardSubmission? Type969 { get; set; } /// /// /// - public global::Opik.WorkspaceUserPermissions? Type970 { get; set; } + public global::Opik.Permission? Type970 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type971 { get; set; } + public global::Opik.WorkspaceUserPermissions? Type971 { get; set; } /// /// /// - public global::Opik.Result? Type972 { get; set; } + public global::System.Collections.Generic.IList? Type972 { get; set; } /// /// /// - public global::Opik.WorkspaceMetricsSummaryRequest? Type973 { get; set; } + public global::Opik.Result? Type973 { get; set; } /// /// /// - public global::Opik.DataPointDouble? Type974 { get; set; } + public global::Opik.WorkspaceMetricsSummaryRequest? Type974 { get; set; } /// /// /// - public global::Opik.WorkspaceMetricResponse? Type975 { get; set; } + public global::Opik.DataPointDouble? Type975 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type976 { get; set; } + public global::Opik.WorkspaceMetricResponse? Type976 { get; set; } /// /// /// - public global::Opik.WorkspaceMetricRequest? Type977 { get; set; } + public global::System.Collections.Generic.IList? Type977 { get; set; } /// /// /// - public global::Opik.WorkspaceConfiguration? Type978 { get; set; } + public global::Opik.WorkspaceMetricRequest? Type978 { get; set; } /// /// /// - public global::Opik.WorkspaceVersion? Type979 { get; set; } + public global::Opik.WorkspaceConfiguration? Type979 { get; set; } /// /// /// - public global::Opik.WorkspaceVersionOpikVersion? Type980 { get; set; } + public global::Opik.WorkspaceVersion? Type980 { get; set; } /// /// /// - public global::Opik.WorkspaceMetricsSummaryResponse? Type981 { get; set; } + public global::Opik.WorkspaceVersionOpikVersion? Type981 { get; set; } /// /// /// - public global::Opik.RevokeRequest? Type982 { get; set; } + public global::Opik.WorkspaceMetricsSummaryResponse? Type982 { get; set; } /// /// /// - public global::Opik.TokenRequest? Type983 { get; set; } + public global::Opik.RevokeRequest? Type983 { get; set; } /// /// /// - public global::Opik.CreateDatasetItemsFromCsvRequest? Type984 { get; set; } + public global::Opik.TokenRequest? Type984 { get; set; } /// /// /// - public global::Opik.CreateDatasetItemsFromJsonRequest? Type985 { get; set; } + public global::Opik.CreateDatasetItemsFromCsvRequest? Type985 { get; set; } /// /// /// - public global::Opik.CreateDatasetItemsFromJsonRequestFormat? Type986 { get; set; } + public global::Opik.CreateDatasetItemsFromJsonRequest? Type986 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type987 { get; set; } + public global::Opik.CreateDatasetItemsFromJsonRequestFormat? Type987 { get; set; } /// /// /// - public global::Opik.FindAgentInsightsIssuesStatus? Type988 { get; set; } + public global::System.Collections.Generic.IList? Type988 { get; set; } /// /// /// - public global::Opik.FindAgentInsightsIssuesSeverity? Type989 { get; set; } + public global::Opik.FindAgentInsightsIssuesStatus? Type989 { get; set; } /// /// /// - public global::Opik.GetWebhookExamplesAlertType? Type990 { get; set; } + public global::Opik.FindAgentInsightsIssuesSeverity? Type990 { get; set; } /// /// /// - public global::Opik.AttachmentListEntityType? Type991 { get; set; } + public global::Opik.GetWebhookExamplesAlertType? Type991 { get; set; } /// /// /// - public global::Opik.DownloadAttachmentEntityType? Type992 { get; set; } + public global::Opik.AttachmentListEntityType? Type992 { get; set; } /// /// /// - public global::Opik.UploadAttachmentEntityType? Type993 { get; set; } + public global::Opik.DownloadAttachmentEntityType? Type993 { get; set; } /// /// /// - public global::Opik.FindFeedbackDefinitionsType? Type994 { get; set; } + public global::Opik.UploadAttachmentEntityType? Type994 { get; set; } /// /// /// - public global::Opik.ListRunnersStatus? Type995 { get; set; } + public global::Opik.FindFeedbackDefinitionsType? Type995 { get; set; } /// /// /// - public global::Opik.FindReportFailuresType? Type996 { get; set; } + public global::Opik.ListRunnersStatus? Type996 { get; set; } /// /// /// - public global::Opik.GetSpansByProjectType? Type997 { get; set; } + public global::Opik.FindReportFailuresType? Type997 { get; set; } /// /// /// - public global::Opik.FindFeedbackScoreNames1Type? Type998 { get; set; } + public global::Opik.GetSpansByProjectType? Type998 { get; set; } /// /// /// - public global::Opik.GetSpanStatsType? Type999 { get; set; } + public global::Opik.FindFeedbackScoreNames1Type? Type999 { get; set; } /// /// /// - public byte[]? Type1000 { get; set; } + public global::Opik.GetSpanStatsType? Type1000 { get; set; } /// /// /// - public global::System.Collections.Generic.IList>? Type1001 { get; set; } + public byte[]? Type1001 { get; set; } /// /// /// - public global::Opik.AnyOf? Type1002 { get; set; } + public global::System.Collections.Generic.IList>? Type1002 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type1003 { get; set; } + public global::Opik.AnyOf? Type1003 { get; set; } /// /// /// - public global::System.Collections.Generic.IList>? Type1004 { get; set; } + public global::System.Collections.Generic.IList? Type1004 { get; set; } /// /// /// - public global::Opik.AnyOf? Type1005 { get; set; } + public global::System.Collections.Generic.IList>? Type1005 { get; set; } /// /// /// - public global::System.Collections.Generic.IList>? Type1006 { get; set; } + public global::Opik.AnyOf? Type1006 { get; set; } /// /// /// - public global::Opik.AnyOf? Type1007 { get; set; } + public global::System.Collections.Generic.IList>? Type1007 { get; set; } /// /// /// - public global::System.Collections.Generic.IList>? Type1008 { get; set; } + public global::Opik.AnyOf? Type1008 { get; set; } /// /// /// - public global::Opik.AnyOf? Type1009 { get; set; } + public global::System.Collections.Generic.IList>? Type1009 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type1010 { get; set; } + public global::Opik.AnyOf? Type1010 { get; set; } /// /// /// - public global::System.Collections.Generic.IList? Type1011 { get; set; } + public global::System.Collections.Generic.IList? Type1011 { get; set; } /// /// /// - public global::System.Collections.Generic.IList>? Type1012 { get; set; } + public global::System.Collections.Generic.IList? Type1012 { get; set; } /// /// /// - public global::Opik.AnyOf? Type1013 { get; set; } + public global::System.Collections.Generic.IList>? Type1013 { get; set; } /// /// /// - public global::System.Collections.Generic.IList>? Type1014 { get; set; } + public global::Opik.AnyOf? Type1014 { get; set; } /// /// /// - public global::Opik.AnyOf? Type1015 { get; set; } + public global::System.Collections.Generic.IList>? Type1015 { get; set; } /// /// /// - public global::System.Collections.Generic.IList>? Type1016 { get; set; } + public global::Opik.AnyOf? Type1016 { get; set; } /// /// /// - public global::Opik.AnyOf? Type1017 { get; set; } + public global::System.Collections.Generic.IList>? Type1017 { get; set; } + /// + /// + /// + public global::Opik.AnyOf? Type1018 { get; set; } /// /// diff --git a/src/libs/Opik/Generated/Opik.Models.ExistenceResponse.Json.g.cs b/src/libs/Opik/Generated/Opik.Models.ExistenceResponse.Json.g.cs new file mode 100644 index 00000000..225bc6c3 --- /dev/null +++ b/src/libs/Opik/Generated/Opik.Models.ExistenceResponse.Json.g.cs @@ -0,0 +1,141 @@ +#nullable enable + +namespace Opik +{ + public sealed partial class ExistenceResponse + { + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerContext. + /// + public string ToJson( + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Serialize( + this, + this.GetType(), + jsonSerializerContext); + } + + /// + /// Serializes the current instance to a JSON string using the generated default JsonSerializerContext. + /// + public string ToJson() + { + return ToJson(global::Opik.SourceGenerationContext.Default); + } + + /// + /// Serializes the current instance to a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public string ToJson( + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return ToJson(global::Opik.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Serialize( + this, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerContext. + /// + public static global::Opik.ExistenceResponse? FromJson( + string json, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + typeof(global::Opik.ExistenceResponse), + jsonSerializerContext) as global::Opik.ExistenceResponse; + } + + /// + /// Deserializes a JSON string using the generated default JsonSerializerContext. + /// + public static global::Opik.ExistenceResponse? FromJson( + string json) + { + return FromJson( + json, + global::Opik.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON string using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::Opik.ExistenceResponse? FromJson( + string json, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJson( + json, + global::Opik.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.Deserialize( + json, + jsonSerializerOptions); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerContext. + /// + public static async global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext) + { + return (await global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + typeof(global::Opik.ExistenceResponse), + jsonSerializerContext).ConfigureAwait(false)) as global::Opik.ExistenceResponse; + } + + /// + /// Deserializes a JSON stream using the generated default JsonSerializerContext. + /// + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream) + { + return FromJsonStreamAsync( + jsonStream, + global::Opik.SourceGenerationContext.Default); + } + + /// + /// Deserializes a JSON stream using the provided JsonSerializerOptions. + /// +#if NET8_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")] + [global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")] +#endif + public static global::System.Threading.Tasks.ValueTask FromJsonStreamAsync( + global::System.IO.Stream jsonStream, + global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null) + { + if (jsonSerializerOptions is null) + { + return FromJsonStreamAsync( + jsonStream, + global::Opik.SourceGenerationContext.Default); + } + + return global::System.Text.Json.JsonSerializer.DeserializeAsync( + jsonStream, + jsonSerializerOptions); + } + } +} diff --git a/src/libs/Opik/Generated/Opik.Models.ExistenceResponse.g.cs b/src/libs/Opik/Generated/Opik.Models.ExistenceResponse.g.cs new file mode 100644 index 00000000..cb75bcf0 --- /dev/null +++ b/src/libs/Opik/Generated/Opik.Models.ExistenceResponse.g.cs @@ -0,0 +1,46 @@ + +#nullable enable + +namespace Opik +{ + /// + /// + /// + public sealed partial class ExistenceResponse + { + /// + /// Whether the project has at least one matching entity for the given scope + /// + [global::System.Text.Json.Serialization.JsonPropertyName("exists")] + public bool? Exists { get; set; } + + /// + /// Additional properties that are not explicitly defined in the schema + /// + [global::System.Text.Json.Serialization.JsonExtensionData] + public global::System.Collections.Generic.IDictionary AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary(); + + /// + /// Initializes a new instance of the class. + /// + /// + /// Whether the project has at least one matching entity for the given scope + /// +#if NET7_0_OR_GREATER + [global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers] +#endif + public ExistenceResponse( + bool? exists) + { + this.Exists = exists; + } + + /// + /// Initializes a new instance of the class. + /// + public ExistenceResponse() + { + } + + } +} \ No newline at end of file diff --git a/src/libs/Opik/Generated/Opik.SpansClient.SpansExist.g.cs b/src/libs/Opik/Generated/Opik.SpansClient.SpansExist.g.cs new file mode 100644 index 00000000..b3180f4c --- /dev/null +++ b/src/libs/Opik/Generated/Opik.SpansClient.SpansExist.g.cs @@ -0,0 +1,468 @@ + +#nullable enable + +namespace Opik +{ + public partial class SpansClient + { + + private static readonly global::Opik.AutoSDKServer[] s_SpansExistServers = new global::Opik.AutoSDKServer[] + { new global::Opik.AutoSDKServer( + id: "http-localhost-api", + name: "Local server", + url: "http://localhost:5173/api", + description: "Local server"), + new global::Opik.AutoSDKServer( + id: "https-www-comet-com-opik-api", + name: "Opik Cloud", + url: "https://www.comet.com/opik/api", + description: "Opik Cloud"), + }; + + + private static readonly global::Opik.EndPointSecurityRequirement s_SpansExistSecurityRequirement0 = + new global::Opik.EndPointSecurityRequirement + { + Authorizations = new global::Opik.EndPointAuthorizationRequirement[] + { new global::Opik.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Opik.EndPointSecurityRequirement[] s_SpansExistSecurityRequirements = + new global::Opik.EndPointSecurityRequirement[] + { s_SpansExistSecurityRequirement0, + }; + partial void PrepareSpansExistArguments( + global::System.Net.Http.HttpClient httpClient, + ref global::System.Guid? projectId, + ref string? projectName, + ref string? source); + partial void PrepareSpansExistRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::System.Guid? projectId, + string? projectName, + string? source); + partial void ProcessSpansExistResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessSpansExistResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Check whether a project has spans
+ /// Returns whether the project has at least one span matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project. + ///
+ /// + /// + /// + /// Restrict the probe to a single ingestion source (e.g. 'sdk' for the Logs empty state), matching the rendered list's logs-source scope. Omit to probe any source. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task SpansExistAsync( + global::System.Guid? projectId = default, + string? projectName = default, + string? source = default, + global::Opik.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await SpansExistAsResponseAsync( + projectId: projectId, + projectName: projectName, + source: source, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Check whether a project has spans
+ /// Returns whether the project has at least one span matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project. + ///
+ /// + /// + /// + /// Restrict the probe to a single ingestion source (e.g. 'sdk' for the Logs empty state), matching the rendered list's logs-source scope. Omit to probe any source. + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> SpansExistAsResponseAsync( + global::System.Guid? projectId = default, + string? projectName = default, + string? source = default, + global::Opik.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareSpansExistArguments( + httpClient: HttpClient, + projectId: ref projectId, + projectName: ref projectName, + source: ref source); + + + var __authorizations = global::Opik.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_SpansExistSecurityRequirements, + operationName: "SpansExistAsync"); + + using var __timeoutCancellationTokenSource = global::Opik.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Opik.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Opik.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Opik.PathBuilder( + path: "/v1/private/spans/exists", + baseUri: ResolveBaseUri( + servers: s_SpansExistServers, + defaultBaseUrl: "http://localhost:5173/api")); + __pathBuilder + .AddOptionalParameter("project_id", projectId?.ToString()) + .AddOptionalParameter("project_name", projectName) + .AddOptionalParameter("source", source) + ; + var __path = __pathBuilder.ToString(); + __path = global::Opik.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::Opik.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareSpansExistRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + projectId: projectId, + projectName: projectName, + source: source); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Opik.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SpansExist", + methodName: "SpansExistAsync", + pathTemplate: "\"/v1/private/spans/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Opik.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Opik.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SpansExist", + methodName: "SpansExistAsync", + pathTemplate: "\"/v1/private/spans/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Opik.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Opik.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Opik.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Opik.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SpansExist", + methodName: "SpansExistAsync", + pathTemplate: "\"/v1/private/spans/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Opik.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessSpansExistResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Opik.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SpansExist", + methodName: "SpansExistAsync", + pathTemplate: "\"/v1/private/spans/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Opik.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "SpansExist", + methodName: "SpansExistAsync", + pathTemplate: "\"/v1/private/spans/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessSpansExistResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Opik.ExistenceResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Opik.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Opik.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Opik.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Opik.ExistenceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Opik.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Opik.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Opik.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Opik/Generated/Opik.TracesClient.TracesExist.g.cs b/src/libs/Opik/Generated/Opik.TracesClient.TracesExist.g.cs new file mode 100644 index 00000000..2eeddcc4 --- /dev/null +++ b/src/libs/Opik/Generated/Opik.TracesClient.TracesExist.g.cs @@ -0,0 +1,484 @@ + +#nullable enable + +namespace Opik +{ + public partial class TracesClient + { + + private static readonly global::Opik.AutoSDKServer[] s_TracesExistServers = new global::Opik.AutoSDKServer[] + { new global::Opik.AutoSDKServer( + id: "http-localhost-api", + name: "Local server", + url: "http://localhost:5173/api", + description: "Local server"), + new global::Opik.AutoSDKServer( + id: "https-www-comet-com-opik-api", + name: "Opik Cloud", + url: "https://www.comet.com/opik/api", + description: "Opik Cloud"), + }; + + + private static readonly global::Opik.EndPointSecurityRequirement s_TracesExistSecurityRequirement0 = + new global::Opik.EndPointSecurityRequirement + { + Authorizations = new global::Opik.EndPointAuthorizationRequirement[] + { new global::Opik.EndPointAuthorizationRequirement + { + Type = "Http", + SchemeId = "HttpBearer", + Location = "Header", + Name = "Bearer", + FriendlyName = "Bearer", + }, + }, + }; + private static readonly global::Opik.EndPointSecurityRequirement[] s_TracesExistSecurityRequirements = + new global::Opik.EndPointSecurityRequirement[] + { s_TracesExistSecurityRequirement0, + }; + partial void PrepareTracesExistArguments( + global::System.Net.Http.HttpClient httpClient, + ref global::System.Guid? projectId, + ref string? projectName, + ref string? source, + ref bool? threadOnly); + partial void PrepareTracesExistRequest( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpRequestMessage httpRequestMessage, + global::System.Guid? projectId, + string? projectName, + string? source, + bool? threadOnly); + partial void ProcessTracesExistResponse( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage); + + partial void ProcessTracesExistResponseContent( + global::System.Net.Http.HttpClient httpClient, + global::System.Net.Http.HttpResponseMessage httpResponseMessage, + ref string content); + + /// + /// Check whether a project has traces
+ /// Returns whether the project has at least one trace matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project. + ///
+ /// + /// + /// + /// Restrict the probe to a single ingestion source (e.g. 'sdk' for the Logs empty state), matching the rendered list's logs-source scope. Omit to probe any source. + /// + /// + /// When true, only considers traces that belong to a thread (thread_id is set) — used by the Threads empty state.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task TracesExistAsync( + global::System.Guid? projectId = default, + string? projectName = default, + string? source = default, + bool? threadOnly = default, + global::Opik.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + var __response = await TracesExistAsResponseAsync( + projectId: projectId, + projectName: projectName, + source: source, + threadOnly: threadOnly, + requestOptions: requestOptions, + cancellationToken: cancellationToken + ).ConfigureAwait(false); + + return __response.Body; + } + /// + /// Check whether a project has traces
+ /// Returns whether the project has at least one trace matching the given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions without scanning or aggregating the whole project. + ///
+ /// + /// + /// + /// Restrict the probe to a single ingestion source (e.g. 'sdk' for the Logs empty state), matching the rendered list's logs-source scope. Omit to probe any source. + /// + /// + /// When true, only considers traces that belong to a thread (thread_id is set) — used by the Threads empty state.
+ /// Default Value: false + /// + /// Per-request overrides such as headers, query parameters, timeout, retries, and response buffering. + /// The token to cancel the operation with + /// + public async global::System.Threading.Tasks.Task> TracesExistAsResponseAsync( + global::System.Guid? projectId = default, + string? projectName = default, + string? source = default, + bool? threadOnly = default, + global::Opik.AutoSDKRequestOptions? requestOptions = default, + global::System.Threading.CancellationToken cancellationToken = default) + { + PrepareArguments( + client: HttpClient); + PrepareTracesExistArguments( + httpClient: HttpClient, + projectId: ref projectId, + projectName: ref projectName, + source: ref source, + threadOnly: ref threadOnly); + + + var __authorizations = global::Opik.EndPointSecurityResolver.ResolveAuthorizations( + availableAuthorizations: Authorizations, + securityRequirements: s_TracesExistSecurityRequirements, + operationName: "TracesExistAsync"); + + using var __timeoutCancellationTokenSource = global::Opik.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource( + clientOptions: Options, + requestOptions: requestOptions, + cancellationToken: cancellationToken); + var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken; + var __effectiveReadResponseAsString = global::Opik.AutoSDKRequestOptionsSupport.GetReadResponseAsString( + clientOptions: Options, + requestOptions: requestOptions, + fallbackValue: ReadResponseAsString); + var __maxAttempts = global::Opik.AutoSDKRequestOptionsSupport.GetMaxAttempts( + clientOptions: Options, + requestOptions: requestOptions, + supportsRetry: true); + + global::System.Net.Http.HttpRequestMessage __CreateHttpRequest() + { + + var __pathBuilder = new global::Opik.PathBuilder( + path: "/v1/private/traces/exists", + baseUri: ResolveBaseUri( + servers: s_TracesExistServers, + defaultBaseUrl: "http://localhost:5173/api")); + __pathBuilder + .AddOptionalParameter("project_id", projectId?.ToString()) + .AddOptionalParameter("project_name", projectName) + .AddOptionalParameter("source", source) + .AddOptionalParameter("thread_only", threadOnly?.ToString().ToLowerInvariant()) + ; + var __path = __pathBuilder.ToString(); + __path = global::Opik.AutoSDKRequestOptionsSupport.AppendQueryParameters( + path: __path, + clientParameters: Options.QueryParameters, + requestParameters: requestOptions?.QueryParameters); + var __httpRequest = new global::System.Net.Http.HttpRequestMessage( + method: global::System.Net.Http.HttpMethod.Get, + requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute)); +#if NET6_0_OR_GREATER + __httpRequest.Version = global::System.Net.HttpVersion.Version11; + __httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher; +#endif + + foreach (var __authorization in __authorizations) + { + if (__authorization.Type == "Http" || + __authorization.Type == "OAuth2" || + __authorization.Type == "OpenIdConnect") + { + __httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue( + scheme: __authorization.Name, + parameter: __authorization.Value); + } + else if (__authorization.Type == "ApiKey" && + __authorization.Location == "Header") + { + __httpRequest.Headers.Add(__authorization.Name, __authorization.Value); + } + } + global::Opik.AutoSDKRequestOptionsSupport.ApplyHeaders( + request: __httpRequest, + clientHeaders: Options.Headers, + requestHeaders: requestOptions?.Headers); + + PrepareRequest( + client: HttpClient, + request: __httpRequest); + PrepareTracesExistRequest( + httpClient: HttpClient, + httpRequestMessage: __httpRequest, + projectId: projectId, + projectName: projectName, + source: source, + threadOnly: threadOnly); + + return __httpRequest; + } + + global::System.Net.Http.HttpRequestMessage? __httpRequest = null; + global::System.Net.Http.HttpResponseMessage? __response = null; + var __attemptNumber = 0; + try + { + for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++) + { + __attemptNumber = __attempt; + __httpRequest = __CreateHttpRequest(); + await global::Opik.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TracesExist", + methodName: "TracesExistAsync", + pathTemplate: "\"/v1/private/traces/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + try + { + __response = await HttpClient.SendAsync( + request: __httpRequest, + completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + } + catch (global::System.Net.Http.HttpRequestException __exception) + { + var __retryDelay = global::Opik.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: null, + attempt: __attempt); + var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested; + await global::Opik.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TracesExist", + methodName: "TracesExistAsync", + pathTemplate: "\"/v1/private/traces/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: null, + exception: __exception, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: __willRetry, + retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null, + retryReason: "exception", + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + if (!__willRetry) + { + throw; + } + + __httpRequest.Dispose(); + __httpRequest = null; + await global::Opik.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + if (__response != null && + __attempt < __maxAttempts && + global::Opik.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode)) + { + var __retryDelay = global::Opik.AutoSDKRequestOptionsSupport.GetRetryDelay( + clientOptions: Options, + requestOptions: requestOptions, + response: __response, + attempt: __attempt); + await global::Opik.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TracesExist", + methodName: "TracesExistAsync", + pathTemplate: "\"/v1/private/traces/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attempt, + maxAttempts: __maxAttempts, + willRetry: true, + retryDelay: __retryDelay, + retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture), + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + __response.Dispose(); + __response = null; + __httpRequest.Dispose(); + __httpRequest = null; + await global::Opik.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync( + retryDelay: __retryDelay, + cancellationToken: __effectiveCancellationToken).ConfigureAwait(false); + continue; + } + + break; + } + + if (__response == null) + { + throw new global::System.InvalidOperationException("No response received."); + } + + using (__response) + { + + ProcessResponse( + client: HttpClient, + response: __response); + ProcessTracesExistResponse( + httpClient: HttpClient, + httpResponseMessage: __response); + if (__response.IsSuccessStatusCode) + { + await global::Opik.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TracesExist", + methodName: "TracesExistAsync", + pathTemplate: "\"/v1/private/traces/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + else + { + await global::Opik.AutoSDKRequestOptionsSupport.OnAfterErrorAsync( + clientOptions: Options, + context: global::Opik.AutoSDKRequestOptionsSupport.CreateHookContext( + operationId: "TracesExist", + methodName: "TracesExistAsync", + pathTemplate: "\"/v1/private/traces/exists\"", + httpMethod: "GET", + baseUri: BaseUri, + request: __httpRequest!, + response: __response, + exception: null, + clientOptions: Options, + requestOptions: requestOptions, + attempt: __attemptNumber, + maxAttempts: __maxAttempts, + willRetry: false, + retryDelay: null, + retryReason: global::System.String.Empty, + cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false); + } + + if (__effectiveReadResponseAsString) + { + var __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + ProcessResponseContent( + client: HttpClient, + response: __response, + content: ref __content); + ProcessTracesExistResponseContent( + httpClient: HttpClient, + httpResponseMessage: __response, + content: ref __content); + + try + { + __response.EnsureSuccessStatusCode(); + + var __value = global::Opik.ExistenceResponse.FromJson(__content, JsonSerializerContext) ?? + throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" "); + return new global::Opik.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Opik.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + throw global::Opik.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + else + { + try + { + __response.EnsureSuccessStatusCode(); + using var __content = await __response.Content.ReadAsStreamAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + + var __value = await global::Opik.ExistenceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ?? + throw new global::System.InvalidOperationException("Response deserialization failed."); + return new global::Opik.AutoSDKHttpResponse( + statusCode: __response.StatusCode, + headers: global::Opik.AutoSDKHttpResponse.CreateHeaders(__response), + requestUri: __response.RequestMessage?.RequestUri, + body: __value); + } + catch (global::System.Exception __ex) + { + string? __content = null; + try + { + __content = await __response.Content.ReadAsStringAsync( + #if NET5_0_OR_GREATER + __effectiveCancellationToken + #endif + ).ConfigureAwait(false); + } + catch (global::System.Exception) + { + } + + throw global::Opik.ApiException.Create( + statusCode: __response.StatusCode, + message: __content ?? __response.ReasonPhrase ?? string.Empty, + innerException: __ex, + responseBody: __content, + responseHeaders: global::System.Linq.Enumerable.ToDictionary( + __response.Headers, + h => h.Key, + h => h.Value)); + } + } + + } + } + finally + { + __httpRequest?.Dispose(); + } + } + } +} \ No newline at end of file diff --git a/src/libs/Opik/openapi.yaml b/src/libs/Opik/openapi.yaml index 16b2bd15..0809f5e4 100644 --- a/src/libs/Opik/openapi.yaml +++ b/src/libs/Opik/openapi.yaml @@ -8004,6 +8004,39 @@ paths: application/octet-stream: schema: $ref: "#/components/schemas/ErrorMessage_Public" + /v1/private/spans/exists: + get: + tags: + - Spans + summary: Check whether a project has spans + description: Returns whether the project has at least one span matching the + given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions + without scanning or aggregating the whole project. + operationId: spansExist + parameters: + - name: project_id + in: query + schema: + type: string + format: uuid + - name: project_name + in: query + schema: + type: string + - name: source + in: query + schema: + type: string + description: "Restrict the probe to a single ingestion source (e.g. 'sdk'\ + \ for the Logs empty state), matching the rendered list's logs-source\ + \ scope. Omit to probe any source." + responses: + "200": + description: Span existence + content: + application/json: + schema: + $ref: "#/components/schemas/ExistenceResponse" /v1/private/spans/comments/{commentId}: patch: tags: @@ -8878,6 +8911,46 @@ paths: application/octet-stream: schema: $ref: "#/components/schemas/ErrorMessage_Public" + /v1/private/traces/exists: + get: + tags: + - Traces + summary: Check whether a project has traces + description: Returns whether the project has at least one trace matching the + given scope. Cheap existence probe (LIMIT 1) used to drive empty-state decisions + without scanning or aggregating the whole project. + operationId: tracesExist + parameters: + - name: project_id + in: query + schema: + type: string + format: uuid + - name: project_name + in: query + schema: + type: string + - name: source + in: query + schema: + type: string + description: "Restrict the probe to a single ingestion source (e.g. 'sdk'\ + \ for the Logs empty state), matching the rendered list's logs-source\ + \ scope. Omit to probe any source." + - name: thread_only + in: query + schema: + type: boolean + description: "When true, only considers traces that belong to a thread (thread_id\ + \ is set) — used by the Threads empty state." + default: false + responses: + "200": + description: Trace existence + content: + application/json: + schema: + $ref: "#/components/schemas/ExistenceResponse" /v1/private/traces/threads/{threadModelId}: patch: tags: @@ -21405,6 +21478,13 @@ components: description: "Filter spans created up to this time (ISO-8601 format). If\ \ not provided, defaults to current time. Must be after 'from_time'." format: date-time + ExistenceResponse: + type: object + properties: + exists: + type: boolean + description: Whether the project has at least one matching entity for the + given scope TraceBatchUpdate: required: - ids