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));
}
}
}

View File

@@ -265,48 +265,44 @@ namespace LukeHagar.PlexAPI.SDK.Utils
if (metadata.File)
{
if (!Utilities.IsClass(value))
if (Utilities.IsList(value))
{
// Handle array/list of files - similar to how normal lists are handled
foreach (var fileItem in (IList)value)
{
if (!Utilities.IsClass(fileItem))
{
throw new Exception(
"Cannot serialize multipart file from type " + fileItem.GetType().Name
);
}
var fileProps = fileItem.GetType().GetProperties();
var (fileName, content) = ExtractFileProperties(fileProps, fileItem);
string fieldName = (metadata.Name ?? prop.Name) + "[]";
var fileContent = new ByteArrayContent(content);
fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream");
formData.Add(fileContent, fieldName, fileName);
}
}
else if (Utilities.IsClass(value))
{
// Handle single file
var fileProps = value.GetType().GetProperties();
var (fileName, content) = ExtractFileProperties(fileProps, value);
string fieldName = metadata.Name;
var fileContent = new ByteArrayContent(content);
fileContent.Headers.ContentType = new System.Net.Http.Headers.MediaTypeHeaderValue("application/octet-stream");
formData.Add(fileContent, fieldName, fileName);
}
else
{
throw new Exception(
"Cannot serialize multipart file from type " + value.GetType().Name
);
}
var fileProps = value.GetType().GetProperties();
byte[]? content = null;
string fileName = "";
string fieldName = metadata.Name;
foreach (var fileProp in fileProps)
{
var fileMetadata = fileProp
.GetCustomAttribute<SpeakeasyMetadata>()
?.GetMultipartFormMetadata();
if (
fileMetadata == null
|| (!fileMetadata.Content && fileMetadata.Name == "")
)
{
continue;
}
if (fileMetadata.Content)
{
content = (byte[]?)fileProp.GetValue(value);
}
else
{
fileName = fileProp.GetValue(value)?.ToString() ?? "";
}
}
if (fileName == "" || content == null)
{
throw new Exception("Invalid multipart/form-data file");
}
formData.Add(new ByteArrayContent(content), fieldName, fileName);
}
else if (metadata.Json)
{
@@ -520,6 +516,42 @@ namespace LukeHagar.PlexAPI.SDK.Utils
}
}
private static (string fileName, byte[] content) ExtractFileProperties(PropertyInfo[] fileProps, object fileObject)
{
byte[]? content = null;
string fileName = "";
foreach (var fileProp in fileProps)
{
var fileMetadata = fileProp
.GetCustomAttribute<SpeakeasyMetadata>()
?.GetMultipartFormMetadata();
if (
fileMetadata == null
|| (!fileMetadata.Content && fileMetadata.Name == "")
)
{
continue;
}
if (fileMetadata.Content)
{
content = (byte[]?)fileProp.GetValue(fileObject);
}
else
{
fileName = fileProp.GetValue(fileObject)?.ToString() ?? "";
}
}
if (fileName == "" || content == null)
{
throw new Exception("Invalid multipart/form-data file");
}
return (fileName, content);
}
private static PropertyInfo? GetPropertyInfo(object value, string propertyName)
{
try