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.487.1
This commit is contained in:
@@ -0,0 +1,199 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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
|
||||
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 class GetMediaMetaDataLibraryOptimizedForStreamingType
|
||||
{
|
||||
private GetMediaMetaDataLibraryOptimizedForStreamingType(string value) { Value = value; }
|
||||
|
||||
public string Value { get; private set; }
|
||||
public static GetMediaMetaDataLibraryOptimizedForStreamingType GetMediaMetaDataOptimizedForStreaming1 { get { return new GetMediaMetaDataLibraryOptimizedForStreamingType("get-media-meta-data_optimizedForStreaming_1"); } }
|
||||
|
||||
public static GetMediaMetaDataLibraryOptimizedForStreamingType Boolean { get { return new GetMediaMetaDataLibraryOptimizedForStreamingType("boolean"); } }
|
||||
|
||||
public static GetMediaMetaDataLibraryOptimizedForStreamingType Null { get { return new GetMediaMetaDataLibraryOptimizedForStreamingType("null"); } }
|
||||
|
||||
public override string ToString() { return Value; }
|
||||
public static implicit operator String(GetMediaMetaDataLibraryOptimizedForStreamingType v) { return v.Value; }
|
||||
public static GetMediaMetaDataLibraryOptimizedForStreamingType FromString(string v) {
|
||||
switch(v) {
|
||||
case "get-media-meta-data_optimizedForStreaming_1": return GetMediaMetaDataOptimizedForStreaming1;
|
||||
case "boolean": return Boolean;
|
||||
case "null": return Null;
|
||||
default: throw new ArgumentException("Invalid value for GetMediaMetaDataLibraryOptimizedForStreamingType");
|
||||
}
|
||||
}
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Value.Equals(((GetMediaMetaDataLibraryOptimizedForStreamingType)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(GetMediaMetaDataLibraryOptimizedForStreaming.GetMediaMetaDataLibraryOptimizedForStreamingConverter))]
|
||||
public class GetMediaMetaDataLibraryOptimizedForStreaming {
|
||||
public GetMediaMetaDataLibraryOptimizedForStreaming(GetMediaMetaDataLibraryOptimizedForStreamingType type) {
|
||||
Type = type;
|
||||
}
|
||||
|
||||
[SpeakeasyMetadata("form:explode=true")]
|
||||
public GetMediaMetaDataOptimizedForStreaming1? GetMediaMetaDataOptimizedForStreaming1 { get; set; }
|
||||
|
||||
[SpeakeasyMetadata("form:explode=true")]
|
||||
public bool? Boolean { get; set; }
|
||||
|
||||
public GetMediaMetaDataLibraryOptimizedForStreamingType Type { get; set; }
|
||||
|
||||
|
||||
public static GetMediaMetaDataLibraryOptimizedForStreaming CreateGetMediaMetaDataOptimizedForStreaming1(GetMediaMetaDataOptimizedForStreaming1 getMediaMetaDataOptimizedForStreaming1) {
|
||||
GetMediaMetaDataLibraryOptimizedForStreamingType typ = GetMediaMetaDataLibraryOptimizedForStreamingType.GetMediaMetaDataOptimizedForStreaming1;
|
||||
|
||||
GetMediaMetaDataLibraryOptimizedForStreaming res = new GetMediaMetaDataLibraryOptimizedForStreaming(typ);
|
||||
res.GetMediaMetaDataOptimizedForStreaming1 = getMediaMetaDataOptimizedForStreaming1;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static GetMediaMetaDataLibraryOptimizedForStreaming CreateBoolean(bool boolean) {
|
||||
GetMediaMetaDataLibraryOptimizedForStreamingType typ = GetMediaMetaDataLibraryOptimizedForStreamingType.Boolean;
|
||||
|
||||
GetMediaMetaDataLibraryOptimizedForStreaming res = new GetMediaMetaDataLibraryOptimizedForStreaming(typ);
|
||||
res.Boolean = boolean;
|
||||
return res;
|
||||
}
|
||||
|
||||
public static GetMediaMetaDataLibraryOptimizedForStreaming CreateNull() {
|
||||
GetMediaMetaDataLibraryOptimizedForStreamingType typ = GetMediaMetaDataLibraryOptimizedForStreamingType.Null;
|
||||
return new GetMediaMetaDataLibraryOptimizedForStreaming(typ);
|
||||
}
|
||||
|
||||
public class GetMediaMetaDataLibraryOptimizedForStreamingConverter : JsonConverter
|
||||
{
|
||||
|
||||
public override bool CanConvert(System.Type objectType) => objectType == typeof(GetMediaMetaDataLibraryOptimizedForStreaming);
|
||||
|
||||
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 GetMediaMetaDataLibraryOptimizedForStreaming(GetMediaMetaDataLibraryOptimizedForStreamingType.GetMediaMetaDataOptimizedForStreaming1)
|
||||
{
|
||||
GetMediaMetaDataOptimizedForStreaming1 = ResponseBodyDeserializer.DeserializeUndiscriminatedUnionMember<GetMediaMetaDataOptimizedForStreaming1>(json)
|
||||
};
|
||||
}
|
||||
catch (ResponseBodyDeserializer.MissingMemberException)
|
||||
{
|
||||
fallbackCandidates.Add((typeof(GetMediaMetaDataOptimizedForStreaming1), new GetMediaMetaDataLibraryOptimizedForStreaming(GetMediaMetaDataLibraryOptimizedForStreamingType.GetMediaMetaDataOptimizedForStreaming1), "GetMediaMetaDataOptimizedForStreaming1"));
|
||||
}
|
||||
catch (ResponseBodyDeserializer.DeserializationException)
|
||||
{
|
||||
// try next option
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var converted = Convert.ToBoolean(json);
|
||||
return new GetMediaMetaDataLibraryOptimizedForStreaming(GetMediaMetaDataLibraryOptimizedForStreamingType.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;
|
||||
}
|
||||
GetMediaMetaDataLibraryOptimizedForStreaming res = (GetMediaMetaDataLibraryOptimizedForStreaming)value;
|
||||
if (GetMediaMetaDataLibraryOptimizedForStreamingType.FromString(res.Type).Equals(GetMediaMetaDataLibraryOptimizedForStreamingType.Null))
|
||||
{
|
||||
writer.WriteRawValue("null");
|
||||
return;
|
||||
}
|
||||
if (res.GetMediaMetaDataOptimizedForStreaming1 != null)
|
||||
{
|
||||
writer.WriteRawValue(Utilities.SerializeJSON(res.GetMediaMetaDataOptimizedForStreaming1));
|
||||
return;
|
||||
}
|
||||
if (res.Boolean != null)
|
||||
{
|
||||
writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean));
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user