diff --git a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.AddRequestLogToDatasetVersion.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.AddRequestLogToDatasetVersion.g.cs
index de31810..f38f15b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.AddRequestLogToDatasetVersion.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.AddRequestLogToDatasetVersion.g.cs
@@ -14,6 +14,7 @@ public partial class DatasetsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessAddRequestLogToDatasetVersionResponseContent(
/// Add Request Log to Draft Dataset
///
///
+ /// 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 AddRequestLogToDatasetVersionAsync(
global::PromptLayer.AddRequestLogToDatasetVersionRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessAddRequestLogToDatasetVersionResponseContent(
securityRequirements: s_AddRequestLogToDatasetVersionSecurityRequirements,
operationName: "AddRequestLogToDatasetVersionAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/dataset-versions/add-request-log",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/dataset-versions/add-request-log",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,232 +114,391 @@ partial void ProcessAddRequestLogToDatasetVersionResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareAddRequestLogToDatasetVersionRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareAddRequestLogToDatasetVersionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessAddRequestLogToDatasetVersionResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Request log and dataset must belong to the same workspace
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddRequestLogToDatasetVersion",
+ methodName: "AddRequestLogToDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/add-request-log\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddRequestLogToDatasetVersion",
+ methodName: "AddRequestLogToDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/add-request-log\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Access denied to this dataset group
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddRequestLogToDatasetVersion",
+ methodName: "AddRequestLogToDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/add-request-log\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Dataset group, draft, or request log not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessAddRequestLogToDatasetVersionResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddRequestLogToDatasetVersion",
+ methodName: "AddRequestLogToDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/add-request-log\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddRequestLogToDatasetVersion",
+ methodName: "AddRequestLogToDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/add-request-log\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Request log and dataset must belong to the same workspace
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Access denied to this dataset group
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessAddRequestLogToDatasetVersionResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Dataset group, draft, or request log not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.AddRequestLogToDatasetVersionResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.AddRequestLogToDatasetVersionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessAddRequestLogToDatasetVersionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.AddRequestLogToDatasetVersionResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.AddRequestLogToDatasetVersionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Add Request Log to Draft Dataset
@@ -326,11 +509,13 @@ partial void ProcessAddRequestLogToDatasetVersionResponseContent(
///
/// ID of the request log to add as a dataset row
///
+ /// 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 AddRequestLogToDatasetVersionAsync(
int datasetGroupId,
int requestLogId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.AddRequestLogToDatasetVersionRequest
@@ -341,6 +526,7 @@ partial void ProcessAddRequestLogToDatasetVersionResponseContent(
return await AddRequestLogToDatasetVersionAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetGroup.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetGroup.g.cs
index 186a376..6899751 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetGroup.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetGroup.g.cs
@@ -14,6 +14,7 @@ public partial class DatasetsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessCreateDatasetGroupResponseContent(
/// Create Dataset Group
///
///
+ /// 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 CreateDatasetGroupAsync(
global::PromptLayer.CreateDatasetGroupRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateDatasetGroupResponseContent(
securityRequirements: s_CreateDatasetGroupSecurityRequirements,
operationName: "CreateDatasetGroupAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/dataset-groups",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/dataset-groups",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,156 +114,315 @@ partial void ProcessCreateDatasetGroupResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateDatasetGroupRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateDatasetGroupRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateDatasetGroupResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request - Invalid workspace_id or dataset with this name already exists
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetGroup",
+ methodName: "CreateDatasetGroupAsync",
+ pathTemplate: "\"/api/public/v2/dataset-groups\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetGroup",
+ methodName: "CreateDatasetGroupAsync",
+ pathTemplate: "\"/api/public/v2/dataset-groups\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetGroup",
+ methodName: "CreateDatasetGroupAsync",
+ pathTemplate: "\"/api/public/v2/dataset-groups\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_400 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateDatasetGroupResponseContent(
+ response: __response);
+ ProcessCreateDatasetGroupResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.CreateDatasetGroupResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetGroup",
+ methodName: "CreateDatasetGroupAsync",
+ pathTemplate: "\"/api/public/v2/dataset-groups\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetGroup",
+ methodName: "CreateDatasetGroupAsync",
+ pathTemplate: "\"/api/public/v2/dataset-groups\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Bad Request - Invalid workspace_id or dataset with this name already exists
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.CreateDatasetGroupResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessCreateDatasetGroupResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateDatasetGroupResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateDatasetGroupResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create Dataset Group
@@ -250,11 +433,13 @@ partial void ProcessCreateDatasetGroupResponseContent(
///
/// Optional: ID of the workspace where the dataset group will be created. If not provided, uses the workspace associated with your API key.
///
+ /// 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 CreateDatasetGroupAsync(
string name,
int? workspaceId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreateDatasetGroupRequest
@@ -265,6 +450,7 @@ partial void ProcessCreateDatasetGroupResponseContent(
return await CreateDatasetGroupAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetVersionFromFile.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetVersionFromFile.g.cs
index a8e67ee..073575d 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetVersionFromFile.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetVersionFromFile.g.cs
@@ -14,6 +14,7 @@ public partial class DatasetsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessCreateDatasetVersionFromFileResponseContent(
/// Create Dataset Version from File
///
///
+ /// 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 CreateDatasetVersionFromFileAsync(
global::PromptLayer.CreateDatasetVersionFromFileRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateDatasetVersionFromFileResponseContent(
securityRequirements: s_CreateDatasetVersionFromFileSecurityRequirements,
operationName: "CreateDatasetVersionFromFileAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/dataset-versions/from-file",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/dataset-versions/from-file",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,270 +114,429 @@ partial void ProcessCreateDatasetVersionFromFileResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateDatasetVersionFromFileRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateDatasetVersionFromFileRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateDatasetVersionFromFileResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request - Invalid file format, file too large, or invalid base64 encoding
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFile",
+ methodName: "CreateDatasetVersionFromFileAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-file\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFile",
+ methodName: "CreateDatasetVersionFromFileAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-file\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Access denied to this dataset group
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFile",
+ methodName: "CreateDatasetVersionFromFileAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-file\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Dataset group not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateDatasetVersionFromFileResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFile",
+ methodName: "CreateDatasetVersionFromFileAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-file\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFile",
+ methodName: "CreateDatasetVersionFromFileAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-file\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request - Invalid file format, file too large, or invalid base64 encoding
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Failed to upload file or create dataset version
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::PromptLayer.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Access denied to this dataset group
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Dataset group not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateDatasetVersionFromFileResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Failed to upload file or create dataset version
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::PromptLayer.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreateDatasetVersionFromFileResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::PromptLayer.CreateDatasetVersionFromFileResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessCreateDatasetVersionFromFileResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateDatasetVersionFromFileResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateDatasetVersionFromFileResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create Dataset Version from File
@@ -367,12 +550,14 @@ partial void ProcessCreateDatasetVersionFromFileResponseContent(
///
/// Base64 encoded content of the file. Maximum file size: 100MB. Supported formats: CSV, JSON
///
+ /// 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 CreateDatasetVersionFromFileAsync(
int datasetGroupId,
string fileName,
string fileContentBase64,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreateDatasetVersionFromFileRequest
@@ -384,6 +569,7 @@ partial void ProcessCreateDatasetVersionFromFileResponseContent(
return await CreateDatasetVersionFromFileAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetVersionFromFilterParams.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetVersionFromFilterParams.g.cs
index 4773887..76524cc 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetVersionFromFilterParams.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDatasetVersionFromFilterParams.g.cs
@@ -14,6 +14,7 @@ public partial class DatasetsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessCreateDatasetVersionFromFilterParamsResponseContent(
/// Create Dataset Version from Filter Params
///
///
+ /// 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 CreateDatasetVersionFromFilterParamsAsync(
global::PromptLayer.CreateDatasetVersionFromFilterParamsRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateDatasetVersionFromFilterParamsResponseContent(
securityRequirements: s_CreateDatasetVersionFromFilterParamsSecurityRequirements,
operationName: "CreateDatasetVersionFromFilterParamsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/dataset-versions/from-filter-params",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/dataset-versions/from-filter-params",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,194 +114,353 @@ partial void ProcessCreateDatasetVersionFromFilterParamsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateDatasetVersionFromFilterParamsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateDatasetVersionFromFilterParamsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateDatasetVersionFromFilterParamsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Access denied to this dataset group
- if ((int)__response.StatusCode == 403)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFilterParams",
+ methodName: "CreateDatasetVersionFromFilterParamsAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-filter-params\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFilterParams",
+ methodName: "CreateDatasetVersionFromFilterParamsAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-filter-params\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Dataset group not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFilterParams",
+ methodName: "CreateDatasetVersionFromFilterParamsAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-filter-params\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateDatasetVersionFromFilterParamsResponseContent(
+ response: __response);
+ ProcessCreateDatasetVersionFromFilterParamsResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.CreateDatasetVersionFromFilterParamsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFilterParams",
+ methodName: "CreateDatasetVersionFromFilterParamsAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-filter-params\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDatasetVersionFromFilterParams",
+ methodName: "CreateDatasetVersionFromFilterParamsAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/from-filter-params\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Access denied to this dataset group
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.CreateDatasetVersionFromFilterParamsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Dataset group not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessCreateDatasetVersionFromFilterParamsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateDatasetVersionFromFilterParamsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateDatasetVersionFromFilterParamsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create Dataset Version from Filter Params
@@ -315,6 +498,7 @@ partial void ProcessCreateDatasetVersionFromFilterParamsResponseContent(
///
/// Filter by score ranges
///
+ /// 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 CreateDatasetVersionFromFilterParamsAsync(
@@ -329,6 +513,7 @@ partial void ProcessCreateDatasetVersionFromFilterParamsResponseContent(
global::System.Collections.Generic.IList? tags = default,
global::System.Collections.Generic.Dictionary? metadata = default,
global::System.Collections.Generic.Dictionary? scores = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreateDatasetVersionFromFilterParamsRequest
@@ -348,6 +533,7 @@ partial void ProcessCreateDatasetVersionFromFilterParamsResponseContent(
return await CreateDatasetVersionFromFilterParamsAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDraftDatasetVersion.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDraftDatasetVersion.g.cs
index 8ed5b55..bcb7e07 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDraftDatasetVersion.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.CreateDraftDatasetVersion.g.cs
@@ -14,6 +14,7 @@ public partial class DatasetsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessCreateDraftDatasetVersionResponseContent(
/// Create Draft Dataset Version
///
///
+ /// 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 CreateDraftDatasetVersionAsync(
global::PromptLayer.CreateDraftDatasetVersionRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateDraftDatasetVersionResponseContent(
securityRequirements: s_CreateDraftDatasetVersionSecurityRequirements,
operationName: "CreateDraftDatasetVersionAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/dataset-versions/create-draft",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/dataset-versions/create-draft",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,232 +114,391 @@ partial void ProcessCreateDraftDatasetVersionResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateDraftDatasetVersionRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateDraftDatasetVersionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateDraftDatasetVersionResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Access denied to this dataset group
- if ((int)__response.StatusCode == 403)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDraftDatasetVersion",
+ methodName: "CreateDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/create-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDraftDatasetVersion",
+ methodName: "CreateDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/create-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Dataset group or source dataset not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDraftDatasetVersion",
+ methodName: "CreateDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/create-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // A draft version already exists for this dataset group
- if ((int)__response.StatusCode == 409)
- {
- string? __content_409 = null;
- global::System.Exception? __exception_409 = null;
- global::PromptLayer.ErrorResponse? __value_409 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::PromptLayer.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
- else
- {
- __content_409 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_409 = global::PromptLayer.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateDraftDatasetVersionResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDraftDatasetVersion",
+ methodName: "CreateDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/create-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_409 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateDraftDatasetVersion",
+ methodName: "CreateDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/create-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Access denied to this dataset group
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_409,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_409,
- ResponseObject = __value_409,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Dataset group or source dataset not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateDraftDatasetVersionResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // A draft version already exists for this dataset group
+ if ((int)__response.StatusCode == 409)
+ {
+ string? __content_409 = null;
+ global::System.Exception? __exception_409 = null;
+ global::PromptLayer.ErrorResponse? __value_409 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_409 = global::PromptLayer.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ else
+ {
+ __content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreateDraftDatasetVersionResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_409 = global::PromptLayer.ErrorResponse.FromJson(__content_409, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_409 = __ex;
+ }
- return
- await global::PromptLayer.CreateDraftDatasetVersionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_409,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_409,
+ ResponseObject = __value_409,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessCreateDraftDatasetVersionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateDraftDatasetVersionResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateDraftDatasetVersionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create Draft Dataset Version
@@ -326,11 +509,13 @@ partial void ProcessCreateDraftDatasetVersionResponseContent(
///
/// Optional. ID of an existing dataset version to copy rows from. Must belong to the same dataset group.
///
+ /// 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 CreateDraftDatasetVersionAsync(
int datasetGroupId,
int? sourceDatasetId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreateDraftDatasetVersionRequest
@@ -341,6 +526,7 @@ partial void ProcessCreateDraftDatasetVersionResponseContent(
return await CreateDraftDatasetVersionAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.GetDatasetRows.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.GetDatasetRows.g.cs
index faf0136..fbcf931 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.GetDatasetRows.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.GetDatasetRows.g.cs
@@ -14,6 +14,7 @@ public partial class DatasetsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -61,6 +62,7 @@ partial void ProcessGetDatasetRowsResponseContent(
/// Default Value: 10
///
///
+ /// 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 GetDatasetRowsAsync(
@@ -69,6 +71,7 @@ partial void ProcessGetDatasetRowsResponseContent(
int? page = default,
int? perPage = default,
string? q = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -87,28 +90,49 @@ partial void ProcessGetDatasetRowsResponseContent(
securityRequirements: s_GetDatasetRowsSecurityRequirements,
operationName: "GetDatasetRowsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/api/public/v2/datasets/{datasetId}/rows",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("workspace_id", workspaceId?.ToString())
- .AddOptionalParameter("page", page?.ToString())
- .AddOptionalParameter("per_page", perPage?.ToString())
- .AddOptionalParameter("q", q)
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/api/public/v2/datasets/{datasetId}/rows",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("workspace_id", workspaceId?.ToString())
+ .AddOptionalParameter("page", page?.ToString())
+ .AddOptionalParameter("per_page", perPage?.ToString())
+ .AddOptionalParameter("q", q)
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -118,192 +142,351 @@ partial void ProcessGetDatasetRowsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetDatasetRowsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- datasetId: datasetId,
- workspaceId: workspaceId,
- page: page,
- perPage: perPage,
- q: q);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetDatasetRowsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ datasetId: datasetId,
+ workspaceId: workspaceId,
+ page: page,
+ perPage: perPage,
+ q: q);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetDatasetRowsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Invalid workspace_id
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetDatasetRows",
+ methodName: "GetDatasetRowsAsync",
+ pathTemplate: "$\"/api/public/v2/datasets/{datasetId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetDatasetRows",
+ methodName: "GetDatasetRowsAsync",
+ pathTemplate: "$\"/api/public/v2/datasets/{datasetId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Dataset not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetDatasetRows",
+ methodName: "GetDatasetRowsAsync",
+ pathTemplate: "$\"/api/public/v2/datasets/{datasetId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetDatasetRowsResponseContent(
+ response: __response);
+ ProcessGetDatasetRowsResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetDatasetRowsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetDatasetRows",
+ methodName: "GetDatasetRowsAsync",
+ pathTemplate: "$\"/api/public/v2/datasets/{datasetId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetDatasetRows",
+ methodName: "GetDatasetRowsAsync",
+ pathTemplate: "$\"/api/public/v2/datasets/{datasetId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Invalid workspace_id
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.GetDatasetRowsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Dataset not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetDatasetRowsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetDatasetRowsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetDatasetRowsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.DatasetsClient.ListDatasets.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.ListDatasets.g.cs
index fb3eeb3..a02dd40 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.ListDatasets.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.ListDatasets.g.cs
@@ -14,6 +14,7 @@ public partial class DatasetsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -77,6 +78,7 @@ partial void ProcessListDatasetsResponseContent(
///
/// Default Value: 10
///
+ /// 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 ListDatasetsAsync(
@@ -90,6 +92,7 @@ partial void ProcessListDatasetsResponseContent(
global::PromptLayer.ListDatasetsStatus? status = default,
int? page = default,
int? perPage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -113,34 +116,55 @@ partial void ProcessListDatasetsResponseContent(
securityRequirements: s_ListDatasetsSecurityRequirements,
operationName: "ListDatasetsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/datasets",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("dataset_group_id", datasetGroupId?.ToString())
- .AddOptionalParameter("prompt_id", promptId?.ToString())
- .AddOptionalParameter("prompt_version_id", promptVersionId?.ToString())
- .AddOptionalParameter("prompt_label_id", promptLabelId?.ToString())
- .AddOptionalParameter("workspace_id", workspaceId?.ToString())
- .AddOptionalParameter("report_id", reportId?.ToString())
- .AddOptionalParameter("name", name)
- .AddOptionalParameter("status", status?.ToValueString())
- .AddOptionalParameter("page", page?.ToString())
- .AddOptionalParameter("per_page", perPage?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/datasets",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("dataset_group_id", datasetGroupId?.ToString())
+ .AddOptionalParameter("prompt_id", promptId?.ToString())
+ .AddOptionalParameter("prompt_version_id", promptVersionId?.ToString())
+ .AddOptionalParameter("prompt_label_id", promptLabelId?.ToString())
+ .AddOptionalParameter("workspace_id", workspaceId?.ToString())
+ .AddOptionalParameter("report_id", reportId?.ToString())
+ .AddOptionalParameter("name", name)
+ .AddOptionalParameter("status", status?.ToValueString())
+ .AddOptionalParameter("page", page?.ToString())
+ .AddOptionalParameter("per_page", perPage?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -150,159 +174,318 @@ partial void ProcessListDatasetsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareListDatasetsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- datasetGroupId: datasetGroupId,
- promptId: promptId,
- promptVersionId: promptVersionId,
- promptLabelId: promptLabelId,
- workspaceId: workspaceId,
- reportId: reportId,
- name: name,
- status: status,
- page: page,
- perPage: perPage);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareListDatasetsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ datasetGroupId: datasetGroupId,
+ promptId: promptId,
+ promptVersionId: promptVersionId,
+ promptLabelId: promptLabelId,
+ workspaceId: workspaceId,
+ reportId: reportId,
+ name: name,
+ status: status,
+ page: page,
+ perPage: perPage);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessListDatasetsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Invalid workspace_id
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListDatasets",
+ methodName: "ListDatasetsAsync",
+ pathTemplate: "\"/api/public/v2/datasets\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListDatasets",
+ methodName: "ListDatasetsAsync",
+ pathTemplate: "\"/api/public/v2/datasets\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListDatasets",
+ methodName: "ListDatasetsAsync",
+ pathTemplate: "\"/api/public/v2/datasets\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_400 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessListDatasetsResponseContent(
+ response: __response);
+ ProcessListDatasetsResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.ListDatasetsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListDatasets",
+ methodName: "ListDatasetsAsync",
+ pathTemplate: "\"/api/public/v2/datasets\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListDatasets",
+ methodName: "ListDatasetsAsync",
+ pathTemplate: "\"/api/public/v2/datasets\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Invalid workspace_id
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.ListDatasetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessListDatasetsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.ListDatasetsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.ListDatasetsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.DatasetsClient.SaveDraftDatasetVersion.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.SaveDraftDatasetVersion.g.cs
index 971baa6..a7a6bf0 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.SaveDraftDatasetVersion.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.SaveDraftDatasetVersion.g.cs
@@ -14,6 +14,7 @@ public partial class DatasetsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessSaveDraftDatasetVersionResponseContent(
/// Save Draft Dataset Version
///
///
+ /// 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 SaveDraftDatasetVersionAsync(
global::PromptLayer.SaveDraftDatasetVersionRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessSaveDraftDatasetVersionResponseContent(
securityRequirements: s_SaveDraftDatasetVersionSecurityRequirements,
operationName: "SaveDraftDatasetVersionAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/dataset-versions/save-draft",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/dataset-versions/save-draft",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,194 +114,353 @@ partial void ProcessSaveDraftDatasetVersionResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareSaveDraftDatasetVersionRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareSaveDraftDatasetVersionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessSaveDraftDatasetVersionResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Access denied to this dataset group
- if ((int)__response.StatusCode == 403)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SaveDraftDatasetVersion",
+ methodName: "SaveDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/save-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SaveDraftDatasetVersion",
+ methodName: "SaveDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/save-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Dataset group not found or no draft version exists
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SaveDraftDatasetVersion",
+ methodName: "SaveDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/save-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessSaveDraftDatasetVersionResponseContent(
+ response: __response);
+ ProcessSaveDraftDatasetVersionResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.SaveDraftDatasetVersionResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SaveDraftDatasetVersion",
+ methodName: "SaveDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/save-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SaveDraftDatasetVersion",
+ methodName: "SaveDraftDatasetVersionAsync",
+ pathTemplate: "\"/api/public/v2/dataset-versions/save-draft\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Access denied to this dataset group
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.SaveDraftDatasetVersionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Dataset group not found or no draft version exists
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessSaveDraftDatasetVersionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.SaveDraftDatasetVersionResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.SaveDraftDatasetVersionResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Save Draft Dataset Version
@@ -285,10 +468,12 @@ partial void ProcessSaveDraftDatasetVersionResponseContent(
///
/// ID of the dataset group containing the draft to save
///
+ /// 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 SaveDraftDatasetVersionAsync(
int datasetGroupId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.SaveDraftDatasetVersionRequest
@@ -298,6 +483,7 @@ partial void ProcessSaveDraftDatasetVersionResponseContent(
return await SaveDraftDatasetVersionAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.g.cs
index 8208ce7..bac8677 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.DatasetsClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class DatasetsClient : global::PromptLayer.IDatasetsClient
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public DatasetsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the DatasetsClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public DatasetsClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.GetEvaluationRows.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.GetEvaluationRows.g.cs
index 8dcd74c..8ca9859 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.GetEvaluationRows.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.GetEvaluationRows.g.cs
@@ -14,6 +14,7 @@ public partial class EvaluationsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -58,6 +59,7 @@ partial void ProcessGetEvaluationRowsResponseContent(
///
/// Default Value: 10
///
+ /// 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 GetEvaluationRowsAsync(
@@ -65,6 +67,7 @@ partial void ProcessGetEvaluationRowsResponseContent(
int? workspaceId = default,
int? page = default,
int? perPage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -82,27 +85,48 @@ partial void ProcessGetEvaluationRowsResponseContent(
securityRequirements: s_GetEvaluationRowsSecurityRequirements,
operationName: "GetEvaluationRowsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/api/public/v2/evaluations/{evaluationId}/rows",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("workspace_id", workspaceId?.ToString())
- .AddOptionalParameter("page", page?.ToString())
- .AddOptionalParameter("per_page", perPage?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/api/public/v2/evaluations/{evaluationId}/rows",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("workspace_id", workspaceId?.ToString())
+ .AddOptionalParameter("page", page?.ToString())
+ .AddOptionalParameter("per_page", perPage?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -112,191 +136,350 @@ partial void ProcessGetEvaluationRowsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetEvaluationRowsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- evaluationId: evaluationId,
- workspaceId: workspaceId,
- page: page,
- perPage: perPage);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetEvaluationRowsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ evaluationId: evaluationId,
+ workspaceId: workspaceId,
+ page: page,
+ perPage: perPage);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetEvaluationRowsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Invalid workspace_id
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetEvaluationRows",
+ methodName: "GetEvaluationRowsAsync",
+ pathTemplate: "$\"/api/public/v2/evaluations/{evaluationId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetEvaluationRows",
+ methodName: "GetEvaluationRowsAsync",
+ pathTemplate: "$\"/api/public/v2/evaluations/{evaluationId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Evaluation not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetEvaluationRows",
+ methodName: "GetEvaluationRowsAsync",
+ pathTemplate: "$\"/api/public/v2/evaluations/{evaluationId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetEvaluationRowsResponseContent(
+ response: __response);
+ ProcessGetEvaluationRowsResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetEvaluationRowsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetEvaluationRows",
+ methodName: "GetEvaluationRowsAsync",
+ pathTemplate: "$\"/api/public/v2/evaluations/{evaluationId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetEvaluationRows",
+ methodName: "GetEvaluationRowsAsync",
+ pathTemplate: "$\"/api/public/v2/evaluations/{evaluationId}/rows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Invalid workspace_id
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.GetEvaluationRowsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Evaluation not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetEvaluationRowsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetEvaluationRowsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetEvaluationRowsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.EvaluationsClient.ListEvaluations.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.ListEvaluations.g.cs
index f44ad0d..03df7e2 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.ListEvaluations.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.ListEvaluations.g.cs
@@ -14,6 +14,7 @@ public partial class EvaluationsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -67,6 +68,7 @@ partial void ProcessListEvaluationsResponseContent(
///
/// Default Value: 10
///
+ /// 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 ListEvaluationsAsync(
@@ -76,6 +78,7 @@ partial void ProcessListEvaluationsResponseContent(
bool? includeRuns = default,
int? page = default,
int? perPage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -95,30 +98,51 @@ partial void ProcessListEvaluationsResponseContent(
securityRequirements: s_ListEvaluationsSecurityRequirements,
operationName: "ListEvaluationsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/evaluations",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("workspace_id", workspaceId?.ToString())
- .AddOptionalParameter("name", name)
- .AddOptionalParameter("status", status?.ToValueString())
- .AddOptionalParameter("include_runs", includeRuns?.ToString().ToLowerInvariant())
- .AddOptionalParameter("page", page?.ToString())
- .AddOptionalParameter("per_page", perPage?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/evaluations",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("workspace_id", workspaceId?.ToString())
+ .AddOptionalParameter("name", name)
+ .AddOptionalParameter("status", status?.ToValueString())
+ .AddOptionalParameter("include_runs", includeRuns?.ToString().ToLowerInvariant())
+ .AddOptionalParameter("page", page?.ToString())
+ .AddOptionalParameter("per_page", perPage?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -128,155 +152,314 @@ partial void ProcessListEvaluationsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareListEvaluationsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- workspaceId: workspaceId,
- name: name,
- status: status,
- includeRuns: includeRuns,
- page: page,
- perPage: perPage);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareListEvaluationsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ workspaceId: workspaceId,
+ name: name,
+ status: status,
+ includeRuns: includeRuns,
+ page: page,
+ perPage: perPage);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessListEvaluationsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Invalid workspace_id
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListEvaluations",
+ methodName: "ListEvaluationsAsync",
+ pathTemplate: "\"/api/public/v2/evaluations\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListEvaluations",
+ methodName: "ListEvaluationsAsync",
+ pathTemplate: "\"/api/public/v2/evaluations\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListEvaluations",
+ methodName: "ListEvaluationsAsync",
+ pathTemplate: "\"/api/public/v2/evaluations\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_400 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessListEvaluationsResponseContent(
+ response: __response);
+ ProcessListEvaluationsResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.ListEvaluationsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListEvaluations",
+ methodName: "ListEvaluationsAsync",
+ pathTemplate: "\"/api/public/v2/evaluations\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListEvaluations",
+ methodName: "ListEvaluationsAsync",
+ pathTemplate: "\"/api/public/v2/evaluations\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Invalid workspace_id
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.ListEvaluationsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessListEvaluationsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.ListEvaluationsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.ListEvaluationsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.EvaluationsClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.g.cs
index a59c08f..e84b71b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.EvaluationsClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class EvaluationsClient : global::PromptLayer.IEvaluations
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public EvaluationsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the EvaluationsClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public EvaluationsClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.CreateFolderApiPublicV2FoldersPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.CreateFolderApiPublicV2FoldersPost.g.cs
index 2178900..43a6bb6 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.CreateFolderApiPublicV2FoldersPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.CreateFolderApiPublicV2FoldersPost.g.cs
@@ -14,6 +14,7 @@ public partial class FoldersClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -45,11 +46,13 @@ partial void ProcessCreateFolderApiPublicV2FoldersPostResponseContent(
/// Creates a new folder in the workspace. Folders can be nested within other folders by providing a parent_id. The folder name must be unique within its parent folder (or at the root level if no parent is specified).
///
///
+ /// 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 CreateFolderApiPublicV2FoldersPostAsync(
global::PromptLayer.CreateFolderRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -66,22 +69,43 @@ partial void ProcessCreateFolderApiPublicV2FoldersPostResponseContent(
securityRequirements: s_CreateFolderApiPublicV2FoldersPostSecurityRequirements,
operationName: "CreateFolderApiPublicV2FoldersPostAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/folders",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/folders",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -91,232 +115,391 @@ partial void ProcessCreateFolderApiPublicV2FoldersPostResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateFolderApiPublicV2FoldersPostRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateFolderApiPublicV2FoldersPostRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateFolderApiPublicV2FoldersPostResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad request - Invalid input or folder name already exists
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.AnyOf? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateFolderApiPublicV2FoldersPost",
+ methodName: "CreateFolderApiPublicV2FoldersPostAsync",
+ pathTemplate: "\"/api/public/v2/folders\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.AnyOf.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateFolderApiPublicV2FoldersPost",
+ methodName: "CreateFolderApiPublicV2FoldersPostAsync",
+ pathTemplate: "\"/api/public/v2/folders\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.AnyOf.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException?>(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized - Missing or invalid API key
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.UnauthorizedError? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateFolderApiPublicV2FoldersPost",
+ methodName: "CreateFolderApiPublicV2FoldersPostAsync",
+ pathTemplate: "\"/api/public/v2/folders\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Parent folder not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ParentFolderNotFoundError? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ParentFolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ParentFolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateFolderApiPublicV2FoldersPostResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateFolderApiPublicV2FoldersPost",
+ methodName: "CreateFolderApiPublicV2FoldersPostAsync",
+ pathTemplate: "\"/api/public/v2/folders\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateFolderApiPublicV2FoldersPost",
+ methodName: "CreateFolderApiPublicV2FoldersPostAsync",
+ pathTemplate: "\"/api/public/v2/folders\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad request - Invalid input or folder name already exists
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.AnyOf? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.AnyOf.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.AnyOf.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException?>(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized - Missing or invalid API key
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.UnauthorizedError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateFolderApiPublicV2FoldersPostResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Parent folder not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ParentFolderNotFoundError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ParentFolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreateFolderSuccessResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ParentFolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.CreateFolderSuccessResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessCreateFolderApiPublicV2FoldersPostResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateFolderSuccessResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateFolderSuccessResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create Folder
@@ -328,11 +511,13 @@ partial void ProcessCreateFolderApiPublicV2FoldersPostResponseContent(
///
/// The ID of the parent folder. If null or not provided, the folder will be created at the root level of the workspace.
///
+ /// 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 CreateFolderApiPublicV2FoldersPostAsync(
string name,
int? parentId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreateFolderRequest
@@ -343,6 +528,7 @@ partial void ProcessCreateFolderApiPublicV2FoldersPostResponseContent(
return await CreateFolderApiPublicV2FoldersPostAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete.g.cs
index f1b551b..14e8f3b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete.g.cs
@@ -14,6 +14,7 @@ public partial class FoldersClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -45,11 +46,13 @@ partial void ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponse
/// Deletes one or more entities from the workspace. Supports deleting folders, prompts, snippets, workflows, datasets, evaluations, AB tests, and input variable sets. Use cascade=true to recursively delete all contents of a folder. Without cascade, deleting a non-empty folder returns an error. Entities are soft-deleted where applicable.
///
///
+ /// 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 DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync(
global::PromptLayer.DeleteFolderEntitiesRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -66,22 +69,43 @@ partial void ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponse
securityRequirements: s_DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteSecurityRequirements,
operationName: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/folders/entities",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/folders/entities",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -91,270 +115,429 @@ partial void ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponse
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad request - Folder is not empty (use cascade=true) or invalid entity type
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete",
+ methodName: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete",
+ methodName: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized - Missing or invalid API key
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.UnauthorizedError? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete",
+ methodName: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Entity not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete",
+ methodName: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete",
+ methodName: "DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad request - Folder is not empty (use cascade=true) or invalid entity type
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal server error during deletion
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::PromptLayer.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized - Missing or invalid API key
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.UnauthorizedError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Entity not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal server error during deletion
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::PromptLayer.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.FolderEntitiesCountResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::PromptLayer.FolderEntitiesCountResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.FolderEntitiesCountResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.FolderEntitiesCountResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Delete Folder Entities
@@ -370,12 +553,14 @@ partial void ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponse
///
/// The ID of the workspace.
///
+ /// 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 DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync(
global::System.Collections.Generic.IList entities,
bool? cascade = default,
int? workspaceId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.DeleteFolderEntitiesRequest
@@ -387,6 +572,7 @@ partial void ProcessDeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteResponse
return await DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.ListFolderEntitiesApiPublicV2FoldersEntitiesGet.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.ListFolderEntitiesApiPublicV2FoldersEntitiesGet.g.cs
index d32206c..c68ccf9 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.ListFolderEntitiesApiPublicV2FoldersEntitiesGet.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.ListFolderEntitiesApiPublicV2FoldersEntitiesGet.g.cs
@@ -14,6 +14,7 @@ public partial class FoldersClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -74,6 +75,7 @@ partial void ProcessListFolderEntitiesApiPublicV2FoldersEntitiesGetResponseConte
/// When true, includes type-specific metadata for each entity (e.g., prompt type, latest version number).
/// 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 ListFolderEntitiesApiPublicV2FoldersEntitiesGetAsync(
@@ -83,6 +85,7 @@ partial void ProcessListFolderEntitiesApiPublicV2FoldersEntitiesGetResponseConte
string? searchQuery = default,
bool? flatten = default,
bool? includeMetadata = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -102,30 +105,51 @@ partial void ProcessListFolderEntitiesApiPublicV2FoldersEntitiesGetResponseConte
securityRequirements: s_ListFolderEntitiesApiPublicV2FoldersEntitiesGetSecurityRequirements,
operationName: "ListFolderEntitiesApiPublicV2FoldersEntitiesGetAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/folders/entities",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddRequiredParameter("workspace_id", workspaceId.ToString()!)
- .AddOptionalParameter("folder_id", folderId?.ToString())
- .AddOptionalParameter("filter_type", filterType?.ToString())
- .AddOptionalParameter("search_query", searchQuery)
- .AddOptionalParameter("flatten", flatten?.ToString().ToLowerInvariant())
- .AddOptionalParameter("include_metadata", includeMetadata?.ToString().ToLowerInvariant())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/folders/entities",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddRequiredParameter("workspace_id", workspaceId.ToString()!)
+ .AddOptionalParameter("folder_id", folderId?.ToString())
+ .AddOptionalParameter("filter_type", filterType?.ToString())
+ .AddOptionalParameter("search_query", searchQuery)
+ .AddOptionalParameter("flatten", flatten?.ToString().ToLowerInvariant())
+ .AddOptionalParameter("include_metadata", includeMetadata?.ToString().ToLowerInvariant())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -135,193 +159,352 @@ partial void ProcessListFolderEntitiesApiPublicV2FoldersEntitiesGetResponseConte
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareListFolderEntitiesApiPublicV2FoldersEntitiesGetRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- workspaceId: workspaceId,
- folderId: folderId,
- filterType: filterType,
- searchQuery: searchQuery,
- flatten: flatten,
- includeMetadata: includeMetadata);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareListFolderEntitiesApiPublicV2FoldersEntitiesGetRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ workspaceId: workspaceId,
+ folderId: folderId,
+ filterType: filterType,
+ searchQuery: searchQuery,
+ flatten: flatten,
+ includeMetadata: includeMetadata);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessListFolderEntitiesApiPublicV2FoldersEntitiesGetResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad request - Missing or invalid workspace_id
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListFolderEntitiesApiPublicV2FoldersEntitiesGet",
+ methodName: "ListFolderEntitiesApiPublicV2FoldersEntitiesGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListFolderEntitiesApiPublicV2FoldersEntitiesGet",
+ methodName: "ListFolderEntitiesApiPublicV2FoldersEntitiesGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Folder not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.FolderNotFoundError? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListFolderEntitiesApiPublicV2FoldersEntitiesGet",
+ methodName: "ListFolderEntitiesApiPublicV2FoldersEntitiesGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessListFolderEntitiesApiPublicV2FoldersEntitiesGetResponseContent(
+ response: __response);
+ ProcessListFolderEntitiesApiPublicV2FoldersEntitiesGetResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.ListFolderEntitiesResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListFolderEntitiesApiPublicV2FoldersEntitiesGet",
+ methodName: "ListFolderEntitiesApiPublicV2FoldersEntitiesGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListFolderEntitiesApiPublicV2FoldersEntitiesGet",
+ methodName: "ListFolderEntitiesApiPublicV2FoldersEntitiesGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Bad request - Missing or invalid workspace_id
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.ListFolderEntitiesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Folder not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.FolderNotFoundError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessListFolderEntitiesApiPublicV2FoldersEntitiesGetResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.ListFolderEntitiesResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.ListFolderEntitiesResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.FoldersClient.MoveFolderEntitiesApiPublicV2FoldersEntitiesPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.MoveFolderEntitiesApiPublicV2FoldersEntitiesPost.g.cs
index 7f2931b..10ee668 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.MoveFolderEntitiesApiPublicV2FoldersEntitiesPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.MoveFolderEntitiesApiPublicV2FoldersEntitiesPost.g.cs
@@ -14,6 +14,7 @@ public partial class FoldersClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -45,11 +46,13 @@ partial void ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponseCont
/// Moves one or more entities into a target folder, or to the workspace root if no folder_id is provided. Supports moving folders, prompts, snippets, workflows, datasets, evaluations, AB tests, and input variable sets. Requires appropriate edit permissions for each entity type.
///
///
+ /// 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 MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync(
global::PromptLayer.MoveFolderEntitiesRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -66,22 +69,43 @@ partial void ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponseCont
securityRequirements: s_MoveFolderEntitiesApiPublicV2FoldersEntitiesPostSecurityRequirements,
operationName: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/folders/entities",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/folders/entities",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -91,232 +115,391 @@ partial void ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponseCont
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareMoveFolderEntitiesApiPublicV2FoldersEntitiesPostRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareMoveFolderEntitiesApiPublicV2FoldersEntitiesPostRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad request - Missing workspace_id or invalid entity type
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPost",
+ methodName: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPost",
+ methodName: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized - Missing or invalid API key
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.UnauthorizedError? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPost",
+ methodName: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Folder or entity not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.FolderNotFoundError? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPost",
+ methodName: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPost",
+ methodName: "MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync",
+ pathTemplate: "\"/api/public/v2/folders/entities\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad request - Missing workspace_id or invalid entity type
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized - Missing or invalid API key
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.UnauthorizedError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Folder or entity not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.FolderNotFoundError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.FolderEntitiesCountResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.FolderEntitiesCountResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.FolderEntitiesCountResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.FolderEntitiesCountResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Move Folder Entities
@@ -331,12 +514,14 @@ partial void ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponseCont
///
/// The ID of the workspace.
///
+ /// 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 MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync(
global::System.Collections.Generic.IList entities,
int? folderId = default,
int? workspaceId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.MoveFolderEntitiesRequest
@@ -348,6 +533,7 @@ partial void ProcessMoveFolderEntitiesApiPublicV2FoldersEntitiesPostResponseCont
return await MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.ResolveFolderIdApiPublicV2FoldersResolveIdGet.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.ResolveFolderIdApiPublicV2FoldersResolveIdGet.g.cs
index e477bc0..3cfbf76 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.ResolveFolderIdApiPublicV2FoldersResolveIdGet.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.ResolveFolderIdApiPublicV2FoldersResolveIdGet.g.cs
@@ -14,6 +14,7 @@ public partial class FoldersClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -52,11 +53,13 @@ partial void ProcessResolveFolderIdApiPublicV2FoldersResolveIdGetResponseContent
///
/// Dot-separated folder path to resolve (e.g., "My Folder.Subfolder").
///
+ /// 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 ResolveFolderIdApiPublicV2FoldersResolveIdGetAsync(
int workspaceId,
string path,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -72,26 +75,47 @@ partial void ProcessResolveFolderIdApiPublicV2FoldersResolveIdGetResponseContent
securityRequirements: s_ResolveFolderIdApiPublicV2FoldersResolveIdGetSecurityRequirements,
operationName: "ResolveFolderIdApiPublicV2FoldersResolveIdGetAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/folders/resolve-id",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddRequiredParameter("workspace_id", workspaceId.ToString()!)
- .AddRequiredParameter("path", path)
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/folders/resolve-id",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddRequiredParameter("workspace_id", workspaceId.ToString()!)
+ .AddRequiredParameter("path", path)
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -101,189 +125,348 @@ partial void ProcessResolveFolderIdApiPublicV2FoldersResolveIdGetResponseContent
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareResolveFolderIdApiPublicV2FoldersResolveIdGetRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- workspaceId: workspaceId,
- path: path);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareResolveFolderIdApiPublicV2FoldersResolveIdGetRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ workspaceId: workspaceId,
+ path: path);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessResolveFolderIdApiPublicV2FoldersResolveIdGetResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad request - Missing or invalid workspace_id
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ResolveFolderIdApiPublicV2FoldersResolveIdGet",
+ methodName: "ResolveFolderIdApiPublicV2FoldersResolveIdGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/resolve-id\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ResolveFolderIdApiPublicV2FoldersResolveIdGet",
+ methodName: "ResolveFolderIdApiPublicV2FoldersResolveIdGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/resolve-id\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Folder path not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ResolveFolderIdApiPublicV2FoldersResolveIdGet",
+ methodName: "ResolveFolderIdApiPublicV2FoldersResolveIdGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/resolve-id\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessResolveFolderIdApiPublicV2FoldersResolveIdGetResponseContent(
+ response: __response);
+ ProcessResolveFolderIdApiPublicV2FoldersResolveIdGetResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.ResolveFolderIdResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ResolveFolderIdApiPublicV2FoldersResolveIdGet",
+ methodName: "ResolveFolderIdApiPublicV2FoldersResolveIdGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/resolve-id\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ResolveFolderIdApiPublicV2FoldersResolveIdGet",
+ methodName: "ResolveFolderIdApiPublicV2FoldersResolveIdGetAsync",
+ pathTemplate: "\"/api/public/v2/folders/resolve-id\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Bad request - Missing or invalid workspace_id
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.ResolveFolderIdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Folder path not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessResolveFolderIdApiPublicV2FoldersResolveIdGetResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.ResolveFolderIdResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.ResolveFolderIdResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.FoldersClient.UpdateFolderApiPublicV2FoldersPatch.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.UpdateFolderApiPublicV2FoldersPatch.g.cs
index 1ecbdc2..fe88d7b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.UpdateFolderApiPublicV2FoldersPatch.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.UpdateFolderApiPublicV2FoldersPatch.g.cs
@@ -14,6 +14,7 @@ public partial class FoldersClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -50,12 +51,14 @@ partial void ProcessUpdateFolderApiPublicV2FoldersPatchResponseContent(
/// The ID of the folder to update.
///
///
+ /// 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 UpdateFolderApiPublicV2FoldersPatchAsync(
int folderId,
global::PromptLayer.UpdateFolderRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -73,22 +76,43 @@ partial void ProcessUpdateFolderApiPublicV2FoldersPatchResponseContent(
securityRequirements: s_UpdateFolderApiPublicV2FoldersPatchSecurityRequirements,
operationName: "UpdateFolderApiPublicV2FoldersPatchAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/api/public/v2/folders/{folderId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: new global::System.Net.Http.HttpMethod("PATCH"),
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/api/public/v2/folders/{folderId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: new global::System.Net.Http.HttpMethod("PATCH"),
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -98,233 +122,392 @@ partial void ProcessUpdateFolderApiPublicV2FoldersPatchResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareUpdateFolderApiPublicV2FoldersPatchRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- folderId: folderId,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareUpdateFolderApiPublicV2FoldersPatchRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ folderId: folderId,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessUpdateFolderApiPublicV2FoldersPatchResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad request - Folder with the same name already exists at this level
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.FolderExistsError? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "UpdateFolderApiPublicV2FoldersPatch",
+ methodName: "UpdateFolderApiPublicV2FoldersPatchAsync",
+ pathTemplate: "$\"/api/public/v2/folders/{folderId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.FolderExistsError.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "UpdateFolderApiPublicV2FoldersPatch",
+ methodName: "UpdateFolderApiPublicV2FoldersPatchAsync",
+ pathTemplate: "$\"/api/public/v2/folders/{folderId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.FolderExistsError.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized - Missing or invalid API key
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.UnauthorizedError? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "UpdateFolderApiPublicV2FoldersPatch",
+ methodName: "UpdateFolderApiPublicV2FoldersPatchAsync",
+ pathTemplate: "$\"/api/public/v2/folders/{folderId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Folder not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.FolderNotFoundError? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessUpdateFolderApiPublicV2FoldersPatchResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "UpdateFolderApiPublicV2FoldersPatch",
+ methodName: "UpdateFolderApiPublicV2FoldersPatchAsync",
+ pathTemplate: "$\"/api/public/v2/folders/{folderId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "UpdateFolderApiPublicV2FoldersPatch",
+ methodName: "UpdateFolderApiPublicV2FoldersPatchAsync",
+ pathTemplate: "$\"/api/public/v2/folders/{folderId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad request - Folder with the same name already exists at this level
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.FolderExistsError? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.FolderExistsError.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.FolderExistsError.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized - Missing or invalid API key
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.UnauthorizedError? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessUpdateFolderApiPublicV2FoldersPatchResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::PromptLayer.UnauthorizedError.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Folder not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.FolderNotFoundError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreateFolderSuccessResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.FolderNotFoundError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.CreateFolderSuccessResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessUpdateFolderApiPublicV2FoldersPatchResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateFolderSuccessResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateFolderSuccessResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Update Folder
@@ -336,11 +519,13 @@ partial void ProcessUpdateFolderApiPublicV2FoldersPatchResponseContent(
///
/// The new name for the folder. Must be unique within its parent folder.
///
+ /// 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 UpdateFolderApiPublicV2FoldersPatchAsync(
int folderId,
string name,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.UpdateFolderRequest
@@ -351,6 +536,7 @@ partial void ProcessUpdateFolderApiPublicV2FoldersPatchResponseContent(
return await UpdateFolderApiPublicV2FoldersPatchAsync(
folderId: folderId,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.g.cs
index 7f9cbd6..22b6d67 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.FoldersClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class FoldersClient : global::PromptLayer.IFoldersClient,
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public FoldersClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the FoldersClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public FoldersClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.GroupClient.TrackGroup.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.GroupClient.TrackGroup.g.cs
index 9ca4b17..3aec673 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.GroupClient.TrackGroup.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.GroupClient.TrackGroup.g.cs
@@ -14,6 +14,7 @@ public partial class GroupClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessTrackGroupResponseContent(
/// Track Group
///
///
+ /// 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 TrackGroupAsync(
global::PromptLayer.TrackGroupRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessTrackGroupResponseContent(
securityRequirements: s_TrackGroupSecurityRequirements,
operationName: "TrackGroupAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/rest/track-group",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/rest/track-group",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,184 +114,343 @@ partial void ProcessTrackGroupResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareTrackGroupRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareTrackGroupRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessTrackGroupResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackGroup",
+ methodName: "TrackGroupAsync",
+ pathTemplate: "\"/rest/track-group\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackGroup",
+ methodName: "TrackGroupAsync",
+ pathTemplate: "\"/rest/track-group\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackGroup",
+ methodName: "TrackGroupAsync",
+ pathTemplate: "\"/rest/track-group\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessTrackGroupResponseContent(
+ response: __response);
+ ProcessTrackGroupResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.TrackGroupResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackGroup",
+ methodName: "TrackGroupAsync",
+ pathTemplate: "\"/rest/track-group\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackGroup",
+ methodName: "TrackGroupAsync",
+ pathTemplate: "\"/rest/track-group\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- return
- await global::PromptLayer.TrackGroupResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessTrackGroupResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.TrackGroupResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.TrackGroupResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Track Group
@@ -278,11 +461,13 @@ partial void ProcessTrackGroupResponseContent(
///
/// The unique identifier for the group to be associated with the request.
///
+ /// 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 TrackGroupAsync(
int requestId,
int groupId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.TrackGroupRequest
@@ -293,6 +478,7 @@ partial void ProcessTrackGroupResponseContent(
return await TrackGroupAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.GroupClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.GroupClient.g.cs
index d1822d8..cbd956c 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.GroupClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.GroupClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class GroupClient : global::PromptLayer.IGroupClient, glob
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public GroupClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the GroupClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public GroupClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.AddRequestLogToDatasetVersion.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.AddRequestLogToDatasetVersion.g.cs
index c24f1af..636804f 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.AddRequestLogToDatasetVersion.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.AddRequestLogToDatasetVersion.g.cs
@@ -8,11 +8,13 @@ public partial interface IDatasetsClient
/// Add Request Log to Draft Dataset
///
///
+ /// 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 AddRequestLogToDatasetVersionAsync(
global::PromptLayer.AddRequestLogToDatasetVersionRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Add Request Log to Draft Dataset
@@ -23,11 +25,13 @@ public partial interface IDatasetsClient
///
/// ID of the request log to add as a dataset row
///
+ /// 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 AddRequestLogToDatasetVersionAsync(
int datasetGroupId,
int requestLogId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetGroup.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetGroup.g.cs
index e32a025..fb0e653 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetGroup.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetGroup.g.cs
@@ -8,11 +8,13 @@ public partial interface IDatasetsClient
/// Create Dataset Group
///
///
+ /// 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 CreateDatasetGroupAsync(
global::PromptLayer.CreateDatasetGroupRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create Dataset Group
@@ -23,11 +25,13 @@ public partial interface IDatasetsClient
///
/// Optional: ID of the workspace where the dataset group will be created. If not provided, uses the workspace associated with your API key.
///
+ /// 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 CreateDatasetGroupAsync(
string name,
int? workspaceId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetVersionFromFile.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetVersionFromFile.g.cs
index 7390dd6..1b9aebb 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetVersionFromFile.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetVersionFromFile.g.cs
@@ -8,11 +8,13 @@ public partial interface IDatasetsClient
/// Create Dataset Version from File
///
///
+ /// 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 CreateDatasetVersionFromFileAsync(
global::PromptLayer.CreateDatasetVersionFromFileRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create Dataset Version from File
@@ -26,12 +28,14 @@ public partial interface IDatasetsClient
///
/// Base64 encoded content of the file. Maximum file size: 100MB. Supported formats: CSV, JSON
///
+ /// 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 CreateDatasetVersionFromFileAsync(
int datasetGroupId,
string fileName,
string fileContentBase64,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetVersionFromFilterParams.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetVersionFromFilterParams.g.cs
index a78e99a..d82b4a9 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetVersionFromFilterParams.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDatasetVersionFromFilterParams.g.cs
@@ -8,11 +8,13 @@ public partial interface IDatasetsClient
/// Create Dataset Version from Filter Params
///
///
+ /// 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 CreateDatasetVersionFromFilterParamsAsync(
global::PromptLayer.CreateDatasetVersionFromFilterParamsRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create Dataset Version from Filter Params
@@ -50,6 +52,7 @@ public partial interface IDatasetsClient
///
/// Filter by score ranges
///
+ /// 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 CreateDatasetVersionFromFilterParamsAsync(
@@ -64,6 +67,7 @@ public partial interface IDatasetsClient
global::System.Collections.Generic.IList? tags = default,
global::System.Collections.Generic.Dictionary? metadata = default,
global::System.Collections.Generic.Dictionary? scores = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDraftDatasetVersion.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDraftDatasetVersion.g.cs
index 0c46601..875527f 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDraftDatasetVersion.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.CreateDraftDatasetVersion.g.cs
@@ -8,11 +8,13 @@ public partial interface IDatasetsClient
/// Create Draft Dataset Version
///
///
+ /// 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 CreateDraftDatasetVersionAsync(
global::PromptLayer.CreateDraftDatasetVersionRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create Draft Dataset Version
@@ -23,11 +25,13 @@ public partial interface IDatasetsClient
///
/// Optional. ID of an existing dataset version to copy rows from. Must belong to the same dataset group.
///
+ /// 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 CreateDraftDatasetVersionAsync(
int datasetGroupId,
int? sourceDatasetId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.GetDatasetRows.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.GetDatasetRows.g.cs
index 72815d2..ebab3ee 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.GetDatasetRows.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.GetDatasetRows.g.cs
@@ -17,6 +17,7 @@ public partial interface IDatasetsClient
/// Default Value: 10
///
///
+ /// 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 GetDatasetRowsAsync(
@@ -25,6 +26,7 @@ public partial interface IDatasetsClient
int? page = default,
int? perPage = default,
string? q = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.ListDatasets.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.ListDatasets.g.cs
index 61bc6b8..062bcc2 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.ListDatasets.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.ListDatasets.g.cs
@@ -23,6 +23,7 @@ public partial interface IDatasetsClient
///
/// Default Value: 10
///
+ /// 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 ListDatasetsAsync(
@@ -36,6 +37,7 @@ public partial interface IDatasetsClient
global::PromptLayer.ListDatasetsStatus? status = default,
int? page = default,
int? perPage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.SaveDraftDatasetVersion.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.SaveDraftDatasetVersion.g.cs
index cf90e71..3b38815 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.SaveDraftDatasetVersion.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.SaveDraftDatasetVersion.g.cs
@@ -8,11 +8,13 @@ public partial interface IDatasetsClient
/// Save Draft Dataset Version
///
///
+ /// 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 SaveDraftDatasetVersionAsync(
global::PromptLayer.SaveDraftDatasetVersionRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Save Draft Dataset Version
@@ -20,10 +22,12 @@ public partial interface IDatasetsClient
///
/// ID of the dataset group containing the draft to save
///
+ /// 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 SaveDraftDatasetVersionAsync(
int datasetGroupId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.g.cs
index d1c6dbf..77d5d8e 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IDatasetsClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IDatasetsClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.GetEvaluationRows.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.GetEvaluationRows.g.cs
index 2428ce2..c1bf23a 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.GetEvaluationRows.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.GetEvaluationRows.g.cs
@@ -16,6 +16,7 @@ public partial interface IEvaluationsClient
///
/// Default Value: 10
///
+ /// 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 GetEvaluationRowsAsync(
@@ -23,6 +24,7 @@ public partial interface IEvaluationsClient
int? workspaceId = default,
int? page = default,
int? perPage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.ListEvaluations.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.ListEvaluations.g.cs
index 2c4ea75..9b31414 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.ListEvaluations.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.ListEvaluations.g.cs
@@ -21,6 +21,7 @@ public partial interface IEvaluationsClient
///
/// Default Value: 10
///
+ /// 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 ListEvaluationsAsync(
@@ -30,6 +31,7 @@ public partial interface IEvaluationsClient
bool? includeRuns = default,
int? page = default,
int? perPage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.g.cs
index d21ca2b..a90589a 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IEvaluationsClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IEvaluationsClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.CreateFolderApiPublicV2FoldersPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.CreateFolderApiPublicV2FoldersPost.g.cs
index f2595e0..abae9c8 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.CreateFolderApiPublicV2FoldersPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.CreateFolderApiPublicV2FoldersPost.g.cs
@@ -9,11 +9,13 @@ public partial interface IFoldersClient
/// Creates a new folder in the workspace. Folders can be nested within other folders by providing a parent_id. The folder name must be unique within its parent folder (or at the root level if no parent is specified).
///
///
+ /// 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 CreateFolderApiPublicV2FoldersPostAsync(
global::PromptLayer.CreateFolderRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create Folder
@@ -25,11 +27,13 @@ public partial interface IFoldersClient
///
/// The ID of the parent folder. If null or not provided, the folder will be created at the root level of the workspace.
///
+ /// 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 CreateFolderApiPublicV2FoldersPostAsync(
string name,
int? parentId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete.g.cs
index 0db5c78..b1573a1 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.DeleteFolderEntitiesApiPublicV2FoldersEntitiesDelete.g.cs
@@ -9,11 +9,13 @@ public partial interface IFoldersClient
/// Deletes one or more entities from the workspace. Supports deleting folders, prompts, snippets, workflows, datasets, evaluations, AB tests, and input variable sets. Use cascade=true to recursively delete all contents of a folder. Without cascade, deleting a non-empty folder returns an error. Entities are soft-deleted where applicable.
///
///
+ /// 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 DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync(
global::PromptLayer.DeleteFolderEntitiesRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Delete Folder Entities
@@ -29,12 +31,14 @@ public partial interface IFoldersClient
///
/// The ID of the workspace.
///
+ /// 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 DeleteFolderEntitiesApiPublicV2FoldersEntitiesDeleteAsync(
global::System.Collections.Generic.IList entities,
bool? cascade = default,
int? workspaceId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.ListFolderEntitiesApiPublicV2FoldersEntitiesGet.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.ListFolderEntitiesApiPublicV2FoldersEntitiesGet.g.cs
index 708a85e..de9448b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.ListFolderEntitiesApiPublicV2FoldersEntitiesGet.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.ListFolderEntitiesApiPublicV2FoldersEntitiesGet.g.cs
@@ -28,6 +28,7 @@ public partial interface IFoldersClient
/// When true, includes type-specific metadata for each entity (e.g., prompt type, latest version number).
/// 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 ListFolderEntitiesApiPublicV2FoldersEntitiesGetAsync(
@@ -37,6 +38,7 @@ public partial interface IFoldersClient
string? searchQuery = default,
bool? flatten = default,
bool? includeMetadata = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.MoveFolderEntitiesApiPublicV2FoldersEntitiesPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.MoveFolderEntitiesApiPublicV2FoldersEntitiesPost.g.cs
index 0b815d8..1018f3a 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.MoveFolderEntitiesApiPublicV2FoldersEntitiesPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.MoveFolderEntitiesApiPublicV2FoldersEntitiesPost.g.cs
@@ -9,11 +9,13 @@ public partial interface IFoldersClient
/// Moves one or more entities into a target folder, or to the workspace root if no folder_id is provided. Supports moving folders, prompts, snippets, workflows, datasets, evaluations, AB tests, and input variable sets. Requires appropriate edit permissions for each entity type.
///
///
+ /// 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 MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync(
global::PromptLayer.MoveFolderEntitiesRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Move Folder Entities
@@ -28,12 +30,14 @@ public partial interface IFoldersClient
///
/// The ID of the workspace.
///
+ /// 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 MoveFolderEntitiesApiPublicV2FoldersEntitiesPostAsync(
global::System.Collections.Generic.IList entities,
int? folderId = default,
int? workspaceId = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.ResolveFolderIdApiPublicV2FoldersResolveIdGet.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.ResolveFolderIdApiPublicV2FoldersResolveIdGet.g.cs
index 92da75c..cfc0f52 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.ResolveFolderIdApiPublicV2FoldersResolveIdGet.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.ResolveFolderIdApiPublicV2FoldersResolveIdGet.g.cs
@@ -14,11 +14,13 @@ public partial interface IFoldersClient
///
/// Dot-separated folder path to resolve (e.g., "My Folder.Subfolder").
///
+ /// 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 ResolveFolderIdApiPublicV2FoldersResolveIdGetAsync(
int workspaceId,
string path,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.UpdateFolderApiPublicV2FoldersPatch.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.UpdateFolderApiPublicV2FoldersPatch.g.cs
index 98f630b..f838173 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.UpdateFolderApiPublicV2FoldersPatch.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.UpdateFolderApiPublicV2FoldersPatch.g.cs
@@ -12,12 +12,14 @@ public partial interface IFoldersClient
/// The ID of the folder to update.
///
///
+ /// 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 UpdateFolderApiPublicV2FoldersPatchAsync(
int folderId,
global::PromptLayer.UpdateFolderRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Update Folder
@@ -29,11 +31,13 @@ public partial interface IFoldersClient
///
/// The new name for the folder. Must be unique within its parent folder.
///
+ /// 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 UpdateFolderApiPublicV2FoldersPatchAsync(
int folderId,
string name,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.g.cs
index a804d63..16ddb1d 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IFoldersClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IFoldersClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IGroupClient.TrackGroup.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IGroupClient.TrackGroup.g.cs
index 9eb05a7..05d72ae 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IGroupClient.TrackGroup.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IGroupClient.TrackGroup.g.cs
@@ -8,11 +8,13 @@ public partial interface IGroupClient
/// Track Group
///
///
+ /// 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 TrackGroupAsync(
global::PromptLayer.TrackGroupRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Track Group
@@ -23,11 +25,13 @@ public partial interface IGroupClient
///
/// The unique identifier for the group to be associated with the request.
///
+ /// 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 TrackGroupAsync(
int requestId,
int groupId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IGroupClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IGroupClient.g.cs
index 5c003a0..e1d2393 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IGroupClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IGroupClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IGroupClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IMetadataClient.TrackMetadata.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IMetadataClient.TrackMetadata.g.cs
index 0095900..b4a5a7b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IMetadataClient.TrackMetadata.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IMetadataClient.TrackMetadata.g.cs
@@ -8,11 +8,13 @@ public partial interface IMetadataClient
/// Track Metadata
///
///
+ /// 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 TrackMetadataAsync(
global::PromptLayer.TrackMetadataRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Track Metadata
@@ -23,11 +25,13 @@ public partial interface IMetadataClient
///
/// A dictionary of metadata items to associate with the request. Can include session_ids, user_ids, location, etc.
///
+ /// 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 TrackMetadataAsync(
int requestId,
object metadata,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IMetadataClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IMetadataClient.g.cs
index 8e93353..0667810 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IMetadataClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IMetadataClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IMetadataClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IOtlpClient.IngestOtlpTraces.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IOtlpClient.IngestOtlpTraces.g.cs
index c8fb875..9b55908 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IOtlpClient.IngestOtlpTraces.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IOtlpClient.IngestOtlpTraces.g.cs
@@ -17,6 +17,7 @@ public partial interface IOtlpClient
///
///
///
+ /// 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 IngestOtlpTracesAsync(
@@ -24,6 +25,7 @@ public partial interface IOtlpClient
global::PromptLayer.OtlpExportTraceServiceRequest request,
global::PromptLayer.IngestOtlpTracesContentEncoding? contentEncoding = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Ingest Traces (OTLP)
@@ -40,12 +42,14 @@ public partial interface IOtlpClient
///
/// An array of ResourceSpans. Each element describes spans from a single instrumented resource.
///
+ /// 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 IngestOtlpTracesAsync(
global::PromptLayer.IngestOtlpTracesContentType contentType,
global::PromptLayer.IngestOtlpTracesContentEncoding? contentEncoding = default,
global::System.Collections.Generic.IList? resourceSpans = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IOtlpClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IOtlpClient.g.cs
index 6355898..0438820 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IOtlpClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IOtlpClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IOtlpClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptClient.TrackPrompt.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptClient.TrackPrompt.g.cs
index 8635347..01f379b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptClient.TrackPrompt.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptClient.TrackPrompt.g.cs
@@ -8,11 +8,13 @@ public partial interface IPromptClient
/// Track Prompt
///
///
+ /// 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 TrackPromptAsync(
global::PromptLayer.TrackPromptRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Track Prompt
@@ -32,6 +34,7 @@ public partial interface IPromptClient
///
/// The label of the prompt template version. Both version and label cannot be specified. Only one or none.
///
+ /// 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 TrackPromptAsync(
@@ -40,6 +43,7 @@ public partial interface IPromptClient
global::System.Collections.Generic.Dictionary? promptInputVariables = default,
int? version = default,
string? label = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptClient.g.cs
index a330bde..c6d5858 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IPromptClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptLayerClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptLayerClient.g.cs
index ecadbec..f45ec8c 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptLayerClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptLayerClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IPromptLayerClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.DeletePromptTemplatesLabelsPromptLabelId.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.DeletePromptTemplatesLabelsPromptLabelId.g.cs
index 8304efa..bf17398 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.DeletePromptTemplatesLabelsPromptLabelId.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.DeletePromptTemplatesLabelsPromptLabelId.g.cs
@@ -8,10 +8,12 @@ public partial interface IPromptTemplatesClient
/// Delete Prompt Template Label
///
///
+ /// 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 DeletePromptTemplatesLabelsPromptLabelIdAsync(
int promptLabelId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetAllPromptTemplatesGet.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetAllPromptTemplatesGet.g.cs
index 264b003..ef01b74 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetAllPromptTemplatesGet.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetAllPromptTemplatesGet.g.cs
@@ -15,6 +15,7 @@ public partial interface IPromptTemplatesClient
///
/// Default Value: active
///
+ /// 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 GetAllPromptTemplatesGetAsync(
@@ -24,6 +25,7 @@ public partial interface IPromptTemplatesClient
string? name = default,
global::PromptLayer.AnyOf>? tags = default,
global::PromptLayer.GetAllPromptTemplatesGetStatus? status = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplateRaw.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplateRaw.g.cs
index faa747a..78b7ed3 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplateRaw.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplateRaw.g.cs
@@ -25,6 +25,7 @@ public partial interface IPromptTemplatesClient
/// When true, includes provider-specific llm_kwargs in the response. Requires model metadata to be set on the template.
/// 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 GetPromptTemplateRawAsync(
@@ -33,6 +34,7 @@ public partial interface IPromptTemplatesClient
string? label = default,
bool? resolveSnippets = default,
bool? includeLlmKwargs = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplatesLabelsPromptIdentifierPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplatesLabelsPromptIdentifierPost.g.cs
index e566860..ac89eca 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplatesLabelsPromptIdentifierPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplatesLabelsPromptIdentifierPost.g.cs
@@ -10,10 +10,12 @@ public partial interface IPromptTemplatesClient
///
/// The identifier can be either the prompt name or the prompt id.
///
+ /// 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 GetPromptTemplatesLabelsPromptIdentifierPostAsync(
string identifier,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplatesPromptIdentifierPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplatesPromptIdentifierPost.g.cs
index 282a493..6fb7f58 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplatesPromptIdentifierPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetPromptTemplatesPromptIdentifierPost.g.cs
@@ -11,12 +11,14 @@ public partial interface IPromptTemplatesClient
/// The identifier can be either the prompt name or the prompt id.
///
///
+ /// 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 GetPromptTemplatesPromptIdentifierPostAsync(
string identifier,
global::PromptLayer.GetPromptTemplate request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Get Prompt Template by ID
@@ -24,10 +26,12 @@ public partial interface IPromptTemplatesClient
///
/// The identifier can be either the prompt name or the prompt id.
///
+ /// 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 GetPromptTemplatesPromptIdentifierPostAsync(
string identifier,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetSnippetUsage.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetSnippetUsage.g.cs
index d21f672..a7a9ea8 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetSnippetUsage.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.GetSnippetUsage.g.cs
@@ -14,11 +14,13 @@ public partial interface IPromptTemplatesClient
///
/// Optional specific version number to check usage for
///
+ /// 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 GetSnippetUsageAsync(
string identifier,
int? promptVersionNumber = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.PromptTemplatesLabelsPromptLabelIdPatch.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.PromptTemplatesLabelsPromptLabelIdPatch.g.cs
index 9d49e74..2f52a5c 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.PromptTemplatesLabelsPromptLabelIdPatch.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.PromptTemplatesLabelsPromptLabelIdPatch.g.cs
@@ -9,23 +9,27 @@ public partial interface IPromptTemplatesClient
///
///
///
+ /// 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 PromptTemplatesLabelsPromptLabelIdPatchAsync(
int promptLabelId,
global::PromptLayer.PromptTemplatesLabelsPromptLabelIdPatchRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Move Prompt Template Labels
///
///
///
+ /// 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 PromptTemplatesLabelsPromptLabelIdPatchAsync(
int promptLabelId,
int promptVersionNumber,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.g.cs
index 4792ef1..afc6225 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptTemplatesClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IPromptTemplatesClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptsClient.CreatePromptLabel.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptsClient.CreatePromptLabel.g.cs
index cddfd4c..26cf2ce 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptsClient.CreatePromptLabel.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptsClient.CreatePromptLabel.g.cs
@@ -9,12 +9,14 @@ public partial interface IPromptsClient
///
///
///
+ /// 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 CreatePromptLabelAsync(
int promptId,
global::PromptLayer.CreatePromptLabelRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create a new label for a prompt
@@ -22,12 +24,14 @@ public partial interface IPromptsClient
///
///
///
+ /// 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 CreatePromptLabelAsync(
int promptId,
int promptVersionNumber,
string name,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IPromptsClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IPromptsClient.g.cs
index 532f36c..30d98f7 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IPromptsClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IPromptsClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IPromptsClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.AddReportColumn.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.AddReportColumn.g.cs
index 54e7651..57658f0 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.AddReportColumn.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.AddReportColumn.g.cs
@@ -14,11 +14,13 @@ public partial interface IReportsClient
/// See the full documentation for detailed configuration requirements for each column type.
///
///
+ /// 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 AddReportColumnAsync(
global::PromptLayer.AddReportColumnRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Add Column to Evaluation Pipeline
@@ -44,6 +46,7 @@ public partial interface IReportsClient
///
/// Optional position for the column. If not specified, the column is added at the end. Cannot overwrite dataset columns.
///
+ /// 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 AddReportColumnAsync(
@@ -52,6 +55,7 @@ public partial interface IReportsClient
string name,
object configuration,
int? position = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.CreateEvaluationPipeline.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.CreateEvaluationPipeline.g.cs
index 627214c..71b839f 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.CreateEvaluationPipeline.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.CreateEvaluationPipeline.g.cs
@@ -9,11 +9,13 @@ public partial interface IReportsClient
/// Creates a new evaluation pipeline (report) with optional evaluation columns and custom scoring.
///
///
+ /// 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 CreateEvaluationPipelineAsync(
global::PromptLayer.CreateEvaluationPipelineRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create Evaluation Pipeline
@@ -37,6 +39,7 @@ public partial interface IReportsClient
///
/// Optional custom scoring logic configuration.
///
+ /// 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 CreateEvaluationPipelineAsync(
@@ -46,6 +49,7 @@ public partial interface IReportsClient
int? datasetVersionNumber = default,
global::System.Collections.Generic.IList? columns = default,
global::PromptLayer.CreateEvaluationPipelineRequestScoreConfiguration? scoreConfiguration = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.DeleteReportsByName.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.DeleteReportsByName.g.cs
index 4569e15..501d208 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.DeleteReportsByName.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.DeleteReportsByName.g.cs
@@ -8,10 +8,12 @@ public partial interface IReportsClient
/// Delete Reports by Name
///
///
+ /// 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 DeleteReportsByNameAsync(
string reportName,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.GetReport.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.GetReport.g.cs
index 2202698..60ae717 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.GetReport.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.GetReport.g.cs
@@ -8,10 +8,12 @@ public partial interface IReportsClient
/// Get Evaluation
///
///
+ /// 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 GetReportAsync(
int reportId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.GetReportScore.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.GetReportScore.g.cs
index 30cde9f..d7e9d11 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.GetReportScore.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.GetReportScore.g.cs
@@ -8,10 +8,12 @@ public partial interface IReportsClient
/// Get Evaluation Score
///
///
+ /// 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 GetReportScoreAsync(
int reportId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.RunReport.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.RunReport.g.cs
index 16c0aa2..f73467d 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.RunReport.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.RunReport.g.cs
@@ -9,12 +9,14 @@ public partial interface IReportsClient
///
///
///
+ /// 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 RunReportAsync(
int reportId,
global::PromptLayer.RunReportRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Run Full Evaluation
@@ -29,6 +31,7 @@ public partial interface IReportsClient
///
/// Whether to refresh the dataset before running the report. Only applicable for dynamic datasets.
///
+ /// 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 RunReportAsync(
@@ -36,6 +39,7 @@ public partial interface IReportsClient
string name,
int? datasetId = default,
bool? refreshDataset = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.g.cs
index 55600e3..02f1501 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IReportsClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IReportsClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IRequestClient.LogRequest.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IRequestClient.LogRequest.g.cs
index 43366b4..fd70ff9 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IRequestClient.LogRequest.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IRequestClient.LogRequest.g.cs
@@ -8,11 +8,13 @@ public partial interface IRequestClient
/// Log Request
///
///
+ /// 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 LogRequestAsync(
global::PromptLayer.LogRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Log Request
@@ -90,6 +92,7 @@ public partial interface IRequestClient
/// Detailed error message describing what went wrong. Maximum 1024 characters.
/// Default Value: openapi-json-null-sentinel-value-2BF93600-0FE4-4250-987A-E5DDB203E464
///
+ /// 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 LogRequestAsync(
@@ -115,6 +118,7 @@ public partial interface IRequestClient
global::PromptLayer.LogRequestStatus? status = default,
global::PromptLayer.LogRequestErrorType2? errorType = default,
string? errorMessage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IRequestClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IRequestClient.g.cs
index a5ea947..f3f67de 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IRequestClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IRequestClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IRequestClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.PatchPromptTemplateVersion.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.PatchPromptTemplateVersion.g.cs
index ce307cb..81906f8 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.PatchPromptTemplateVersion.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.PatchPromptTemplateVersion.g.cs
@@ -12,12 +12,14 @@ public partial interface IRestClient
/// The prompt template name or ID.
///
///
+ /// 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 PatchPromptTemplateVersionAsync(
string identifier,
global::PromptLayer.PatchPromptTemplateVersion request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Patch Prompt Template Version
@@ -62,6 +64,7 @@ public partial interface IRestClient
///
/// Release labels to create or move to the newly created version (e.g. ['staging', 'production']).
///
+ /// 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 PatchPromptTemplateVersionAsync(
@@ -78,6 +81,7 @@ public partial interface IRestClient
object? responseFormat = default,
string? commitMessage = default,
global::System.Collections.Generic.IList? releaseLabels = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.PublishPromptTemplateRestPromptTemplatesPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.PublishPromptTemplateRestPromptTemplatesPost.g.cs
index f177e8b..5fb6592 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.PublishPromptTemplateRestPromptTemplatesPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.PublishPromptTemplateRestPromptTemplatesPost.g.cs
@@ -8,11 +8,13 @@ public partial interface IRestClient
/// Publish Prompt Template
///
///
+ /// 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 PublishPromptTemplateRestPromptTemplatesPostAsync(
global::PromptLayer.CreatePromptTemplate request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Publish Prompt Template
@@ -20,12 +22,14 @@ public partial interface IRestClient
///
///
///
+ /// 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 PublishPromptTemplateRestPromptTemplatesPostAsync(
global::PromptLayer.BasePromptTemplate promptTemplate,
global::PromptLayer.PromptVersion promptVersion,
global::System.Collections.Generic.IList? releaseLabels = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.g.cs
index 5e46c67..1fa5c2f 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IRestClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IRestClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IScoreClient.TrackScore.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IScoreClient.TrackScore.g.cs
index 88827a0..a52f53f 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IScoreClient.TrackScore.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IScoreClient.TrackScore.g.cs
@@ -8,11 +8,13 @@ public partial interface IScoreClient
/// Track Score
///
///
+ /// 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 TrackScoreAsync(
global::PromptLayer.TrackScoreRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Track Score
@@ -26,12 +28,14 @@ public partial interface IScoreClient
///
/// A name for this request score. If not provided, the score will be tracked as `default`.
///
+ /// 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 TrackScoreAsync(
int requestId,
int score,
string? name = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IScoreClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IScoreClient.g.cs
index 21357d8..82c2fd9 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IScoreClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IScoreClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IScoreClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ISpansClient.CreateSpansBulk.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ISpansClient.CreateSpansBulk.g.cs
index fdbed69..21f80df 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ISpansClient.CreateSpansBulk.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ISpansClient.CreateSpansBulk.g.cs
@@ -8,20 +8,24 @@ public partial interface ISpansClient
/// Create Spans Bulk
///
///
+ /// 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 CreateSpansBulkAsync(
global::PromptLayer.CreateSpansBulk request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create Spans Bulk
///
///
+ /// 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 CreateSpansBulkAsync(
global::System.Collections.Generic.IList spans,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ISpansClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ISpansClient.g.cs
index aff70de..bf21239 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ISpansClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ISpansClient.g.cs
@@ -33,6 +33,11 @@ public partial interface ISpansClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetRequest.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetRequest.g.cs
index 07f7c64..35661db 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetRequest.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetRequest.g.cs
@@ -8,10 +8,12 @@ public partial interface ITrackingClient
/// Get Request
///
///
+ /// 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 GetRequestAsync(
int requestId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetRequestSearchSuggestions.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetRequestSearchSuggestions.g.cs
index 0e171aa..5056e2e 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetRequestSearchSuggestions.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetRequestSearchSuggestions.g.cs
@@ -12,6 +12,7 @@ public partial interface ITrackingClient
///
///
///
+ /// 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 GetRequestSearchSuggestionsAsync(
@@ -20,6 +21,7 @@ public partial interface ITrackingClient
string? metadataKey = default,
int? promptId = default,
string? filterGroup = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetTrace.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetTrace.g.cs
index 2bb90fb..59496df 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetTrace.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.GetTrace.g.cs
@@ -8,10 +8,12 @@ public partial interface ITrackingClient
/// Get Trace
///
///
+ /// 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 GetTraceAsync(
string traceId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.SearchRequestLogs.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.SearchRequestLogs.g.cs
index a6f9076..adc8453 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.SearchRequestLogs.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.SearchRequestLogs.g.cs
@@ -8,11 +8,13 @@ public partial interface ITrackingClient
/// Search Request Logs
///
///
+ /// 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 SearchRequestLogsAsync(
global::PromptLayer.SearchRequestLogsRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Search Request Logs
@@ -38,6 +40,7 @@ public partial interface ITrackingClient
///
/// When true, includes the prompt template name in each result item. Defaults to 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 SearchRequestLogsAsync(
@@ -48,6 +51,7 @@ public partial interface ITrackingClient
global::PromptLayer.SearchRequestLogsRequestSortBy? sortBy = default,
global::PromptLayer.SearchRequestLogsRequestSortOrder? sortOrder = default,
bool? includePromptName = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.g.cs
index 314ab6c..77056ce 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ITrackingClient.g.cs
@@ -33,6 +33,11 @@ public partial interface ITrackingClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.CreateWorkflow.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.CreateWorkflow.g.cs
index 442e968..d7a7984 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.CreateWorkflow.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.CreateWorkflow.g.cs
@@ -8,11 +8,13 @@ public partial interface IWorkflowClient
/// Create Workflow
///
///
+ /// 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 CreateWorkflowAsync(
global::PromptLayer.CreateWorkflow request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Create Workflow
@@ -44,6 +46,7 @@ public partial interface IWorkflowClient
///
/// Labels to attach to this version.
///
+ /// 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 CreateWorkflowAsync(
@@ -56,6 +59,7 @@ public partial interface IWorkflowClient
global::System.Collections.Generic.Dictionary? requiredInputVariables = default,
global::System.Collections.Generic.IList? edges = default,
global::System.Collections.Generic.IList? releaseLabels = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflow.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflow.g.cs
index e972246..64e7109 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflow.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflow.g.cs
@@ -10,12 +10,14 @@ public partial interface IWorkflowClient
///
///
///
+ /// 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 GetWorkflowAsync(
string workflowIdOrName,
int? version = default,
string? label = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflowLabels.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflowLabels.g.cs
index 3b01c31..88798c8 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflowLabels.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflowLabels.g.cs
@@ -8,10 +8,12 @@ public partial interface IWorkflowClient
/// Get Agent Labels
///
///
+ /// 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 GetWorkflowLabelsAsync(
string workflowIdOrName,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflowVersionExecutionResults.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflowVersionExecutionResults.g.cs
index 4ca4f54..5cde6b6 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflowVersionExecutionResults.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.GetWorkflowVersionExecutionResults.g.cs
@@ -11,11 +11,13 @@ public partial interface IWorkflowClient
///
/// 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, object>> GetWorkflowVersionExecutionResultsAsync(
long workflowVersionExecutionId,
bool? returnAllOutputs = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.ListWorkflows.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.ListWorkflows.g.cs
index 21fda39..756ac10 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.ListWorkflows.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.ListWorkflows.g.cs
@@ -13,11 +13,13 @@ public partial interface IWorkflowClient
///
/// Default Value: 30
///
+ /// 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 ListWorkflowsAsync(
int? page = default,
int? perPage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.PatchWorkflow.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.PatchWorkflow.g.cs
index cc3b3cf..f12fc09 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.PatchWorkflow.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.PatchWorkflow.g.cs
@@ -9,12 +9,14 @@ public partial interface IWorkflowClient
///
///
///
+ /// 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 PatchWorkflowAsync(
string workflowIdOrName,
global::PromptLayer.PatchWorkflow request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Patch Workflow
@@ -38,6 +40,7 @@ public partial interface IWorkflowClient
///
/// Labels to attach to the new version.
///
+ /// 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 PatchWorkflowAsync(
@@ -48,6 +51,7 @@ public partial interface IWorkflowClient
global::System.Collections.Generic.Dictionary? requiredInputVariables = default,
global::System.Collections.Generic.IList? edges = default,
global::System.Collections.Generic.IList? releaseLabels = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.RunWorkflow.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.RunWorkflow.g.cs
index e1dbe06..58eb8b7 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.RunWorkflow.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.RunWorkflow.g.cs
@@ -9,12 +9,14 @@ public partial interface IWorkflowClient
///
///
///
+ /// 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 RunWorkflowAsync(
string workflowName,
global::PromptLayer.RunWorkflow request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
///
/// Run Workflow
@@ -37,6 +39,7 @@ public partial interface IWorkflowClient
/// If set to `true`, all outputs from the workflow execution will be returned.
/// 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 RunWorkflowAsync(
@@ -46,6 +49,7 @@ public partial interface IWorkflowClient
global::System.Collections.Generic.Dictionary? metadata = default,
object? inputVariables = default,
bool? returnAllOutputs = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.g.cs
index 09f6ab3..a43bc01 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.IWorkflowClient.g.cs
@@ -33,6 +33,11 @@ public partial interface IWorkflowClient : global::System.IDisposable
///
public bool ReadResponseAsString { get; set; }
+ ///
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.MetadataClient.TrackMetadata.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.MetadataClient.TrackMetadata.g.cs
index 02c4b73..9c9db7f 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.MetadataClient.TrackMetadata.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.MetadataClient.TrackMetadata.g.cs
@@ -14,6 +14,7 @@ public partial class MetadataClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessTrackMetadataResponseContent(
/// Track Metadata
///
///
+ /// 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 TrackMetadataAsync(
global::PromptLayer.TrackMetadataRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessTrackMetadataResponseContent(
securityRequirements: s_TrackMetadataSecurityRequirements,
operationName: "TrackMetadataAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/rest/track-metadata",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/rest/track-metadata",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,184 +114,343 @@ partial void ProcessTrackMetadataResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareTrackMetadataRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareTrackMetadataRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessTrackMetadataResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackMetadata",
+ methodName: "TrackMetadataAsync",
+ pathTemplate: "\"/rest/track-metadata\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackMetadata",
+ methodName: "TrackMetadataAsync",
+ pathTemplate: "\"/rest/track-metadata\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackMetadata",
+ methodName: "TrackMetadataAsync",
+ pathTemplate: "\"/rest/track-metadata\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessTrackMetadataResponseContent(
+ response: __response);
+ ProcessTrackMetadataResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.TrackMetadataResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackMetadata",
+ methodName: "TrackMetadataAsync",
+ pathTemplate: "\"/rest/track-metadata\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackMetadata",
+ methodName: "TrackMetadataAsync",
+ pathTemplate: "\"/rest/track-metadata\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- return
- await global::PromptLayer.TrackMetadataResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessTrackMetadataResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.TrackMetadataResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.TrackMetadataResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Track Metadata
@@ -278,11 +461,13 @@ partial void ProcessTrackMetadataResponseContent(
///
/// A dictionary of metadata items to associate with the request. Can include session_ids, user_ids, location, etc.
///
+ /// 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 TrackMetadataAsync(
int requestId,
object metadata,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.TrackMetadataRequest
@@ -293,6 +478,7 @@ partial void ProcessTrackMetadataResponseContent(
return await TrackMetadataAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.MetadataClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.MetadataClient.g.cs
index d58c80a..065e491 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.MetadataClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.MetadataClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class MetadataClient : global::PromptLayer.IMetadataClient
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public MetadataClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the MetadataClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public MetadataClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.OptionsSupport.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.OptionsSupport.g.cs
new file mode 100644
index 0000000..60f494b
--- /dev/null
+++ b/src/libs/PromptLayer/Generated/PromptLayer.OptionsSupport.g.cs
@@ -0,0 +1,460 @@
+
+#nullable enable
+
+namespace PromptLayer
+{
+ ///
+ /// Global defaults applied to generated SDK requests.
+ ///
+ public sealed class AutoSDKClientOptions
+ {
+ ///
+ /// Additional headers applied to every request after generated headers are set.
+ /// Entries with the same key overwrite earlier header values.
+ ///
+ public global::System.Collections.Generic.Dictionary Headers { get; } =
+ new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase);
+
+ ///
+ /// Additional query parameters appended to every request.
+ /// Request-level entries with the same key are appended after client defaults.
+ ///
+ public global::System.Collections.Generic.Dictionary QueryParameters { get; } =
+ new global::System.Collections.Generic.Dictionary(global::System.StringComparer.Ordinal);
+
+ ///
+ /// Optional timeout applied to the full request execution.
+ ///
+ public global::System.TimeSpan? Timeout { get; set; }
+
+ ///
+ /// Default retry behavior for generated HTTP requests.
+ ///
+ public global::PromptLayer.AutoSDKRetryOptions Retry { get; set; } = new global::PromptLayer.AutoSDKRetryOptions();
+
+ ///
+ /// Overrides the client-wide response buffering mode when set.
+ ///
+ public bool? ReadResponseAsString { get; set; }
+
+ ///
+ /// Reusable hooks invoked for every generated SDK request.
+ ///
+ public global::System.Collections.Generic.List Hooks { get; } =
+ new global::System.Collections.Generic.List();
+
+ ///
+ /// Registers a hook for all requests issued by this client.
+ ///
+ ///
+ /// The current options instance.
+ public global::PromptLayer.AutoSDKClientOptions AddHook(
+ global::PromptLayer.IAutoSDKHook hook)
+ {
+ Hooks.Add(hook ?? throw new global::System.ArgumentNullException(nameof(hook)));
+ return this;
+ }
+ }
+
+ ///
+ /// Per-request overrides applied on top of .
+ ///
+ public sealed class AutoSDKRequestOptions
+ {
+ ///
+ /// Additional headers applied after generated and client-level headers.
+ ///
+ public global::System.Collections.Generic.Dictionary Headers { get; } =
+ new global::System.Collections.Generic.Dictionary(global::System.StringComparer.OrdinalIgnoreCase);
+
+ ///
+ /// Additional query parameters appended after generated and client-level query parameters.
+ ///
+ public global::System.Collections.Generic.Dictionary QueryParameters { get; } =
+ new global::System.Collections.Generic.Dictionary(global::System.StringComparer.Ordinal);
+
+ ///
+ /// Optional timeout override for this request.
+ ///
+ public global::System.TimeSpan? Timeout { get; set; }
+
+ ///
+ /// Optional retry override for this request.
+ ///
+ public global::PromptLayer.AutoSDKRetryOptions? Retry { get; set; }
+
+ ///
+ /// Overrides response buffering for this request when set.
+ ///
+ public bool? ReadResponseAsString { get; set; }
+ }
+
+ ///
+ /// Retry settings for generated HTTP requests.
+ ///
+ public sealed class AutoSDKRetryOptions
+ {
+ ///
+ /// Total number of attempts, including the initial request.
+ /// Values less than 1 are normalized to 1.
+ ///
+ public int MaxAttempts { get; set; } = 1;
+
+ ///
+ /// Optional fixed delay between retry attempts.
+ ///
+ public global::System.TimeSpan? Delay { get; set; }
+ }
+
+ ///
+ /// Runtime hook interface for generated SDK lifecycle events.
+ ///
+ public interface IAutoSDKHook
+ {
+ ///
+ /// Runs before a request is sent.
+ ///
+ ///
+ global::System.Threading.Tasks.Task OnBeforeRequestAsync(
+ global::PromptLayer.AutoSDKHookContext context);
+
+ ///
+ /// Runs after a successful HTTP response is received.
+ ///
+ ///
+ global::System.Threading.Tasks.Task OnAfterSuccessAsync(
+ global::PromptLayer.AutoSDKHookContext context);
+
+ ///
+ /// Runs after an error response or transport failure is observed.
+ ///
+ ///
+ global::System.Threading.Tasks.Task OnAfterErrorAsync(
+ global::PromptLayer.AutoSDKHookContext context);
+ }
+
+ ///
+ /// Convenience base type for request hooks with no-op defaults.
+ ///
+ public abstract class AutoSDKHook : global::PromptLayer.IAutoSDKHook
+ {
+ ///
+ public virtual global::System.Threading.Tasks.Task OnBeforeRequestAsync(
+ global::PromptLayer.AutoSDKHookContext context)
+ {
+ return global::System.Threading.Tasks.Task.CompletedTask;
+ }
+
+ ///
+ public virtual global::System.Threading.Tasks.Task OnAfterSuccessAsync(
+ global::PromptLayer.AutoSDKHookContext context)
+ {
+ return global::System.Threading.Tasks.Task.CompletedTask;
+ }
+
+ ///
+ public virtual global::System.Threading.Tasks.Task OnAfterErrorAsync(
+ global::PromptLayer.AutoSDKHookContext context)
+ {
+ return global::System.Threading.Tasks.Task.CompletedTask;
+ }
+ }
+
+ ///
+ /// Runtime metadata passed to generated SDK hooks.
+ ///
+ public sealed class AutoSDKHookContext
+ {
+ ///
+ /// The source OpenAPI operation id or generated fallback id.
+ ///
+ public string OperationId { get; set; } = string.Empty;
+
+ ///
+ /// The generated C# method name.
+ ///
+ public string MethodName { get; set; } = string.Empty;
+
+ ///
+ /// The OpenAPI path template for the operation.
+ ///
+ public string PathTemplate { get; set; } = string.Empty;
+
+ ///
+ /// The HTTP method used for the request.
+ ///
+ public string HttpMethod { get; set; } = string.Empty;
+
+ ///
+ /// The client's resolved base URI.
+ ///
+ public global::System.Uri? BaseUri { get; set; }
+
+ ///
+ /// The outgoing HTTP request for the current attempt.
+ ///
+ public global::System.Net.Http.HttpRequestMessage Request { get; set; } = null!;
+
+ ///
+ /// The HTTP response when one was received.
+ ///
+ public global::System.Net.Http.HttpResponseMessage? Response { get; set; }
+
+ ///
+ /// The transport or processing exception when one was observed.
+ ///
+ public global::System.Exception? Exception { get; set; }
+
+ ///
+ /// The client-wide runtime options.
+ ///
+ public global::PromptLayer.AutoSDKClientOptions ClientOptions { get; set; } = null!;
+
+ ///
+ /// The per-request runtime options.
+ ///
+ public global::PromptLayer.AutoSDKRequestOptions? RequestOptions { get; set; }
+
+ ///
+ /// The current attempt number, starting at 1.
+ ///
+ public int Attempt { get; set; }
+
+ ///
+ /// The total number of attempts allowed for this request.
+ ///
+ public int MaxAttempts { get; set; }
+
+ ///
+ /// Indicates whether the generated client will retry after this hook invocation.
+ ///
+ public bool WillRetry { get; set; }
+
+ ///
+ /// The effective cancellation token for the current request attempt.
+ ///
+ public global::System.Threading.CancellationToken CancellationToken { get; set; }
+ }
+
+ internal static class AutoSDKRequestOptionsSupport
+ {
+ internal static global::PromptLayer.AutoSDKHookContext CreateHookContext(
+ string operationId,
+ string methodName,
+ string pathTemplate,
+ string httpMethod,
+ global::System.Uri? baseUri,
+ global::System.Net.Http.HttpRequestMessage request,
+ global::System.Net.Http.HttpResponseMessage? response,
+ global::System.Exception? exception,
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions,
+ int attempt,
+ int maxAttempts,
+ bool willRetry,
+ global::System.Threading.CancellationToken cancellationToken)
+ {
+ return new global::PromptLayer.AutoSDKHookContext
+ {
+ OperationId = operationId ?? string.Empty,
+ MethodName = methodName ?? string.Empty,
+ PathTemplate = pathTemplate ?? string.Empty,
+ HttpMethod = httpMethod ?? string.Empty,
+ BaseUri = baseUri,
+ Request = request,
+ Response = response,
+ Exception = exception,
+ ClientOptions = clientOptions,
+ RequestOptions = requestOptions,
+ Attempt = attempt,
+ MaxAttempts = maxAttempts,
+ WillRetry = willRetry,
+ CancellationToken = cancellationToken,
+ };
+ }
+
+ internal static global::System.Threading.Tasks.Task OnBeforeRequestAsync(
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::PromptLayer.AutoSDKHookContext context)
+ {
+ return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnBeforeRequestAsync(hookContext), context);
+ }
+
+ internal static global::System.Threading.Tasks.Task OnAfterSuccessAsync(
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::PromptLayer.AutoSDKHookContext context)
+ {
+ return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnAfterSuccessAsync(hookContext), context);
+ }
+
+ internal static global::System.Threading.Tasks.Task OnAfterErrorAsync(
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::PromptLayer.AutoSDKHookContext context)
+ {
+ return InvokeHooksAsync(clientOptions, static (hook, hookContext) => hook.OnAfterErrorAsync(hookContext), context);
+ }
+
+ internal static bool GetReadResponseAsString(
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions,
+ bool fallbackValue)
+ {
+ return requestOptions?.ReadResponseAsString ??
+ clientOptions.ReadResponseAsString ??
+ fallbackValue;
+ }
+
+ internal static global::System.Threading.CancellationTokenSource? CreateTimeoutCancellationTokenSource(
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions,
+ global::System.Threading.CancellationToken cancellationToken)
+ {
+ var timeout = requestOptions?.Timeout ?? clientOptions.Timeout;
+ if (!timeout.HasValue || timeout.Value <= global::System.TimeSpan.Zero)
+ {
+ return null;
+ }
+
+ var cancellationTokenSource = global::System.Threading.CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
+ cancellationTokenSource.CancelAfter(timeout.Value);
+ return cancellationTokenSource;
+ }
+
+ internal static int GetMaxAttempts(
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions,
+ bool supportsRetry)
+ {
+ if (!supportsRetry)
+ {
+ return 1;
+ }
+
+ var maxAttempts = requestOptions?.Retry?.MaxAttempts ??
+ clientOptions.Retry?.MaxAttempts ??
+ 1;
+ return maxAttempts < 1 ? 1 : maxAttempts;
+ }
+
+ internal static async global::System.Threading.Tasks.Task DelayBeforeRetryAsync(
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions,
+ global::System.Threading.CancellationToken cancellationToken)
+ {
+ var delay = requestOptions?.Retry?.Delay ??
+ clientOptions.Retry?.Delay;
+ if (!delay.HasValue || delay.Value <= global::System.TimeSpan.Zero)
+ {
+ return;
+ }
+
+ await global::System.Threading.Tasks.Task.Delay(delay.Value, cancellationToken).ConfigureAwait(false);
+ }
+
+ internal static bool ShouldRetryStatusCode(
+ global::System.Net.HttpStatusCode statusCode)
+ {
+ return (int)statusCode switch
+ {
+ 408 => true,
+ 429 => true,
+ 500 => true,
+ 502 => true,
+ 503 => true,
+ 504 => true,
+ _ => false,
+ };
+ }
+
+ internal static string AppendQueryParameters(
+ string path,
+ global::System.Collections.Generic.Dictionary clientParameters,
+ global::System.Collections.Generic.Dictionary? requestParameters)
+ {
+ var hasClientParameters = clientParameters != null && clientParameters.Count > 0;
+ var hasRequestParameters = requestParameters != null && requestParameters.Count > 0;
+ if (!hasClientParameters && !hasRequestParameters)
+ {
+ return path;
+ }
+
+ var builder = new global::System.Text.StringBuilder(path ?? string.Empty);
+ var hasQuery = builder.ToString().Contains("?", global::System.StringComparison.Ordinal);
+ AppendParameters(builder, clientParameters, ref hasQuery);
+ AppendParameters(builder, requestParameters, ref hasQuery);
+ return builder.ToString();
+ }
+
+ internal static void ApplyHeaders(
+ global::System.Net.Http.HttpRequestMessage request,
+ global::System.Collections.Generic.Dictionary clientHeaders,
+ global::System.Collections.Generic.Dictionary? requestHeaders)
+ {
+ ApplyHeadersCore(request, clientHeaders);
+ ApplyHeadersCore(request, requestHeaders);
+ }
+
+ private static void AppendParameters(
+ global::System.Text.StringBuilder builder,
+ global::System.Collections.Generic.Dictionary? parameters,
+ ref bool hasQuery)
+ {
+ if (parameters == null || parameters.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var parameter in parameters)
+ {
+ builder.Append(hasQuery ? '&' : '?');
+ builder.Append(global::System.Uri.EscapeDataString(parameter.Key));
+ builder.Append('=');
+ builder.Append(global::System.Uri.EscapeDataString(parameter.Value ?? string.Empty));
+ hasQuery = true;
+ }
+ }
+
+ private static void ApplyHeadersCore(
+ global::System.Net.Http.HttpRequestMessage request,
+ global::System.Collections.Generic.Dictionary? headers)
+ {
+ if (headers == null || headers.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var header in headers)
+ {
+ request.Headers.Remove(header.Key);
+ request.Content?.Headers.Remove(header.Key);
+
+ if (!request.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty) &&
+ request.Content != null)
+ {
+ request.Content.Headers.TryAddWithoutValidation(header.Key, header.Value ?? string.Empty);
+ }
+ }
+ }
+
+ private static async global::System.Threading.Tasks.Task InvokeHooksAsync(
+ global::PromptLayer.AutoSDKClientOptions clientOptions,
+ global::System.Func callback,
+ global::PromptLayer.AutoSDKHookContext context)
+ {
+ if (clientOptions.Hooks == null || clientOptions.Hooks.Count == 0)
+ {
+ return;
+ }
+
+ foreach (var hook in clientOptions.Hooks)
+ {
+ if (hook == null)
+ {
+ continue;
+ }
+
+ await callback(hook, context).ConfigureAwait(false);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.OtlpClient.IngestOtlpTraces.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.OtlpClient.IngestOtlpTraces.g.cs
index 7355df3..8cfb414 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.OtlpClient.IngestOtlpTraces.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.OtlpClient.IngestOtlpTraces.g.cs
@@ -14,6 +14,7 @@ public partial class OtlpClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -57,6 +58,7 @@ partial void ProcessIngestOtlpTracesResponseContent(
///
///
///
+ /// 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 IngestOtlpTracesAsync(
@@ -64,6 +66,7 @@ partial void ProcessIngestOtlpTracesResponseContent(
global::PromptLayer.OtlpExportTraceServiceRequest request,
global::PromptLayer.IngestOtlpTracesContentEncoding? contentEncoding = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -82,22 +85,43 @@ partial void ProcessIngestOtlpTracesResponseContent(
securityRequirements: s_IngestOtlpTracesSecurityRequirements,
operationName: "IngestOtlpTracesAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/v1/traces",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/v1/traces",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -107,203 +131,362 @@ partial void ProcessIngestOtlpTracesResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- __httpRequest.Headers.TryAddWithoutValidation("Content-Type", contentType.ToValueString());
- if (contentEncoding != default)
- {
- __httpRequest.Headers.TryAddWithoutValidation("Content-Encoding", contentEncoding?.ToValueString() ?? string.Empty);
- }
+ __httpRequest.Headers.TryAddWithoutValidation("Content-Type", contentType.ToValueString());
+ if (contentEncoding != default)
+ {
+ __httpRequest.Headers.TryAddWithoutValidation("Content-Encoding", contentEncoding?.ToValueString() ?? string.Empty);
+ }
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareIngestOtlpTracesRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- contentType: contentType,
- contentEncoding: contentEncoding,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareIngestOtlpTracesRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ contentType: contentType,
+ contentEncoding: contentEncoding,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessIngestOtlpTracesResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Unsupported Content-Type
- if ((int)__response.StatusCode == 415)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_415 = null;
- global::System.Exception? __exception_415 = null;
- global::PromptLayer.ErrorResponse? __value_415 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "IngestOtlpTraces",
+ methodName: "IngestOtlpTracesAsync",
+ pathTemplate: "\"/v1/traces\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_415 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_415 = global::PromptLayer.ErrorResponse.FromJson(__content_415, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_415 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "IngestOtlpTraces",
+ methodName: "IngestOtlpTracesAsync",
+ pathTemplate: "\"/v1/traces\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_415 = global::PromptLayer.ErrorResponse.FromJson(__content_415, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_415 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_415 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_415,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_415,
- ResponseObject = __value_415,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal server error during ingestion
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::PromptLayer.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "IngestOtlpTraces",
+ methodName: "IngestOtlpTracesAsync",
+ pathTemplate: "\"/v1/traces\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_500 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessIngestOtlpTracesResponseContent(
+ response: __response);
+ ProcessIngestOtlpTracesResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.OtlpExportTraceServiceResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "IngestOtlpTraces",
+ methodName: "IngestOtlpTracesAsync",
+ pathTemplate: "\"/v1/traces\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "IngestOtlpTraces",
+ methodName: "IngestOtlpTracesAsync",
+ pathTemplate: "\"/v1/traces\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Unsupported Content-Type
+ if ((int)__response.StatusCode == 415)
+ {
+ string? __content_415 = null;
+ global::System.Exception? __exception_415 = null;
+ global::PromptLayer.ErrorResponse? __value_415 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_415 = global::PromptLayer.ErrorResponse.FromJson(__content_415, JsonSerializerContext);
+ }
+ else
+ {
+ __content_415 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.OtlpExportTraceServiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_415 = global::PromptLayer.ErrorResponse.FromJson(__content_415, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_415 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_415 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_415,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_415,
+ ResponseObject = __value_415,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal server error during ingestion
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::PromptLayer.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessIngestOtlpTracesResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.OtlpExportTraceServiceResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.OtlpExportTraceServiceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Ingest Traces (OTLP)
@@ -320,12 +503,14 @@ partial void ProcessIngestOtlpTracesResponseContent(
///
/// An array of ResourceSpans. Each element describes spans from a single instrumented resource.
///
+ /// 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 IngestOtlpTracesAsync(
global::PromptLayer.IngestOtlpTracesContentType contentType,
global::PromptLayer.IngestOtlpTracesContentEncoding? contentEncoding = default,
global::System.Collections.Generic.IList? resourceSpans = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.OtlpExportTraceServiceRequest
@@ -337,6 +522,7 @@ partial void ProcessIngestOtlpTracesResponseContent(
contentType: contentType,
contentEncoding: contentEncoding,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.OtlpClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.OtlpClient.g.cs
index ee54f0b..3f0f3bc 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.OtlpClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.OtlpClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class OtlpClient : global::PromptLayer.IOtlpClient, global
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public OtlpClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the OtlpClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public OtlpClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PathBuilder.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PathBuilder.g.cs
index c36ed91..c46a46b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PathBuilder.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PathBuilder.g.cs
@@ -275,6 +275,11 @@ public class EndPointAuthorization
///
public string Type { get; set; } = string.Empty;
+ ///
+ ///
+ ///
+ public string SchemeId { get; set; } = string.Empty;
+
///
///
///
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptClient.TrackPrompt.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptClient.TrackPrompt.g.cs
index a5bc006..36c11ed 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptClient.TrackPrompt.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptClient.TrackPrompt.g.cs
@@ -14,6 +14,7 @@ public partial class PromptClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessTrackPromptResponseContent(
/// Track Prompt
///
///
+ /// 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 TrackPromptAsync(
global::PromptLayer.TrackPromptRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessTrackPromptResponseContent(
securityRequirements: s_TrackPromptSecurityRequirements,
operationName: "TrackPromptAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/rest/track-prompt",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/rest/track-prompt",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,184 +114,343 @@ partial void ProcessTrackPromptResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareTrackPromptRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareTrackPromptRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessTrackPromptResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackPrompt",
+ methodName: "TrackPromptAsync",
+ pathTemplate: "\"/rest/track-prompt\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackPrompt",
+ methodName: "TrackPromptAsync",
+ pathTemplate: "\"/rest/track-prompt\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackPrompt",
+ methodName: "TrackPromptAsync",
+ pathTemplate: "\"/rest/track-prompt\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessTrackPromptResponseContent(
+ response: __response);
+ ProcessTrackPromptResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.TrackPromptResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackPrompt",
+ methodName: "TrackPromptAsync",
+ pathTemplate: "\"/rest/track-prompt\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackPrompt",
+ methodName: "TrackPromptAsync",
+ pathTemplate: "\"/rest/track-prompt\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- return
- await global::PromptLayer.TrackPromptResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessTrackPromptResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.TrackPromptResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.TrackPromptResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Track Prompt
@@ -287,6 +470,7 @@ partial void ProcessTrackPromptResponseContent(
///
/// The label of the prompt template version. Both version and label cannot be specified. Only one or none.
///
+ /// 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 TrackPromptAsync(
@@ -295,6 +479,7 @@ partial void ProcessTrackPromptResponseContent(
global::System.Collections.Generic.Dictionary? promptInputVariables = default,
int? version = default,
string? label = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.TrackPromptRequest
@@ -308,6 +493,7 @@ partial void ProcessTrackPromptResponseContent(
return await TrackPromptAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptClient.g.cs
index 4110a2e..7adae7f 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class PromptClient : global::PromptLayer.IPromptClient, gl
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public PromptClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the PromptClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public PromptClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptLayerClient.Authorizations.ApiKeyInHeader.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptLayerClient.Authorizations.ApiKeyInHeader.g.cs
index 67be79e..a117d8b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptLayerClient.Authorizations.ApiKeyInHeader.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptLayerClient.Authorizations.ApiKeyInHeader.g.cs
@@ -26,6 +26,7 @@ public void AuthorizeUsingApiKeyInHeader(
Authorizations.Add(new global::PromptLayer.EndPointAuthorization
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
Value = apiKey,
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptLayerClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptLayerClient.g.cs
index 52b6e56..dbfea20 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptLayerClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptLayerClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -39,7 +42,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public DatasetsClient Datasets => new DatasetsClient(HttpClient, authorizations: Authorizations)
+ public DatasetsClient Datasets => new DatasetsClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -48,7 +51,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public EvaluationsClient Evaluations => new EvaluationsClient(HttpClient, authorizations: Authorizations)
+ public EvaluationsClient Evaluations => new EvaluationsClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -57,7 +60,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public FoldersClient Folders => new FoldersClient(HttpClient, authorizations: Authorizations)
+ public FoldersClient Folders => new FoldersClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -66,7 +69,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public GroupClient Group => new GroupClient(HttpClient, authorizations: Authorizations)
+ public GroupClient Group => new GroupClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -75,7 +78,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public MetadataClient Metadata => new MetadataClient(HttpClient, authorizations: Authorizations)
+ public MetadataClient Metadata => new MetadataClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -84,7 +87,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public OtlpClient Otlp => new OtlpClient(HttpClient, authorizations: Authorizations)
+ public OtlpClient Otlp => new OtlpClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -93,7 +96,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public PromptClient Prompt => new PromptClient(HttpClient, authorizations: Authorizations)
+ public PromptClient Prompt => new PromptClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -102,7 +105,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public PromptTemplatesClient PromptTemplates => new PromptTemplatesClient(HttpClient, authorizations: Authorizations)
+ public PromptTemplatesClient PromptTemplates => new PromptTemplatesClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -111,7 +114,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public PromptsClient Prompts => new PromptsClient(HttpClient, authorizations: Authorizations)
+ public PromptsClient Prompts => new PromptsClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -120,7 +123,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public ReportsClient Reports => new ReportsClient(HttpClient, authorizations: Authorizations)
+ public ReportsClient Reports => new ReportsClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -129,7 +132,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public RequestClient Request => new RequestClient(HttpClient, authorizations: Authorizations)
+ public RequestClient Request => new RequestClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -138,7 +141,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public RestClient Rest => new RestClient(HttpClient, authorizations: Authorizations)
+ public RestClient Rest => new RestClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -147,7 +150,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public ScoreClient Score => new ScoreClient(HttpClient, authorizations: Authorizations)
+ public ScoreClient Score => new ScoreClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -156,7 +159,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public SpansClient Spans => new SpansClient(HttpClient, authorizations: Authorizations)
+ public SpansClient Spans => new SpansClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -165,7 +168,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public TrackingClient Tracking => new TrackingClient(HttpClient, authorizations: Authorizations)
+ public TrackingClient Tracking => new TrackingClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -174,7 +177,7 @@ public sealed partial class PromptLayerClient : global::PromptLayer.IPromptLayer
///
///
///
- public WorkflowClient Workflow => new WorkflowClient(HttpClient, authorizations: Authorizations)
+ public WorkflowClient Workflow => new WorkflowClient(HttpClient, authorizations: Authorizations, options: Options)
{
ReadResponseAsString = ReadResponseAsString,
JsonSerializerContext = JsonSerializerContext,
@@ -193,11 +196,37 @@ public PromptLayerClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the PromptLayerClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public PromptLayerClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.DeletePromptTemplatesLabelsPromptLabelId.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.DeletePromptTemplatesLabelsPromptLabelId.g.cs
index 3126156..17b3d53 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.DeletePromptTemplatesLabelsPromptLabelId.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.DeletePromptTemplatesLabelsPromptLabelId.g.cs
@@ -14,6 +14,7 @@ public partial class PromptTemplatesClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,10 +45,12 @@ partial void ProcessDeletePromptTemplatesLabelsPromptLabelIdResponseContent(
/// Delete Prompt Template Label
///
///
+ /// 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 DeletePromptTemplatesLabelsPromptLabelIdAsync(
int promptLabelId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessDeletePromptTemplatesLabelsPromptLabelIdResponseContent(
securityRequirements: s_DeletePromptTemplatesLabelsPromptLabelIdSecurityRequirements,
operationName: "DeletePromptTemplatesLabelsPromptLabelIdAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/prompt-labels/{promptLabelId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/prompt-labels/{promptLabelId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,108 +111,267 @@ partial void ProcessDeletePromptTemplatesLabelsPromptLabelIdResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeletePromptTemplatesLabelsPromptLabelIdRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- promptLabelId: promptLabelId);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeletePromptTemplatesLabelsPromptLabelIdRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ promptLabelId: promptLabelId);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeletePromptTemplatesLabelsPromptLabelIdResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
+ return __httpRequest;
+ }
- if (ReadResponseAsString)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePromptTemplatesLabelsPromptLabelId",
+ methodName: "DeletePromptTemplatesLabelsPromptLabelIdAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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 __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePromptTemplatesLabelsPromptLabelId",
+ methodName: "DeletePromptTemplatesLabelsPromptLabelIdAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessDeletePromptTemplatesLabelsPromptLabelIdResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePromptTemplatesLabelsPromptLabelId",
+ methodName: "DeletePromptTemplatesLabelsPromptLabelIdAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- return __content;
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ throw new global::System.InvalidOperationException("No response received.");
}
- }
- else
- {
- try
+
+ using (__response)
{
- __response.EnsureSuccessStatusCode();
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- return __content;
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessDeletePromptTemplatesLabelsPromptLabelIdResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePromptTemplatesLabelsPromptLabelId",
+ methodName: "DeletePromptTemplatesLabelsPromptLabelIdAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeletePromptTemplatesLabelsPromptLabelId",
+ methodName: "DeletePromptTemplatesLabelsPromptLabelIdAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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);
+ ProcessDeletePromptTemplatesLabelsPromptLabelIdResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return __content;
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
+ else
+ {
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
+
+ return __content;
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetAllPromptTemplatesGet.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetAllPromptTemplatesGet.g.cs
index 5a7b884..97b9533 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetAllPromptTemplatesGet.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetAllPromptTemplatesGet.g.cs
@@ -14,6 +14,7 @@ public partial class PromptTemplatesClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -61,6 +62,7 @@ partial void ProcessGetAllPromptTemplatesGetResponseContent(
///
/// Default Value: active
///
+ /// 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 GetAllPromptTemplatesGetAsync(
@@ -70,6 +72,7 @@ partial void ProcessGetAllPromptTemplatesGetResponseContent(
string? name = default,
global::PromptLayer.AnyOf>? tags = default,
global::PromptLayer.GetAllPromptTemplatesGetStatus? status = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -89,30 +92,51 @@ partial void ProcessGetAllPromptTemplatesGetResponseContent(
securityRequirements: s_GetAllPromptTemplatesGetSecurityRequirements,
operationName: "GetAllPromptTemplatesGetAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/prompt-templates",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("page", page?.ToString())
- .AddOptionalParameter("per_page", perPage?.ToString())
- .AddOptionalParameter("label", label)
- .AddOptionalParameter("name", name)
- .AddOptionalParameter("tags", tags?.ToString())
- .AddOptionalParameter("status", status?.ToValueString())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/prompt-templates",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("page", page?.ToString())
+ .AddOptionalParameter("per_page", perPage?.ToString())
+ .AddOptionalParameter("label", label)
+ .AddOptionalParameter("name", name)
+ .AddOptionalParameter("tags", tags?.ToString())
+ .AddOptionalParameter("status", status?.ToValueString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -122,117 +146,276 @@ partial void ProcessGetAllPromptTemplatesGetResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetAllPromptTemplatesGetRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- page: page,
- perPage: perPage,
- label: label,
- name: name,
- tags: tags,
- status: status);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetAllPromptTemplatesGetRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ page: page,
+ perPage: perPage,
+ label: label,
+ name: name,
+ tags: tags,
+ status: status);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetAllPromptTemplatesGetResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
+ return __httpRequest;
+ }
- if (ReadResponseAsString)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAllPromptTemplatesGet",
+ methodName: "GetAllPromptTemplatesGetAsync",
+ pathTemplate: "\"/prompt-templates\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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 __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAllPromptTemplatesGet",
+ methodName: "GetAllPromptTemplatesGetAsync",
+ pathTemplate: "\"/prompt-templates\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetAllPromptTemplatesGetResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAllPromptTemplatesGet",
+ methodName: "GetAllPromptTemplatesGetAsync",
+ pathTemplate: "\"/prompt-templates\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- return
- global::PromptLayer.ListPromptTemplates.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ throw new global::System.InvalidOperationException("No response received.");
}
- }
- else
- {
- try
+
+ using (__response)
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- return
- await global::PromptLayer.ListPromptTemplates.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetAllPromptTemplatesGetResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAllPromptTemplatesGet",
+ methodName: "GetAllPromptTemplatesGetAsync",
+ pathTemplate: "\"/prompt-templates\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetAllPromptTemplatesGet",
+ methodName: "GetAllPromptTemplatesGetAsync",
+ pathTemplate: "\"/prompt-templates\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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);
+ ProcessGetAllPromptTemplatesGetResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.ListPromptTemplates.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.ListPromptTemplates.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplateRaw.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplateRaw.g.cs
index 05c756c..a756ef4 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplateRaw.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplateRaw.g.cs
@@ -14,6 +14,7 @@ public partial class PromptTemplatesClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -69,6 +70,7 @@ partial void ProcessGetPromptTemplateRawResponseContent(
/// When true, includes provider-specific llm_kwargs in the response. Requires model metadata to be set on the template.
/// 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 GetPromptTemplateRawAsync(
@@ -77,6 +79,7 @@ partial void ProcessGetPromptTemplateRawResponseContent(
string? label = default,
bool? resolveSnippets = default,
bool? includeLlmKwargs = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -95,28 +98,49 @@ partial void ProcessGetPromptTemplateRawResponseContent(
securityRequirements: s_GetPromptTemplateRawSecurityRequirements,
operationName: "GetPromptTemplateRawAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/prompt-templates/{identifier}",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("version", version?.ToString())
- .AddOptionalParameter("label", label)
- .AddOptionalParameter("resolve_snippets", resolveSnippets?.ToString().ToLowerInvariant())
- .AddOptionalParameter("include_llm_kwargs", includeLlmKwargs?.ToString().ToLowerInvariant())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/prompt-templates/{identifier}",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("version", version?.ToString())
+ .AddOptionalParameter("label", label)
+ .AddOptionalParameter("resolve_snippets", resolveSnippets?.ToString().ToLowerInvariant())
+ .AddOptionalParameter("include_llm_kwargs", includeLlmKwargs?.ToString().ToLowerInvariant())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -126,192 +150,351 @@ partial void ProcessGetPromptTemplateRawResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetPromptTemplateRawRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- identifier: identifier,
- version: version,
- label: label,
- resolveSnippets: resolveSnippets,
- includeLlmKwargs: includeLlmKwargs);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetPromptTemplateRawRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ identifier: identifier,
+ version: version,
+ label: label,
+ resolveSnippets: resolveSnippets,
+ includeLlmKwargs: includeLlmKwargs);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetPromptTemplateRawResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Prompt template not found
- if ((int)__response.StatusCode == 404)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplateRaw",
+ methodName: "GetPromptTemplateRawAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplateRaw",
+ methodName: "GetPromptTemplateRawAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Validation Error
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::PromptLayer.HTTPValidationError? __value_422 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplateRaw",
+ methodName: "GetPromptTemplateRawAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetPromptTemplateRawResponseContent(
+ response: __response);
+ ProcessGetPromptTemplateRawResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetPromptTemplateRawResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplateRaw",
+ methodName: "GetPromptTemplateRawAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplateRaw",
+ methodName: "GetPromptTemplateRawAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Prompt template not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.GetPromptTemplateRawResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::PromptLayer.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetPromptTemplateRawResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetPromptTemplateRawResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetPromptTemplateRawResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplatesLabelsPromptIdentifierPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplatesLabelsPromptIdentifierPost.g.cs
index d98aa43..1d25ea1 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplatesLabelsPromptIdentifierPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplatesLabelsPromptIdentifierPost.g.cs
@@ -14,6 +14,7 @@ public partial class PromptTemplatesClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -46,10 +47,12 @@ partial void ProcessGetPromptTemplatesLabelsPromptIdentifierPostResponseContent(
///
/// The identifier can be either the prompt name or the prompt id.
///
+ /// 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 GetPromptTemplatesLabelsPromptIdentifierPostAsync(
string identifier,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -64,22 +67,43 @@ partial void ProcessGetPromptTemplatesLabelsPromptIdentifierPostResponseContent(
securityRequirements: s_GetPromptTemplatesLabelsPromptIdentifierPostSecurityRequirements,
operationName: "GetPromptTemplatesLabelsPromptIdentifierPostAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/prompt-templates/{identifier}/labels",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/prompt-templates/{identifier}/labels",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -89,145 +113,304 @@ partial void ProcessGetPromptTemplatesLabelsPromptIdentifierPostResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetPromptTemplatesLabelsPromptIdentifierPostRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- identifier: identifier);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetPromptTemplatesLabelsPromptIdentifierPostRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ identifier: identifier);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetPromptTemplatesLabelsPromptIdentifierPostResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 404)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesLabelsPromptIdentifierPost",
+ methodName: "GetPromptTemplatesLabelsPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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)
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesLabelsPromptIdentifierPost",
+ methodName: "GetPromptTemplatesLabelsPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesLabelsPromptIdentifierPost",
+ methodName: "GetPromptTemplatesLabelsPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetPromptTemplatesLabelsPromptIdentifierPostResponseContent(
+ response: __response);
+ ProcessGetPromptTemplatesLabelsPromptIdentifierPostResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetPromptTemplateLabelResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesLabelsPromptIdentifierPost",
+ methodName: "GetPromptTemplatesLabelsPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesLabelsPromptIdentifierPost",
+ methodName: "GetPromptTemplatesLabelsPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.GetPromptTemplateLabelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetPromptTemplatesLabelsPromptIdentifierPostResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetPromptTemplateLabelResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetPromptTemplateLabelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplatesPromptIdentifierPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplatesPromptIdentifierPost.g.cs
index 2c5778c..5640ce8 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplatesPromptIdentifierPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetPromptTemplatesPromptIdentifierPost.g.cs
@@ -14,6 +14,7 @@ public partial class PromptTemplatesClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -49,12 +50,14 @@ partial void ProcessGetPromptTemplatesPromptIdentifierPostResponseContent(
/// The identifier can be either the prompt name or the prompt id.
///
///
+ /// 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 GetPromptTemplatesPromptIdentifierPostAsync(
string identifier,
global::PromptLayer.GetPromptTemplate request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -72,22 +75,43 @@ partial void ProcessGetPromptTemplatesPromptIdentifierPostResponseContent(
securityRequirements: s_GetPromptTemplatesPromptIdentifierPostSecurityRequirements,
operationName: "GetPromptTemplatesPromptIdentifierPostAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/prompt-templates/{identifier}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/prompt-templates/{identifier}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -97,157 +121,316 @@ partial void ProcessGetPromptTemplatesPromptIdentifierPostResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetPromptTemplatesPromptIdentifierPostRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- identifier: identifier,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetPromptTemplatesPromptIdentifierPostRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ identifier: identifier,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetPromptTemplatesPromptIdentifierPostResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Validation Error
- if ((int)__response.StatusCode == 422)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::PromptLayer.HTTPValidationError? __value_422 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesPromptIdentifierPost",
+ methodName: "GetPromptTemplatesPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesPromptIdentifierPost",
+ methodName: "GetPromptTemplatesPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesPromptIdentifierPost",
+ methodName: "GetPromptTemplatesPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetPromptTemplatesPromptIdentifierPostResponseContent(
+ response: __response);
+ ProcessGetPromptTemplatesPromptIdentifierPostResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetPromptTemplateResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesPromptIdentifierPost",
+ methodName: "GetPromptTemplatesPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetPromptTemplatesPromptIdentifierPost",
+ methodName: "GetPromptTemplatesPromptIdentifierPostAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::PromptLayer.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.GetPromptTemplateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetPromptTemplatesPromptIdentifierPostResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetPromptTemplateResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetPromptTemplateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Get Prompt Template by ID
@@ -255,10 +438,12 @@ partial void ProcessGetPromptTemplatesPromptIdentifierPostResponseContent(
///
/// The identifier can be either the prompt name or the prompt id.
///
+ /// 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 GetPromptTemplatesPromptIdentifierPostAsync(
string identifier,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.GetPromptTemplate
@@ -268,6 +453,7 @@ partial void ProcessGetPromptTemplatesPromptIdentifierPostResponseContent(
return await GetPromptTemplatesPromptIdentifierPostAsync(
identifier: identifier,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetSnippetUsage.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetSnippetUsage.g.cs
index 0b05caa..4d0ef56 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetSnippetUsage.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.GetSnippetUsage.g.cs
@@ -14,6 +14,7 @@ public partial class PromptTemplatesClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -52,11 +53,13 @@ partial void ProcessGetSnippetUsageResponseContent(
///
/// Optional specific version number to check usage for
///
+ /// 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 GetSnippetUsageAsync(
string identifier,
int? promptVersionNumber = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -72,25 +75,46 @@ partial void ProcessGetSnippetUsageResponseContent(
securityRequirements: s_GetSnippetUsageSecurityRequirements,
operationName: "GetSnippetUsageAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/prompt-templates/{identifier}/snippet-usage",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("prompt_version_number", promptVersionNumber?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/prompt-templates/{identifier}/snippet-usage",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("prompt_version_number", promptVersionNumber?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -100,179 +124,338 @@ partial void ProcessGetSnippetUsageResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetSnippetUsageRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- identifier: identifier,
- promptVersionNumber: promptVersionNumber);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetSnippetUsageRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ identifier: identifier,
+ promptVersionNumber: promptVersionNumber);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetSnippetUsageResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 403)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetSnippetUsage",
+ methodName: "GetSnippetUsageAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/snippet-usage\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetSnippetUsage",
+ methodName: "GetSnippetUsageAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/snippet-usage\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetSnippetUsage",
+ methodName: "GetSnippetUsageAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/snippet-usage\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetSnippetUsageResponseContent(
+ response: __response);
+ ProcessGetSnippetUsageResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetSnippetUsageResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetSnippetUsage",
+ methodName: "GetSnippetUsageAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/snippet-usage\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetSnippetUsage",
+ methodName: "GetSnippetUsageAsync",
+ pathTemplate: "$\"/prompt-templates/{identifier}/snippet-usage\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- return
- await global::PromptLayer.GetSnippetUsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetSnippetUsageResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetSnippetUsageResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetSnippetUsageResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.PromptTemplatesLabelsPromptLabelIdPatch.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.PromptTemplatesLabelsPromptLabelIdPatch.g.cs
index 5bfc831..fe7f228 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.PromptTemplatesLabelsPromptLabelIdPatch.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.PromptTemplatesLabelsPromptLabelIdPatch.g.cs
@@ -14,6 +14,7 @@ public partial class PromptTemplatesClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -47,12 +48,14 @@ partial void ProcessPromptTemplatesLabelsPromptLabelIdPatchResponseContent(
///
///
///
+ /// 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 PromptTemplatesLabelsPromptLabelIdPatchAsync(
int promptLabelId,
global::PromptLayer.PromptTemplatesLabelsPromptLabelIdPatchRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -70,22 +73,43 @@ partial void ProcessPromptTemplatesLabelsPromptLabelIdPatchResponseContent(
securityRequirements: s_PromptTemplatesLabelsPromptLabelIdPatchSecurityRequirements,
operationName: "PromptTemplatesLabelsPromptLabelIdPatchAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/prompt-labels/{promptLabelId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: new global::System.Net.Http.HttpMethod("PATCH"),
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/prompt-labels/{promptLabelId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: new global::System.Net.Http.HttpMethod("PATCH"),
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -95,130 +119,291 @@ partial void ProcessPromptTemplatesLabelsPromptLabelIdPatchResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PreparePromptTemplatesLabelsPromptLabelIdPatchRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- promptLabelId: promptLabelId,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PreparePromptTemplatesLabelsPromptLabelIdPatchRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ promptLabelId: promptLabelId,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessPromptTemplatesLabelsPromptLabelIdPatchResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
+ return __httpRequest;
+ }
- if (ReadResponseAsString)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PromptTemplatesLabelsPromptLabelIdPatch",
+ methodName: "PromptTemplatesLabelsPromptLabelIdPatchAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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 __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PromptTemplatesLabelsPromptLabelIdPatch",
+ methodName: "PromptTemplatesLabelsPromptLabelIdPatchAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessPromptTemplatesLabelsPromptLabelIdPatchResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PromptTemplatesLabelsPromptLabelIdPatch",
+ methodName: "PromptTemplatesLabelsPromptLabelIdPatchAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- return
- global::PromptLayer.PromptTemplatesLabelsPromptLabelIdPatchResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ throw new global::System.InvalidOperationException("No response received.");
}
- }
- else
- {
- try
+
+ using (__response)
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- return
- await global::PromptLayer.PromptTemplatesLabelsPromptLabelIdPatchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessPromptTemplatesLabelsPromptLabelIdPatchResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PromptTemplatesLabelsPromptLabelIdPatch",
+ methodName: "PromptTemplatesLabelsPromptLabelIdPatchAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PromptTemplatesLabelsPromptLabelIdPatch",
+ methodName: "PromptTemplatesLabelsPromptLabelIdPatchAsync",
+ pathTemplate: "$\"/prompt-labels/{promptLabelId}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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);
+ ProcessPromptTemplatesLabelsPromptLabelIdPatchResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.PromptTemplatesLabelsPromptLabelIdPatchResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.PromptTemplatesLabelsPromptLabelIdPatchResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Move Prompt Template Labels
///
///
///
+ /// 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 PromptTemplatesLabelsPromptLabelIdPatchAsync(
int promptLabelId,
int promptVersionNumber,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.PromptTemplatesLabelsPromptLabelIdPatchRequest
@@ -229,6 +414,7 @@ partial void ProcessPromptTemplatesLabelsPromptLabelIdPatchResponseContent(
return await PromptTemplatesLabelsPromptLabelIdPatchAsync(
promptLabelId: promptLabelId,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.g.cs
index 23d8ed9..1a23969 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptTemplatesClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class PromptTemplatesClient : global::PromptLayer.IPromptT
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public PromptTemplatesClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the PromptTemplatesClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public PromptTemplatesClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptsClient.CreatePromptLabel.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptsClient.CreatePromptLabel.g.cs
index bdd108a..1880185 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptsClient.CreatePromptLabel.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptsClient.CreatePromptLabel.g.cs
@@ -14,6 +14,7 @@ public partial class PromptsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -47,12 +48,14 @@ partial void ProcessCreatePromptLabelResponseContent(
///
///
///
+ /// 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 CreatePromptLabelAsync(
int promptId,
global::PromptLayer.CreatePromptLabelRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -70,22 +73,43 @@ partial void ProcessCreatePromptLabelResponseContent(
securityRequirements: s_CreatePromptLabelSecurityRequirements,
operationName: "CreatePromptLabelAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/prompts/{promptId}/label",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/prompts/{promptId}/label",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -95,119 +119,278 @@ partial void ProcessCreatePromptLabelResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreatePromptLabelRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- promptId: promptId,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreatePromptLabelRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ promptId: promptId,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreatePromptLabelResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
+ return __httpRequest;
+ }
- if (ReadResponseAsString)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
+ {
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePromptLabel",
+ methodName: "CreatePromptLabelAsync",
+ pathTemplate: "$\"/prompts/{promptId}/label\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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 __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePromptLabel",
+ methodName: "CreatePromptLabelAsync",
+ pathTemplate: "$\"/prompts/{promptId}/label\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreatePromptLabelResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePromptLabel",
+ methodName: "CreatePromptLabelAsync",
+ pathTemplate: "$\"/prompts/{promptId}/label\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
- return
- global::PromptLayer.CreatePromptLabelResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ throw new global::System.InvalidOperationException("No response received.");
}
- }
- else
- {
- try
+
+ using (__response)
{
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- return
- await global::PromptLayer.CreatePromptLabelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreatePromptLabelResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePromptLabel",
+ methodName: "CreatePromptLabelAsync",
+ pathTemplate: "$\"/prompts/{promptId}/label\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreatePromptLabel",
+ methodName: "CreatePromptLabelAsync",
+ pathTemplate: "$\"/prompts/{promptId}/label\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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);
+ ProcessCreatePromptLabelResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreatePromptLabelResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreatePromptLabelResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create a new label for a prompt
@@ -215,12 +398,14 @@ partial void ProcessCreatePromptLabelResponseContent(
///
///
///
+ /// 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 CreatePromptLabelAsync(
int promptId,
int promptVersionNumber,
string name,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreatePromptLabelRequest
@@ -232,6 +417,7 @@ partial void ProcessCreatePromptLabelResponseContent(
return await CreatePromptLabelAsync(
promptId: promptId,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.PromptsClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.PromptsClient.g.cs
index b91928d..351b6f5 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.PromptsClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.PromptsClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class PromptsClient : global::PromptLayer.IPromptsClient,
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public PromptsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the PromptsClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public PromptsClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.AddReportColumn.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.AddReportColumn.g.cs
index 31c57a7..d1c72d8 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.AddReportColumn.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.AddReportColumn.g.cs
@@ -14,6 +14,7 @@ public partial class ReportsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -50,11 +51,13 @@ partial void ProcessAddReportColumnResponseContent(
/// See the full documentation for detailed configuration requirements for each column type.
///
///
+ /// 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 AddReportColumnAsync(
global::PromptLayer.AddReportColumnRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -71,22 +74,43 @@ partial void ProcessAddReportColumnResponseContent(
securityRequirements: s_AddReportColumnSecurityRequirements,
operationName: "AddReportColumnAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/report-columns",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/report-columns",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -96,265 +120,424 @@ partial void ProcessAddReportColumnResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareAddReportColumnRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessAddReportColumnResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request - Invalid column type, configuration validation failed, or column name already exists
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.AddReportColumnResponse2? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.AddReportColumnResponse2.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_400 = global::PromptLayer.AddReportColumnResponse2.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareAddReportColumnRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Forbidden - Cannot overwrite dataset columns or missing permissions
- if ((int)__response.StatusCode == 403)
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.AddReportColumnResponse3? __value_403 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddReportColumn",
+ methodName: "AddReportColumnAsync",
+ pathTemplate: "\"/report-columns\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.AddReportColumnResponse3.FromJson(__content_403, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddReportColumn",
+ methodName: "AddReportColumnAsync",
+ pathTemplate: "\"/report-columns\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_403 = global::PromptLayer.AddReportColumnResponse3.FromJson(__content_403, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found - Report not found or not accessible
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.AddReportColumnResponse4? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.AddReportColumnResponse4.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddReportColumn",
+ methodName: "AddReportColumnAsync",
+ pathTemplate: "\"/report-columns\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.AddReportColumnResponse4.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessAddReportColumnResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddReportColumn",
+ methodName: "AddReportColumnAsync",
+ pathTemplate: "\"/report-columns\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_401 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "AddReportColumn",
+ methodName: "AddReportColumnAsync",
+ pathTemplate: "\"/report-columns\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request - Invalid column type, configuration validation failed, or column name already exists
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.AddReportColumnResponse2? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.AddReportColumnResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.AddReportColumnResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Forbidden - Cannot overwrite dataset columns or missing permissions
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.AddReportColumnResponse3? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.AddReportColumnResponse3.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessAddReportColumnResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_403 = global::PromptLayer.AddReportColumnResponse3.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found - Report not found or not accessible
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.AddReportColumnResponse4? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.AddReportColumnResponse4.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.AddReportColumnResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.AddReportColumnResponse4.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.AddReportColumnResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessAddReportColumnResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.AddReportColumnResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.AddReportColumnResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Add Column to Evaluation Pipeline
@@ -380,6 +563,7 @@ partial void ProcessAddReportColumnResponseContent(
///
/// Optional position for the column. If not specified, the column is added at the end. Cannot overwrite dataset columns.
///
+ /// 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 AddReportColumnAsync(
@@ -388,6 +572,7 @@ partial void ProcessAddReportColumnResponseContent(
string name,
object configuration,
int? position = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.AddReportColumnRequest
@@ -401,6 +586,7 @@ partial void ProcessAddReportColumnResponseContent(
return await AddReportColumnAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.CreateEvaluationPipeline.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.CreateEvaluationPipeline.g.cs
index 4510c0d..e45e41b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.CreateEvaluationPipeline.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.CreateEvaluationPipeline.g.cs
@@ -14,6 +14,7 @@ public partial class ReportsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -45,11 +46,13 @@ partial void ProcessCreateEvaluationPipelineResponseContent(
/// Creates a new evaluation pipeline (report) with optional evaluation columns and custom scoring.
///
///
+ /// 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 CreateEvaluationPipelineAsync(
global::PromptLayer.CreateEvaluationPipelineRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -66,22 +69,43 @@ partial void ProcessCreateEvaluationPipelineResponseContent(
securityRequirements: s_CreateEvaluationPipelineSecurityRequirements,
operationName: "CreateEvaluationPipelineAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/reports",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/reports",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -91,265 +115,424 @@ partial void ProcessCreateEvaluationPipelineResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateEvaluationPipelineRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateEvaluationPipelineResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request - Invalid parameters, draft dataset version, or no datasets in group
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.CreateEvaluationPipelineResponse2? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.CreateEvaluationPipelineResponse2.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_400 = global::PromptLayer.CreateEvaluationPipelineResponse2.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateEvaluationPipelineRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Forbidden - Access to dataset group not allowed or missing permissions
- if ((int)__response.StatusCode == 403)
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.CreateEvaluationPipelineResponse3? __value_403 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateEvaluationPipeline",
+ methodName: "CreateEvaluationPipelineAsync",
+ pathTemplate: "\"/reports\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.CreateEvaluationPipelineResponse3.FromJson(__content_403, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateEvaluationPipeline",
+ methodName: "CreateEvaluationPipelineAsync",
+ pathTemplate: "\"/reports\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_403 = global::PromptLayer.CreateEvaluationPipelineResponse3.FromJson(__content_403, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_403 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found - Dataset group or version not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.CreateEvaluationPipelineResponse4? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.CreateEvaluationPipelineResponse4.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateEvaluationPipeline",
+ methodName: "CreateEvaluationPipelineAsync",
+ pathTemplate: "\"/reports\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.CreateEvaluationPipelineResponse4.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateEvaluationPipelineResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateEvaluationPipeline",
+ methodName: "CreateEvaluationPipelineAsync",
+ pathTemplate: "\"/reports\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_401 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateEvaluationPipeline",
+ methodName: "CreateEvaluationPipelineAsync",
+ pathTemplate: "\"/reports\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request - Invalid parameters, draft dataset version, or no datasets in group
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.CreateEvaluationPipelineResponse2? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.CreateEvaluationPipelineResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.CreateEvaluationPipelineResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Forbidden - Access to dataset group not allowed or missing permissions
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.CreateEvaluationPipelineResponse3? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.CreateEvaluationPipelineResponse3.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateEvaluationPipelineResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_403 = global::PromptLayer.CreateEvaluationPipelineResponse3.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found - Dataset group or version not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.CreateEvaluationPipelineResponse4? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.CreateEvaluationPipelineResponse4.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreateEvaluationPipelineResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.CreateEvaluationPipelineResponse4.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.CreateEvaluationPipelineResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessCreateEvaluationPipelineResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateEvaluationPipelineResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateEvaluationPipelineResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create Evaluation Pipeline
@@ -373,6 +556,7 @@ partial void ProcessCreateEvaluationPipelineResponseContent(
///
/// Optional custom scoring logic configuration.
///
+ /// 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 CreateEvaluationPipelineAsync(
@@ -382,6 +566,7 @@ partial void ProcessCreateEvaluationPipelineResponseContent(
int? datasetVersionNumber = default,
global::System.Collections.Generic.IList? columns = default,
global::PromptLayer.CreateEvaluationPipelineRequestScoreConfiguration? scoreConfiguration = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreateEvaluationPipelineRequest
@@ -396,6 +581,7 @@ partial void ProcessCreateEvaluationPipelineResponseContent(
return await CreateEvaluationPipelineAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.DeleteReportsByName.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.DeleteReportsByName.g.cs
index 33c9f7f..c1e9fcd 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.DeleteReportsByName.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.DeleteReportsByName.g.cs
@@ -14,6 +14,7 @@ public partial class ReportsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,10 +45,12 @@ partial void ProcessDeleteReportsByNameResponseContent(
/// Delete Reports by Name
///
///
+ /// 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 DeleteReportsByNameAsync(
string reportName,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessDeleteReportsByNameResponseContent(
securityRequirements: s_DeleteReportsByNameSecurityRequirements,
operationName: "DeleteReportsByNameAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/reports/name/{reportName}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Delete,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/reports/name/{reportName}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Delete,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,178 +111,337 @@ partial void ProcessDeleteReportsByNameResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareDeleteReportsByNameRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- reportName: reportName);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareDeleteReportsByNameRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ reportName: reportName);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessDeleteReportsByNameResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteReportsByName",
+ methodName: "DeleteReportsByNameAsync",
+ pathTemplate: "$\"/reports/name/{reportName}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteReportsByName",
+ methodName: "DeleteReportsByNameAsync",
+ pathTemplate: "$\"/reports/name/{reportName}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteReportsByName",
+ methodName: "DeleteReportsByNameAsync",
+ pathTemplate: "$\"/reports/name/{reportName}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessDeleteReportsByNameResponseContent(
+ response: __response);
+ ProcessDeleteReportsByNameResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.DeleteReportsByNameResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteReportsByName",
+ methodName: "DeleteReportsByNameAsync",
+ pathTemplate: "$\"/reports/name/{reportName}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "DeleteReportsByName",
+ methodName: "DeleteReportsByNameAsync",
+ pathTemplate: "$\"/reports/name/{reportName}\"",
+ httpMethod: "DELETE",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- return
- await global::PromptLayer.DeleteReportsByNameResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessDeleteReportsByNameResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.DeleteReportsByNameResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.DeleteReportsByNameResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.ReportsClient.GetReport.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.GetReport.g.cs
index 43be723..3b836ba 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.GetReport.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.GetReport.g.cs
@@ -14,6 +14,7 @@ public partial class ReportsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,10 +45,12 @@ partial void ProcessGetReportResponseContent(
/// Get Evaluation
///
///
+ /// 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 GetReportAsync(
int reportId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessGetReportResponseContent(
securityRequirements: s_GetReportSecurityRequirements,
operationName: "GetReportAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/reports/{reportId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/reports/{reportId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,178 +111,337 @@ partial void ProcessGetReportResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetReportRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- reportId: reportId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetReportRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ reportId: reportId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetReportResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReport",
+ methodName: "GetReportAsync",
+ pathTemplate: "$\"/reports/{reportId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReport",
+ methodName: "GetReportAsync",
+ pathTemplate: "$\"/reports/{reportId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReport",
+ methodName: "GetReportAsync",
+ pathTemplate: "$\"/reports/{reportId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetReportResponseContent(
+ response: __response);
+ ProcessGetReportResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetReportResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReport",
+ methodName: "GetReportAsync",
+ pathTemplate: "$\"/reports/{reportId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReport",
+ methodName: "GetReportAsync",
+ pathTemplate: "$\"/reports/{reportId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- return
- await global::PromptLayer.GetReportResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetReportResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetReportResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetReportResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.ReportsClient.GetReportScore.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.GetReportScore.g.cs
index 7175923..4eb1a1c 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.GetReportScore.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.GetReportScore.g.cs
@@ -14,6 +14,7 @@ public partial class ReportsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,10 +45,12 @@ partial void ProcessGetReportScoreResponseContent(
/// Get Evaluation Score
///
///
+ /// 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 GetReportScoreAsync(
int reportId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessGetReportScoreResponseContent(
securityRequirements: s_GetReportScoreSecurityRequirements,
operationName: "GetReportScoreAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/reports/{reportId}/score",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/reports/{reportId}/score",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,244 +111,403 @@ partial void ProcessGetReportScoreResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetReportScoreRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- reportId: reportId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetReportScoreRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ reportId: reportId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetReportScoreResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReportScore",
+ methodName: "GetReportScoreAsync",
+ pathTemplate: "$\"/reports/{reportId}/score\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReportScore",
+ methodName: "GetReportScoreAsync",
+ pathTemplate: "$\"/reports/{reportId}/score\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReportScore",
+ methodName: "GetReportScoreAsync",
+ pathTemplate: "$\"/reports/{reportId}/score\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- try
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetReportScoreResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReportScore",
+ methodName: "GetReportScoreAsync",
+ pathTemplate: "$\"/reports/{reportId}/score\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetReportScore",
+ methodName: "GetReportScoreAsync",
+ pathTemplate: "$\"/reports/{reportId}/score\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ //
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetReportScoreResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
- return
- global::PromptLayer.GetReportScoreResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
- return
- await global::PromptLayer.GetReportScoreResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetReportScoreResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetReportScoreResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetReportScoreResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.ReportsClient.RunReport.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.RunReport.g.cs
index e81bf14..66fe9ca 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.RunReport.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.RunReport.g.cs
@@ -14,6 +14,7 @@ public partial class ReportsClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -47,12 +48,14 @@ partial void ProcessRunReportResponseContent(
///
///
///
+ /// 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 RunReportAsync(
int reportId,
global::PromptLayer.RunReportRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -70,22 +73,43 @@ partial void ProcessRunReportResponseContent(
securityRequirements: s_RunReportSecurityRequirements,
operationName: "RunReportAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/reports/{reportId}/run",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/reports/{reportId}/run",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -95,271 +119,430 @@ partial void ProcessRunReportResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareRunReportRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- reportId: reportId,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareRunReportRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ reportId: reportId,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessRunReportResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request - Invalid data or report generation error
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.RunReportResponse2? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunReport",
+ methodName: "RunReportAsync",
+ pathTemplate: "$\"/reports/{reportId}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.RunReportResponse2.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunReport",
+ methodName: "RunReportAsync",
+ pathTemplate: "$\"/reports/{reportId}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.RunReportResponse2.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized - No requests found for the given criteria
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.RunReportResponse3? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.RunReportResponse3.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunReport",
+ methodName: "RunReportAsync",
+ pathTemplate: "$\"/reports/{reportId}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.RunReportResponse3.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Forbidden - Can only run evaluation pipeline reports or dataset refresh not allowed
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.RunReportResponse4? __value_403 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.RunReportResponse4.FromJson(__content_403, JsonSerializerContext);
- }
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.RunReportResponse4.FromJson(__content_403, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessRunReportResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunReport",
+ methodName: "RunReportAsync",
+ pathTemplate: "$\"/reports/{reportId}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_403 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunReport",
+ methodName: "RunReportAsync",
+ pathTemplate: "$\"/reports/{reportId}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request - Invalid data or report generation error
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.RunReportResponse2? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.RunReportResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found - Report or dataset not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.RunReportResponse5? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.RunReportResponse5.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.RunReportResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- __value_404 = global::PromptLayer.RunReportResponse5.FromJson(__content_404, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized - No requests found for the given criteria
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.RunReportResponse3? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.RunReportResponse3.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::PromptLayer.RunReportResponse3.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Forbidden - Can only run evaluation pipeline reports or dataset refresh not allowed
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.RunReportResponse4? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.RunReportResponse4.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessRunReportResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_403 = global::PromptLayer.RunReportResponse4.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found - Report or dataset not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.RunReportResponse5? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.RunReportResponse5.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.RunReportResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.RunReportResponse5.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.RunReportResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessRunReportResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.RunReportResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.RunReportResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Run Full Evaluation
@@ -374,6 +557,7 @@ partial void ProcessRunReportResponseContent(
///
/// Whether to refresh the dataset before running the report. Only applicable for dynamic datasets.
///
+ /// 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 RunReportAsync(
@@ -381,6 +565,7 @@ partial void ProcessRunReportResponseContent(
string name,
int? datasetId = default,
bool? refreshDataset = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.RunReportRequest
@@ -393,6 +578,7 @@ partial void ProcessRunReportResponseContent(
return await RunReportAsync(
reportId: reportId,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.g.cs
index 24b71cf..192b649 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ReportsClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class ReportsClient : global::PromptLayer.IReportsClient,
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public ReportsClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the ReportsClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public ReportsClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.RequestClient.LogRequest.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.RequestClient.LogRequest.g.cs
index 3354f75..7ded07f 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.RequestClient.LogRequest.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.RequestClient.LogRequest.g.cs
@@ -14,6 +14,7 @@ public partial class RequestClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessLogRequestResponseContent(
/// Log Request
///
///
+ /// 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 LogRequestAsync(
global::PromptLayer.LogRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessLogRequestResponseContent(
securityRequirements: s_LogRequestSecurityRequirements,
operationName: "LogRequestAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/log-request",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/log-request",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,194 +114,353 @@ partial void ProcessLogRequestResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareLogRequestRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareLogRequestRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessLogRequestResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.AnyOf? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "LogRequest",
+ methodName: "LogRequestAsync",
+ pathTemplate: "\"/log-request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.AnyOf.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "LogRequest",
+ methodName: "LogRequestAsync",
+ pathTemplate: "\"/log-request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.AnyOf.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException?>(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.BadRequestError? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.BadRequestError.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "LogRequest",
+ methodName: "LogRequestAsync",
+ pathTemplate: "\"/log-request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.BadRequestError.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessLogRequestResponseContent(
+ response: __response);
+ ProcessLogRequestResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.LogRequestResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "LogRequest",
+ methodName: "LogRequestAsync",
+ pathTemplate: "\"/log-request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "LogRequest",
+ methodName: "LogRequestAsync",
+ pathTemplate: "\"/log-request\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.AnyOf? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.AnyOf.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.LogRequestResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.AnyOf.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException?>(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.BadRequestError? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.BadRequestError.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_404 = global::PromptLayer.BadRequestError.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessLogRequestResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.LogRequestResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.LogRequestResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Log Request
@@ -355,6 +538,7 @@ partial void ProcessLogRequestResponseContent(
/// Detailed error message describing what went wrong. Maximum 1024 characters.
/// Default Value: openapi-json-null-sentinel-value-2BF93600-0FE4-4250-987A-E5DDB203E464
///
+ /// 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 LogRequestAsync(
@@ -380,6 +564,7 @@ partial void ProcessLogRequestResponseContent(
global::PromptLayer.LogRequestStatus? status = default,
global::PromptLayer.LogRequestErrorType2? errorType = default,
string? errorMessage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.LogRequest
@@ -410,6 +595,7 @@ partial void ProcessLogRequestResponseContent(
return await LogRequestAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.RequestClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.RequestClient.g.cs
index 86d6f9e..af1b56a 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.RequestClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.RequestClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class RequestClient : global::PromptLayer.IRequestClient,
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public RequestClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the RequestClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public RequestClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.RestClient.PatchPromptTemplateVersion.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.RestClient.PatchPromptTemplateVersion.g.cs
index 45de306..23c87bd 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.RestClient.PatchPromptTemplateVersion.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.RestClient.PatchPromptTemplateVersion.g.cs
@@ -14,6 +14,7 @@ public partial class RestClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -50,12 +51,14 @@ partial void ProcessPatchPromptTemplateVersionResponseContent(
/// The prompt template name or ID.
///
///
+ /// 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 PatchPromptTemplateVersionAsync(
string identifier,
global::PromptLayer.PatchPromptTemplateVersion request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -73,22 +76,43 @@ partial void ProcessPatchPromptTemplateVersionResponseContent(
securityRequirements: s_PatchPromptTemplateVersionSecurityRequirements,
operationName: "PatchPromptTemplateVersionAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/rest/prompt-templates/{identifier}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: new global::System.Net.Http.HttpMethod("PATCH"),
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/rest/prompt-templates/{identifier}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: new global::System.Net.Http.HttpMethod("PATCH"),
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -98,233 +122,392 @@ partial void ProcessPatchPromptTemplateVersionResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PreparePatchPromptTemplateVersionRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- identifier: identifier,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PreparePatchPromptTemplateVersionRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ identifier: identifier,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessPatchPromptTemplateVersionResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Validation error (e.g. conflicting fields, out-of-bounds index, wrong template type)
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchPromptTemplateVersion",
+ methodName: "PatchPromptTemplateVersionAsync",
+ pathTemplate: "$\"/rest/prompt-templates/{identifier}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchPromptTemplateVersion",
+ methodName: "PatchPromptTemplateVersionAsync",
+ pathTemplate: "$\"/rest/prompt-templates/{identifier}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized - missing or invalid API key
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchPromptTemplateVersion",
+ methodName: "PatchPromptTemplateVersionAsync",
+ pathTemplate: "$\"/rest/prompt-templates/{identifier}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Prompt template, version, or label not found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessPatchPromptTemplateVersionResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchPromptTemplateVersion",
+ methodName: "PatchPromptTemplateVersionAsync",
+ pathTemplate: "$\"/rest/prompt-templates/{identifier}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchPromptTemplateVersion",
+ methodName: "PatchPromptTemplateVersionAsync",
+ pathTemplate: "$\"/rest/prompt-templates/{identifier}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Validation error (e.g. conflicting fields, out-of-bounds index, wrong template type)
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized - missing or invalid API key
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessPatchPromptTemplateVersionResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Prompt template, version, or label not found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreatePromptTemplateResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.CreatePromptTemplateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessPatchPromptTemplateVersionResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreatePromptTemplateResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreatePromptTemplateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Patch Prompt Template Version
@@ -369,6 +552,7 @@ partial void ProcessPatchPromptTemplateVersionResponseContent(
///
/// Release labels to create or move to the newly created version (e.g. ['staging', 'production']).
///
+ /// 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 PatchPromptTemplateVersionAsync(
@@ -385,6 +569,7 @@ partial void ProcessPatchPromptTemplateVersionResponseContent(
object? responseFormat = default,
string? commitMessage = default,
global::System.Collections.Generic.IList? releaseLabels = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.PatchPromptTemplateVersion
@@ -406,6 +591,7 @@ partial void ProcessPatchPromptTemplateVersionResponseContent(
return await PatchPromptTemplateVersionAsync(
identifier: identifier,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.RestClient.PublishPromptTemplateRestPromptTemplatesPost.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.RestClient.PublishPromptTemplateRestPromptTemplatesPost.g.cs
index bcc0a8e..40eec79 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.RestClient.PublishPromptTemplateRestPromptTemplatesPost.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.RestClient.PublishPromptTemplateRestPromptTemplatesPost.g.cs
@@ -14,6 +14,7 @@ public partial class RestClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessPublishPromptTemplateRestPromptTemplatesPostResponseContent(
/// Publish Prompt Template
///
///
+ /// 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 PublishPromptTemplateRestPromptTemplatesPostAsync(
global::PromptLayer.CreatePromptTemplate request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessPublishPromptTemplateRestPromptTemplatesPostResponseContent(
securityRequirements: s_PublishPromptTemplateRestPromptTemplatesPostSecurityRequirements,
operationName: "PublishPromptTemplateRestPromptTemplatesPostAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/rest/prompt-templates",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/rest/prompt-templates",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,156 +114,315 @@ partial void ProcessPublishPromptTemplateRestPromptTemplatesPostResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PreparePublishPromptTemplateRestPromptTemplatesPostRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PreparePublishPromptTemplateRestPromptTemplatesPostRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessPublishPromptTemplateRestPromptTemplatesPostResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Validation Error
- if ((int)__response.StatusCode == 422)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- global::PromptLayer.HTTPValidationError? __value_422 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PublishPromptTemplateRestPromptTemplatesPost",
+ methodName: "PublishPromptTemplateRestPromptTemplatesPostAsync",
+ pathTemplate: "\"/rest/prompt-templates\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PublishPromptTemplateRestPromptTemplatesPost",
+ methodName: "PublishPromptTemplateRestPromptTemplatesPostAsync",
+ pathTemplate: "\"/rest/prompt-templates\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
+ }
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PublishPromptTemplateRestPromptTemplatesPost",
+ methodName: "PublishPromptTemplateRestPromptTemplatesPostAsync",
+ pathTemplate: "\"/rest/prompt-templates\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_422,
- ResponseObject = __value_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessPublishPromptTemplateRestPromptTemplatesPostResponseContent(
+ response: __response);
+ ProcessPublishPromptTemplateRestPromptTemplatesPostResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.CreatePromptTemplateResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PublishPromptTemplateRestPromptTemplatesPost",
+ methodName: "PublishPromptTemplateRestPromptTemplatesPostAsync",
+ pathTemplate: "\"/rest/prompt-templates\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PublishPromptTemplateRestPromptTemplatesPost",
+ methodName: "PublishPromptTemplateRestPromptTemplatesPostAsync",
+ pathTemplate: "\"/rest/prompt-templates\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Validation Error
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ global::PromptLayer.HTTPValidationError? __value_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.CreatePromptTemplateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_422 = global::PromptLayer.HTTPValidationError.FromJson(__content_422, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseObject = __value_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessPublishPromptTemplateRestPromptTemplatesPostResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreatePromptTemplateResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreatePromptTemplateResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Publish Prompt Template
@@ -247,12 +430,14 @@ partial void ProcessPublishPromptTemplateRestPromptTemplatesPostResponseContent(
///
///
///
+ /// 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 PublishPromptTemplateRestPromptTemplatesPostAsync(
global::PromptLayer.BasePromptTemplate promptTemplate,
global::PromptLayer.PromptVersion promptVersion,
global::System.Collections.Generic.IList? releaseLabels = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreatePromptTemplate
@@ -264,6 +449,7 @@ partial void ProcessPublishPromptTemplateRestPromptTemplatesPostResponseContent(
return await PublishPromptTemplateRestPromptTemplatesPostAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.RestClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.RestClient.g.cs
index 5630618..d4fcbf3 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.RestClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.RestClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class RestClient : global::PromptLayer.IRestClient, global
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public RestClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the RestClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public RestClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ScoreClient.TrackScore.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ScoreClient.TrackScore.g.cs
index dee99c3..aa99efa 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ScoreClient.TrackScore.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ScoreClient.TrackScore.g.cs
@@ -14,6 +14,7 @@ public partial class ScoreClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessTrackScoreResponseContent(
/// Track Score
///
///
+ /// 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 TrackScoreAsync(
global::PromptLayer.TrackScoreRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessTrackScoreResponseContent(
securityRequirements: s_TrackScoreSecurityRequirements,
operationName: "TrackScoreAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/rest/track-score",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/rest/track-score",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,184 +114,343 @@ partial void ProcessTrackScoreResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareTrackScoreRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareTrackScoreRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessTrackScoreResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackScore",
+ methodName: "TrackScoreAsync",
+ pathTemplate: "\"/rest/track-score\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackScore",
+ methodName: "TrackScoreAsync",
+ pathTemplate: "\"/rest/track-score\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackScore",
+ methodName: "TrackScoreAsync",
+ pathTemplate: "\"/rest/track-score\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
-
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessTrackScoreResponseContent(
+ response: __response);
+ ProcessTrackScoreResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.TrackScoreResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackScore",
+ methodName: "TrackScoreAsync",
+ pathTemplate: "\"/rest/track-score\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "TrackScore",
+ methodName: "TrackScoreAsync",
+ pathTemplate: "\"/rest/track-score\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- return
- await global::PromptLayer.TrackScoreResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessTrackScoreResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.TrackScoreResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.TrackScoreResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Track Score
@@ -281,12 +464,14 @@ partial void ProcessTrackScoreResponseContent(
///
/// A name for this request score. If not provided, the score will be tracked as `default`.
///
+ /// 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 TrackScoreAsync(
int requestId,
int score,
string? name = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.TrackScoreRequest
@@ -298,6 +483,7 @@ partial void ProcessTrackScoreResponseContent(
return await TrackScoreAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.ScoreClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.ScoreClient.g.cs
index 06c0ace..2476b03 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.ScoreClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.ScoreClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class ScoreClient : global::PromptLayer.IScoreClient, glob
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public ScoreClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the ScoreClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public ScoreClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.Security.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.Security.g.cs
index 147f4d0..1de81db 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.Security.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.Security.g.cs
@@ -6,6 +6,8 @@ internal sealed class EndPointAuthorizationRequirement
{
internal string Type { get; set; } = string.Empty;
+ internal string SchemeId { get; set; } = string.Empty;
+
internal string Location { get; set; } = string.Empty;
internal string Name { get; set; } = string.Empty;
@@ -97,7 +99,18 @@ private static bool Matches(
return requiredAuthorization.Type switch
{
- "OAuth2" => true,
+ "OAuth2" => string.Equals(
+ availableAuthorization.SchemeId,
+ requiredAuthorization.SchemeId,
+ global::System.StringComparison.Ordinal),
+ "OpenIdConnect" => string.Equals(
+ availableAuthorization.SchemeId,
+ requiredAuthorization.SchemeId,
+ global::System.StringComparison.Ordinal),
+ "MutualTLS" => string.Equals(
+ availableAuthorization.SchemeId,
+ requiredAuthorization.SchemeId,
+ global::System.StringComparison.Ordinal),
"Http" => string.Equals(
availableAuthorization.Name,
requiredAuthorization.Name,
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.SpansClient.CreateSpansBulk.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.SpansClient.CreateSpansBulk.g.cs
index 047a3c1..2f191b2 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.SpansClient.CreateSpansBulk.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.SpansClient.CreateSpansBulk.g.cs
@@ -14,6 +14,7 @@ public partial class SpansClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessCreateSpansBulkResponseContent(
/// Create Spans Bulk
///
///
+ /// 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 CreateSpansBulkAsync(
global::PromptLayer.CreateSpansBulk request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateSpansBulkResponseContent(
securityRequirements: s_CreateSpansBulkSecurityRequirements,
operationName: "CreateSpansBulkAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/spans-bulk",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/spans-bulk",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,241 +114,402 @@ partial void ProcessCreateSpansBulkResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateSpansBulkRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateSpansBulkRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateSpansBulkResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ValidationError? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSpansBulk",
+ methodName: "CreateSpansBulkAsync",
+ pathTemplate: "\"/spans-bulk\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ValidationError.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSpansBulk",
+ methodName: "CreateSpansBulkAsync",
+ pathTemplate: "\"/spans-bulk\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ValidationError.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Forbidden
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSpansBulk",
+ methodName: "CreateSpansBulkAsync",
+ pathTemplate: "\"/spans-bulk\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal Server Error
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::PromptLayer.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateSpansBulkResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSpansBulk",
+ methodName: "CreateSpansBulkAsync",
+ pathTemplate: "\"/spans-bulk\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_500 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateSpansBulk",
+ methodName: "CreateSpansBulkAsync",
+ pathTemplate: "\"/spans-bulk\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ValidationError? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ValidationError.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.ValidationError.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Forbidden
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateSpansBulkResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal Server Error
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::PromptLayer.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreateSpansBulkResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::PromptLayer.CreateSpansBulkResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessCreateSpansBulkResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateSpansBulkResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateSpansBulkResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create Spans Bulk
///
///
+ /// 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 CreateSpansBulkAsync(
global::System.Collections.Generic.IList spans,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreateSpansBulk
@@ -334,6 +519,7 @@ partial void ProcessCreateSpansBulkResponseContent(
return await CreateSpansBulkAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.SpansClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.SpansClient.g.cs
index 7488c68..3930aff 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.SpansClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.SpansClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class SpansClient : global::PromptLayer.ISpansClient, glob
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public SpansClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the SpansClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public SpansClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetRequest.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetRequest.g.cs
index e5175cc..cee179c 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetRequest.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetRequest.g.cs
@@ -14,6 +14,7 @@ public partial class TrackingClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,10 +45,12 @@ partial void ProcessGetRequestResponseContent(
/// Get Request
///
///
+ /// 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 GetRequestAsync(
int requestId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessGetRequestResponseContent(
securityRequirements: s_GetRequestSecurityRequirements,
operationName: "GetRequestAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/api/public/v2/requests/{requestId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/api/public/v2/requests/{requestId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,264 +111,423 @@ partial void ProcessGetRequestResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetRequestRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- requestId: requestId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetRequestRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ requestId: requestId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetRequestResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Authentication failed.
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ErrorResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequest",
+ methodName: "GetRequestAsync",
+ pathTemplate: "$\"/api/public/v2/requests/{requestId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequest",
+ methodName: "GetRequestAsync",
+ pathTemplate: "$\"/api/public/v2/requests/{requestId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Invalid workspace.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequest",
+ methodName: "GetRequestAsync",
+ pathTemplate: "$\"/api/public/v2/requests/{requestId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Request not found.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetRequestResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequest",
+ methodName: "GetRequestAsync",
+ pathTemplate: "$\"/api/public/v2/requests/{requestId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequest",
+ methodName: "GetRequestAsync",
+ pathTemplate: "$\"/api/public/v2/requests/{requestId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Authentication failed.
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal server error.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::PromptLayer.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Invalid workspace.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Request not found.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetRequestResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal server error.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::PromptLayer.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.GetRequestResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::PromptLayer.GetRequestResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetRequestResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetRequestResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetRequestResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.TrackingClient.GetRequestSearchSuggestions.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetRequestSearchSuggestions.g.cs
index 42587a9..0391274 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetRequestSearchSuggestions.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetRequestSearchSuggestions.g.cs
@@ -14,6 +14,7 @@ public partial class TrackingClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -56,6 +57,7 @@ partial void ProcessGetRequestSearchSuggestionsResponseContent(
///
///
///
+ /// 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 GetRequestSearchSuggestionsAsync(
@@ -64,6 +66,7 @@ partial void ProcessGetRequestSearchSuggestionsResponseContent(
string? metadataKey = default,
int? promptId = default,
string? filterGroup = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -82,29 +85,50 @@ partial void ProcessGetRequestSearchSuggestionsResponseContent(
securityRequirements: s_GetRequestSearchSuggestionsSecurityRequirements,
operationName: "GetRequestSearchSuggestionsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/requests/suggestions",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddRequiredParameter("field", field.ToValueString())
- .AddOptionalParameter("prefix", prefix)
- .AddOptionalParameter("metadata_key", metadataKey)
- .AddOptionalParameter("prompt_id", promptId?.ToString())
- .AddOptionalParameter("filter_group", filterGroup)
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/requests/suggestions",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddRequiredParameter("field", field.ToValueString())
+ .AddOptionalParameter("prefix", prefix)
+ .AddOptionalParameter("metadata_key", metadataKey)
+ .AddOptionalParameter("prompt_id", promptId?.ToString())
+ .AddOptionalParameter("filter_group", filterGroup)
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -114,225 +138,384 @@ partial void ProcessGetRequestSearchSuggestionsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetRequestSearchSuggestionsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- field: field,
- prefix: prefix,
- metadataKey: metadataKey,
- promptId: promptId,
- filterGroup: filterGroup);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetRequestSearchSuggestionsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ field: field,
+ prefix: prefix,
+ metadataKey: metadataKey,
+ promptId: promptId,
+ filterGroup: filterGroup);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetRequestSearchSuggestionsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Authentication failed.
- if ((int)__response.StatusCode == 401)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ErrorResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequestSearchSuggestions",
+ methodName: "GetRequestSearchSuggestionsAsync",
+ pathTemplate: "\"/api/public/v2/requests/suggestions\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequestSearchSuggestions",
+ methodName: "GetRequestSearchSuggestionsAsync",
+ pathTemplate: "\"/api/public/v2/requests/suggestions\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Invalid workspace.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequestSearchSuggestions",
+ methodName: "GetRequestSearchSuggestionsAsync",
+ pathTemplate: "\"/api/public/v2/requests/suggestions\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- try
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetRequestSearchSuggestionsResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequestSearchSuggestions",
+ methodName: "GetRequestSearchSuggestionsAsync",
+ pathTemplate: "\"/api/public/v2/requests/suggestions\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_429 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetRequestSearchSuggestions",
+ methodName: "GetRequestSearchSuggestionsAsync",
+ pathTemplate: "\"/api/public/v2/requests/suggestions\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Authentication failed.
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Invalid workspace.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetRequestSearchSuggestionsResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
- return
- global::PromptLayer.GetRequestSearchSuggestionsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
- return
- await global::PromptLayer.GetRequestSearchSuggestionsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ 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);
+ ProcessGetRequestSearchSuggestionsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetRequestSearchSuggestionsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetRequestSearchSuggestionsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.TrackingClient.GetTrace.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetTrace.g.cs
index bbee71c..f94d767 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetTrace.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.GetTrace.g.cs
@@ -14,6 +14,7 @@ public partial class TrackingClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,10 +45,12 @@ partial void ProcessGetTraceResponseContent(
/// Get Trace
///
///
+ /// 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 GetTraceAsync(
string traceId,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessGetTraceResponseContent(
securityRequirements: s_GetTraceSecurityRequirements,
operationName: "GetTraceAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/api/public/v2/traces/{traceId}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/api/public/v2/traces/{traceId}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,264 +111,423 @@ partial void ProcessGetTraceResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetTraceRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- traceId: traceId);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetTraceRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ traceId: traceId);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetTraceResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Authentication failed.
- if ((int)__response.StatusCode == 401)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ErrorResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetTrace",
+ methodName: "GetTraceAsync",
+ pathTemplate: "$\"/api/public/v2/traces/{traceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetTrace",
+ methodName: "GetTraceAsync",
+ pathTemplate: "$\"/api/public/v2/traces/{traceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Invalid workspace.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetTrace",
+ methodName: "GetTraceAsync",
+ pathTemplate: "$\"/api/public/v2/traces/{traceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Trace not found.
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
+ using (__response)
{
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetTraceResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetTrace",
+ methodName: "GetTraceAsync",
+ pathTemplate: "$\"/api/public/v2/traces/{traceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetTrace",
+ methodName: "GetTraceAsync",
+ pathTemplate: "$\"/api/public/v2/traces/{traceId}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Authentication failed.
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Internal server error.
- if ((int)__response.StatusCode == 500)
- {
- string? __content_500 = null;
- global::System.Exception? __exception_500 = null;
- global::PromptLayer.ErrorResponse? __value_500 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- else
- {
- __content_500 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_500 = __ex;
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Invalid workspace.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_500,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_500,
- ResponseObject = __value_500,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Trace not found.
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetTraceResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Internal server error.
+ if ((int)__response.StatusCode == 500)
+ {
+ string? __content_500 = null;
+ global::System.Exception? __exception_500 = null;
+ global::PromptLayer.ErrorResponse? __value_500 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ else
+ {
+ __content_500 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.GetTraceResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_500 = global::PromptLayer.ErrorResponse.FromJson(__content_500, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_500 = __ex;
+ }
- return
- await global::PromptLayer.GetTraceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_500 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_500,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_500,
+ ResponseObject = __value_500,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetTraceResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetTraceResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetTraceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.TrackingClient.SearchRequestLogs.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.SearchRequestLogs.g.cs
index 4138b3a..443f0cd 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.SearchRequestLogs.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.SearchRequestLogs.g.cs
@@ -14,6 +14,7 @@ public partial class TrackingClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessSearchRequestLogsResponseContent(
/// Search Request Logs
///
///
+ /// 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 SearchRequestLogsAsync(
global::PromptLayer.SearchRequestLogsRequest request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessSearchRequestLogsResponseContent(
securityRequirements: s_SearchRequestLogsSecurityRequirements,
operationName: "SearchRequestLogsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/api/public/v2/requests/search",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/api/public/v2/requests/search",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,265 +114,424 @@ partial void ProcessSearchRequestLogsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareSearchRequestLogsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
-
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
-
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessSearchRequestLogsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Invalid filter or search parameters.
- if ((int)__response.StatusCode == 400)
- {
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- else
- {
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareSearchRequestLogsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ return __httpRequest;
}
- // Authentication failed.
- if ((int)__response.StatusCode == 401)
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ErrorResponse? __value_401 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SearchRequestLogs",
+ methodName: "SearchRequestLogsAsync",
+ pathTemplate: "\"/api/public/v2/requests/search\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SearchRequestLogs",
+ methodName: "SearchRequestLogsAsync",
+ pathTemplate: "\"/api/public/v2/requests/search\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Invalid workspace.
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- global::PromptLayer.ErrorResponse? __value_403 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SearchRequestLogs",
+ methodName: "SearchRequestLogsAsync",
+ pathTemplate: "\"/api/public/v2/requests/search\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_403,
- ResponseObject = __value_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 429)
- {
- string? __content_429 = null;
- global::System.Exception? __exception_429 = null;
- try
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessSearchRequestLogsResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- if (ReadResponseAsString)
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- __content_429 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SearchRequestLogs",
+ methodName: "SearchRequestLogsAsync",
+ pathTemplate: "\"/api/public/v2/requests/search\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_429 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "SearchRequestLogs",
+ methodName: "SearchRequestLogsAsync",
+ pathTemplate: "\"/api/public/v2/requests/search\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Invalid filter or search parameters.
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_429,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_429,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Authentication failed.
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessSearchRequestLogsResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Invalid workspace.
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ global::PromptLayer.ErrorResponse? __value_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.SearchRequestLogsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_403 = global::PromptLayer.ErrorResponse.FromJson(__content_403, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- return
- await global::PromptLayer.SearchRequestLogsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseObject = __value_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 429)
+ {
+ string? __content_429 = null;
+ global::System.Exception? __exception_429 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_429 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_429 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_429 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_429,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_429,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessSearchRequestLogsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.SearchRequestLogsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.SearchRequestLogsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Search Request Logs
@@ -374,6 +557,7 @@ partial void ProcessSearchRequestLogsResponseContent(
///
/// When true, includes the prompt template name in each result item. Defaults to 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 SearchRequestLogsAsync(
@@ -384,6 +568,7 @@ partial void ProcessSearchRequestLogsResponseContent(
global::PromptLayer.SearchRequestLogsRequestSortBy? sortBy = default,
global::PromptLayer.SearchRequestLogsRequestSortOrder? sortOrder = default,
bool? includePromptName = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.SearchRequestLogsRequest
@@ -399,6 +584,7 @@ partial void ProcessSearchRequestLogsResponseContent(
return await SearchRequestLogsAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.g.cs
index d376953..ad2513a 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.TrackingClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class TrackingClient : global::PromptLayer.ITrackingClient
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public TrackingClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the TrackingClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public TrackingClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.CreateWorkflow.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.CreateWorkflow.g.cs
index 3e66a84..67cce8b 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.CreateWorkflow.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.CreateWorkflow.g.cs
@@ -14,6 +14,7 @@ public partial class WorkflowClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,11 +45,13 @@ partial void ProcessCreateWorkflowResponseContent(
/// Create Workflow
///
///
+ /// 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 CreateWorkflowAsync(
global::PromptLayer.CreateWorkflow request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -65,22 +68,43 @@ partial void ProcessCreateWorkflowResponseContent(
securityRequirements: s_CreateWorkflowSecurityRequirements,
operationName: "CreateWorkflowAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/rest/workflows",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/rest/workflows",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -90,232 +114,391 @@ partial void ProcessCreateWorkflowResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareCreateWorkflowRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareCreateWorkflowRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessCreateWorkflowResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWorkflow",
+ methodName: "CreateWorkflowAsync",
+ pathTemplate: "\"/rest/workflows\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWorkflow",
+ methodName: "CreateWorkflowAsync",
+ pathTemplate: "\"/rest/workflows\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWorkflow",
+ methodName: "CreateWorkflowAsync",
+ pathTemplate: "\"/rest/workflows\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessCreateWorkflowResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWorkflow",
+ methodName: "CreateWorkflowAsync",
+ pathTemplate: "\"/rest/workflows\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "CreateWorkflow",
+ methodName: "CreateWorkflowAsync",
+ pathTemplate: "\"/rest/workflows\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessCreateWorkflowResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreateWorkflowResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.CreateWorkflowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessCreateWorkflowResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateWorkflowResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateWorkflowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Create Workflow
@@ -347,6 +530,7 @@ partial void ProcessCreateWorkflowResponseContent(
///
/// Labels to attach to this version.
///
+ /// 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 CreateWorkflowAsync(
@@ -359,6 +543,7 @@ partial void ProcessCreateWorkflowResponseContent(
global::System.Collections.Generic.Dictionary? requiredInputVariables = default,
global::System.Collections.Generic.IList? edges = default,
global::System.Collections.Generic.IList? releaseLabels = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.CreateWorkflow
@@ -376,6 +561,7 @@ partial void ProcessCreateWorkflowResponseContent(
return await CreateWorkflowAsync(
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflow.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflow.g.cs
index 5217356..b67f73c 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflow.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflow.g.cs
@@ -14,6 +14,7 @@ public partial class WorkflowClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -50,12 +51,14 @@ partial void ProcessGetWorkflowResponseContent(
///
///
///
+ /// 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 GetWorkflowAsync(
string workflowIdOrName,
int? version = default,
string? label = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -72,26 +75,47 @@ partial void ProcessGetWorkflowResponseContent(
securityRequirements: s_GetWorkflowSecurityRequirements,
operationName: "GetWorkflowAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/workflows/{workflowIdOrName}",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("version", version?.ToString())
- .AddOptionalParameter("label", label)
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/workflows/{workflowIdOrName}",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("version", version?.ToString())
+ .AddOptionalParameter("label", label)
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -101,180 +125,339 @@ partial void ProcessGetWorkflowResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetWorkflowRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- workflowIdOrName: workflowIdOrName,
- version: version,
- label: label);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetWorkflowRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ workflowIdOrName: workflowIdOrName,
+ version: version,
+ label: label);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetWorkflowResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 404)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflow",
+ methodName: "GetWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_404 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflow",
+ methodName: "GetWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 422)
- {
- string? __content_422 = null;
- global::System.Exception? __exception_422 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_422 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflow",
+ methodName: "GetWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_422 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_422,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_422,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetWorkflowResponseContent(
+ response: __response);
+ ProcessGetWorkflowResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetWorkflowResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflow",
+ methodName: "GetWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflow",
+ methodName: "GetWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.GetWorkflowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 422)
+ {
+ string? __content_422 = null;
+ global::System.Exception? __exception_422 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_422 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_422 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_422 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_422,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_422,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetWorkflowResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetWorkflowResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetWorkflowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflowLabels.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflowLabels.g.cs
index 056eb8d..99390cf 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflowLabels.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflowLabels.g.cs
@@ -14,6 +14,7 @@ public partial class WorkflowClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -44,10 +45,12 @@ partial void ProcessGetWorkflowLabelsResponseContent(
/// Get Agent Labels
///
///
+ /// 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 GetWorkflowLabelsAsync(
string workflowIdOrName,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -62,22 +65,43 @@ partial void ProcessGetWorkflowLabelsResponseContent(
securityRequirements: s_GetWorkflowLabelsSecurityRequirements,
operationName: "GetWorkflowLabelsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/workflows/{workflowIdOrName}/labels",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/workflows/{workflowIdOrName}/labels",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -87,145 +111,304 @@ partial void ProcessGetWorkflowLabelsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetWorkflowLabelsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- workflowIdOrName: workflowIdOrName);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetWorkflowLabelsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ workflowIdOrName: workflowIdOrName);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetWorkflowLabelsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 404)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowLabels",
+ methodName: "GetWorkflowLabelsAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ 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)
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowLabels",
+ methodName: "GetWorkflowLabelsAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
+
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
+
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowLabels",
+ methodName: "GetWorkflowLabelsAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetWorkflowLabelsResponseContent(
+ response: __response);
+ ProcessGetWorkflowLabelsResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.GetWorkflowLabelsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowLabels",
+ methodName: "GetWorkflowLabelsAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowLabels",
+ methodName: "GetWorkflowLabelsAsync",
+ pathTemplate: "$\"/workflows/{workflowIdOrName}/labels\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ //
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.GetWorkflowLabelsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessGetWorkflowLabelsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.GetWorkflowLabelsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.GetWorkflowLabelsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflowVersionExecutionResults.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflowVersionExecutionResults.g.cs
index 9392385..dff3630 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflowVersionExecutionResults.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.GetWorkflowVersionExecutionResults.g.cs
@@ -14,6 +14,7 @@ public partial class WorkflowClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -49,11 +50,13 @@ partial void ProcessGetWorkflowVersionExecutionResultsResponseContent(
///
/// 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, object>> GetWorkflowVersionExecutionResultsAsync(
long workflowVersionExecutionId,
bool? returnAllOutputs = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -69,26 +72,47 @@ partial void ProcessGetWorkflowVersionExecutionResultsResponseContent(
securityRequirements: s_GetWorkflowVersionExecutionResultsSecurityRequirements,
operationName: "GetWorkflowVersionExecutionResultsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/workflow-version-execution-results",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddRequiredParameter("workflow_version_execution_id", workflowVersionExecutionId.ToString()!)
- .AddOptionalParameter("return_all_outputs", returnAllOutputs?.ToString().ToLowerInvariant())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/workflow-version-execution-results",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddRequiredParameter("workflow_version_execution_id", workflowVersionExecutionId.ToString()!)
+ .AddOptionalParameter("return_all_outputs", returnAllOutputs?.ToString().ToLowerInvariant())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -98,245 +122,404 @@ partial void ProcessGetWorkflowVersionExecutionResultsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareGetWorkflowVersionExecutionResultsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- workflowVersionExecutionId: workflowVersionExecutionId,
- returnAllOutputs: returnAllOutputs);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareGetWorkflowVersionExecutionResultsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ workflowVersionExecutionId: workflowVersionExecutionId,
+ returnAllOutputs: returnAllOutputs);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessGetWorkflowVersionExecutionResultsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- //
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowVersionExecutionResults",
+ methodName: "GetWorkflowVersionExecutionResultsAsync",
+ pathTemplate: "\"/workflow-version-execution-results\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowVersionExecutionResults",
+ methodName: "GetWorkflowVersionExecutionResultsAsync",
+ pathTemplate: "\"/workflow-version-execution-results\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_401 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 403)
- {
- string? __content_403 = null;
- global::System.Exception? __exception_403 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_403 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowVersionExecutionResults",
+ methodName: "GetWorkflowVersionExecutionResultsAsync",
+ pathTemplate: "\"/workflow-version-execution-results\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
+
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_403 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_403,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_403,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- //
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- try
+
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessGetWorkflowVersionExecutionResultsResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- }
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowVersionExecutionResults",
+ methodName: "GetWorkflowVersionExecutionResultsAsync",
+ pathTemplate: "\"/workflow-version-execution-results\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "GetWorkflowVersionExecutionResults",
+ methodName: "GetWorkflowVersionExecutionResultsAsync",
+ pathTemplate: "\"/workflow-version-execution-results\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ //
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 403)
+ {
+ string? __content_403 = null;
+ global::System.Exception? __exception_403 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_403 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_403 = __ex;
+ }
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessGetWorkflowVersionExecutionResultsResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ throw new global::PromptLayer.ApiException(
+ message: __content_403 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_403,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_403,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ //
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
- return
- global::PromptLayer.OneOf, object>.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ if (__effectiveReadResponseAsString)
+ {
+ var __content = await __response.Content.ReadAsStringAsync(
+ #if NET5_0_OR_GREATER
+ __effectiveCancellationToken
+ #endif
+ ).ConfigureAwait(false);
- return
- await global::PromptLayer.OneOf, object>.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ ProcessResponseContent(
+ client: HttpClient,
+ response: __response,
+ content: ref __content);
+ ProcessGetWorkflowVersionExecutionResultsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.OneOf, object>.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.OneOf, object>.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.WorkflowClient.ListWorkflows.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.ListWorkflows.g.cs
index 96222b2..e8be584 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.ListWorkflows.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.ListWorkflows.g.cs
@@ -14,6 +14,7 @@ public partial class WorkflowClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -51,11 +52,13 @@ partial void ProcessListWorkflowsResponseContent(
///
/// Default Value: 30
///
+ /// 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 ListWorkflowsAsync(
int? page = default,
int? perPage = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
@@ -71,26 +74,47 @@ partial void ProcessListWorkflowsResponseContent(
securityRequirements: s_ListWorkflowsSecurityRequirements,
operationName: "ListWorkflowsAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: "/workflows",
- baseUri: HttpClient.BaseAddress);
- __pathBuilder
- .AddOptionalParameter("page", page?.ToString())
- .AddOptionalParameter("per_page", perPage?.ToString())
- ;
- var __path = __pathBuilder.ToString();
- using 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));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: "/workflows",
+ baseUri: HttpClient.BaseAddress);
+ __pathBuilder
+ .AddOptionalParameter("page", page?.ToString())
+ .AddOptionalParameter("per_page", perPage?.ToString())
+ ;
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -100,189 +124,348 @@ partial void ProcessListWorkflowsResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareListWorkflowsRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- page: page,
- perPage: perPage);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareListWorkflowsRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ page: page,
+ perPage: perPage);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ return __httpRequest;
+ }
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessListWorkflowsResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ListWorkflowsResponse2? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListWorkflows",
+ methodName: "ListWorkflowsAsync",
+ pathTemplate: "\"/workflows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ListWorkflowsResponse2.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListWorkflows",
+ methodName: "ListWorkflowsAsync",
+ pathTemplate: "\"/workflows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ListWorkflowsResponse2.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ListWorkflowsResponse3? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ListWorkflowsResponse3.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListWorkflows",
+ methodName: "ListWorkflowsAsync",
+ pathTemplate: "\"/workflows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ListWorkflowsResponse3.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
-
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- ProcessResponseContent(
+ ProcessResponse(
client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessListWorkflowsResponseContent(
+ response: __response);
+ ProcessListWorkflowsResponse(
httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
-
- try
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
{
- __response.EnsureSuccessStatusCode();
-
- return
- global::PromptLayer.ListWorkflowsResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListWorkflows",
+ methodName: "ListWorkflowsAsync",
+ pathTemplate: "\"/workflows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "ListWorkflows",
+ methodName: "ListWorkflowsAsync",
+ pathTemplate: "\"/workflows\"",
+ httpMethod: "GET",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- }
- else
- {
- try
- {
- __response.EnsureSuccessStatusCode();
- using var __content = await __response.Content.ReadAsStreamAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ListWorkflowsResponse2? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ListWorkflowsResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- await global::PromptLayer.ListWorkflowsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ __value_400 = global::PromptLayer.ListWorkflowsResponse2.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ListWorkflowsResponse3? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ListWorkflowsResponse3.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+
+ __value_401 = global::PromptLayer.ListWorkflowsResponse3.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
+
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessListWorkflowsResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.ListWorkflowsResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.ListWorkflowsResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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/PromptLayer/Generated/PromptLayer.WorkflowClient.PatchWorkflow.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.PatchWorkflow.g.cs
index 3ac0234..1f77bf4 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.PatchWorkflow.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.PatchWorkflow.g.cs
@@ -14,6 +14,7 @@ public partial class WorkflowClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -47,12 +48,14 @@ partial void ProcessPatchWorkflowResponseContent(
///
///
///
+ /// 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 PatchWorkflowAsync(
string workflowIdOrName,
global::PromptLayer.PatchWorkflow request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -70,22 +73,43 @@ partial void ProcessPatchWorkflowResponseContent(
securityRequirements: s_PatchWorkflowSecurityRequirements,
operationName: "PatchWorkflowAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/rest/workflows/{workflowIdOrName}",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: new global::System.Net.Http.HttpMethod("PATCH"),
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/rest/workflows/{workflowIdOrName}",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: new global::System.Net.Http.HttpMethod("PATCH"),
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -95,233 +119,392 @@ partial void ProcessPatchWorkflowResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PreparePatchWorkflowRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- workflowIdOrName: workflowIdOrName,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PreparePatchWorkflowRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ workflowIdOrName: workflowIdOrName,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessPatchWorkflowResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchWorkflow",
+ methodName: "PatchWorkflowAsync",
+ pathTemplate: "$\"/rest/workflows/{workflowIdOrName}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchWorkflow",
+ methodName: "PatchWorkflowAsync",
+ pathTemplate: "$\"/rest/workflows/{workflowIdOrName}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchWorkflow",
+ methodName: "PatchWorkflowAsync",
+ pathTemplate: "$\"/rest/workflows/{workflowIdOrName}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_401 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessPatchWorkflowResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchWorkflow",
+ methodName: "PatchWorkflowAsync",
+ pathTemplate: "$\"/rest/workflows/{workflowIdOrName}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_404 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "PatchWorkflow",
+ methodName: "PatchWorkflowAsync",
+ pathTemplate: "$\"/rest/workflows/{workflowIdOrName}\"",
+ httpMethod: "PATCH",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessPatchWorkflowResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.CreateWorkflowResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- return
- await global::PromptLayer.CreateWorkflowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessPatchWorkflowResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.CreateWorkflowResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.CreateWorkflowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Patch Workflow
@@ -345,6 +528,7 @@ partial void ProcessPatchWorkflowResponseContent(
///
/// Labels to attach to the new version.
///
+ /// 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 PatchWorkflowAsync(
@@ -355,6 +539,7 @@ partial void ProcessPatchWorkflowResponseContent(
global::System.Collections.Generic.Dictionary? requiredInputVariables = default,
global::System.Collections.Generic.IList? edges = default,
global::System.Collections.Generic.IList? releaseLabels = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.PatchWorkflow
@@ -370,6 +555,7 @@ partial void ProcessPatchWorkflowResponseContent(
return await PatchWorkflowAsync(
workflowIdOrName: workflowIdOrName,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.RunWorkflow.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.RunWorkflow.g.cs
index f442c57..055e15d 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.RunWorkflow.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.RunWorkflow.g.cs
@@ -14,6 +14,7 @@ public partial class WorkflowClient
{ new global::PromptLayer.EndPointAuthorizationRequirement
{
Type = "ApiKey",
+ SchemeId = "ApikeyXApiKey",
Location = "Header",
Name = "X-API-KEY",
FriendlyName = "ApiKeyInHeader",
@@ -47,12 +48,14 @@ partial void ProcessRunWorkflowResponseContent(
///
///
///
+ /// 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 RunWorkflowAsync(
string workflowName,
global::PromptLayer.RunWorkflow request,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
request = request ?? throw new global::System.ArgumentNullException(nameof(request));
@@ -70,22 +73,43 @@ partial void ProcessRunWorkflowResponseContent(
securityRequirements: s_RunWorkflowSecurityRequirements,
operationName: "RunWorkflowAsync");
- var __pathBuilder = new global::PromptLayer.PathBuilder(
- path: $"/workflows/{workflowName}/run",
- baseUri: HttpClient.BaseAddress);
- var __path = __pathBuilder.ToString();
- using var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
- method: global::System.Net.Http.HttpMethod.Post,
- requestUri: new global::System.Uri(__path, global::System.UriKind.RelativeOrAbsolute));
+ using var __timeoutCancellationTokenSource = global::PromptLayer.AutoSDKRequestOptionsSupport.CreateTimeoutCancellationTokenSource(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: cancellationToken);
+ var __effectiveCancellationToken = __timeoutCancellationTokenSource?.Token ?? cancellationToken;
+ var __effectiveReadResponseAsString = global::PromptLayer.AutoSDKRequestOptionsSupport.GetReadResponseAsString(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ fallbackValue: ReadResponseAsString);
+ var __maxAttempts = global::PromptLayer.AutoSDKRequestOptionsSupport.GetMaxAttempts(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ supportsRetry: true);
+
+ global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
+ {
+ var __pathBuilder = new global::PromptLayer.PathBuilder(
+ path: $"/workflows/{workflowName}/run",
+ baseUri: HttpClient.BaseAddress);
+ var __path = __pathBuilder.ToString();
+ __path = global::PromptLayer.AutoSDKRequestOptionsSupport.AppendQueryParameters(
+ path: __path,
+ clientParameters: Options.QueryParameters,
+ requestParameters: requestOptions?.QueryParameters);
+ var __httpRequest = new global::System.Net.Http.HttpRequestMessage(
+ method: global::System.Net.Http.HttpMethod.Post,
+ 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;
+ __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 == "OAuth2" ||
+ __authorization.Type == "OpenIdConnect")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
@@ -95,233 +119,392 @@ partial void ProcessRunWorkflowResponseContent(
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
- }
+ }
}
- var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
- var __httpRequestContent = new global::System.Net.Http.StringContent(
- content: __httpRequestContentBody,
- encoding: global::System.Text.Encoding.UTF8,
- mediaType: "application/json");
- __httpRequest.Content = __httpRequestContent;
-
- PrepareRequest(
- client: HttpClient,
- request: __httpRequest);
- PrepareRunWorkflowRequest(
- httpClient: HttpClient,
- httpRequestMessage: __httpRequest,
- workflowName: workflowName,
- request: request);
+ var __httpRequestContentBody = request.ToJson(JsonSerializerContext);
+ var __httpRequestContent = new global::System.Net.Http.StringContent(
+ content: __httpRequestContentBody,
+ encoding: global::System.Text.Encoding.UTF8,
+ mediaType: "application/json");
+ __httpRequest.Content = __httpRequestContent;
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ApplyHeaders(
+ request: __httpRequest,
+ clientHeaders: Options.Headers,
+ requestHeaders: requestOptions?.Headers);
- using var __response = await HttpClient.SendAsync(
- request: __httpRequest,
- completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
- cancellationToken: cancellationToken).ConfigureAwait(false);
+ PrepareRequest(
+ client: HttpClient,
+ request: __httpRequest);
+ PrepareRunWorkflowRequest(
+ httpClient: HttpClient,
+ httpRequestMessage: __httpRequest,
+ workflowName: workflowName,
+ request: request);
- ProcessResponse(
- client: HttpClient,
- response: __response);
- ProcessRunWorkflowResponse(
- httpClient: HttpClient,
- httpResponseMessage: __response);
- // Bad Request
- if ((int)__response.StatusCode == 400)
+ return __httpRequest;
+ }
+
+ global::System.Net.Http.HttpRequestMessage? __httpRequest = null;
+ global::System.Net.Http.HttpResponseMessage? __response = null;
+ var __attemptNumber = 0;
+ try
{
- string? __content_400 = null;
- global::System.Exception? __exception_400 = null;
- global::PromptLayer.ErrorResponse? __value_400 = null;
- try
+ for (var __attempt = 1; __attempt <= __maxAttempts; __attempt++)
{
- if (ReadResponseAsString)
+ __attemptNumber = __attempt;
+ __httpRequest = __CreateHttpRequest();
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnBeforeRequestAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunWorkflow",
+ methodName: "RunWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowName}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ try
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __response = await HttpClient.SendAsync(
+ request: __httpRequest,
+ completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
}
- else
+ catch (global::System.Net.Http.HttpRequestException __exception)
{
- __content_400 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
+ var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunWorkflow",
+ methodName: "RunWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowName}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: null,
+ exception: __exception,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: __willRetry,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ if (!__willRetry)
+ {
+ throw;
+ }
- __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- }
- catch (global::System.Exception __ex)
- {
- __exception_400 = __ex;
- }
- throw new global::PromptLayer.ApiException(
- message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_400,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_400,
- ResponseObject = __value_400,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Not Found
- if ((int)__response.StatusCode == 404)
- {
- string? __content_404 = null;
- global::System.Exception? __exception_404 = null;
- global::PromptLayer.ErrorResponse? __value_404 = null;
- try
- {
- if (ReadResponseAsString)
+ if (__response != null &&
+ __attempt < __maxAttempts &&
+ global::PromptLayer.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunWorkflow",
+ methodName: "RunWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowName}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attempt,
+ maxAttempts: __maxAttempts,
+ willRetry: true,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
+ __response.Dispose();
+ __response = null;
+ __httpRequest.Dispose();
+ __httpRequest = null;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
+ continue;
}
- else
- {
- __content_404 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
- }
+ break;
}
- catch (global::System.Exception __ex)
+
+ if (__response == null)
{
- __exception_404 = __ex;
+ throw new global::System.InvalidOperationException("No response received.");
}
- throw new global::PromptLayer.ApiException(
- message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_404,
- statusCode: __response.StatusCode)
+ using (__response)
{
- ResponseBody = __content_404,
- ResponseObject = __value_404,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
- // Unauthorized
- if ((int)__response.StatusCode == 401)
- {
- string? __content_401 = null;
- global::System.Exception? __exception_401 = null;
- global::PromptLayer.ErrorResponse? __value_401 = null;
- try
- {
- if (ReadResponseAsString)
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
- else
- {
- __content_401 = await __response.Content.ReadAsStringAsync(cancellationToken).ConfigureAwait(false);
- __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
- }
+ ProcessResponse(
+ client: HttpClient,
+ response: __response);
+ ProcessRunWorkflowResponse(
+ httpClient: HttpClient,
+ httpResponseMessage: __response);
+ if (__response.IsSuccessStatusCode)
+ {
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterSuccessAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunWorkflow",
+ methodName: "RunWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowName}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
- catch (global::System.Exception __ex)
+ else
{
- __exception_401 = __ex;
+ await global::PromptLayer.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
+ clientOptions: Options,
+ context: global::PromptLayer.AutoSDKRequestOptionsSupport.CreateHookContext(
+ operationId: "RunWorkflow",
+ methodName: "RunWorkflowAsync",
+ pathTemplate: "$\"/workflows/{workflowName}/run\"",
+ httpMethod: "POST",
+ baseUri: BaseUri,
+ request: __httpRequest!,
+ response: __response,
+ exception: null,
+ clientOptions: Options,
+ requestOptions: requestOptions,
+ attempt: __attemptNumber,
+ maxAttempts: __maxAttempts,
+ willRetry: false,
+ cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
+ // Bad Request
+ if ((int)__response.StatusCode == 400)
+ {
+ string? __content_400 = null;
+ global::System.Exception? __exception_400 = null;
+ global::PromptLayer.ErrorResponse? __value_400 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ else
+ {
+ __content_400 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- throw new global::PromptLayer.ApiException(
- message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __exception_401,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content_401,
- ResponseObject = __value_401,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
- }
+ __value_400 = global::PromptLayer.ErrorResponse.FromJson(__content_400, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_400 = __ex;
+ }
- if (ReadResponseAsString)
- {
- var __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ throw new global::PromptLayer.ApiException(
+ message: __content_400 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_400,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_400,
+ ResponseObject = __value_400,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Not Found
+ if ((int)__response.StatusCode == 404)
+ {
+ string? __content_404 = null;
+ global::System.Exception? __exception_404 = null;
+ global::PromptLayer.ErrorResponse? __value_404 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ else
+ {
+ __content_404 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- ProcessResponseContent(
- client: HttpClient,
- response: __response,
- content: ref __content);
- ProcessRunWorkflowResponseContent(
- httpClient: HttpClient,
- httpResponseMessage: __response,
- content: ref __content);
+ __value_404 = global::PromptLayer.ErrorResponse.FromJson(__content_404, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_404 = __ex;
+ }
- try
- {
- __response.EnsureSuccessStatusCode();
+ throw new global::PromptLayer.ApiException(
+ message: __content_404 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_404,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_404,
+ ResponseObject = __value_404,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ // Unauthorized
+ if ((int)__response.StatusCode == 401)
+ {
+ string? __content_401 = null;
+ global::System.Exception? __exception_401 = null;
+ global::PromptLayer.ErrorResponse? __value_401 = null;
+ try
+ {
+ if (__effectiveReadResponseAsString)
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ else
+ {
+ __content_401 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
- return
- global::PromptLayer.RunWorkflowResponse.FromJson(__content, JsonSerializerContext) ??
- throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
- }
- catch (global::System.Exception __ex)
- {
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- 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
- cancellationToken
-#endif
- ).ConfigureAwait(false);
+ __value_401 = global::PromptLayer.ErrorResponse.FromJson(__content_401, JsonSerializerContext);
+ }
+ }
+ catch (global::System.Exception __ex)
+ {
+ __exception_401 = __ex;
+ }
- return
- await global::PromptLayer.RunWorkflowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
- throw new global::System.InvalidOperationException("Response deserialization failed.");
- }
- catch (global::System.Exception __ex)
- {
- string? __content = null;
- try
- {
- __content = await __response.Content.ReadAsStringAsync(
-#if NET5_0_OR_GREATER
- cancellationToken
-#endif
- ).ConfigureAwait(false);
- }
- catch (global::System.Exception)
- {
- }
+ throw new global::PromptLayer.ApiException(
+ message: __content_401 ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __exception_401,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content_401,
+ ResponseObject = __value_401,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+
+ 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);
+ ProcessRunWorkflowResponseContent(
+ httpClient: HttpClient,
+ httpResponseMessage: __response,
+ content: ref __content);
+
+ try
+ {
+ __response.EnsureSuccessStatusCode();
+
+ return
+ global::PromptLayer.RunWorkflowResponse.FromJson(__content, JsonSerializerContext) ??
+ throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
+ }
+ catch (global::System.Exception __ex)
+ {
+ throw new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ 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);
+
+ return
+ await global::PromptLayer.RunWorkflowResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
+ throw new global::System.InvalidOperationException("Response deserialization failed.");
+ }
+ 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 new global::PromptLayer.ApiException(
+ message: __content ?? __response.ReasonPhrase ?? string.Empty,
+ innerException: __ex,
+ statusCode: __response.StatusCode)
+ {
+ ResponseBody = __content,
+ ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
+ __response.Headers,
+ h => h.Key,
+ h => h.Value),
+ };
+ }
+ }
- throw new global::PromptLayer.ApiException(
- message: __content ?? __response.ReasonPhrase ?? string.Empty,
- innerException: __ex,
- statusCode: __response.StatusCode)
- {
- ResponseBody = __content,
- ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
- __response.Headers,
- h => h.Key,
- h => h.Value),
- };
}
}
+ finally
+ {
+ __httpRequest?.Dispose();
+ }
}
///
/// Run Workflow
@@ -344,6 +527,7 @@ partial void ProcessRunWorkflowResponseContent(
/// If set to `true`, all outputs from the workflow execution will be returned.
/// 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 RunWorkflowAsync(
@@ -353,6 +537,7 @@ partial void ProcessRunWorkflowResponseContent(
global::System.Collections.Generic.Dictionary? metadata = default,
object? inputVariables = default,
bool? returnAllOutputs = default,
+ global::PromptLayer.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __request = new global::PromptLayer.RunWorkflow
@@ -367,6 +552,7 @@ partial void ProcessRunWorkflowResponseContent(
return await RunWorkflowAsync(
workflowName: workflowName,
request: __request,
+ requestOptions: requestOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
}
}
diff --git a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.g.cs b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.g.cs
index 9767f11..9490a3e 100644
--- a/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.g.cs
+++ b/src/libs/PromptLayer/Generated/PromptLayer.WorkflowClient.g.cs
@@ -30,6 +30,9 @@ public sealed partial class WorkflowClient : global::PromptLayer.IWorkflowClient
#if DEBUG
= true;
#endif
+
+ ///
+ public global::PromptLayer.AutoSDKClientOptions Options { get; }
///
///
///
@@ -49,11 +52,37 @@ public WorkflowClient(
global::System.Net.Http.HttpClient? httpClient = null,
global::System.Uri? baseUri = null,
global::System.Collections.Generic.List? authorizations = null,
+ bool disposeHttpClient = true) : this(
+ httpClient,
+ baseUri,
+ authorizations,
+ options: null,
+ disposeHttpClient: disposeHttpClient)
+ {
+ }
+
+ ///
+ /// Creates a new instance of the WorkflowClient.
+ /// 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.
+ ///
+ /// The HttpClient instance. If not provided, a new one will be created.
+ /// The base URL for the API. If not provided, the default baseUri from OpenAPI spec will be used.
+ /// The authorizations to use for the requests.
+ /// Client-wide request defaults such as headers, query parameters, retries, and timeout.
+ /// Dispose the HttpClient when the instance is disposed. True by default.
+ public WorkflowClient(
+ global::System.Net.Http.HttpClient? httpClient = null,
+ global::System.Uri? baseUri = null,
+ global::System.Collections.Generic.List? authorizations = null,
+ global::PromptLayer.AutoSDKClientOptions? options = null,
bool disposeHttpClient = true)
{
+
HttpClient = httpClient ?? new global::System.Net.Http.HttpClient();
HttpClient.BaseAddress ??= baseUri ?? new global::System.Uri(DefaultBaseUrl);
Authorizations = authorizations ?? new global::System.Collections.Generic.List();
+ Options = options ?? new global::PromptLayer.AutoSDKClientOptions();
_disposeHttpClient = disposeHttpClient;
Initialized(HttpClient);