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 @@ -324,24 +324,24 @@ partial void ProcessAssistantControllerRemoveResponseContent(
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
//
// One of its versions is pinned (see AssistantPinnedConflictResponseDTO), or Vapi Agents manages the assistant (see AssistantManagedConflictResponseDTO).
if ((int)__response.StatusCode == 409)
{
string? __content_409 = null;
global::System.Exception? __exception_409 = null;
global::Vapi.AssistantPinnedConflictResponseDTO? __value_409 = null;
global::Vapi.AssistantControllerRemoveResponse? __value_409 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_409 = global::Vapi.AssistantPinnedConflictResponseDTO.FromJson(__content_409, JsonSerializerContext);
__value_409 = global::Vapi.AssistantControllerRemoveResponse.FromJson(__content_409, JsonSerializerContext);
}
else
{
__content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_409 = global::Vapi.AssistantPinnedConflictResponseDTO.FromJson(__content_409, JsonSerializerContext);
__value_409 = global::Vapi.AssistantControllerRemoveResponse.FromJson(__content_409, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
Expand All @@ -350,7 +350,7 @@ partial void ProcessAssistantControllerRemoveResponseContent(
}


throw global::Vapi.ApiException<global::Vapi.AssistantPinnedConflictResponseDTO>.Create(
throw global::Vapi.ApiException<global::Vapi.AssistantControllerRemoveResponse?>.Create(
statusCode: __response.StatusCode,
message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_409,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,43 @@ partial void ProcessAssistantControllerUpdateResponseContent(
retryReason: global::System.String.Empty,
cancellationToken: __effectiveCancellationToken)).ConfigureAwait(false);
}
// Vapi Agents manages the assistant (see AssistantManagedConflictResponseDTO). Other 409s on this route carry a plain message instead.
if ((int)__response.StatusCode == 409)
{
string? __content_409 = null;
global::System.Exception? __exception_409 = null;
global::Vapi.AssistantManagedConflictResponseDTO? __value_409 = null;
try
{
if (__effectiveReadResponseAsString)
{
__content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);
__value_409 = global::Vapi.AssistantManagedConflictResponseDTO.FromJson(__content_409, JsonSerializerContext);
}
else
{
__content_409 = await __response.Content.ReadAsStringAsync(__effectiveCancellationToken).ConfigureAwait(false);

__value_409 = global::Vapi.AssistantManagedConflictResponseDTO.FromJson(__content_409, JsonSerializerContext);
}
}
catch (global::System.Exception __ex)
{
__exception_409 = __ex;
}


throw global::Vapi.ApiException<global::Vapi.AssistantManagedConflictResponseDTO>.Create(
statusCode: __response.StatusCode,
message: __content_409 ?? __response.ReasonPhrase ?? string.Empty,
innerException: __exception_409,
responseBody: __content_409,
responseObject: __value_409,
responseHeaders: global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
h => h.Value));
}

if (__effectiveReadResponseAsString)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#nullable enable
#pragma warning disable CS0618 // Type or member is obsolete

namespace Vapi.JsonConverters
{
/// <inheritdoc />
public class AssistantControllerRemoveResponseJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Vapi.AssistantControllerRemoveResponse>
{
/// <inheritdoc />
public override global::Vapi.AssistantControllerRemoveResponse Read(
ref global::System.Text.Json.Utf8JsonReader reader,
global::System.Type typeToConvert,
global::System.Text.Json.JsonSerializerOptions options)
{
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");


var readerCopy = reader;
var discriminatorTypeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Vapi.AssistantControllerRemoveResponseDiscriminator), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Vapi.AssistantControllerRemoveResponseDiscriminator> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Vapi.AssistantControllerRemoveResponseDiscriminator)}");
var discriminator = global::System.Text.Json.JsonSerializer.Deserialize(ref readerCopy, discriminatorTypeInfo);

global::Vapi.AssistantPinnedConflictResponseDTO? assistantPinned = default;
if (discriminator?.Error == global::Vapi.AssistantControllerRemoveResponseDiscriminatorError.AssistantPinned)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Vapi.AssistantPinnedConflictResponseDTO), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Vapi.AssistantPinnedConflictResponseDTO> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Vapi.AssistantPinnedConflictResponseDTO)}");
assistantPinned = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}
global::Vapi.AssistantManagedConflictResponseDTO? assistantManagedByVapiAgents = default;
if (discriminator?.Error == global::Vapi.AssistantControllerRemoveResponseDiscriminatorError.AssistantManagedByVapiAgents)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Vapi.AssistantManagedConflictResponseDTO), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Vapi.AssistantManagedConflictResponseDTO> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {nameof(global::Vapi.AssistantManagedConflictResponseDTO)}");
assistantManagedByVapiAgents = global::System.Text.Json.JsonSerializer.Deserialize(ref reader, typeInfo);
}

