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 @@ -157,6 +157,10 @@ namespace Ultravox

typeof(global::Ultravox.JsonConverters.UltravoxV1TimedMessageEndBehaviorNullableJsonConverter),

typeof(global::Ultravox.JsonConverters.AccountsMeUsageConcurrencyRetrieveBucketJsonConverter),

typeof(global::Ultravox.JsonConverters.AccountsMeUsageConcurrencyRetrieveBucketNullableJsonConverter),

typeof(global::Ultravox.JsonConverters.AgentsScheduledBatchesScheduledCallsListStatusJsonConverter),

typeof(global::Ultravox.JsonConverters.AgentsScheduledBatchesScheduledCallsListStatusNullableJsonConverter),
Expand Down Expand Up @@ -269,6 +273,9 @@ namespace Ultravox
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.DailyCallStatistics))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList<global::Ultravox.HourlyCallStatistics>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.HourlyCallStatistics))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.ConcurrencyBucket))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.ConcurrencyResponse))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.IList<global::Ultravox.ConcurrencyBucket>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.CorpusUploadsRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.CorpusUploadsResponse))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.EventsEnum))]
Expand Down Expand Up @@ -442,6 +449,7 @@ namespace Ultravox
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.ToolsCreateRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(byte[]))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.VoicesCreateRequest))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.AgentsScheduledBatchesScheduledCallsListStatus))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.CallsEventsListMinimumSeverity))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::Ultravox.CallsMessagesListMode))]
Expand All @@ -461,6 +469,7 @@ namespace Ultravox
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::Ultravox.UltravoxV1TimedMessage>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::Ultravox.DailyCallStatistics>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::Ultravox.HourlyCallStatistics>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::Ultravox.ConcurrencyBucket>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::Ultravox.APIKey>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::Ultravox.Agent>))]
[global::System.Text.Json.Serialization.JsonSerializable(typeof(global::System.Collections.Generic.List<global::Ultravox.CallEvent>))]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@

#nullable enable

namespace Ultravox
{
public partial class AccountsClient
{
partial void PrepareAccountsMeUsageConcurrencyRetrieveArguments(
global::System.Net.Http.HttpClient httpClient,
ref global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket? bucket,
ref global::System.DateTime? end,
ref global::System.DateTime? start);
partial void PrepareAccountsMeUsageConcurrencyRetrieveRequest(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpRequestMessage httpRequestMessage,
global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket? bucket,
global::System.DateTime? end,
global::System.DateTime? start);
partial void ProcessAccountsMeUsageConcurrencyRetrieveResponse(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage);

partial void ProcessAccountsMeUsageConcurrencyRetrieveResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);

/// <summary>
/// Gets historical call concurrency for the account.
/// </summary>
/// <param name="bucket">
/// Default Value: minute
/// </param>
/// <param name="end"></param>
/// <param name="start"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Ultravox.ApiException"></exception>
public async global::System.Threading.Tasks.Task<global::Ultravox.ConcurrencyResponse> AccountsMeUsageConcurrencyRetrieveAsync(
global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket? bucket = default,
global::System.DateTime? end = default,
global::System.DateTime? start = default,
global::System.Threading.CancellationToken cancellationToken = default)
{
PrepareArguments(
client: HttpClient);
PrepareAccountsMeUsageConcurrencyRetrieveArguments(
httpClient: HttpClient,
bucket: ref bucket,
end: ref end,
start: ref start);

var __pathBuilder = new global::Ultravox.PathBuilder(
path: "/api/accounts/me/usage/concurrency",
baseUri: HttpClient.BaseAddress);
__pathBuilder
.AddOptionalParameter("bucket", bucket?.ToValueString())
.AddOptionalParameter("end", end?.ToString("yyyy-MM-ddTHH:mm:ssZ"))
.AddOptionalParameter("start", start?.ToString("yyyy-MM-ddTHH:mm:ssZ"))
;
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));
#if NET6_0_OR_GREATER
__httpRequest.Version = global::System.Net.HttpVersion.Version11;
__httpRequest.VersionPolicy = global::System.Net.Http.HttpVersionPolicy.RequestVersionOrHigher;
#endif

