mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 12:37:46 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.557.0
This commit is contained in:
@@ -9,12 +9,191 @@
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
|
||||
public enum GetLibraryItemsOptimizedForStreaming
|
||||
|
||||
public class GetLibraryItemsOptimizedForStreamingType
|
||||
{
|
||||
Disable = 0,
|
||||
Enable = 1,
|
||||
private GetLibraryItemsOptimizedForStreamingType(string value) { Value = value; }
|
||||
|
||||
public string Value { get; private set; }
|
||||
public static GetLibraryItemsOptimizedForStreamingType OptimizedForStreaming1 { get { return new GetLibraryItemsOptimizedForStreamingType("optimizedForStreaming_1"); } }
|
||||
|
||||
public static GetLibraryItemsOptimizedForStreamingType Boolean { get { return new GetLibraryItemsOptimizedForStreamingType("boolean"); } }
|
||||
|
||||
public static GetLibraryItemsOptimizedForStreamingType Null { get { return new GetLibraryItemsOptimizedForStreamingType("null"); } }
|
||||
|
||||
public override string ToString() { return Value; }
|
||||
public static implicit operator String(GetLibraryItemsOptimizedForStreamingType v) { return v.Value; }
|
||||
public static GetLibraryItemsOptimizedForStreamingType FromString(string v) {
|
||||
switch(v) {
|
||||
case "optimizedForStreaming_1": return OptimizedForStreaming1;
|
||||
case "boolean": return Boolean;
|
||||
case "null": return Null;
|
||||
default: throw new ArgumentException("Invalid value for GetLibraryItemsOptimizedForStreamingType");
|
||||
}
|
||||
}
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Value.Equals(((GetLibraryItemsOptimizedForStreamingType)obj).Value);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Value.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(GetLibraryItemsOptimizedForStreaming.GetLibraryItemsOptimizedForStreamingConverter))]
|
||||
public class GetLibraryItemsOptimizedForStreaming {
|
||||
public GetLibraryItemsOptimizedForStreaming(GetLibraryItemsOptimizedForStreamingType type) {
|
||||
Type = type;
|
||||
}
|
||||
|
||||
[SpeakeasyMetadata("form:explode=true")]
|
||||
public OptimizedForStreaming1? OptimizedForStreaming1 { get; set; }
|
||||
|
||||
[SpeakeasyMetadata("form:explode=true")]
|
||||
public bool? Boolean { get; set; }
|
||||
|
||||
public GetLibraryItemsOptimizedForStreamingType Type { get; set; }
|
||||
|
||||
|
||||
public static GetLibraryItemsOptimizedForStreaming CreateOptimizedForStreaming1(OptimizedForStreaming1 optimizedForStreaming1) {
|
||||
GetLibraryItemsOptimizedForStreamingType typ = GetLibraryItemsOptimizedForStreamingType.OptimizedForStreaming1;
|
||||
|
||||
GetLibraryItemsOptimizedForStreaming res = new GetLibraryItemsOptimizedForStreaming(typ);
|
||||
res.OptimizedForStreaming1 = optimizedForStreaming1;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static GetLibraryItemsOptimizedForStreaming CreateBoolean(bool boolean) {
|
||||
GetLibraryItemsOptimizedForStreamingType typ = GetLibraryItemsOptimizedForStreamingType.Boolean;
|
||||
|
||||
GetLibraryItemsOptimizedForStreaming res = new GetLibraryItemsOptimizedForStreaming(typ);
|
||||
res.Boolean = boolean;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static GetLibraryItemsOptimizedForStreaming CreateNull() {
|
||||
GetLibraryItemsOptimizedForStreamingType typ = GetLibraryItemsOptimizedForStreamingType.Null;
|
||||
return new GetLibraryItemsOptimizedForStreaming(typ);
|
||||
}
|
||||
|
||||
public class GetLibraryItemsOptimizedForStreamingConverter : JsonConverter
|
||||
{
|
||||
|
||||
public override bool CanConvert(System.Type objectType) => objectType == typeof(GetLibraryItemsOptimizedForStreaming);
|
||||
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override object? ReadJson(JsonReader reader, System.Type objectType, object? existingValue, JsonSerializer serializer)
|
||||
{
|
||||
var json = JRaw.Create(reader).ToString();
|
||||
if (json == "null")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var fallbackCandidates = new List<(System.Type, object, string)>();
|
||||
|
||||
try
|
||||
{
|
||||
return new GetLibraryItemsOptimizedForStreaming(GetLibraryItemsOptimizedForStreamingType.OptimizedForStreaming1)
|
||||
{
|
||||
OptimizedForStreaming1 = ResponseBodyDeserializer.DeserializeUndiscriminatedUnionMember<OptimizedForStreaming1>(json)
|
||||
};
|
||||
}
|
||||
catch (ResponseBodyDeserializer.MissingMemberException)
|
||||
{
|
||||
fallbackCandidates.Add((typeof(OptimizedForStreaming1), new GetLibraryItemsOptimizedForStreaming(GetLibraryItemsOptimizedForStreamingType.OptimizedForStreaming1), "OptimizedForStreaming1"));
|
||||
}
|
||||
catch (ResponseBodyDeserializer.DeserializationException)
|
||||
{
|
||||
// try next option
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var converted = Convert.ToBoolean(json);
|
||||
return new GetLibraryItemsOptimizedForStreaming(GetLibraryItemsOptimizedForStreamingType.Boolean)
|
||||
{
|
||||
Boolean = converted
|
||||
};
|
||||
}
|
||||
catch (System.FormatException)
|
||||
{
|
||||
// try next option
|
||||
}
|
||||
|
||||
if (fallbackCandidates.Count > 0)
|
||||
{
|
||||
fallbackCandidates.Sort((a, b) => ResponseBodyDeserializer.CompareFallbackCandidates(a.Item1, b.Item1, json));
|
||||
foreach(var (deserializationType, returnObject, propertyName) in fallbackCandidates)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ResponseBodyDeserializer.DeserializeUndiscriminatedUnionFallback(deserializationType, returnObject, propertyName, json);
|
||||
}
|
||||
catch (ResponseBodyDeserializer.DeserializationException)
|
||||
{
|
||||
// try next fallback option
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException("Could not deserialize into any supported types.");
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||
{
|
||||
if (value == null) {
|
||||
writer.WriteRawValue("null");
|
||||
return;
|
||||
}
|
||||
GetLibraryItemsOptimizedForStreaming res = (GetLibraryItemsOptimizedForStreaming)value;
|
||||
if (GetLibraryItemsOptimizedForStreamingType.FromString(res.Type).Equals(GetLibraryItemsOptimizedForStreamingType.Null))
|
||||
{
|
||||
writer.WriteRawValue("null");
|
||||
return;
|
||||
}
|
||||
if (res.OptimizedForStreaming1 != null)
|
||||
{
|
||||
writer.WriteRawValue(Utilities.SerializeJSON(res.OptimizedForStreaming1));
|
||||
return;
|
||||
}
|
||||
if (res.Boolean != null)
|
||||
{
|
||||
writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user