Skip to content

Commit

Permalink
feat: Updated OpenAPI spec
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 19, 2024
1 parent 7561113 commit 2a1ba5d
Show file tree
Hide file tree
Showing 35 changed files with 2,919 additions and 747 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#nullable enable

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

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

return default;
}

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

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

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

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

return default;
}

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

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

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

return default;
}

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

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

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

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

return default;
}

/// <inheritdoc />
public override void Write(
global::System.Text.Json.Utf8JsonWriter writer,
global::OpenAI.ProjectRateLimitObject? 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::OpenAI.ProjectRateLimitObjectExtensions.ToValueString(value.Value));
}
}
}
}
4 changes: 4 additions & 0 deletions src/libs/OpenAI/Generated/JsonSerializerContext.g.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,10 @@ namespace OpenAI
typeof(global::OpenAI.JsonConverters.ProjectApiKeyListResponseObjectNullableJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectListResponseObjectJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectListResponseObjectNullableJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectRateLimitObjectJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectRateLimitObjectNullableJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectRateLimitListResponseObjectJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectRateLimitListResponseObjectNullableJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectServiceAccountApiKeyObjectJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectServiceAccountApiKeyObjectNullableJsonConverter),
typeof(global::OpenAI.JsonConverters.ProjectServiceAccountCreateResponseObjectJsonConverter),
Expand Down
Loading

0 comments on commit 2a1ba5d

Please sign in to comment.