Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
530 changes: 530 additions & 0 deletions src/libs/Opik/Generated/Opik.AiSpendClient.GetSpendComposition.g.cs

Large diffs are not rendered by default.

542 changes: 542 additions & 0 deletions src/libs/Opik/Generated/Opik.AiSpendClient.GetSpendLaneBreakdown.g.cs

Large diffs are not rendered by default.

Large diffs are not rendered by default.

530 changes: 530 additions & 0 deletions src/libs/Opik/Generated/Opik.AiSpendClient.GetSpendSummary.g.cs

Large diffs are not rendered by default.

602 changes: 602 additions & 0 deletions src/libs/Opik/Generated/Opik.AiSpendClient.GetSpendUsers.g.cs

Large diffs are not rendered by default.

285 changes: 285 additions & 0 deletions src/libs/Opik/Generated/Opik.AiSpendClient.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,285 @@

#nullable enable

namespace Opik
{
/// <summary>
/// Coding-agent spend analytics<br/>
/// If no httpClient is provided, a new one will be created.<br/>
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
public sealed partial class AiSpendClient : global::Opik.IAiSpendClient, global::System.IDisposable
{
/// <summary>
/// Local server
/// </summary>
public const string DefaultBaseUrl = "http://localhost:5173/api";

private bool _disposeHttpClient = true;

/// <inheritdoc/>
public global::System.Net.Http.HttpClient HttpClient { get; }

/// <inheritdoc/>
public System.Uri? BaseUri => ResolveDisplayedBaseUri();

/// <inheritdoc/>
public global::System.Collections.Generic.List<global::Opik.EndPointAuthorization> Authorizations { get; }

/// <inheritdoc/>
public bool ReadResponseAsString { get; set; }
#if DEBUG
= true;
#endif

/// <inheritdoc/>
public global::Opik.AutoSDKClientOptions Options { get; }


internal global::Opik.AutoSDKServerConfiguration AutoSDKServerConfiguration { get; set; } = new global::Opik.AutoSDKServerConfiguration();
/// <summary>
///
/// </summary>
public global::System.Text.Json.Serialization.JsonSerializerContext JsonSerializerContext { get; set; } = global::Opik.SourceGenerationContext.Default;



private static readonly global::Opik.AutoSDKServer[] s_availableServers = 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"),
};

/// <summary>
/// The server options available for this client.
/// </summary>
public global::System.Collections.Generic.IReadOnlyList<global::Opik.AutoSDKServer> AvailableServers => s_availableServers;

/// <summary>
/// The currently selected server for this client, if any.
/// </summary>
public global::Opik.AutoSDKServer? SelectedServer
{
get => ResolveSelectedServer();
set => SelectServer(value);
}

/// <summary>
/// Creates a new instance of the AiSpendClient.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient">The HttpClient instance. If not provided, a new one will be created.</param>
/// <param name="baseUri">The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.</param>
/// <param name="authorizations">The authorizations to use for the requests.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public AiSpendClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List<global::Opik.EndPointAuthorization>? authorizations = null,
bool disposeHttpClient = true) : this(
httpClient,
baseUri,
authorizations,
options: null,
disposeHttpClient: disposeHttpClient)
{
}

/// <summary>
/// Creates a new instance of the AiSpendClient with explicit options but no base URL override.
/// Skips passing <c>baseUri</c> so the default base URL from the OpenAPI spec applies.
/// </summary>
/// <param name="httpClient">The HttpClient instance. If not provided, a new one will be created.</param>
/// <param name="authorizations">The authorizations to use for the requests.</param>
/// <param name="options">Client-wide request defaults such as headers, query parameters, retries, and timeout.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public AiSpendClient(
global::System.Net.Http.HttpClient? httpClient,
global::System.Collections.Generic.List<global::Opik.EndPointAuthorization>? authorizations,
global::Opik.AutoSDKClientOptions? options,
bool disposeHttpClient = true) : this(
httpClient,
baseUri: null,
authorizations,
options,
disposeHttpClient: disposeHttpClient)
{
}

/// <summary>
/// Creates a new instance of the AiSpendClient.
/// If no httpClient is provided, a new one will be created.
/// If no baseUri is provided, the default baseUri from OpenAPI spec will be used.
/// </summary>
/// <param name="httpClient">The HttpClient instance. If not provided, a new one will be created.</param>
/// <param name="baseUri">The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.</param>
/// <param name="authorizations">The authorizations to use for the requests.</param>
/// <param name="options">Client-wide request defaults such as headers, query parameters, retries, and timeout.</param>
/// <param name="disposeHttpClient">Dispose the HttpClient when the instance is disposed. True by default.</param>
public AiSpendClient(
global::System.Net.Http.HttpClient? httpClient,
global::System.Uri? baseUri,
global::System.Collections.Generic.List<global::Opik.EndPointAuthorization>? authorizations,
global::Opik.AutoSDKClientOptions? options,
bool disposeHttpClient = true)
{

HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
if (baseUri is not null)
{
HttpClient.BaseAddress ??= baseUri;
}
Authorizations = authorizations ?? new global::System.Collections.Generic.List<global::Opik.EndPointAuthorization>();
Options = options ?? new global::Opik.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;

AutoSDKServerConfiguration.ExplicitBaseUri = baseUri ?? httpClient?.BaseAddress;

Initialized(HttpClient);
}

