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 @@ -19,7 +19,7 @@ partial void ProcessGetSkillContentResponse(
partial void ProcessGetSkillContentResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);
ref byte[] content);

/// <summary>
/// Download a skill zip bundle by its ID.
Expand Down Expand Up @@ -89,16 +89,12 @@ partial void ProcessGetSkillContentResponseContent(

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

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetSkillContentResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
Expand All @@ -108,18 +104,15 @@ partial void ProcessGetSkillContentResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(byte[]), JsonSerializerContext) as byte[] ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return __content;
}
catch (global::System.Exception __ex)
{
throw new global::tryAGI.OpenAI.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
Expand All @@ -133,15 +126,13 @@ partial void ProcessGetSkillContentResponseContent(
{
__response.EnsureSuccessStatusCode();

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

return
await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(byte[]), JsonSerializerContext).ConfigureAwait(false) as byte[] ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return __content;
}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ partial void ProcessGetSkillVersionContentResponse(
partial void ProcessGetSkillVersionContentResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);
ref byte[] content);

/// <summary>
/// Download a skill version zip bundle.
Expand Down Expand Up @@ -97,16 +97,12 @@ partial void ProcessGetSkillVersionContentResponseContent(

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

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessGetSkillVersionContentResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
Expand All @@ -116,18 +112,15 @@ partial void ProcessGetSkillVersionContentResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(byte[]), JsonSerializerContext) as byte[] ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return __content;
}
catch (global::System.Exception __ex)
{
throw new global::tryAGI.OpenAI.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
Expand All @@ -141,15 +134,13 @@ partial void ProcessGetSkillVersionContentResponseContent(
{
__response.EnsureSuccessStatusCode();

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

return
await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(byte[]), JsonSerializerContext).ConfigureAwait(false) as byte[] ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return __content;
}
catch (global::System.Exception __ex)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ partial void ProcessRetrieveVideoContentResponse(
partial void ProcessRetrieveVideoContentResponseContent(
global::System.Net.Http.HttpClient httpClient,
global::System.Net.Http.HttpResponseMessage httpResponseMessage,
ref string content);
ref byte[] content);

/// <summary>
/// Download the generated video bytes or a derived preview asset.<br/>
Expand Down Expand Up @@ -99,16 +99,12 @@ partial void ProcessRetrieveVideoContentResponseContent(

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

ProcessResponseContent(
client: HttpClient,
response: __response,
content: ref __content);
ProcessRetrieveVideoContentResponseContent(
httpClient: HttpClient,
httpResponseMessage: __response,
Expand All @@ -118,18 +114,15 @@ partial void ProcessRetrieveVideoContentResponseContent(
{
__response.EnsureSuccessStatusCode();

return
global::System.Text.Json.JsonSerializer.Deserialize(__content, typeof(byte[]), JsonSerializerContext) as byte[] ??
throw new global::System.InvalidOperationException($"Response deserialization failed for \"{__content}\" ");
return __content;
}
catch (global::System.Exception __ex)
{
throw new global::tryAGI.OpenAI.ApiException(
message: __content ?? __response.ReasonPhrase ?? string.Empty,
message: __response.ReasonPhrase ?? string.Empty,
innerException: __ex,
statusCode: __response.StatusCode)
{
ResponseBody = __content,
ResponseHeaders = global::System.Linq.Enumerable.ToDictionary(
__response.Headers,
h => h.Key,
Expand All @@ -143,15 +136,13 @@ partial void ProcessRetrieveVideoContentResponseContent(
{
__response.EnsureSuccessStatusCode();

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

return
await global::System.Text.Json.JsonSerializer.DeserializeAsync(__content, typeof(byte[]), JsonSerializerContext).ConfigureAwait(false) as byte[] ??
throw new global::System.InvalidOperationException("Response deserialization failed.");
return __content;
}
catch (global::System.Exception __ex)
{
Expand Down
Loading