Files
plexcsharp/LukeHagar/PlexAPI/SDK/Models/Requests/Status.cs

76 lines
2.3 KiB
C#

//------------------------------------------------------------------------------
// <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.Utils;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Current friend request status
/// </summary>
[JsonConverter(typeof(OpenEnumConverter))]
public class Status : IEquatable<Status>
{
public static readonly Status Accepted = new Status("accepted");
private static readonly Dictionary <string, Status> _knownValues =
new Dictionary <string, Status> ()
{
["accepted"] = Accepted
};
private static readonly ConcurrentDictionary<string, Status> _values =
new ConcurrentDictionary<string, Status>(_knownValues);
private Status(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static Status Of(string value)
{
return _values.GetOrAdd(value, _ => new Status(value));
}
public static implicit operator Status(string value) => Of(value);
public static implicit operator string(Status status) => status.Value;
public static Status[] 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 Status);
public bool Equals(Status? 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();
}
}