/// <inheritdoc/>
public void Dispose()
{
if (_disposeHttpClient)
{
HttpClient.Dispose();
}
}

partial void Initialized(
global::System.Net.Http.HttpClient client);
partial void PrepareArguments(
global::System.Net.Http.HttpClient client);
partial void PrepareRequest(
global::System.Net.Http.HttpClient client,
global::System.Net.Http.HttpRequestMessage request);
partial void ProcessResponse(
global::System.Net.Http.HttpClient client,
global::System.Net.Http.HttpResponseMessage response);
partial void ProcessResponseContent(
global::System.Net.Http.HttpClient client,
global::System.Net.Http.HttpResponseMessage response,
ref string content);


/// <summary>
/// Selects one of the generated server options by id.
/// </summary>
public bool TrySelectServer(string serverId)
{
if (string.IsNullOrWhiteSpace(serverId))
{
return false;
}

foreach (var server in s_availableServers)
{
if (string.Equals(server.Id, serverId, global::System.StringComparison.OrdinalIgnoreCase))
{
AutoSDKServerConfiguration.SelectedServer = server;
AutoSDKServerConfiguration.ExplicitBaseUri = null;
return true;
}
}

return false;
}

/// <summary>
/// Clears the currently selected server.
/// </summary>
public void ClearSelectedServer()
{
AutoSDKServerConfiguration.SelectedServer = null;
}

private global::Opik.AutoSDKServer? ResolveSelectedServer()
{
var selectedServer = AutoSDKServerConfiguration.SelectedServer;
if (selectedServer is null)
{
return null;
}

foreach (var server in s_availableServers)
{
if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal))
{
return server;
}
}

return null;
}

private void SelectServer(global::Opik.AutoSDKServer? server)
{
if (server is null)
{
AutoSDKServerConfiguration.SelectedServer = null;
return;
}

foreach (var candidate in s_availableServers)
{
if (string.Equals(candidate.Id, server.Id, global::System.StringComparison.Ordinal))
{
AutoSDKServerConfiguration.SelectedServer = candidate;
AutoSDKServerConfiguration.ExplicitBaseUri = null;
return;
}
}

throw new global::System.ArgumentException("The provided server is not available for this client.", nameof(server));
}

private global::System.Uri? ResolveDisplayedBaseUri()
{
if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri)
{
return explicitBaseUri;
}

return ResolveSelectedServer()?.Uri ?? (s_availableServers.Length > 0 ? s_availableServers[0].Uri : HttpClient.BaseAddress);
}

private global::System.Uri? ResolveBaseUri(
global::Opik.AutoSDKServer[] servers,
string defaultBaseUrl)
{
if (AutoSDKServerConfiguration.ExplicitBaseUri is global::System.Uri explicitBaseUri)
{
return explicitBaseUri;
}

if (AutoSDKServerConfiguration.SelectedServer is global::Opik.AutoSDKServer selectedServer)
{
foreach (var server in servers)
{
if (string.Equals(server.Id, selectedServer.Id, global::System.StringComparison.Ordinal))
{
return server.Uri;
}
}
}

if (servers.Length > 0)
{
return servers[0].Uri;
}

return string.IsNullOrWhiteSpace(defaultBaseUrl)
? HttpClient.BaseAddress
: new global::System.Uri(defaultBaseUrl, global::System.UriKind.RelativeOrAbsolute);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,7 @@ await CreateAnnotationQueueAsResponseAsync(
/// <param name="commentsEnabled"></param>
/// <param name="feedbackDefinitionNames"></param>
/// <param name="annotatorsPerItem"></param>
/// <param name="lockTimeoutSeconds"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::System.InvalidOperationException"></exception>
Expand All @@ -525,6 +526,7 @@ await CreateAnnotationQueueAsResponseAsync(
bool? commentsEnabled = default,
global::System.Collections.Generic.IList<string>? feedbackDefinitionNames = default,
int? annotatorsPerItem = default,
int? lockTimeoutSeconds = default,
global::Opik.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
Expand All @@ -539,6 +541,7 @@ await CreateAnnotationQueueAsResponseAsync(
CommentsEnabled = commentsEnabled,
FeedbackDefinitionNames = feedbackDefinitionNames,
AnnotatorsPerItem = annotatorsPerItem,
LockTimeoutSeconds = lockTimeoutSeconds,
};

await CreateAnnotationQueueAsync(
Expand Down
Loading