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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ partial void ProcessGetAudienceByIdResponseContent(
string id,
global::JasperAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __response = await GetAudienceByIdAsResponseAsync(
id: id,
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);

return __response.Body;
}
/// <summary>
/// Get audience by ID<br/>
/// Retrieve a specific target audience by its unique identifier.
/// </summary>
/// <param name="id"></param>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::JasperAI.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::JasperAI.AutoSDKHttpResponse<global::JasperAI.AudienceResponse>> GetAudienceByIdAsResponseAsync(
string id,
global::JasperAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
Expand Down Expand Up @@ -82,6 +103,7 @@ partial void ProcessGetAudienceByIdResponseContent(

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::JasperAI.PathBuilder(
path: $"/audiences/{id}",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -155,6 +177,8 @@ partial void ProcessGetAudienceByIdResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -165,6 +189,11 @@ partial void ProcessGetAudienceByIdResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -182,6 +211,8 @@ partial void ProcessGetAudienceByIdResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -191,8 +222,7 @@ partial void ProcessGetAudienceByIdResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -201,6 +231,11 @@ partial void ProcessGetAudienceByIdResponseContent(
__attempt < __maxAttempts &&
global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -217,14 +252,15 @@ partial void ProcessGetAudienceByIdResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -264,6 +300,8 @@ partial void ProcessGetAudienceByIdResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -284,6 +322,8 @@ partial void ProcessGetAudienceByIdResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
// Audience not found.
Expand Down Expand Up @@ -384,9 +424,13 @@ partial void ProcessGetAudienceByIdResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::JasperAI.AudienceResponse.FromJson(__content, JsonSerializerContext) ??
var __value = global::JasperAI.AudienceResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return new global::JasperAI.AutoSDKHttpResponse<global::JasperAI.AudienceResponse>(
statusCode: __response.StatusCode,
headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down Expand Up @@ -414,9 +458,13 @@ partial void ProcessGetAudienceByIdResponseContent(
#endif
).ConfigureAwait(false);

return
await global::JasperAI.AudienceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
var __value = await global::JasperAI.AudienceResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return new global::JasperAI.AutoSDKHttpResponse<global::JasperAI.AudienceResponse>(
statusCode: __response.StatusCode,
headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,24 @@ partial void ProcessGetAudiencesResponseContent(
public async global::System.Threading.Tasks.Task<global::JasperAI.AudienceListResponse> GetAudiencesAsync(
global::JasperAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
var __response = await GetAudiencesAsResponseAsync(
requestOptions: requestOptions,
cancellationToken: cancellationToken
).ConfigureAwait(false);

return __response.Body;
}
/// <summary>
/// List all audiences<br/>
/// Retrieve all target audiences defined in the workspace.
/// </summary>
/// <param name="requestOptions">Per-request overrides such as headers, query parameters, timeout, retries, and response buffering.</param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::JasperAI.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::JasperAI.AutoSDKHttpResponse<global::JasperAI.AudienceListResponse>> GetAudiencesAsResponseAsync(
global::JasperAI.AutoSDKRequestOptions? requestOptions = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
Expand Down Expand Up @@ -77,6 +95,7 @@ partial void ProcessGetAudiencesResponseContent(

global::System.Net.Http.HttpRequestMessage __CreateHttpRequest()
{

var __pathBuilder = new global::JasperAI.PathBuilder(
path: "/audiences",
baseUri: HttpClient.BaseAddress);
Expand Down Expand Up @@ -149,6 +168,8 @@ partial void ProcessGetAudiencesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
try
{
Expand All @@ -159,6 +180,11 @@ partial void ProcessGetAudiencesResponseContent(
}
catch (global::System.Net.Http.HttpRequestException __exception)
{
var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: null,
attempt: __attempt);
var __willRetry = __attempt < __maxAttempts && !__effectiveCancellationToken.IsCancellationRequested;
await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
Expand All @@ -176,6 +202,8 @@ partial void ProcessGetAudiencesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: __willRetry,
retryDelay: __willRetry ? __retryDelay : (global::System.TimeSpan?)null,
retryReason: "exception",
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
if (!__willRetry)
{
Expand All @@ -185,8 +213,7 @@ partial void ProcessGetAudiencesResponseContent(
__httpRequest.Dispose();
__httpRequest = null;
await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand All @@ -195,6 +222,11 @@ partial void ProcessGetAudiencesResponseContent(
__attempt < __maxAttempts &&
global::JasperAI.AutoSDKRequestOptionsSupport.ShouldRetryStatusCode(__response.StatusCode))
{
var __retryDelay = global::JasperAI.AutoSDKRequestOptionsSupport.GetRetryDelay(
clientOptions: Options,
requestOptions: requestOptions,
response: __response,
attempt: __attempt);
await global::JasperAI.AutoSDKRequestOptionsSupport.OnAfterErrorAsync(
clientOptions: Options,
context: global::JasperAI.AutoSDKRequestOptionsSupport.CreateHookContext(
Expand All @@ -211,14 +243,15 @@ partial void ProcessGetAudiencesResponseContent(
attempt: __attempt,
maxAttempts: __maxAttempts,
willRetry: true,
retryDelay: __retryDelay,
retryReason: "status:" + ((int)__response.StatusCode).ToString(global::System.Globalization.CultureInfo.InvariantCulture),
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
__response.Dispose();
__response = null;
__httpRequest.Dispose();
__httpRequest = null;
await global::JasperAI.AutoSDKRequestOptionsSupport.DelayBeforeRetryAsync(
clientOptions: Options,
requestOptions: requestOptions,
retryDelay: __retryDelay,
cancellationToken: __effectiveCancellationToken).ConfigureAwait(false);
continue;
}
Expand Down Expand Up @@ -258,6 +291,8 @@ partial void ProcessGetAudiencesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
else
Expand All @@ -278,6 +313,8 @@ partial void ProcessGetAudiencesResponseContent(
attempt: __attemptNumber,
maxAttempts: __maxAttempts,
willRetry: false,
retryDelay: null,
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
// Internal server error.
Expand Down Expand Up @@ -340,9 +377,13 @@ partial void ProcessGetAudiencesResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::JasperAI.AudienceListResponse.FromJson(__content, JsonSerializerContext) ??
var __value = global::JasperAI.AudienceListResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return new global::JasperAI.AutoSDKHttpResponse<global::JasperAI.AudienceListResponse>(
statusCode: __response.StatusCode,
headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down Expand Up @@ -370,9 +411,13 @@ partial void ProcessGetAudiencesResponseContent(
#endif
).ConfigureAwait(false);

return
await global::JasperAI.AudienceListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
var __value = await global::JasperAI.AudienceListResponse.FromJsonStreamAsync(__content, JsonSerializerContext).ConfigureAwait(false) ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return new global::JasperAI.AutoSDKHttpResponse<global::JasperAI.AudienceListResponse>(
statusCode: __response.StatusCode,
headers: global::JasperAI.AutoSDKHttpResponse.CreateHeaders(__response),
requestUri: __response.RequestMessage?.RequestUri,
body: __value);
}
catch (global::System.Exception __ex)
{
Expand Down
Loading