ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.598.0

This commit is contained in:
speakeasybot
2025-08-06 00:28:40 +00:00
parent 4197184f92
commit d970db3b6f
128 changed files with 3498 additions and 1576 deletions

View File

@@ -0,0 +1,62 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
using System;
using Newtonsoft.Json;
namespace LukeHagar.PlexAPI.SDK.Utils
{
internal class OpenEnumConverter : JsonConverter
{
public override bool CanConvert(System.Type objectType)
{
return objectType.GetMethod("Of") != null && objectType.GetMethod("ToString") != null;
}
public override object? ReadJson(
JsonReader reader,
System.Type objectType,
object? existingValue,
JsonSerializer serializer
)
{
if (reader.Value == null)
{
return null;
}
var method = objectType.GetMethod("Of");
if (method == null)
{
throw new Exception($"Unable to find Of method on {objectType}");
}
try {
return method.Invoke(null, new[] { reader.Value });
} catch(System.Reflection.TargetInvocationException e) {
throw new Newtonsoft.Json.JsonSerializationException("Unable to convert value to open enum", e);
}
}
public override void WriteJson(JsonWriter writer, object? obj, JsonSerializer serializer)
{
if (obj == null)
{
writer.WriteValue("null");
return;
}
var valueProp = obj.GetType().GetProperty("Value");
if (valueProp == null)
{
throw new Exception($"{obj.GetType()} does not have a Value property");
}
writer.WriteValue(valueProp.GetValue(obj));
}
}
}