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
126 changes: 124 additions & 2 deletions src/libs/RetellAI/Generated/RetellAI.Polyfills.g.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

#if !NET6_0_OR_GREATER
#nullable enable

namespace RetellAI
Expand All @@ -9,6 +8,7 @@ namespace RetellAI
/// </summary>
public static partial class AutoSdkPolyfills
{
#if !NET6_0_OR_GREATER
/// <summary>
///
/// </summary>
Expand Down Expand Up @@ -48,6 +48,128 @@ public static partial class AutoSdkPolyfills
content = content ?? throw new global::System.ArgumentNullException(nameof(content));
return content.ReadAsByteArrayAsync();
}
#endif

/// <summary>
/// Creates a JSON request content instance.
/// </summary>
public static global::System.Net.Http.HttpContent CreateJsonContent<T>(
T inputValue,
string mediaType,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions)
{
if (string.IsNullOrWhiteSpace(mediaType))
{
throw new global::System.ArgumentException("Media type is required.", nameof(mediaType));
}

#if NET5_0_OR_GREATER
return global::System.Net.Http.Json.JsonContent.Create(
inputValue: inputValue,
mediaType: new global::System.Net.Http.Headers.MediaTypeHeaderValue(mediaType),
options: jsonSerializerOptions);
#else
var json = global::System.Text.Json.JsonSerializer.Serialize(inputValue, jsonSerializerOptions);
var stringContent = new global::System.Net.Http.StringContent(
content: json,
encoding: global::System.Text.Encoding.UTF8);
stringContent.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(mediaType)
{
CharSet = global::System.Text.Encoding.UTF8.WebName,
};
return stringContent;
#endif
}

/// <summary>
/// Creates a JSON request content instance using a source-generated serializer context.
/// </summary>
public static global::System.Net.Http.HttpContent CreateJsonContent(
object? inputValue,
global::System.Type inputType,
string mediaType,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext)
{
inputType = inputType ?? throw new global::System.ArgumentNullException(nameof(inputType));
jsonSerializerContext = jsonSerializerContext ?? throw new global::System.ArgumentNullException(nameof(jsonSerializerContext));

if (string.IsNullOrWhiteSpace(mediaType))
{
throw new global::System.ArgumentException("Media type is required.", nameof(mediaType));
}

#if NET5_0_OR_GREATER
var jsonTypeInfo = jsonSerializerContext.GetTypeInfo(inputType) ??
throw new global::System.InvalidOperationException($"No JsonTypeInfo registered for '{inputType}'.");
return global::System.Net.Http.Json.JsonContent.Create(
inputValue: inputValue,
jsonTypeInfo: jsonTypeInfo,
mediaType: new global::System.Net.Http.Headers.MediaTypeHeaderValue(mediaType));
#else
var json = global::System.Text.Json.JsonSerializer.Serialize(
value: inputValue,
inputType: inputType,
jsonSerializerContext);
var stringContent = new global::System.Net.Http.StringContent(
content: json,
encoding: global::System.Text.Encoding.UTF8);
stringContent.Headers.ContentType = new global::System.Net.Http.Headers.MediaTypeHeaderValue(mediaType)
{
CharSet = global::System.Text.Encoding.UTF8.WebName,
};
return stringContent;
#endif
}

/// <summary>
/// Reads JSON content into the specified type using serializer options.
/// </summary>
public static async global::System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(
this global::System.Net.Http.HttpContent content,
global::System.Text.Json.JsonSerializerOptions? jsonSerializerOptions,
global::System.Threading.CancellationToken cancellationToken)
{
content = content ?? throw new global::System.ArgumentNullException(nameof(content));

#if NET5_0_OR_GREATER
return await global::System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsync<T>(
content,
jsonSerializerOptions,
cancellationToken).ConfigureAwait(false);
#else
using var stream = await AutoSdkPolyfills.ReadAsStreamAsync(content, cancellationToken).ConfigureAwait(false);
return await global::System.Text.Json.JsonSerializer.DeserializeAsync<T>(
utf8Json: stream,
options: jsonSerializerOptions,
cancellationToken: cancellationToken).ConfigureAwait(false);
#endif
}

/// <summary>
/// Reads JSON content into the specified type using a source-generated serializer context.
/// </summary>
public static async global::System.Threading.Tasks.Task<T?> ReadFromJsonAsync<T>(
this global::System.Net.Http.HttpContent content,
global::System.Text.Json.Serialization.JsonSerializerContext jsonSerializerContext,
global::System.Threading.CancellationToken cancellationToken)
{
content = content ?? throw new global::System.ArgumentNullException(nameof(content));
jsonSerializerContext = jsonSerializerContext ?? throw new global::System.ArgumentNullException(nameof(jsonSerializerContext));

#if NET5_0_OR_GREATER
return (T?)await global::System.Net.Http.Json.HttpContentJsonExtensions.ReadFromJsonAsync(
content,
typeof(T),
jsonSerializerContext,
cancellationToken).ConfigureAwait(false);
#else
using var stream = await AutoSdkPolyfills.ReadAsStreamAsync(content, cancellationToken).ConfigureAwait(false);
return (T?)await global::System.Text.Json.JsonSerializer.DeserializeAsync(
utf8Json: stream,
returnType: typeof(T),
jsonSerializerContext,
cancellationToken: cancellationToken).ConfigureAwait(false);
#endif
}
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ partial void ProcessAddCommunityVoiceResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ partial void ProcessAddKnowledgeBaseSourcesResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,6 @@ partial void ProcessCloneVoiceResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ partial void ProcessCreateAgentResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,6 @@ partial void ProcessCreateBatchCallResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ partial void ProcessCreateBatchTestResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ partial void ProcessCreateChatResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,6 @@ partial void ProcessCreateChatAgentResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ partial void ProcessCreateChatCompletionResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ partial void ProcessCreateConversationFlowResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ partial void ProcessCreateConversationFlowComponentResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,6 @@ partial void ProcessCreateKnowledgeBaseResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ partial void ProcessCreatePhoneCallResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ partial void ProcessCreatePhoneNumberResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ partial void ProcessCreateRetellLLMResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ partial void ProcessCreateSmsChatResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ partial void ProcessCreateTestCaseDefinitionResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ partial void ProcessCreateWebCallResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,6 @@ partial void ProcessDeleteAgentResponse(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,6 @@ partial void ProcessDeleteCallResponse(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,6 @@ partial void ProcessDeleteChatAgentResponse(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,13 +308,6 @@ partial void ProcessDeleteConversationFlowResponse(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -270,13 +270,6 @@ partial void ProcessDeleteConversationFlowComponentResponse(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,13 +272,6 @@ partial void ProcessDeleteKnowledgeBaseResponse(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ partial void ProcessDeleteKnowledgeBaseSourceResponseContent(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,13 +234,6 @@ partial void ProcessDeletePhoneNumberResponse(
try
{
__response.EnsureSuccessStatusCode();

using var __content = await __response.Content.ReadAsStreamAsync(
#if NET5_0_OR_GREATER
cancellationToken
#endif
).ConfigureAwait(false);

}
catch (global::System.Exception __ex)
{
Expand Down
Loading
Loading