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
@@ -0,0 +1,92 @@
#nullable enable

namespace ElevenLabs
{
public sealed partial class BatchCallResponse
{
/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerContext.
/// </summary>
public string ToJson(
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
this.GetType(),
jsonSerializerContext);
}

/// <summary>
/// Serializes the current instance to a JSON string using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public string ToJson(
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Serialize(
this,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerContext.
/// </summary>
public static global::ElevenLabs.BatchCallResponse? FromJson(
string json,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return global::System.Text.Json.JsonSerializer.Deserialize(
json,
typeof(global::ElevenLabs.BatchCallResponse),
jsonSerializerContext) as global::ElevenLabs.BatchCallResponse;
}

/// <summary>
/// Deserializes a JSON string using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public static global::ElevenLabs.BatchCallResponse? FromJson(
string json,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.Deserialize<global::ElevenLabs.BatchCallResponse>(
json,
jsonSerializerOptions);
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerContext.
/// </summary>
public static async global::System.Threading.Tasks.ValueTask<global::ElevenLabs.BatchCallResponse?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
return (await global::System.Text.Json.JsonSerializer.DeserializeAsync(
jsonStream,
typeof(global::ElevenLabs.BatchCallResponse),
jsonSerializerContext).ConfigureAwait(false)) as global::ElevenLabs.BatchCallResponse;
}

/// <summary>
/// Deserializes a JSON stream using the provided JsonSerializerOptions.
/// </summary>
#if NET8_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed. Use the overload that takes a JsonTypeInfo or JsonSerializerContext, or make sure all of the required types are preserved.")]
[global::System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use System.Text.Json source generation for native AOT applications.")]
#endif
public static global::System.Threading.Tasks.ValueTask<global::ElevenLabs.BatchCallResponse?> FromJsonStreamAsync(
global::System.IO.Stream jsonStream,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions = null)
{
return global::System.Text.Json.JsonSerializer.DeserializeAsync<global::ElevenLabs.BatchCallResponse?>(
jsonStream,
jsonSerializerOptions);
}
}
}
145 changes: 145 additions & 0 deletions src/libs/ElevenLabs/Generated/ElevenLabs.Models.BatchCallResponse.g.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@

#nullable enable

namespace ElevenLabs
{
/// <summary>
///
/// </summary>
public sealed partial class BatchCallResponse
{
/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("batch_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string BatchId { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("phone_number_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string PhoneNumberId { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("name")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string Name { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("agent_id")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string AgentId { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("created_at_unix")]
[global::System.Text.Json.Serialization.JsonRequired]
public required int CreatedAtUnix { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("scheduled_time_unix")]
[global::System.Text.Json.Serialization.JsonRequired]
public required int ScheduledTimeUnix { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("total_calls_dispatched")]
[global::System.Text.Json.Serialization.JsonRequired]
public required int TotalCallsDispatched { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("total_calls_scheduled")]
[global::System.Text.Json.Serialization.JsonRequired]
public required int TotalCallsScheduled { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("last_updated_at_unix")]
[global::System.Text.Json.Serialization.JsonRequired]
public required int LastUpdatedAtUnix { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("status")]
[global::System.Text.Json.Serialization.JsonConverter(typeof(global::ElevenLabs.JsonConverters.BatchCallStatusJsonConverter))]
[global::System.Text.Json.Serialization.JsonRequired]
public required global::ElevenLabs.BatchCallStatus Status { get; set; }

/// <summary>
///
/// </summary>
[global::System.Text.Json.Serialization.JsonPropertyName("agent_name")]
[global::System.Text.Json.Serialization.JsonRequired]
public required string AgentName { get; set; }

/// <summary>
/// Additional properties that are not explicitly defined in the schema
/// </summary>
[global::System.Text.Json.Serialization.JsonExtensionData]
public global::System.Collections.Generic.IDictionary<string, object> AdditionalProperties { get; set; } = new global::System.Collections.Generic.Dictionary<string, object>();

/// <summary>
/// Initializes a new instance of the <see cref="BatchCallResponse" /> class.
/// </summary>
/// <param name="batchId"></param>
/// <param name="phoneNumberId"></param>
/// <param name="name"></param>
/// <param name="agentId"></param>
/// <param name="createdAtUnix"></param>
/// <param name="scheduledTimeUnix"></param>
/// <param name="totalCallsDispatched"></param>
/// <param name="totalCallsScheduled"></param>
/// <param name="lastUpdatedAtUnix"></param>
/// <param name="status"></param>
/// <param name="agentName"></param>
#if NET7_0_OR_GREATER
[global::System.Diagnostics.CodeAnalysis.SetsRequiredMembers]
#endif
public BatchCallResponse(
string batchId,
string phoneNumberId,
string name,
string agentId,
int createdAtUnix,
int scheduledTimeUnix,
int totalCallsDispatched,
int totalCallsScheduled,
int lastUpdatedAtUnix,
global::ElevenLabs.BatchCallStatus status,
string agentName)
{
this.BatchId = batchId ?? throw new global::System.ArgumentNullException(nameof(batchId));
this.PhoneNumberId = phoneNumberId ?? throw new global::System.ArgumentNullException(nameof(phoneNumberId));
this.Name = name ?? throw new global::System.ArgumentNullException(nameof(name));
this.AgentId = agentId ?? throw new global::System.ArgumentNullException(nameof(agentId));
this.CreatedAtUnix = createdAtUnix;
this.ScheduledTimeUnix = scheduledTimeUnix;
this.TotalCallsDispatched = totalCallsDispatched;
this.TotalCallsScheduled = totalCallsScheduled;
this.LastUpdatedAtUnix = lastUpdatedAtUnix;
this.Status = status;
this.AgentName = agentName ?? throw new global::System.ArgumentNullException(nameof(agentName));
}

/// <summary>
/// Initializes a new instance of the <see cref="BatchCallResponse" /> class.
/// </summary>
public BatchCallResponse()
{
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

#nullable enable

namespace ElevenLabs
{
/// <summary>
///
/// </summary>
public enum BatchCallStatus
{
/// <summary>
///
/// </summary>
Pending,
/// <summary>
///
/// </summary>
InProgress,
/// <summary>
///
/// </summary>
Completed,
/// <summary>
///
/// </summary>
Failed,
/// <summary>
///
/// </summary>
Cancelled,
}

/// <summary>
/// Enum extensions to do fast conversions without the reflection.
/// </summary>
public static class BatchCallStatusExtensions
{
/// <summary>
/// Converts an enum to a string.
/// </summary>
public static string ToValueString(this BatchCallStatus value)
{
return value switch
{
BatchCallStatus.Pending => "pending",
BatchCallStatus.InProgress => "in_progress",
BatchCallStatus.Completed => "completed",
BatchCallStatus.Failed => "failed",
BatchCallStatus.Cancelled => "cancelled",
_ => throw new global::System.ArgumentOutOfRangeException(nameof(value), value, null),
};
}
/// <summary>
/// Converts an string to a enum.
/// </summary>
public static BatchCallStatus? ToEnum(string value)
{
return value switch
{
"pending" => BatchCallStatus.Pending,
"in_progress" => BatchCallStatus.InProgress,
"completed" => BatchCallStatus.Completed,
"failed" => BatchCallStatus.Failed,
"cancelled" => BatchCallStatus.Cancelled,
_ => null,
};
}
}
}
Loading