//------------------------------------------------------------------------------ // // 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. // //------------------------------------------------------------------------------ #nullable enable namespace LukeHagar.PlexAPI.SDK.Models.Requests { using LukeHagar.PlexAPI.SDK.Utils; using Newtonsoft.Json; using System; /// /// The error which could have occurred (or `good`) /// public enum ProcessingStateContext { [JsonProperty("good")] Good, [JsonProperty("sourceFileUnavailable")] SourceFileUnavailable, [JsonProperty("sourceFileMetadataError")] SourceFileMetadataError, [JsonProperty("clientProfileError")] ClientProfileError, [JsonProperty("ioError")] IoError, [JsonProperty("transcoderError")] TranscoderError, [JsonProperty("unknownError")] UnknownError, [JsonProperty("mediaAnalysisError")] MediaAnalysisError, [JsonProperty("downloadFailed")] DownloadFailed, [JsonProperty("accessDenied")] AccessDenied, [JsonProperty("cannotTranscode")] CannotTranscode, [JsonProperty("codecInstallError")] CodecInstallError, } public static class ProcessingStateContextExtension { public static string Value(this ProcessingStateContext value) { return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString(); } public static ProcessingStateContext ToEnum(this string value) { foreach(var field in typeof(ProcessingStateContext).GetFields()) { var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false); if (attributes.Length == 0) { continue; } var attribute = attributes[0] as JsonPropertyAttribute; if (attribute != null && attribute.PropertyName == value) { var enumVal = field.GetValue(null); if (enumVal is ProcessingStateContext) { return (ProcessingStateContext)enumVal; } } } throw new Exception($"Unknown value {value} for enum ProcessingStateContext"); } } }