ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.193.0

This commit is contained in:
speakeasybot
2024-02-23 14:46:39 +00:00
parent 966fd34307
commit 8fa47f9bef
117 changed files with 3662 additions and 1104 deletions

View File

@@ -15,24 +15,52 @@ namespace PlexAPI.Utils
using System.Net.Http.Headers;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Numerics;
using Newtonsoft.Json;
using NodaTime;
using System.Collections;
public class Utilities
{
public static string SerializeJSON(object obj)
public static JsonConverter[] GetJsonConverters(Type type, string format = "")
{
if (format == "string")
{
if (type == typeof(BigInteger))
{
return new JsonConverter[] { new BigIntSerializer() };
}
if (type == typeof(Decimal))
{
return new JsonConverter[] { new DecimalSerializer() };
}
}
return new JsonConverter[]
{
new IsoDateTimeSerializer(),
new EnumSerializer(),
};
}
public static string SerializeJSON(object obj, string format = "")
{
var type = obj.GetType();
if (IsList(obj))
{
type = type.GetGenericArguments().Single();
}
else if (IsDictionary(obj))
{
type = type.GetGenericArguments().Last();
}
return JsonConvert.SerializeObject(
obj,
new JsonSerializerSettings()
{
NullValueHandling = NullValueHandling.Ignore,
Converters = new JsonConverter[]
{
new IsoDateTimeSerializer(),
new EnumSerializer()
}
Converters = GetJsonConverters(type, format)
}
);
}
@@ -82,11 +110,11 @@ namespace PlexAPI.Utils
}
}
public static bool IsPrimitive(object obj) => obj != null && obj.GetType().IsPrimitive;
public static bool IsPrimitive(object? obj) => obj != null && obj.GetType().IsPrimitive;
public static bool IsEnum(object obj) => obj != null && obj.GetType().IsEnum;
public static bool IsEnum(object? obj) => obj != null && obj.GetType().IsEnum;
public static bool IsDate(object obj) =>
public static bool IsDate(object? obj) =>
obj != null && (obj.GetType() == typeof(DateTime) || obj.GetType() == typeof(LocalDate));
private static string StripSurroundingQuotes(string input)
@@ -238,4 +266,4 @@ namespace PlexAPI.Utils
return template;
}
}
}
}