foreach (var __authorization in Authorizations)
{
if (__authorization.Type == "Http" ||
__authorization.Type == "OAuth2")
{
__httpRequest.Headers.Authorization = new global::System.Net.Http.Headers.AuthenticationHeaderValue(
scheme: __authorization.Name,
parameter: __authorization.Value);
}
else if (__authorization.Type == "ApiKey" &&
__authorization.Location == "Header")
{
__httpRequest.Headers.Add(__authorization.Name, __authorization.Value);
}
}

PrepareRequest(
client: HttpClient,
request: __httpRequest);
PrepareAccountsMeUsageConcurrencyRetrieveRequest(
httpClient: HttpClient,
httpRequestMessage: __httpRequest,
bucket: bucket,
end: end,
start: start);

using var __response = await HttpClient.SendAsync(
request: __httpRequest,
completionOption: global::System.Net.Http.HttpCompletionOption.ResponseContentRead,
cancellationToken: cancellationToken).ConfigureAwait(false);

ProcessResponse(
client: HttpClient,
response: __response);
ProcessAccountsMeUsageConcurrencyRetrieveResponse(
httpClient: HttpClient,
httpResponseMessage: __response);

if (ReadResponseAsString)
{
var __content = await __response.Content.ReadAsStringAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessAccountsMeUsageConcurrencyRetrieveResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
content: ref __content);

try
{
__response.EnsureSuccessStatusCode();

return
global::Ultravox.ConcurrencyResponse.FromJson(__content, JsonSerializerContext) ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
}
catch (global::System.Exception __ex)
{
throw new global::Ultravox.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);

return
await global::Ultravox.ConcurrencyResponse.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::Ultravox.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),
};
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#nullable enable

namespace Ultravox
{
public partial interface IAccountsClient
{
/// <summary>
/// Gets historical call concurrency for the account.
/// </summary>
/// <param name="bucket">
/// Default Value: minute
/// </param>
/// <param name="end"></param>
/// <param name="start"></param>
/// <param name="cancellationToken">The token to cancel the operation with</param>
/// <exception cref="global::Ultravox.ApiException"></exception>
global::System.Threading.Tasks.Task<global::Ultravox.ConcurrencyResponse> AccountsMeUsageConcurrencyRetrieveAsync(
global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket? bucket = default,
global::System.DateTime? end = default,
global::System.DateTime? start = default,
global::System.Threading.CancellationToken cancellationToken = default);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Ultravox.JsonConverters
{
/// <inheritdoc />
public sealed class AccountsMeUsageConcurrencyRetrieveBucketJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket>
{
/// <inheritdoc />
public override global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucketExtensions.ToEnum(stringValue) ?? default;
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

writer.WriteStringValue(global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucketExtensions.ToValueString(value));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#nullable enable

namespace Ultravox.JsonConverters
{
/// <inheritdoc />
public sealed class AccountsMeUsageConcurrencyRetrieveBucketNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket?>
{
/// <inheritdoc />
public override global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket? Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
switch (reader.TokenType)
{
case global::System.Text.Json.JsonTokenType.String:
{
var stringValue = reader.GetString();
if (stringValue != null)
{
return global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucketExtensions.ToEnum(stringValue);
}

break;
}
case global::System.Text.Json.JsonTokenType.Number:
{
var numValue = reader.GetInt32();
return (global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket)numValue;
}
case global::System.Text.Json.JsonTokenType.Null:
{
return default(global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket?);
}
default:
throw new global::System.ArgumentOutOfRangeException(nameof(reader));
}

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucket? value,
global::System.Text.Json.JsonSerializerOptions options)
{
writer = writer ?? throw new global::System.ArgumentNullException(nameof(writer));

if (value == null)
{
writer.WriteNullValue();
}
else
{
writer.WriteStringValue(global::Ultravox.AccountsMeUsageConcurrencyRetrieveBucketExtensions.ToValueString(value.Value));
}
}
}
}
Loading