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

@@ -12,51 +12,69 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// The state of the media item
/// </summary>
public enum State
[JsonConverter(typeof(OpenEnumConverter))]
public class State : IEquatable<State>
{
[JsonProperty("playing")]
Playing,
[JsonProperty("paused")]
Paused,
[JsonProperty("stopped")]
Stopped,
}
public static readonly State Playing = new State("playing");
public static readonly State Paused = new State("paused");
public static readonly State Stopped = new State("stopped");
public static class StateExtension
{
public static string Value(this State value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static State ToEnum(this string value)
{
foreach(var field in typeof(State).GetFields())
private static readonly Dictionary <string, State> _knownValues =
new Dictionary <string, State> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["playing"] = Playing,
["paused"] = Paused,
["stopped"] = Stopped
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, State> _values =
new ConcurrentDictionary<string, State>(_knownValues);
if (enumVal is State)
{
return (State)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum State");
private State(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static State Of(string value)
{
return _values.GetOrAdd(value, _ => new State(value));
}
public static implicit operator State(string value) => Of(value);
public static implicit operator string(State state) => state.Value;
public static State[] Values()
{
return _values.Values.ToArray();
}
public override string ToString() => Value.ToString();
public bool IsKnown()
{
return _knownValues.ContainsKey(Value);
}
public override bool Equals(object? obj) => Equals(obj as State);
public bool Equals(State? other)
{
if (ReferenceEquals(this, other)) return true;
if (other is null) return false;
return string.Equals(Value, other.Value);
}
public override int GetHashCode() => Value.GetHashCode();
}
}