var __value = new global::Vapi.AssistantControllerRemoveResponse(
discriminator?.Error,
assistantPinned,

assistantManagedByVapiAgents
);

return __value;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Vapi.AssistantControllerRemoveResponse value,
global::System.Text.Json.JsonSerializerOptions options)
{
options = options ?? throw new global::System.ArgumentNullException(nameof(options));
var typeInfoResolver = options.TypeInfoResolver ?? throw new global::System.InvalidOperationException("TypeInfoResolver is not set.");

if (value.IsAssistantPinned)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Vapi.AssistantPinnedConflictResponseDTO), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Vapi.AssistantPinnedConflictResponseDTO?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Vapi.AssistantPinnedConflictResponseDTO).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickAssistantPinned(), typeInfo);
}
else if (value.IsAssistantManagedByVapiAgents)
{
var typeInfo = typeInfoResolver.GetTypeInfo(typeof(global::Vapi.AssistantManagedConflictResponseDTO), options) as global::System.Text.Json.Serialization.Metadata.JsonTypeInfo<global::Vapi.AssistantManagedConflictResponseDTO?> ??
throw new global::System.InvalidOperationException($"Cannot get type info for {typeof(global::Vapi.AssistantManagedConflictResponseDTO).Name}");
global::System.Text.Json.JsonSerializer.Serialize(writer, value.PickAssistantManagedByVapiAgents(), typeInfo);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Vapi.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantControllerRemoveResponseDiscriminatorErrorJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Vapi.AssistantControllerRemoveResponseDiscriminatorError>
{
/// <inheritdoc />
public override global::Vapi.AssistantControllerRemoveResponseDiscriminatorError 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::Vapi.AssistantControllerRemoveResponseDiscriminatorErrorExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

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

namespace Vapi.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantControllerRemoveResponseDiscriminatorErrorNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Vapi.AssistantControllerRemoveResponseDiscriminatorError?>
{
/// <inheritdoc />
public override global::Vapi.AssistantControllerRemoveResponseDiscriminatorError? 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::Vapi.AssistantControllerRemoveResponseDiscriminatorErrorExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Vapi.AssistantControllerRemoveResponseDiscriminatorError? 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::Vapi.AssistantControllerRemoveResponseDiscriminatorErrorExtensions.ToValueString(value.Value));
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#nullable enable

namespace Vapi.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantManagedConflictResponseDTOErrorJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Vapi.AssistantManagedConflictResponseDTOError>
{
/// <inheritdoc />
public override global::Vapi.AssistantManagedConflictResponseDTOError 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::Vapi.AssistantManagedConflictResponseDTOErrorExtensions.ToEnum(stringValue) ?? default;
}

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

return default;
}

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

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

namespace Vapi.JsonConverters
{
/// <inheritdoc />
public sealed class AssistantManagedConflictResponseDTOErrorNullableJsonConverter : global::System.Text.Json.Serialization.JsonConverter<global::Vapi.AssistantManagedConflictResponseDTOError?>
{
/// <inheritdoc />
public override global::Vapi.AssistantManagedConflictResponseDTOError? 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::Vapi.AssistantManagedConflictResponseDTOErrorExtensions.ToEnum(stringValue);
}

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::Vapi.AssistantManagedConflictResponseDTOError? 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::Vapi.AssistantManagedConflictResponseDTOErrorExtensions.ToValueString(value.Value));
}
}
}
}
Loading
Loading