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>
/// type of playlist to create
/// </summary>
public enum CreatePlaylistQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class CreatePlaylistQueryParamType : IEquatable<CreatePlaylistQueryParamType>
{
[JsonProperty("audio")]
Audio,
[JsonProperty("video")]
Video,
[JsonProperty("photo")]
Photo,
}
public static readonly CreatePlaylistQueryParamType Audio = new CreatePlaylistQueryParamType("audio");
public static readonly CreatePlaylistQueryParamType Video = new CreatePlaylistQueryParamType("video");
public static readonly CreatePlaylistQueryParamType Photo = new CreatePlaylistQueryParamType("photo");
public static class CreatePlaylistQueryParamTypeExtension
{
public static string Value(this CreatePlaylistQueryParamType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static CreatePlaylistQueryParamType ToEnum(this string value)
{
foreach(var field in typeof(CreatePlaylistQueryParamType).GetFields())
private static readonly Dictionary <string, CreatePlaylistQueryParamType> _knownValues =
new Dictionary <string, CreatePlaylistQueryParamType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["audio"] = Audio,
["video"] = Video,
["photo"] = Photo
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, CreatePlaylistQueryParamType> _values =
new ConcurrentDictionary<string, CreatePlaylistQueryParamType>(_knownValues);
if (enumVal is CreatePlaylistQueryParamType)
{
return (CreatePlaylistQueryParamType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum CreatePlaylistQueryParamType");
private CreatePlaylistQueryParamType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static CreatePlaylistQueryParamType Of(string value)
{
return _values.GetOrAdd(value, _ => new CreatePlaylistQueryParamType(value));
}
public static implicit operator CreatePlaylistQueryParamType(string value) => Of(value);
public static implicit operator string(CreatePlaylistQueryParamType createplaylistqueryparamtype) => createplaylistqueryparamtype.Value;
public static CreatePlaylistQueryParamType[] 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 CreatePlaylistQueryParamType);
public bool Equals(CreatePlaylistQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class CreatePlaylistRequest
{

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>
/// Filter
/// </summary>
public enum Filter
[JsonConverter(typeof(OpenEnumConverter))]
public class Filter : IEquatable<Filter>
{
[JsonProperty("all")]
All,
[JsonProperty("available")]
Available,
[JsonProperty("released")]
Released,
}
public static readonly Filter All = new Filter("all");
public static readonly Filter Available = new Filter("available");
public static readonly Filter Released = new Filter("released");
public static class FilterExtension
{
public static string Value(this Filter value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static Filter ToEnum(this string value)
{
foreach(var field in typeof(Filter).GetFields())
private static readonly Dictionary <string, Filter> _knownValues =
new Dictionary <string, Filter> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["all"] = All,
["available"] = Available,
["released"] = Released
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, Filter> _values =
new ConcurrentDictionary<string, Filter>(_knownValues);
if (enumVal is Filter)
{
return (Filter)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum Filter");
private Filter(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static Filter Of(string value)
{
return _values.GetOrAdd(value, _ => new Filter(value));
}
public static implicit operator Filter(string value) => Of(value);
public static implicit operator string(Filter filter) => filter.Value;
public static Filter[] 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 Filter);
public bool Equals(Filter? 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();
}
}

View File

@@ -12,7 +12,10 @@ 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>
/// Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).<br/>
///
@@ -20,47 +23,62 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum FlattenSeasons
[JsonConverter(typeof(OpenEnumConverter))]
public class FlattenSeasons : IEquatable<FlattenSeasons>
{
[JsonProperty("-1")]
LibraryDefault,
[JsonProperty("0")]
Hide,
[JsonProperty("1")]
Show,
}
public static readonly FlattenSeasons LibraryDefault = new FlattenSeasons("-1");
public static readonly FlattenSeasons Hide = new FlattenSeasons("0");
public static readonly FlattenSeasons Show = new FlattenSeasons("1");
public static class FlattenSeasonsExtension
{
public static string Value(this FlattenSeasons value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static FlattenSeasons ToEnum(this string value)
{
foreach(var field in typeof(FlattenSeasons).GetFields())
private static readonly Dictionary <string, FlattenSeasons> _knownValues =
new Dictionary <string, FlattenSeasons> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["-1"] = LibraryDefault,
["0"] = Hide,
["1"] = Show
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, FlattenSeasons> _values =
new ConcurrentDictionary<string, FlattenSeasons>(_knownValues);
if (enumVal is FlattenSeasons)
{
return (FlattenSeasons)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum FlattenSeasons");
private FlattenSeasons(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static FlattenSeasons Of(string value)
{
return _values.GetOrAdd(value, _ => new FlattenSeasons(value));
}
public static implicit operator FlattenSeasons(string value) => Of(value);
public static implicit operator string(FlattenSeasons flattenseasons) => flattenseasons.Value;
public static FlattenSeasons[] 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 FlattenSeasons);
public bool Equals(FlattenSeasons? 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();
}
}

View File

@@ -12,7 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class Friend
{

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetActorsLibraryQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetActorsLibraryQueryParamType : IEquatable<GetActorsLibraryQueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly GetActorsLibraryQueryParamType Movie = new GetActorsLibraryQueryParamType(1);
public static readonly GetActorsLibraryQueryParamType TvShow = new GetActorsLibraryQueryParamType(2);
public static readonly GetActorsLibraryQueryParamType Season = new GetActorsLibraryQueryParamType(3);
public static readonly GetActorsLibraryQueryParamType Episode = new GetActorsLibraryQueryParamType(4);
public static readonly GetActorsLibraryQueryParamType Artist = new GetActorsLibraryQueryParamType(5);
public static readonly GetActorsLibraryQueryParamType Album = new GetActorsLibraryQueryParamType(6);
public static readonly GetActorsLibraryQueryParamType Track = new GetActorsLibraryQueryParamType(7);
public static readonly GetActorsLibraryQueryParamType PhotoAlbum = new GetActorsLibraryQueryParamType(8);
public static readonly GetActorsLibraryQueryParamType Photo = new GetActorsLibraryQueryParamType(9);
private static readonly Dictionary <long, GetActorsLibraryQueryParamType> _knownValues =
new Dictionary <long, GetActorsLibraryQueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, GetActorsLibraryQueryParamType> _values =
new ConcurrentDictionary<long, GetActorsLibraryQueryParamType>(_knownValues);
private GetActorsLibraryQueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static GetActorsLibraryQueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new GetActorsLibraryQueryParamType(value));
}
public static implicit operator GetActorsLibraryQueryParamType(long value) => Of(value);
public static implicit operator long(GetActorsLibraryQueryParamType getactorslibraryqueryparamtype) => getactorslibraryqueryparamtype.Value;
public static GetActorsLibraryQueryParamType[] 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 GetActorsLibraryQueryParamType);
public bool Equals(GetActorsLibraryQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetActorsLibraryRequest
{

View File

@@ -12,7 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class GetAllLibrariesDirectory
{

View File

@@ -12,65 +12,83 @@ 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 library type
/// </summary>
public enum GetAllLibrariesType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetAllLibrariesType : IEquatable<GetAllLibrariesType>
{
[JsonProperty("movie")]
Movie,
[JsonProperty("show")]
TvShow,
[JsonProperty("season")]
Season,
[JsonProperty("episode")]
Episode,
[JsonProperty("artist")]
Artist,
[JsonProperty("album")]
Album,
[JsonProperty("track")]
Track,
[JsonProperty("photoalbum")]
PhotoAlbum,
[JsonProperty("photo")]
Photo,
[JsonProperty("collection")]
Collection,
}
public static readonly GetAllLibrariesType Movie = new GetAllLibrariesType("movie");
public static readonly GetAllLibrariesType TvShow = new GetAllLibrariesType("show");
public static readonly GetAllLibrariesType Season = new GetAllLibrariesType("season");
public static readonly GetAllLibrariesType Episode = new GetAllLibrariesType("episode");
public static readonly GetAllLibrariesType Artist = new GetAllLibrariesType("artist");
public static readonly GetAllLibrariesType Album = new GetAllLibrariesType("album");
public static readonly GetAllLibrariesType Track = new GetAllLibrariesType("track");
public static readonly GetAllLibrariesType PhotoAlbum = new GetAllLibrariesType("photoalbum");
public static readonly GetAllLibrariesType Photo = new GetAllLibrariesType("photo");
public static readonly GetAllLibrariesType Collection = new GetAllLibrariesType("collection");
public static class GetAllLibrariesTypeExtension
{
public static string Value(this GetAllLibrariesType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetAllLibrariesType ToEnum(this string value)
{
foreach(var field in typeof(GetAllLibrariesType).GetFields())
private static readonly Dictionary <string, GetAllLibrariesType> _knownValues =
new Dictionary <string, GetAllLibrariesType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["movie"] = Movie,
["show"] = TvShow,
["season"] = Season,
["episode"] = Episode,
["artist"] = Artist,
["album"] = Album,
["track"] = Track,
["photoalbum"] = PhotoAlbum,
["photo"] = Photo,
["collection"] = Collection
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetAllLibrariesType> _values =
new ConcurrentDictionary<string, GetAllLibrariesType>(_knownValues);
if (enumVal is GetAllLibrariesType)
{
return (GetAllLibrariesType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetAllLibrariesType");
private GetAllLibrariesType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetAllLibrariesType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetAllLibrariesType(value));
}
public static implicit operator GetAllLibrariesType(string value) => Of(value);
public static implicit operator string(GetAllLibrariesType getalllibrariestype) => getalllibrariestype.Value;
public static GetAllLibrariesType[] 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 GetAllLibrariesType);
public bool Equals(GetAllLibrariesType? 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();
}
}

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetCountriesLibraryQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetCountriesLibraryQueryParamType : IEquatable<GetCountriesLibraryQueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly GetCountriesLibraryQueryParamType Movie = new GetCountriesLibraryQueryParamType(1);
public static readonly GetCountriesLibraryQueryParamType TvShow = new GetCountriesLibraryQueryParamType(2);
public static readonly GetCountriesLibraryQueryParamType Season = new GetCountriesLibraryQueryParamType(3);
public static readonly GetCountriesLibraryQueryParamType Episode = new GetCountriesLibraryQueryParamType(4);
public static readonly GetCountriesLibraryQueryParamType Artist = new GetCountriesLibraryQueryParamType(5);
public static readonly GetCountriesLibraryQueryParamType Album = new GetCountriesLibraryQueryParamType(6);
public static readonly GetCountriesLibraryQueryParamType Track = new GetCountriesLibraryQueryParamType(7);
public static readonly GetCountriesLibraryQueryParamType PhotoAlbum = new GetCountriesLibraryQueryParamType(8);
public static readonly GetCountriesLibraryQueryParamType Photo = new GetCountriesLibraryQueryParamType(9);
private static readonly Dictionary <long, GetCountriesLibraryQueryParamType> _knownValues =
new Dictionary <long, GetCountriesLibraryQueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, GetCountriesLibraryQueryParamType> _values =
new ConcurrentDictionary<long, GetCountriesLibraryQueryParamType>(_knownValues);
private GetCountriesLibraryQueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static GetCountriesLibraryQueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new GetCountriesLibraryQueryParamType(value));
}
public static implicit operator GetCountriesLibraryQueryParamType(long value) => Of(value);
public static implicit operator long(GetCountriesLibraryQueryParamType getcountrieslibraryqueryparamtype) => getcountrieslibraryqueryparamtype.Value;
public static GetCountriesLibraryQueryParamType[] 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 GetCountriesLibraryQueryParamType);
public bool Equals(GetCountriesLibraryQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetCountriesLibraryRequest
{

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetGenresLibraryQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetGenresLibraryQueryParamType : IEquatable<GetGenresLibraryQueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly GetGenresLibraryQueryParamType Movie = new GetGenresLibraryQueryParamType(1);
public static readonly GetGenresLibraryQueryParamType TvShow = new GetGenresLibraryQueryParamType(2);
public static readonly GetGenresLibraryQueryParamType Season = new GetGenresLibraryQueryParamType(3);
public static readonly GetGenresLibraryQueryParamType Episode = new GetGenresLibraryQueryParamType(4);
public static readonly GetGenresLibraryQueryParamType Artist = new GetGenresLibraryQueryParamType(5);
public static readonly GetGenresLibraryQueryParamType Album = new GetGenresLibraryQueryParamType(6);
public static readonly GetGenresLibraryQueryParamType Track = new GetGenresLibraryQueryParamType(7);
public static readonly GetGenresLibraryQueryParamType PhotoAlbum = new GetGenresLibraryQueryParamType(8);
public static readonly GetGenresLibraryQueryParamType Photo = new GetGenresLibraryQueryParamType(9);
private static readonly Dictionary <long, GetGenresLibraryQueryParamType> _knownValues =
new Dictionary <long, GetGenresLibraryQueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, GetGenresLibraryQueryParamType> _values =
new ConcurrentDictionary<long, GetGenresLibraryQueryParamType>(_knownValues);
private GetGenresLibraryQueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static GetGenresLibraryQueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new GetGenresLibraryQueryParamType(value));
}
public static implicit operator GetGenresLibraryQueryParamType(long value) => Of(value);
public static implicit operator long(GetGenresLibraryQueryParamType getgenreslibraryqueryparamtype) => getgenreslibraryqueryparamtype.Value;
public static GetGenresLibraryQueryParamType[] 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 GetGenresLibraryQueryParamType);
public bool Equals(GetGenresLibraryQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetGenresLibraryRequest
{

View File

@@ -12,6 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class GetLibraryItemsImage
{

View File

@@ -12,50 +12,68 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum GetLibraryItemsLibraryResponseType
{
[JsonProperty("coverPoster")]
CoverPoster,
[JsonProperty("background")]
Background,
[JsonProperty("snapshot")]
Snapshot,
[JsonProperty("clearLogo")]
ClearLogo,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class GetLibraryItemsLibraryResponseTypeExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class GetLibraryItemsLibraryResponseType : IEquatable<GetLibraryItemsLibraryResponseType>
{
public static string Value(this GetLibraryItemsLibraryResponseType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly GetLibraryItemsLibraryResponseType CoverPoster = new GetLibraryItemsLibraryResponseType("coverPoster");
public static readonly GetLibraryItemsLibraryResponseType Background = new GetLibraryItemsLibraryResponseType("background");
public static readonly GetLibraryItemsLibraryResponseType Snapshot = new GetLibraryItemsLibraryResponseType("snapshot");
public static readonly GetLibraryItemsLibraryResponseType ClearLogo = new GetLibraryItemsLibraryResponseType("clearLogo");
public static GetLibraryItemsLibraryResponseType ToEnum(this string value)
{
foreach(var field in typeof(GetLibraryItemsLibraryResponseType).GetFields())
private static readonly Dictionary <string, GetLibraryItemsLibraryResponseType> _knownValues =
new Dictionary <string, GetLibraryItemsLibraryResponseType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["coverPoster"] = CoverPoster,
["background"] = Background,
["snapshot"] = Snapshot,
["clearLogo"] = ClearLogo
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetLibraryItemsLibraryResponseType> _values =
new ConcurrentDictionary<string, GetLibraryItemsLibraryResponseType>(_knownValues);
if (enumVal is GetLibraryItemsLibraryResponseType)
{
return (GetLibraryItemsLibraryResponseType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetLibraryItemsLibraryResponseType");
private GetLibraryItemsLibraryResponseType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetLibraryItemsLibraryResponseType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetLibraryItemsLibraryResponseType(value));
}
public static implicit operator GetLibraryItemsLibraryResponseType(string value) => Of(value);
public static implicit operator string(GetLibraryItemsLibraryResponseType getlibraryitemslibraryresponsetype) => getlibraryitemslibraryresponsetype.Value;
public static GetLibraryItemsLibraryResponseType[] 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 GetLibraryItemsLibraryResponseType);
public bool Equals(GetLibraryItemsLibraryResponseType? 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();
}
}

View File

@@ -13,7 +13,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using NodaTime;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Unknown<br/>

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetLibraryItemsQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetLibraryItemsQueryParamType : IEquatable<GetLibraryItemsQueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly GetLibraryItemsQueryParamType Movie = new GetLibraryItemsQueryParamType(1);
public static readonly GetLibraryItemsQueryParamType TvShow = new GetLibraryItemsQueryParamType(2);
public static readonly GetLibraryItemsQueryParamType Season = new GetLibraryItemsQueryParamType(3);
public static readonly GetLibraryItemsQueryParamType Episode = new GetLibraryItemsQueryParamType(4);
public static readonly GetLibraryItemsQueryParamType Artist = new GetLibraryItemsQueryParamType(5);
public static readonly GetLibraryItemsQueryParamType Album = new GetLibraryItemsQueryParamType(6);
public static readonly GetLibraryItemsQueryParamType Track = new GetLibraryItemsQueryParamType(7);
public static readonly GetLibraryItemsQueryParamType PhotoAlbum = new GetLibraryItemsQueryParamType(8);
public static readonly GetLibraryItemsQueryParamType Photo = new GetLibraryItemsQueryParamType(9);
private static readonly Dictionary <long, GetLibraryItemsQueryParamType> _knownValues =
new Dictionary <long, GetLibraryItemsQueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, GetLibraryItemsQueryParamType> _values =
new ConcurrentDictionary<long, GetLibraryItemsQueryParamType>(_knownValues);
private GetLibraryItemsQueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static GetLibraryItemsQueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new GetLibraryItemsQueryParamType(value));
}
public static implicit operator GetLibraryItemsQueryParamType(long value) => Of(value);
public static implicit operator long(GetLibraryItemsQueryParamType getlibraryitemsqueryparamtype) => getlibraryitemsqueryparamtype.Value;
public static GetLibraryItemsQueryParamType[] 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 GetLibraryItemsQueryParamType);
public bool Equals(GetLibraryItemsQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetLibraryItemsRequest
{

View File

@@ -12,7 +12,10 @@ 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 type of media content in the Plex library. This can represent videos, music, or photos.<br/>
///
@@ -20,61 +23,76 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetLibraryItemsType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetLibraryItemsType : IEquatable<GetLibraryItemsType>
{
[JsonProperty("movie")]
Movie,
[JsonProperty("show")]
TvShow,
[JsonProperty("season")]
Season,
[JsonProperty("episode")]
Episode,
[JsonProperty("artist")]
Artist,
[JsonProperty("album")]
Album,
[JsonProperty("track")]
Track,
[JsonProperty("photoalbum")]
PhotoAlbum,
[JsonProperty("photo")]
Photo,
[JsonProperty("collection")]
Collection,
}
public static readonly GetLibraryItemsType Movie = new GetLibraryItemsType("movie");
public static readonly GetLibraryItemsType TvShow = new GetLibraryItemsType("show");
public static readonly GetLibraryItemsType Season = new GetLibraryItemsType("season");
public static readonly GetLibraryItemsType Episode = new GetLibraryItemsType("episode");
public static readonly GetLibraryItemsType Artist = new GetLibraryItemsType("artist");
public static readonly GetLibraryItemsType Album = new GetLibraryItemsType("album");
public static readonly GetLibraryItemsType Track = new GetLibraryItemsType("track");
public static readonly GetLibraryItemsType PhotoAlbum = new GetLibraryItemsType("photoalbum");
public static readonly GetLibraryItemsType Photo = new GetLibraryItemsType("photo");
public static readonly GetLibraryItemsType Collection = new GetLibraryItemsType("collection");
public static class GetLibraryItemsTypeExtension
{
public static string Value(this GetLibraryItemsType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetLibraryItemsType ToEnum(this string value)
{
foreach(var field in typeof(GetLibraryItemsType).GetFields())
private static readonly Dictionary <string, GetLibraryItemsType> _knownValues =
new Dictionary <string, GetLibraryItemsType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["movie"] = Movie,
["show"] = TvShow,
["season"] = Season,
["episode"] = Episode,
["artist"] = Artist,
["album"] = Album,
["track"] = Track,
["photoalbum"] = PhotoAlbum,
["photo"] = Photo,
["collection"] = Collection
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetLibraryItemsType> _values =
new ConcurrentDictionary<string, GetLibraryItemsType>(_knownValues);
if (enumVal is GetLibraryItemsType)
{
return (GetLibraryItemsType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetLibraryItemsType");
private GetLibraryItemsType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetLibraryItemsType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetLibraryItemsType(value));
}
public static implicit operator GetLibraryItemsType(string value) => Of(value);
public static implicit operator string(GetLibraryItemsType getlibraryitemstype) => getlibraryitemstype.Value;
public static GetLibraryItemsType[] 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 GetLibraryItemsType);
public bool Equals(GetLibraryItemsType? 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();
}
}

View File

@@ -12,6 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class GetLibrarySectionsAllImage
{

View File

@@ -12,50 +12,68 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum GetLibrarySectionsAllLibraryResponseType
{
[JsonProperty("coverPoster")]
CoverPoster,
[JsonProperty("background")]
Background,
[JsonProperty("snapshot")]
Snapshot,
[JsonProperty("clearLogo")]
ClearLogo,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class GetLibrarySectionsAllLibraryResponseTypeExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class GetLibrarySectionsAllLibraryResponseType : IEquatable<GetLibrarySectionsAllLibraryResponseType>
{
public static string Value(this GetLibrarySectionsAllLibraryResponseType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly GetLibrarySectionsAllLibraryResponseType CoverPoster = new GetLibrarySectionsAllLibraryResponseType("coverPoster");
public static readonly GetLibrarySectionsAllLibraryResponseType Background = new GetLibrarySectionsAllLibraryResponseType("background");
public static readonly GetLibrarySectionsAllLibraryResponseType Snapshot = new GetLibrarySectionsAllLibraryResponseType("snapshot");
public static readonly GetLibrarySectionsAllLibraryResponseType ClearLogo = new GetLibrarySectionsAllLibraryResponseType("clearLogo");
public static GetLibrarySectionsAllLibraryResponseType ToEnum(this string value)
{
foreach(var field in typeof(GetLibrarySectionsAllLibraryResponseType).GetFields())
private static readonly Dictionary <string, GetLibrarySectionsAllLibraryResponseType> _knownValues =
new Dictionary <string, GetLibrarySectionsAllLibraryResponseType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["coverPoster"] = CoverPoster,
["background"] = Background,
["snapshot"] = Snapshot,
["clearLogo"] = ClearLogo
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetLibrarySectionsAllLibraryResponseType> _values =
new ConcurrentDictionary<string, GetLibrarySectionsAllLibraryResponseType>(_knownValues);
if (enumVal is GetLibrarySectionsAllLibraryResponseType)
{
return (GetLibrarySectionsAllLibraryResponseType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetLibrarySectionsAllLibraryResponseType");
private GetLibrarySectionsAllLibraryResponseType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetLibrarySectionsAllLibraryResponseType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetLibrarySectionsAllLibraryResponseType(value));
}
public static implicit operator GetLibrarySectionsAllLibraryResponseType(string value) => Of(value);
public static implicit operator string(GetLibrarySectionsAllLibraryResponseType getlibrarysectionsalllibraryresponsetype) => getlibrarysectionsalllibraryresponsetype.Value;
public static GetLibrarySectionsAllLibraryResponseType[] 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 GetLibrarySectionsAllLibraryResponseType);
public bool Equals(GetLibrarySectionsAllLibraryResponseType? 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();
}
}

View File

@@ -12,7 +12,10 @@ 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 type of media content in the Plex library. This can represent videos, music, or photos.<br/>
///
@@ -20,61 +23,76 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetLibrarySectionsAllLibraryType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetLibrarySectionsAllLibraryType : IEquatable<GetLibrarySectionsAllLibraryType>
{
[JsonProperty("movie")]
Movie,
[JsonProperty("show")]
TvShow,
[JsonProperty("season")]
Season,
[JsonProperty("episode")]
Episode,
[JsonProperty("artist")]
Artist,
[JsonProperty("album")]
Album,
[JsonProperty("track")]
Track,
[JsonProperty("photoalbum")]
PhotoAlbum,
[JsonProperty("photo")]
Photo,
[JsonProperty("collection")]
Collection,
}
public static readonly GetLibrarySectionsAllLibraryType Movie = new GetLibrarySectionsAllLibraryType("movie");
public static readonly GetLibrarySectionsAllLibraryType TvShow = new GetLibrarySectionsAllLibraryType("show");
public static readonly GetLibrarySectionsAllLibraryType Season = new GetLibrarySectionsAllLibraryType("season");
public static readonly GetLibrarySectionsAllLibraryType Episode = new GetLibrarySectionsAllLibraryType("episode");
public static readonly GetLibrarySectionsAllLibraryType Artist = new GetLibrarySectionsAllLibraryType("artist");
public static readonly GetLibrarySectionsAllLibraryType Album = new GetLibrarySectionsAllLibraryType("album");
public static readonly GetLibrarySectionsAllLibraryType Track = new GetLibrarySectionsAllLibraryType("track");
public static readonly GetLibrarySectionsAllLibraryType PhotoAlbum = new GetLibrarySectionsAllLibraryType("photoalbum");
public static readonly GetLibrarySectionsAllLibraryType Photo = new GetLibrarySectionsAllLibraryType("photo");
public static readonly GetLibrarySectionsAllLibraryType Collection = new GetLibrarySectionsAllLibraryType("collection");
public static class GetLibrarySectionsAllLibraryTypeExtension
{
public static string Value(this GetLibrarySectionsAllLibraryType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetLibrarySectionsAllLibraryType ToEnum(this string value)
{
foreach(var field in typeof(GetLibrarySectionsAllLibraryType).GetFields())
private static readonly Dictionary <string, GetLibrarySectionsAllLibraryType> _knownValues =
new Dictionary <string, GetLibrarySectionsAllLibraryType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["movie"] = Movie,
["show"] = TvShow,
["season"] = Season,
["episode"] = Episode,
["artist"] = Artist,
["album"] = Album,
["track"] = Track,
["photoalbum"] = PhotoAlbum,
["photo"] = Photo,
["collection"] = Collection
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetLibrarySectionsAllLibraryType> _values =
new ConcurrentDictionary<string, GetLibrarySectionsAllLibraryType>(_knownValues);
if (enumVal is GetLibrarySectionsAllLibraryType)
{
return (GetLibrarySectionsAllLibraryType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetLibrarySectionsAllLibraryType");
private GetLibrarySectionsAllLibraryType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetLibrarySectionsAllLibraryType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetLibrarySectionsAllLibraryType(value));
}
public static implicit operator GetLibrarySectionsAllLibraryType(string value) => Of(value);
public static implicit operator string(GetLibrarySectionsAllLibraryType getlibrarysectionsalllibrarytype) => getlibrarysectionsalllibrarytype.Value;
public static GetLibrarySectionsAllLibraryType[] 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 GetLibrarySectionsAllLibraryType);
public bool Equals(GetLibrarySectionsAllLibraryType? 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();
}
}

View File

@@ -13,7 +13,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using NodaTime;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Unknown<br/>

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetLibrarySectionsAllQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetLibrarySectionsAllQueryParamType : IEquatable<GetLibrarySectionsAllQueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly GetLibrarySectionsAllQueryParamType Movie = new GetLibrarySectionsAllQueryParamType(1);
public static readonly GetLibrarySectionsAllQueryParamType TvShow = new GetLibrarySectionsAllQueryParamType(2);
public static readonly GetLibrarySectionsAllQueryParamType Season = new GetLibrarySectionsAllQueryParamType(3);
public static readonly GetLibrarySectionsAllQueryParamType Episode = new GetLibrarySectionsAllQueryParamType(4);
public static readonly GetLibrarySectionsAllQueryParamType Artist = new GetLibrarySectionsAllQueryParamType(5);
public static readonly GetLibrarySectionsAllQueryParamType Album = new GetLibrarySectionsAllQueryParamType(6);
public static readonly GetLibrarySectionsAllQueryParamType Track = new GetLibrarySectionsAllQueryParamType(7);
public static readonly GetLibrarySectionsAllQueryParamType PhotoAlbum = new GetLibrarySectionsAllQueryParamType(8);
public static readonly GetLibrarySectionsAllQueryParamType Photo = new GetLibrarySectionsAllQueryParamType(9);
private static readonly Dictionary <long, GetLibrarySectionsAllQueryParamType> _knownValues =
new Dictionary <long, GetLibrarySectionsAllQueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, GetLibrarySectionsAllQueryParamType> _values =
new ConcurrentDictionary<long, GetLibrarySectionsAllQueryParamType>(_knownValues);
private GetLibrarySectionsAllQueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static GetLibrarySectionsAllQueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new GetLibrarySectionsAllQueryParamType(value));
}
public static implicit operator GetLibrarySectionsAllQueryParamType(long value) => Of(value);
public static implicit operator long(GetLibrarySectionsAllQueryParamType getlibrarysectionsallqueryparamtype) => getlibrarysectionsallqueryparamtype.Value;
public static GetLibrarySectionsAllQueryParamType[] 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 GetLibrarySectionsAllQueryParamType);
public bool Equals(GetLibrarySectionsAllQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetLibrarySectionsAllRequest
{

View File

@@ -12,6 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class GetMediaMetaDataImage
{

View File

@@ -12,50 +12,68 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum GetMediaMetaDataLibraryType
{
[JsonProperty("coverPoster")]
CoverPoster,
[JsonProperty("background")]
Background,
[JsonProperty("snapshot")]
Snapshot,
[JsonProperty("clearLogo")]
ClearLogo,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class GetMediaMetaDataLibraryTypeExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class GetMediaMetaDataLibraryType : IEquatable<GetMediaMetaDataLibraryType>
{
public static string Value(this GetMediaMetaDataLibraryType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly GetMediaMetaDataLibraryType CoverPoster = new GetMediaMetaDataLibraryType("coverPoster");
public static readonly GetMediaMetaDataLibraryType Background = new GetMediaMetaDataLibraryType("background");
public static readonly GetMediaMetaDataLibraryType Snapshot = new GetMediaMetaDataLibraryType("snapshot");
public static readonly GetMediaMetaDataLibraryType ClearLogo = new GetMediaMetaDataLibraryType("clearLogo");
public static GetMediaMetaDataLibraryType ToEnum(this string value)
{
foreach(var field in typeof(GetMediaMetaDataLibraryType).GetFields())
private static readonly Dictionary <string, GetMediaMetaDataLibraryType> _knownValues =
new Dictionary <string, GetMediaMetaDataLibraryType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["coverPoster"] = CoverPoster,
["background"] = Background,
["snapshot"] = Snapshot,
["clearLogo"] = ClearLogo
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetMediaMetaDataLibraryType> _values =
new ConcurrentDictionary<string, GetMediaMetaDataLibraryType>(_knownValues);
if (enumVal is GetMediaMetaDataLibraryType)
{
return (GetMediaMetaDataLibraryType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetMediaMetaDataLibraryType");
private GetMediaMetaDataLibraryType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetMediaMetaDataLibraryType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetMediaMetaDataLibraryType(value));
}
public static implicit operator GetMediaMetaDataLibraryType(string value) => Of(value);
public static implicit operator string(GetMediaMetaDataLibraryType getmediametadatalibrarytype) => getmediametadatalibrarytype.Value;
public static GetMediaMetaDataLibraryType[] 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 GetMediaMetaDataLibraryType);
public bool Equals(GetMediaMetaDataLibraryType? 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();
}
}

View File

@@ -13,7 +13,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using NodaTime;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Unknown<br/>

View File

@@ -12,7 +12,10 @@ 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 type of media content in the Plex library. This can represent videos, music, or photos.<br/>
///
@@ -20,61 +23,76 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetMediaMetaDataType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetMediaMetaDataType : IEquatable<GetMediaMetaDataType>
{
[JsonProperty("movie")]
Movie,
[JsonProperty("show")]
TvShow,
[JsonProperty("season")]
Season,
[JsonProperty("episode")]
Episode,
[JsonProperty("artist")]
Artist,
[JsonProperty("album")]
Album,
[JsonProperty("track")]
Track,
[JsonProperty("photoalbum")]
PhotoAlbum,
[JsonProperty("photo")]
Photo,
[JsonProperty("collection")]
Collection,
}
public static readonly GetMediaMetaDataType Movie = new GetMediaMetaDataType("movie");
public static readonly GetMediaMetaDataType TvShow = new GetMediaMetaDataType("show");
public static readonly GetMediaMetaDataType Season = new GetMediaMetaDataType("season");
public static readonly GetMediaMetaDataType Episode = new GetMediaMetaDataType("episode");
public static readonly GetMediaMetaDataType Artist = new GetMediaMetaDataType("artist");
public static readonly GetMediaMetaDataType Album = new GetMediaMetaDataType("album");
public static readonly GetMediaMetaDataType Track = new GetMediaMetaDataType("track");
public static readonly GetMediaMetaDataType PhotoAlbum = new GetMediaMetaDataType("photoalbum");
public static readonly GetMediaMetaDataType Photo = new GetMediaMetaDataType("photo");
public static readonly GetMediaMetaDataType Collection = new GetMediaMetaDataType("collection");
public static class GetMediaMetaDataTypeExtension
{
public static string Value(this GetMediaMetaDataType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetMediaMetaDataType ToEnum(this string value)
{
foreach(var field in typeof(GetMediaMetaDataType).GetFields())
private static readonly Dictionary <string, GetMediaMetaDataType> _knownValues =
new Dictionary <string, GetMediaMetaDataType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["movie"] = Movie,
["show"] = TvShow,
["season"] = Season,
["episode"] = Episode,
["artist"] = Artist,
["album"] = Album,
["track"] = Track,
["photoalbum"] = PhotoAlbum,
["photo"] = Photo,
["collection"] = Collection
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetMediaMetaDataType> _values =
new ConcurrentDictionary<string, GetMediaMetaDataType>(_knownValues);
if (enumVal is GetMediaMetaDataType)
{
return (GetMediaMetaDataType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetMediaMetaDataType");
private GetMediaMetaDataType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetMediaMetaDataType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetMediaMetaDataType(value));
}
public static implicit operator GetMediaMetaDataType(string value) => Of(value);
public static implicit operator string(GetMediaMetaDataType getmediametadatatype) => getmediametadatatype.Value;
public static GetMediaMetaDataType[] 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 GetMediaMetaDataType);
public bool Equals(GetMediaMetaDataType? 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();
}
}

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetPlaylistContentsQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetPlaylistContentsQueryParamType : IEquatable<GetPlaylistContentsQueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly GetPlaylistContentsQueryParamType Movie = new GetPlaylistContentsQueryParamType(1);
public static readonly GetPlaylistContentsQueryParamType TvShow = new GetPlaylistContentsQueryParamType(2);
public static readonly GetPlaylistContentsQueryParamType Season = new GetPlaylistContentsQueryParamType(3);
public static readonly GetPlaylistContentsQueryParamType Episode = new GetPlaylistContentsQueryParamType(4);
public static readonly GetPlaylistContentsQueryParamType Artist = new GetPlaylistContentsQueryParamType(5);
public static readonly GetPlaylistContentsQueryParamType Album = new GetPlaylistContentsQueryParamType(6);
public static readonly GetPlaylistContentsQueryParamType Track = new GetPlaylistContentsQueryParamType(7);
public static readonly GetPlaylistContentsQueryParamType PhotoAlbum = new GetPlaylistContentsQueryParamType(8);
public static readonly GetPlaylistContentsQueryParamType Photo = new GetPlaylistContentsQueryParamType(9);
private static readonly Dictionary <long, GetPlaylistContentsQueryParamType> _knownValues =
new Dictionary <long, GetPlaylistContentsQueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, GetPlaylistContentsQueryParamType> _values =
new ConcurrentDictionary<long, GetPlaylistContentsQueryParamType>(_knownValues);
private GetPlaylistContentsQueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static GetPlaylistContentsQueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new GetPlaylistContentsQueryParamType(value));
}
public static implicit operator GetPlaylistContentsQueryParamType(long value) => Of(value);
public static implicit operator long(GetPlaylistContentsQueryParamType getplaylistcontentsqueryparamtype) => getplaylistcontentsqueryparamtype.Value;
public static GetPlaylistContentsQueryParamType[] 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 GetPlaylistContentsQueryParamType);
public bool Equals(GetPlaylistContentsQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetPlaylistContentsRequest
{

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetPlaylistsRequest
{

View File

@@ -12,50 +12,68 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum GetRecentlyAddedHubsResponseType
{
[JsonProperty("coverPoster")]
CoverPoster,
[JsonProperty("background")]
Background,
[JsonProperty("snapshot")]
Snapshot,
[JsonProperty("clearLogo")]
ClearLogo,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class GetRecentlyAddedHubsResponseTypeExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class GetRecentlyAddedHubsResponseType : IEquatable<GetRecentlyAddedHubsResponseType>
{
public static string Value(this GetRecentlyAddedHubsResponseType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly GetRecentlyAddedHubsResponseType CoverPoster = new GetRecentlyAddedHubsResponseType("coverPoster");
public static readonly GetRecentlyAddedHubsResponseType Background = new GetRecentlyAddedHubsResponseType("background");
public static readonly GetRecentlyAddedHubsResponseType Snapshot = new GetRecentlyAddedHubsResponseType("snapshot");
public static readonly GetRecentlyAddedHubsResponseType ClearLogo = new GetRecentlyAddedHubsResponseType("clearLogo");
public static GetRecentlyAddedHubsResponseType ToEnum(this string value)
{
foreach(var field in typeof(GetRecentlyAddedHubsResponseType).GetFields())
private static readonly Dictionary <string, GetRecentlyAddedHubsResponseType> _knownValues =
new Dictionary <string, GetRecentlyAddedHubsResponseType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["coverPoster"] = CoverPoster,
["background"] = Background,
["snapshot"] = Snapshot,
["clearLogo"] = ClearLogo
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetRecentlyAddedHubsResponseType> _values =
new ConcurrentDictionary<string, GetRecentlyAddedHubsResponseType>(_knownValues);
if (enumVal is GetRecentlyAddedHubsResponseType)
{
return (GetRecentlyAddedHubsResponseType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetRecentlyAddedHubsResponseType");
private GetRecentlyAddedHubsResponseType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetRecentlyAddedHubsResponseType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetRecentlyAddedHubsResponseType(value));
}
public static implicit operator GetRecentlyAddedHubsResponseType(string value) => Of(value);
public static implicit operator string(GetRecentlyAddedHubsResponseType getrecentlyaddedhubsresponsetype) => getrecentlyaddedhubsresponsetype.Value;
public static GetRecentlyAddedHubsResponseType[] 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 GetRecentlyAddedHubsResponseType);
public bool Equals(GetRecentlyAddedHubsResponseType? 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();
}
}

View File

@@ -12,7 +12,10 @@ 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 type of media content in the Plex library. This can represent videos, music, or photos.<br/>
///
@@ -20,61 +23,76 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetRecentlyAddedHubsType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetRecentlyAddedHubsType : IEquatable<GetRecentlyAddedHubsType>
{
[JsonProperty("movie")]
Movie,
[JsonProperty("show")]
TvShow,
[JsonProperty("season")]
Season,
[JsonProperty("episode")]
Episode,
[JsonProperty("artist")]
Artist,
[JsonProperty("album")]
Album,
[JsonProperty("track")]
Track,
[JsonProperty("photoalbum")]
PhotoAlbum,
[JsonProperty("photo")]
Photo,
[JsonProperty("collection")]
Collection,
}
public static readonly GetRecentlyAddedHubsType Movie = new GetRecentlyAddedHubsType("movie");
public static readonly GetRecentlyAddedHubsType TvShow = new GetRecentlyAddedHubsType("show");
public static readonly GetRecentlyAddedHubsType Season = new GetRecentlyAddedHubsType("season");
public static readonly GetRecentlyAddedHubsType Episode = new GetRecentlyAddedHubsType("episode");
public static readonly GetRecentlyAddedHubsType Artist = new GetRecentlyAddedHubsType("artist");
public static readonly GetRecentlyAddedHubsType Album = new GetRecentlyAddedHubsType("album");
public static readonly GetRecentlyAddedHubsType Track = new GetRecentlyAddedHubsType("track");
public static readonly GetRecentlyAddedHubsType PhotoAlbum = new GetRecentlyAddedHubsType("photoalbum");
public static readonly GetRecentlyAddedHubsType Photo = new GetRecentlyAddedHubsType("photo");
public static readonly GetRecentlyAddedHubsType Collection = new GetRecentlyAddedHubsType("collection");
public static class GetRecentlyAddedHubsTypeExtension
{
public static string Value(this GetRecentlyAddedHubsType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetRecentlyAddedHubsType ToEnum(this string value)
{
foreach(var field in typeof(GetRecentlyAddedHubsType).GetFields())
private static readonly Dictionary <string, GetRecentlyAddedHubsType> _knownValues =
new Dictionary <string, GetRecentlyAddedHubsType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["movie"] = Movie,
["show"] = TvShow,
["season"] = Season,
["episode"] = Episode,
["artist"] = Artist,
["album"] = Album,
["track"] = Track,
["photoalbum"] = PhotoAlbum,
["photo"] = Photo,
["collection"] = Collection
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetRecentlyAddedHubsType> _values =
new ConcurrentDictionary<string, GetRecentlyAddedHubsType>(_knownValues);
if (enumVal is GetRecentlyAddedHubsType)
{
return (GetRecentlyAddedHubsType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetRecentlyAddedHubsType");
private GetRecentlyAddedHubsType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetRecentlyAddedHubsType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetRecentlyAddedHubsType(value));
}
public static implicit operator GetRecentlyAddedHubsType(string value) => Of(value);
public static implicit operator string(GetRecentlyAddedHubsType getrecentlyaddedhubstype) => getrecentlyaddedhubstype.Value;
public static GetRecentlyAddedHubsType[] 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 GetRecentlyAddedHubsType);
public bool Equals(GetRecentlyAddedHubsType? 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();
}
}

View File

@@ -12,6 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class GetRecentlyAddedImage
{

View File

@@ -11,7 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetRecentlyAddedLibraryRequest
{

View File

@@ -13,7 +13,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using NodaTime;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Unknown<br/>

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetRecentlyAddedRequest
{

View File

@@ -12,7 +12,10 @@ 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>
/// Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).<br/>
///
@@ -20,47 +23,62 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetSearchAllLibrariesFlattenSeasons
[JsonConverter(typeof(OpenEnumConverter))]
public class GetSearchAllLibrariesFlattenSeasons : IEquatable<GetSearchAllLibrariesFlattenSeasons>
{
[JsonProperty("-1")]
LibraryDefault,
[JsonProperty("0")]
Hide,
[JsonProperty("1")]
Show,
}
public static readonly GetSearchAllLibrariesFlattenSeasons LibraryDefault = new GetSearchAllLibrariesFlattenSeasons("-1");
public static readonly GetSearchAllLibrariesFlattenSeasons Hide = new GetSearchAllLibrariesFlattenSeasons("0");
public static readonly GetSearchAllLibrariesFlattenSeasons Show = new GetSearchAllLibrariesFlattenSeasons("1");
public static class GetSearchAllLibrariesFlattenSeasonsExtension
{
public static string Value(this GetSearchAllLibrariesFlattenSeasons value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetSearchAllLibrariesFlattenSeasons ToEnum(this string value)
{
foreach(var field in typeof(GetSearchAllLibrariesFlattenSeasons).GetFields())
private static readonly Dictionary <string, GetSearchAllLibrariesFlattenSeasons> _knownValues =
new Dictionary <string, GetSearchAllLibrariesFlattenSeasons> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["-1"] = LibraryDefault,
["0"] = Hide,
["1"] = Show
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetSearchAllLibrariesFlattenSeasons> _values =
new ConcurrentDictionary<string, GetSearchAllLibrariesFlattenSeasons>(_knownValues);
if (enumVal is GetSearchAllLibrariesFlattenSeasons)
{
return (GetSearchAllLibrariesFlattenSeasons)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetSearchAllLibrariesFlattenSeasons");
private GetSearchAllLibrariesFlattenSeasons(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetSearchAllLibrariesFlattenSeasons Of(string value)
{
return _values.GetOrAdd(value, _ => new GetSearchAllLibrariesFlattenSeasons(value));
}
public static implicit operator GetSearchAllLibrariesFlattenSeasons(string value) => Of(value);
public static implicit operator string(GetSearchAllLibrariesFlattenSeasons getsearchalllibrariesflattenseasons) => getsearchalllibrariesflattenseasons.Value;
public static GetSearchAllLibrariesFlattenSeasons[] 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 GetSearchAllLibrariesFlattenSeasons);
public bool Equals(GetSearchAllLibrariesFlattenSeasons? 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();
}
}

View File

@@ -12,6 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class GetSearchAllLibrariesImage
{

View File

@@ -12,50 +12,68 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum GetSearchAllLibrariesLibraryType
{
[JsonProperty("coverPoster")]
CoverPoster,
[JsonProperty("background")]
Background,
[JsonProperty("snapshot")]
Snapshot,
[JsonProperty("clearLogo")]
ClearLogo,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class GetSearchAllLibrariesLibraryTypeExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class GetSearchAllLibrariesLibraryType : IEquatable<GetSearchAllLibrariesLibraryType>
{
public static string Value(this GetSearchAllLibrariesLibraryType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly GetSearchAllLibrariesLibraryType CoverPoster = new GetSearchAllLibrariesLibraryType("coverPoster");
public static readonly GetSearchAllLibrariesLibraryType Background = new GetSearchAllLibrariesLibraryType("background");
public static readonly GetSearchAllLibrariesLibraryType Snapshot = new GetSearchAllLibrariesLibraryType("snapshot");
public static readonly GetSearchAllLibrariesLibraryType ClearLogo = new GetSearchAllLibrariesLibraryType("clearLogo");
public static GetSearchAllLibrariesLibraryType ToEnum(this string value)
{
foreach(var field in typeof(GetSearchAllLibrariesLibraryType).GetFields())
private static readonly Dictionary <string, GetSearchAllLibrariesLibraryType> _knownValues =
new Dictionary <string, GetSearchAllLibrariesLibraryType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["coverPoster"] = CoverPoster,
["background"] = Background,
["snapshot"] = Snapshot,
["clearLogo"] = ClearLogo
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetSearchAllLibrariesLibraryType> _values =
new ConcurrentDictionary<string, GetSearchAllLibrariesLibraryType>(_knownValues);
if (enumVal is GetSearchAllLibrariesLibraryType)
{
return (GetSearchAllLibrariesLibraryType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetSearchAllLibrariesLibraryType");
private GetSearchAllLibrariesLibraryType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetSearchAllLibrariesLibraryType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetSearchAllLibrariesLibraryType(value));
}
public static implicit operator GetSearchAllLibrariesLibraryType(string value) => Of(value);
public static implicit operator string(GetSearchAllLibrariesLibraryType getsearchalllibrarieslibrarytype) => getsearchalllibrarieslibrarytype.Value;
public static GetSearchAllLibrariesLibraryType[] 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 GetSearchAllLibrariesLibraryType);
public bool Equals(GetSearchAllLibrariesLibraryType? 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();
}
}

View File

@@ -13,7 +13,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using NodaTime;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Unknown<br/>

View File

@@ -11,7 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetSearchAllLibrariesRequest
{

View File

@@ -12,7 +12,10 @@ 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>
/// Setting that indicates the episode ordering for the show.<br/>
///
@@ -26,51 +29,66 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetSearchAllLibrariesShowOrdering
[JsonConverter(typeof(OpenEnumConverter))]
public class GetSearchAllLibrariesShowOrdering : IEquatable<GetSearchAllLibrariesShowOrdering>
{
[JsonProperty("None")]
None,
[JsonProperty("tmdbAiring")]
TmdbAiring,
[JsonProperty("aired")]
TvdbAired,
[JsonProperty("dvd")]
TvdbDvd,
[JsonProperty("absolute")]
TvdbAbsolute,
}
public static readonly GetSearchAllLibrariesShowOrdering None = new GetSearchAllLibrariesShowOrdering("None");
public static readonly GetSearchAllLibrariesShowOrdering TmdbAiring = new GetSearchAllLibrariesShowOrdering("tmdbAiring");
public static readonly GetSearchAllLibrariesShowOrdering TvdbAired = new GetSearchAllLibrariesShowOrdering("aired");
public static readonly GetSearchAllLibrariesShowOrdering TvdbDvd = new GetSearchAllLibrariesShowOrdering("dvd");
public static readonly GetSearchAllLibrariesShowOrdering TvdbAbsolute = new GetSearchAllLibrariesShowOrdering("absolute");
public static class GetSearchAllLibrariesShowOrderingExtension
{
public static string Value(this GetSearchAllLibrariesShowOrdering value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetSearchAllLibrariesShowOrdering ToEnum(this string value)
{
foreach(var field in typeof(GetSearchAllLibrariesShowOrdering).GetFields())
private static readonly Dictionary <string, GetSearchAllLibrariesShowOrdering> _knownValues =
new Dictionary <string, GetSearchAllLibrariesShowOrdering> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["None"] = None,
["tmdbAiring"] = TmdbAiring,
["aired"] = TvdbAired,
["dvd"] = TvdbDvd,
["absolute"] = TvdbAbsolute
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetSearchAllLibrariesShowOrdering> _values =
new ConcurrentDictionary<string, GetSearchAllLibrariesShowOrdering>(_knownValues);
if (enumVal is GetSearchAllLibrariesShowOrdering)
{
return (GetSearchAllLibrariesShowOrdering)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetSearchAllLibrariesShowOrdering");
private GetSearchAllLibrariesShowOrdering(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetSearchAllLibrariesShowOrdering Of(string value)
{
return _values.GetOrAdd(value, _ => new GetSearchAllLibrariesShowOrdering(value));
}
public static implicit operator GetSearchAllLibrariesShowOrdering(string value) => Of(value);
public static implicit operator string(GetSearchAllLibrariesShowOrdering getsearchalllibrariesshowordering) => getsearchalllibrariesshowordering.Value;
public static GetSearchAllLibrariesShowOrdering[] 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 GetSearchAllLibrariesShowOrdering);
public bool Equals(GetSearchAllLibrariesShowOrdering? 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();
}
}

View File

@@ -12,7 +12,10 @@ 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 type of media content in the Plex library. This can represent videos, music, or photos.<br/>
///
@@ -20,61 +23,76 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetSearchAllLibrariesType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetSearchAllLibrariesType : IEquatable<GetSearchAllLibrariesType>
{
[JsonProperty("movie")]
Movie,
[JsonProperty("show")]
TvShow,
[JsonProperty("season")]
Season,
[JsonProperty("episode")]
Episode,
[JsonProperty("artist")]
Artist,
[JsonProperty("album")]
Album,
[JsonProperty("track")]
Track,
[JsonProperty("photoalbum")]
PhotoAlbum,
[JsonProperty("photo")]
Photo,
[JsonProperty("collection")]
Collection,
}
public static readonly GetSearchAllLibrariesType Movie = new GetSearchAllLibrariesType("movie");
public static readonly GetSearchAllLibrariesType TvShow = new GetSearchAllLibrariesType("show");
public static readonly GetSearchAllLibrariesType Season = new GetSearchAllLibrariesType("season");
public static readonly GetSearchAllLibrariesType Episode = new GetSearchAllLibrariesType("episode");
public static readonly GetSearchAllLibrariesType Artist = new GetSearchAllLibrariesType("artist");
public static readonly GetSearchAllLibrariesType Album = new GetSearchAllLibrariesType("album");
public static readonly GetSearchAllLibrariesType Track = new GetSearchAllLibrariesType("track");
public static readonly GetSearchAllLibrariesType PhotoAlbum = new GetSearchAllLibrariesType("photoalbum");
public static readonly GetSearchAllLibrariesType Photo = new GetSearchAllLibrariesType("photo");
public static readonly GetSearchAllLibrariesType Collection = new GetSearchAllLibrariesType("collection");
public static class GetSearchAllLibrariesTypeExtension
{
public static string Value(this GetSearchAllLibrariesType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetSearchAllLibrariesType ToEnum(this string value)
{
foreach(var field in typeof(GetSearchAllLibrariesType).GetFields())
private static readonly Dictionary <string, GetSearchAllLibrariesType> _knownValues =
new Dictionary <string, GetSearchAllLibrariesType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["movie"] = Movie,
["show"] = TvShow,
["season"] = Season,
["episode"] = Episode,
["artist"] = Artist,
["album"] = Album,
["track"] = Track,
["photoalbum"] = PhotoAlbum,
["photo"] = Photo,
["collection"] = Collection
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetSearchAllLibrariesType> _values =
new ConcurrentDictionary<string, GetSearchAllLibrariesType>(_knownValues);
if (enumVal is GetSearchAllLibrariesType)
{
return (GetSearchAllLibrariesType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetSearchAllLibrariesType");
private GetSearchAllLibrariesType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetSearchAllLibrariesType Of(string value)
{
return _values.GetOrAdd(value, _ => new GetSearchAllLibrariesType(value));
}
public static implicit operator GetSearchAllLibrariesType(string value) => Of(value);
public static implicit operator string(GetSearchAllLibrariesType getsearchalllibrariestype) => getsearchalllibrariestype.Value;
public static GetSearchAllLibrariesType[] 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 GetSearchAllLibrariesType);
public bool Equals(GetSearchAllLibrariesType? 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();
}
}

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetSearchLibraryQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetSearchLibraryQueryParamType : IEquatable<GetSearchLibraryQueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly GetSearchLibraryQueryParamType Movie = new GetSearchLibraryQueryParamType(1);
public static readonly GetSearchLibraryQueryParamType TvShow = new GetSearchLibraryQueryParamType(2);
public static readonly GetSearchLibraryQueryParamType Season = new GetSearchLibraryQueryParamType(3);
public static readonly GetSearchLibraryQueryParamType Episode = new GetSearchLibraryQueryParamType(4);
public static readonly GetSearchLibraryQueryParamType Artist = new GetSearchLibraryQueryParamType(5);
public static readonly GetSearchLibraryQueryParamType Album = new GetSearchLibraryQueryParamType(6);
public static readonly GetSearchLibraryQueryParamType Track = new GetSearchLibraryQueryParamType(7);
public static readonly GetSearchLibraryQueryParamType PhotoAlbum = new GetSearchLibraryQueryParamType(8);
public static readonly GetSearchLibraryQueryParamType Photo = new GetSearchLibraryQueryParamType(9);
private static readonly Dictionary <long, GetSearchLibraryQueryParamType> _knownValues =
new Dictionary <long, GetSearchLibraryQueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, GetSearchLibraryQueryParamType> _values =
new ConcurrentDictionary<long, GetSearchLibraryQueryParamType>(_knownValues);
private GetSearchLibraryQueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static GetSearchLibraryQueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new GetSearchLibraryQueryParamType(value));
}
public static implicit operator GetSearchLibraryQueryParamType(long value) => Of(value);
public static implicit operator long(GetSearchLibraryQueryParamType getsearchlibraryqueryparamtype) => getsearchlibraryqueryparamtype.Value;
public static GetSearchLibraryQueryParamType[] 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 GetSearchLibraryQueryParamType);
public bool Equals(GetSearchLibraryQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetSearchLibraryRequest
{

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetTimelineRequest
{

View File

@@ -12,49 +12,67 @@ 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>
/// String representation of subscriptionActive
/// </summary>
public enum GetTokenDetailsAuthenticationResponseStatus
[JsonConverter(typeof(OpenEnumConverter))]
public class GetTokenDetailsAuthenticationResponseStatus : IEquatable<GetTokenDetailsAuthenticationResponseStatus>
{
[JsonProperty("Inactive")]
Inactive,
[JsonProperty("Active")]
Active,
}
public static readonly GetTokenDetailsAuthenticationResponseStatus Inactive = new GetTokenDetailsAuthenticationResponseStatus("Inactive");
public static readonly GetTokenDetailsAuthenticationResponseStatus Active = new GetTokenDetailsAuthenticationResponseStatus("Active");
public static class GetTokenDetailsAuthenticationResponseStatusExtension
{
public static string Value(this GetTokenDetailsAuthenticationResponseStatus value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetTokenDetailsAuthenticationResponseStatus ToEnum(this string value)
{
foreach(var field in typeof(GetTokenDetailsAuthenticationResponseStatus).GetFields())
private static readonly Dictionary <string, GetTokenDetailsAuthenticationResponseStatus> _knownValues =
new Dictionary <string, GetTokenDetailsAuthenticationResponseStatus> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["Inactive"] = Inactive,
["Active"] = Active
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetTokenDetailsAuthenticationResponseStatus> _values =
new ConcurrentDictionary<string, GetTokenDetailsAuthenticationResponseStatus>(_knownValues);
if (enumVal is GetTokenDetailsAuthenticationResponseStatus)
{
return (GetTokenDetailsAuthenticationResponseStatus)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetTokenDetailsAuthenticationResponseStatus");
private GetTokenDetailsAuthenticationResponseStatus(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetTokenDetailsAuthenticationResponseStatus Of(string value)
{
return _values.GetOrAdd(value, _ => new GetTokenDetailsAuthenticationResponseStatus(value));
}
public static implicit operator GetTokenDetailsAuthenticationResponseStatus(string value) => Of(value);
public static implicit operator string(GetTokenDetailsAuthenticationResponseStatus gettokendetailsauthenticationresponsestatus) => gettokendetailsauthenticationresponsestatus.Value;
public static GetTokenDetailsAuthenticationResponseStatus[] 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 GetTokenDetailsAuthenticationResponseStatus);
public bool Equals(GetTokenDetailsAuthenticationResponseStatus? 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();
}
}

View File

@@ -12,49 +12,67 @@ 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>
/// String representation of subscriptionActive
/// </summary>
public enum GetTokenDetailsAuthenticationStatus
[JsonConverter(typeof(OpenEnumConverter))]
public class GetTokenDetailsAuthenticationStatus : IEquatable<GetTokenDetailsAuthenticationStatus>
{
[JsonProperty("Inactive")]
Inactive,
[JsonProperty("Active")]
Active,
}
public static readonly GetTokenDetailsAuthenticationStatus Inactive = new GetTokenDetailsAuthenticationStatus("Inactive");
public static readonly GetTokenDetailsAuthenticationStatus Active = new GetTokenDetailsAuthenticationStatus("Active");
public static class GetTokenDetailsAuthenticationStatusExtension
{
public static string Value(this GetTokenDetailsAuthenticationStatus value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetTokenDetailsAuthenticationStatus ToEnum(this string value)
{
foreach(var field in typeof(GetTokenDetailsAuthenticationStatus).GetFields())
private static readonly Dictionary <string, GetTokenDetailsAuthenticationStatus> _knownValues =
new Dictionary <string, GetTokenDetailsAuthenticationStatus> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["Inactive"] = Inactive,
["Active"] = Active
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetTokenDetailsAuthenticationStatus> _values =
new ConcurrentDictionary<string, GetTokenDetailsAuthenticationStatus>(_knownValues);
if (enumVal is GetTokenDetailsAuthenticationStatus)
{
return (GetTokenDetailsAuthenticationStatus)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetTokenDetailsAuthenticationStatus");
private GetTokenDetailsAuthenticationStatus(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetTokenDetailsAuthenticationStatus Of(string value)
{
return _values.GetOrAdd(value, _ => new GetTokenDetailsAuthenticationStatus(value));
}
public static implicit operator GetTokenDetailsAuthenticationStatus(string value) => Of(value);
public static implicit operator string(GetTokenDetailsAuthenticationStatus gettokendetailsauthenticationstatus) => gettokendetailsauthenticationstatus.Value;
public static GetTokenDetailsAuthenticationStatus[] 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 GetTokenDetailsAuthenticationStatus);
public bool Equals(GetTokenDetailsAuthenticationStatus? 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();
}
}

View File

@@ -12,46 +12,64 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum GetTokenDetailsStatus
{
[JsonProperty("online")]
Online,
[JsonProperty("offline")]
Offline,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class GetTokenDetailsStatusExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class GetTokenDetailsStatus : IEquatable<GetTokenDetailsStatus>
{
public static string Value(this GetTokenDetailsStatus value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly GetTokenDetailsStatus Online = new GetTokenDetailsStatus("online");
public static readonly GetTokenDetailsStatus Offline = new GetTokenDetailsStatus("offline");
public static GetTokenDetailsStatus ToEnum(this string value)
{
foreach(var field in typeof(GetTokenDetailsStatus).GetFields())
private static readonly Dictionary <string, GetTokenDetailsStatus> _knownValues =
new Dictionary <string, GetTokenDetailsStatus> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["online"] = Online,
["offline"] = Offline
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, GetTokenDetailsStatus> _values =
new ConcurrentDictionary<string, GetTokenDetailsStatus>(_knownValues);
if (enumVal is GetTokenDetailsStatus)
{
return (GetTokenDetailsStatus)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetTokenDetailsStatus");
private GetTokenDetailsStatus(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static GetTokenDetailsStatus Of(string value)
{
return _values.GetOrAdd(value, _ => new GetTokenDetailsStatus(value));
}
public static implicit operator GetTokenDetailsStatus(string value) => Of(value);
public static implicit operator string(GetTokenDetailsStatus gettokendetailsstatus) => gettokendetailsstatus.Value;
public static GetTokenDetailsStatus[] 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 GetTokenDetailsStatus);
public bool Equals(GetTokenDetailsStatus? 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();
}
}

View File

@@ -12,7 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class GetTokenDetailsSubscription
{

View File

@@ -13,7 +13,9 @@ 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>
/// Logged in user details

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum GetTopWatchedContentQueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class GetTopWatchedContentQueryParamType : IEquatable<GetTopWatchedContentQueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly GetTopWatchedContentQueryParamType Movie = new GetTopWatchedContentQueryParamType(1);
public static readonly GetTopWatchedContentQueryParamType TvShow = new GetTopWatchedContentQueryParamType(2);
public static readonly GetTopWatchedContentQueryParamType Season = new GetTopWatchedContentQueryParamType(3);
public static readonly GetTopWatchedContentQueryParamType Episode = new GetTopWatchedContentQueryParamType(4);
public static readonly GetTopWatchedContentQueryParamType Artist = new GetTopWatchedContentQueryParamType(5);
public static readonly GetTopWatchedContentQueryParamType Album = new GetTopWatchedContentQueryParamType(6);
public static readonly GetTopWatchedContentQueryParamType Track = new GetTopWatchedContentQueryParamType(7);
public static readonly GetTopWatchedContentQueryParamType PhotoAlbum = new GetTopWatchedContentQueryParamType(8);
public static readonly GetTopWatchedContentQueryParamType Photo = new GetTopWatchedContentQueryParamType(9);
private static readonly Dictionary <long, GetTopWatchedContentQueryParamType> _knownValues =
new Dictionary <long, GetTopWatchedContentQueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, GetTopWatchedContentQueryParamType> _values =
new ConcurrentDictionary<long, GetTopWatchedContentQueryParamType>(_knownValues);
private GetTopWatchedContentQueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static GetTopWatchedContentQueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new GetTopWatchedContentQueryParamType(value));
}
public static implicit operator GetTopWatchedContentQueryParamType(long value) => Of(value);
public static implicit operator long(GetTopWatchedContentQueryParamType gettopwatchedcontentqueryparamtype) => gettopwatchedcontentqueryparamtype.Value;
public static GetTopWatchedContentQueryParamType[] 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 GetTopWatchedContentQueryParamType);
public bool Equals(GetTopWatchedContentQueryParamType? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetTopWatchedContentRequest
{

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class GetWatchListRequest
{

View File

@@ -10,7 +10,12 @@
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>
/// An integer log level to write to the PMS log with.<br/>
///
@@ -23,13 +28,65 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum Level
[JsonConverter(typeof(OpenEnumConverter))]
public class Level : IEquatable<Level>
{
Zero = 0,
One = 1,
Two = 2,
Three = 3,
Four = 4,
public static readonly Level Zero = new Level(0);
public static readonly Level One = new Level(1);
public static readonly Level Two = new Level(2);
public static readonly Level Three = new Level(3);
public static readonly Level Four = new Level(4);
private static readonly Dictionary <long, Level> _knownValues =
new Dictionary <long, Level> ()
{
[0] = Zero,
[1] = One,
[2] = Two,
[3] = Three,
[4] = Four
};
private static readonly ConcurrentDictionary<long, Level> _values =
new ConcurrentDictionary<long, Level>(_knownValues);
private Level(long value)
{
Value = value;
}
public long Value { get; }
public static Level Of(long value)
{
return _values.GetOrAdd(value, _ => new Level(value));
}
public static implicit operator Level(long value) => Of(value);
public static implicit operator long(Level level) => level.Value;
public static Level[] 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 Level);
public bool Equals(Level? 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();
}
}

View File

@@ -12,7 +12,10 @@ 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 type of library to filter. Can be &quot;movie&quot; or &quot;show&quot;, or all if not present.<br/>
///
@@ -20,45 +23,60 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum Libtype
[JsonConverter(typeof(OpenEnumConverter))]
public class Libtype : IEquatable<Libtype>
{
[JsonProperty("movie")]
Movie,
[JsonProperty("show")]
Show,
}
public static readonly Libtype Movie = new Libtype("movie");
public static readonly Libtype Show = new Libtype("show");
public static class LibtypeExtension
{
public static string Value(this Libtype value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static Libtype ToEnum(this string value)
{
foreach(var field in typeof(Libtype).GetFields())
private static readonly Dictionary <string, Libtype> _knownValues =
new Dictionary <string, Libtype> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["movie"] = Movie,
["show"] = Show
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, Libtype> _values =
new ConcurrentDictionary<string, Libtype>(_knownValues);
if (enumVal is Libtype)
{
return (Libtype)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum Libtype");
private Libtype(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static Libtype Of(string value)
{
return _values.GetOrAdd(value, _ => new Libtype(value));
}
public static implicit operator Libtype(string value) => Of(value);
public static implicit operator string(Libtype libtype) => libtype.Value;
public static Libtype[] 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 Libtype);
public bool Equals(Libtype? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class LogLineRequest
{

View File

@@ -12,49 +12,67 @@ 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>
/// Your current mailing list status (active or unsubscribed)
/// </summary>
public enum MailingListStatus
[JsonConverter(typeof(OpenEnumConverter))]
public class MailingListStatus : IEquatable<MailingListStatus>
{
[JsonProperty("active")]
Active,
[JsonProperty("unsubscribed")]
Unsubscribed,
}
public static readonly MailingListStatus Active = new MailingListStatus("active");
public static readonly MailingListStatus Unsubscribed = new MailingListStatus("unsubscribed");
public static class MailingListStatusExtension
{
public static string Value(this MailingListStatus value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static MailingListStatus ToEnum(this string value)
{
foreach(var field in typeof(MailingListStatus).GetFields())
private static readonly Dictionary <string, MailingListStatus> _knownValues =
new Dictionary <string, MailingListStatus> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["active"] = Active,
["unsubscribed"] = Unsubscribed
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, MailingListStatus> _values =
new ConcurrentDictionary<string, MailingListStatus>(_knownValues);
if (enumVal is MailingListStatus)
{
return (MailingListStatus)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum MailingListStatus");
private MailingListStatus(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static MailingListStatus Of(string value)
{
return _values.GetOrAdd(value, _ => new MailingListStatus(value));
}
public static implicit operator MailingListStatus(string value) => Of(value);
public static implicit operator string(MailingListStatus mailingliststatus) => mailingliststatus.Value;
public static MailingListStatus[] 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 MailingListStatus);
public bool Equals(MailingListStatus? 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();
}
}

View File

@@ -12,6 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class PastSubscription
{

View File

@@ -12,73 +12,91 @@ 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 name of the task to be started.
/// </summary>
public enum PathParamTaskName
[JsonConverter(typeof(OpenEnumConverter))]
public class PathParamTaskName : IEquatable<PathParamTaskName>
{
[JsonProperty("BackupDatabase")]
BackupDatabase,
[JsonProperty("BuildGracenoteCollections")]
BuildGracenoteCollections,
[JsonProperty("CheckForUpdates")]
CheckForUpdates,
[JsonProperty("CleanOldBundles")]
CleanOldBundles,
[JsonProperty("CleanOldCacheFiles")]
CleanOldCacheFiles,
[JsonProperty("DeepMediaAnalysis")]
DeepMediaAnalysis,
[JsonProperty("GenerateAutoTags")]
GenerateAutoTags,
[JsonProperty("GenerateChapterThumbs")]
GenerateChapterThumbs,
[JsonProperty("GenerateMediaIndexFiles")]
GenerateMediaIndexFiles,
[JsonProperty("OptimizeDatabase")]
OptimizeDatabase,
[JsonProperty("RefreshLibraries")]
RefreshLibraries,
[JsonProperty("RefreshLocalMedia")]
RefreshLocalMedia,
[JsonProperty("RefreshPeriodicMetadata")]
RefreshPeriodicMetadata,
[JsonProperty("UpgradeMediaAnalysis")]
UpgradeMediaAnalysis,
}
public static readonly PathParamTaskName BackupDatabase = new PathParamTaskName("BackupDatabase");
public static readonly PathParamTaskName BuildGracenoteCollections = new PathParamTaskName("BuildGracenoteCollections");
public static readonly PathParamTaskName CheckForUpdates = new PathParamTaskName("CheckForUpdates");
public static readonly PathParamTaskName CleanOldBundles = new PathParamTaskName("CleanOldBundles");
public static readonly PathParamTaskName CleanOldCacheFiles = new PathParamTaskName("CleanOldCacheFiles");
public static readonly PathParamTaskName DeepMediaAnalysis = new PathParamTaskName("DeepMediaAnalysis");
public static readonly PathParamTaskName GenerateAutoTags = new PathParamTaskName("GenerateAutoTags");
public static readonly PathParamTaskName GenerateChapterThumbs = new PathParamTaskName("GenerateChapterThumbs");
public static readonly PathParamTaskName GenerateMediaIndexFiles = new PathParamTaskName("GenerateMediaIndexFiles");
public static readonly PathParamTaskName OptimizeDatabase = new PathParamTaskName("OptimizeDatabase");
public static readonly PathParamTaskName RefreshLibraries = new PathParamTaskName("RefreshLibraries");
public static readonly PathParamTaskName RefreshLocalMedia = new PathParamTaskName("RefreshLocalMedia");
public static readonly PathParamTaskName RefreshPeriodicMetadata = new PathParamTaskName("RefreshPeriodicMetadata");
public static readonly PathParamTaskName UpgradeMediaAnalysis = new PathParamTaskName("UpgradeMediaAnalysis");
public static class PathParamTaskNameExtension
{
public static string Value(this PathParamTaskName value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static PathParamTaskName ToEnum(this string value)
{
foreach(var field in typeof(PathParamTaskName).GetFields())
private static readonly Dictionary <string, PathParamTaskName> _knownValues =
new Dictionary <string, PathParamTaskName> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["BackupDatabase"] = BackupDatabase,
["BuildGracenoteCollections"] = BuildGracenoteCollections,
["CheckForUpdates"] = CheckForUpdates,
["CleanOldBundles"] = CleanOldBundles,
["CleanOldCacheFiles"] = CleanOldCacheFiles,
["DeepMediaAnalysis"] = DeepMediaAnalysis,
["GenerateAutoTags"] = GenerateAutoTags,
["GenerateChapterThumbs"] = GenerateChapterThumbs,
["GenerateMediaIndexFiles"] = GenerateMediaIndexFiles,
["OptimizeDatabase"] = OptimizeDatabase,
["RefreshLibraries"] = RefreshLibraries,
["RefreshLocalMedia"] = RefreshLocalMedia,
["RefreshPeriodicMetadata"] = RefreshPeriodicMetadata,
["UpgradeMediaAnalysis"] = UpgradeMediaAnalysis
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, PathParamTaskName> _values =
new ConcurrentDictionary<string, PathParamTaskName>(_knownValues);
if (enumVal is PathParamTaskName)
{
return (PathParamTaskName)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum PathParamTaskName");
private PathParamTaskName(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static PathParamTaskName Of(string value)
{
return _values.GetOrAdd(value, _ => new PathParamTaskName(value));
}
public static implicit operator PathParamTaskName(string value) => Of(value);
public static implicit operator string(PathParamTaskName pathparamtaskname) => pathparamtaskname.Value;
public static PathParamTaskName[] 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 PathParamTaskName);
public bool Equals(PathParamTaskName? 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();
}
}

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>
/// limit to a type of playlist.
/// </summary>
public enum PlaylistType
[JsonConverter(typeof(OpenEnumConverter))]
public class PlaylistType : IEquatable<PlaylistType>
{
[JsonProperty("audio")]
Audio,
[JsonProperty("video")]
Video,
[JsonProperty("photo")]
Photo,
}
public static readonly PlaylistType Audio = new PlaylistType("audio");
public static readonly PlaylistType Video = new PlaylistType("video");
public static readonly PlaylistType Photo = new PlaylistType("photo");
public static class PlaylistTypeExtension
{
public static string Value(this PlaylistType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static PlaylistType ToEnum(this string value)
{
foreach(var field in typeof(PlaylistType).GetFields())
private static readonly Dictionary <string, PlaylistType> _knownValues =
new Dictionary <string, PlaylistType> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["audio"] = Audio,
["video"] = Video,
["photo"] = Photo
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, PlaylistType> _values =
new ConcurrentDictionary<string, PlaylistType>(_knownValues);
if (enumVal is PlaylistType)
{
return (PlaylistType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum PlaylistType");
private PlaylistType(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static PlaylistType Of(string value)
{
return _values.GetOrAdd(value, _ => new PlaylistType(value));
}
public static implicit operator PlaylistType(string value) => Of(value);
public static implicit operator string(PlaylistType playlisttype) => playlisttype.Value;
public static PlaylistType[] 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 PlaylistType);
public bool Equals(PlaylistType? 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();
}
}

View File

@@ -12,49 +12,67 @@ 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>
/// String representation of subscriptionActive
/// </summary>
public enum PostUsersSignInDataAuthenticationResponseStatus
[JsonConverter(typeof(OpenEnumConverter))]
public class PostUsersSignInDataAuthenticationResponseStatus : IEquatable<PostUsersSignInDataAuthenticationResponseStatus>
{
[JsonProperty("Inactive")]
Inactive,
[JsonProperty("Active")]
Active,
}
public static readonly PostUsersSignInDataAuthenticationResponseStatus Inactive = new PostUsersSignInDataAuthenticationResponseStatus("Inactive");
public static readonly PostUsersSignInDataAuthenticationResponseStatus Active = new PostUsersSignInDataAuthenticationResponseStatus("Active");
public static class PostUsersSignInDataAuthenticationResponseStatusExtension
{
public static string Value(this PostUsersSignInDataAuthenticationResponseStatus value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static PostUsersSignInDataAuthenticationResponseStatus ToEnum(this string value)
{
foreach(var field in typeof(PostUsersSignInDataAuthenticationResponseStatus).GetFields())
private static readonly Dictionary <string, PostUsersSignInDataAuthenticationResponseStatus> _knownValues =
new Dictionary <string, PostUsersSignInDataAuthenticationResponseStatus> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["Inactive"] = Inactive,
["Active"] = Active
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, PostUsersSignInDataAuthenticationResponseStatus> _values =
new ConcurrentDictionary<string, PostUsersSignInDataAuthenticationResponseStatus>(_knownValues);
if (enumVal is PostUsersSignInDataAuthenticationResponseStatus)
{
return (PostUsersSignInDataAuthenticationResponseStatus)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum PostUsersSignInDataAuthenticationResponseStatus");
private PostUsersSignInDataAuthenticationResponseStatus(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static PostUsersSignInDataAuthenticationResponseStatus Of(string value)
{
return _values.GetOrAdd(value, _ => new PostUsersSignInDataAuthenticationResponseStatus(value));
}
public static implicit operator PostUsersSignInDataAuthenticationResponseStatus(string value) => Of(value);
public static implicit operator string(PostUsersSignInDataAuthenticationResponseStatus postuserssignindataauthenticationresponsestatus) => postuserssignindataauthenticationresponsestatus.Value;
public static PostUsersSignInDataAuthenticationResponseStatus[] 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 PostUsersSignInDataAuthenticationResponseStatus);
public bool Equals(PostUsersSignInDataAuthenticationResponseStatus? 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();
}
}

View File

@@ -12,49 +12,67 @@ 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>
/// String representation of subscriptionActive
/// </summary>
public enum PostUsersSignInDataAuthenticationStatus
[JsonConverter(typeof(OpenEnumConverter))]
public class PostUsersSignInDataAuthenticationStatus : IEquatable<PostUsersSignInDataAuthenticationStatus>
{
[JsonProperty("Inactive")]
Inactive,
[JsonProperty("Active")]
Active,
}
public static readonly PostUsersSignInDataAuthenticationStatus Inactive = new PostUsersSignInDataAuthenticationStatus("Inactive");
public static readonly PostUsersSignInDataAuthenticationStatus Active = new PostUsersSignInDataAuthenticationStatus("Active");
public static class PostUsersSignInDataAuthenticationStatusExtension
{
public static string Value(this PostUsersSignInDataAuthenticationStatus value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static PostUsersSignInDataAuthenticationStatus ToEnum(this string value)
{
foreach(var field in typeof(PostUsersSignInDataAuthenticationStatus).GetFields())
private static readonly Dictionary <string, PostUsersSignInDataAuthenticationStatus> _knownValues =
new Dictionary <string, PostUsersSignInDataAuthenticationStatus> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["Inactive"] = Inactive,
["Active"] = Active
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, PostUsersSignInDataAuthenticationStatus> _values =
new ConcurrentDictionary<string, PostUsersSignInDataAuthenticationStatus>(_knownValues);
if (enumVal is PostUsersSignInDataAuthenticationStatus)
{
return (PostUsersSignInDataAuthenticationStatus)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum PostUsersSignInDataAuthenticationStatus");
private PostUsersSignInDataAuthenticationStatus(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static PostUsersSignInDataAuthenticationStatus Of(string value)
{
return _values.GetOrAdd(value, _ => new PostUsersSignInDataAuthenticationStatus(value));
}
public static implicit operator PostUsersSignInDataAuthenticationStatus(string value) => Of(value);
public static implicit operator string(PostUsersSignInDataAuthenticationStatus postuserssignindataauthenticationstatus) => postuserssignindataauthenticationstatus.Value;
public static PostUsersSignInDataAuthenticationStatus[] 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 PostUsersSignInDataAuthenticationStatus);
public bool Equals(PostUsersSignInDataAuthenticationStatus? 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();
}
}

View File

@@ -12,7 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class PostUsersSignInDataAuthenticationSubscription
{

View File

@@ -12,49 +12,67 @@ 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>
/// Your current mailing list status (active or unsubscribed)
/// </summary>
public enum PostUsersSignInDataMailingListStatus
[JsonConverter(typeof(OpenEnumConverter))]
public class PostUsersSignInDataMailingListStatus : IEquatable<PostUsersSignInDataMailingListStatus>
{
[JsonProperty("active")]
Active,
[JsonProperty("unsubscribed")]
Unsubscribed,
}
public static readonly PostUsersSignInDataMailingListStatus Active = new PostUsersSignInDataMailingListStatus("active");
public static readonly PostUsersSignInDataMailingListStatus Unsubscribed = new PostUsersSignInDataMailingListStatus("unsubscribed");
public static class PostUsersSignInDataMailingListStatusExtension
{
public static string Value(this PostUsersSignInDataMailingListStatus value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static PostUsersSignInDataMailingListStatus ToEnum(this string value)
{
foreach(var field in typeof(PostUsersSignInDataMailingListStatus).GetFields())
private static readonly Dictionary <string, PostUsersSignInDataMailingListStatus> _knownValues =
new Dictionary <string, PostUsersSignInDataMailingListStatus> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["active"] = Active,
["unsubscribed"] = Unsubscribed
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, PostUsersSignInDataMailingListStatus> _values =
new ConcurrentDictionary<string, PostUsersSignInDataMailingListStatus>(_knownValues);
if (enumVal is PostUsersSignInDataMailingListStatus)
{
return (PostUsersSignInDataMailingListStatus)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum PostUsersSignInDataMailingListStatus");
private PostUsersSignInDataMailingListStatus(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static PostUsersSignInDataMailingListStatus Of(string value)
{
return _values.GetOrAdd(value, _ => new PostUsersSignInDataMailingListStatus(value));
}
public static implicit operator PostUsersSignInDataMailingListStatus(string value) => Of(value);
public static implicit operator string(PostUsersSignInDataMailingListStatus postuserssignindatamailingliststatus) => postuserssignindatamailingliststatus.Value;
public static PostUsersSignInDataMailingListStatus[] 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 PostUsersSignInDataMailingListStatus);
public bool Equals(PostUsersSignInDataMailingListStatus? 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();
}
}

View File

@@ -12,6 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class PostUsersSignInDataServices
{

View File

@@ -12,44 +12,62 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum PostUsersSignInDataState
{
[JsonProperty("ended")]
Ended,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class PostUsersSignInDataStateExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class PostUsersSignInDataState : IEquatable<PostUsersSignInDataState>
{
public static string Value(this PostUsersSignInDataState value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly PostUsersSignInDataState Ended = new PostUsersSignInDataState("ended");
public static PostUsersSignInDataState ToEnum(this string value)
{
foreach(var field in typeof(PostUsersSignInDataState).GetFields())
private static readonly Dictionary <string, PostUsersSignInDataState> _knownValues =
new Dictionary <string, PostUsersSignInDataState> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["ended"] = Ended
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, PostUsersSignInDataState> _values =
new ConcurrentDictionary<string, PostUsersSignInDataState>(_knownValues);
if (enumVal is PostUsersSignInDataState)
{
return (PostUsersSignInDataState)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum PostUsersSignInDataState");
private PostUsersSignInDataState(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static PostUsersSignInDataState Of(string value)
{
return _values.GetOrAdd(value, _ => new PostUsersSignInDataState(value));
}
public static implicit operator PostUsersSignInDataState(string value) => Of(value);
public static implicit operator string(PostUsersSignInDataState postuserssignindatastate) => postuserssignindatastate.Value;
public static PostUsersSignInDataState[] 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 PostUsersSignInDataState);
public bool Equals(PostUsersSignInDataState? 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();
}
}

View File

@@ -12,46 +12,64 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum PostUsersSignInDataStatus
{
[JsonProperty("online")]
Online,
[JsonProperty("offline")]
Offline,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class PostUsersSignInDataStatusExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class PostUsersSignInDataStatus : IEquatable<PostUsersSignInDataStatus>
{
public static string Value(this PostUsersSignInDataStatus value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly PostUsersSignInDataStatus Online = new PostUsersSignInDataStatus("online");
public static readonly PostUsersSignInDataStatus Offline = new PostUsersSignInDataStatus("offline");
public static PostUsersSignInDataStatus ToEnum(this string value)
{
foreach(var field in typeof(PostUsersSignInDataStatus).GetFields())
private static readonly Dictionary <string, PostUsersSignInDataStatus> _knownValues =
new Dictionary <string, PostUsersSignInDataStatus> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["online"] = Online,
["offline"] = Offline
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, PostUsersSignInDataStatus> _values =
new ConcurrentDictionary<string, PostUsersSignInDataStatus>(_knownValues);
if (enumVal is PostUsersSignInDataStatus)
{
return (PostUsersSignInDataStatus)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum PostUsersSignInDataStatus");
private PostUsersSignInDataStatus(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static PostUsersSignInDataStatus Of(string value)
{
return _values.GetOrAdd(value, _ => new PostUsersSignInDataStatus(value));
}
public static implicit operator PostUsersSignInDataStatus(string value) => Of(value);
public static implicit operator string(PostUsersSignInDataStatus postuserssignindatastatus) => postuserssignindatastatus.Value;
public static PostUsersSignInDataStatus[] 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 PostUsersSignInDataStatus);
public bool Equals(PostUsersSignInDataStatus? 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();
}
}

View File

@@ -12,7 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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>
/// If the accounts Plex Pass subscription is active

View File

@@ -13,7 +13,9 @@ 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>
/// Returns the user account data with a valid auth token

View File

@@ -10,14 +10,68 @@
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>
/// type of playlists to return (default is all).
/// </summary>
public enum QueryParamSmart
[JsonConverter(typeof(OpenEnumConverter))]
public class QueryParamSmart : IEquatable<QueryParamSmart>
{
Zero = 0,
One = 1,
public static readonly QueryParamSmart Zero = new QueryParamSmart(0);
public static readonly QueryParamSmart One = new QueryParamSmart(1);
private static readonly Dictionary <long, QueryParamSmart> _knownValues =
new Dictionary <long, QueryParamSmart> ()
{
[0] = Zero,
[1] = One
};
private static readonly ConcurrentDictionary<long, QueryParamSmart> _values =
new ConcurrentDictionary<long, QueryParamSmart>(_knownValues);
private QueryParamSmart(long value)
{
Value = value;
}
public long Value { get; }
public static QueryParamSmart Of(long value)
{
return _values.GetOrAdd(value, _ => new QueryParamSmart(value));
}
public static implicit operator QueryParamSmart(long value) => Of(value);
public static implicit operator long(QueryParamSmart queryparamsmart) => queryparamsmart.Value;
public static QueryParamSmart[] 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 QueryParamSmart);
public bool Equals(QueryParamSmart? 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();
}
}

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum QueryParamType
[JsonConverter(typeof(OpenEnumConverter))]
public class QueryParamType : IEquatable<QueryParamType>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly QueryParamType Movie = new QueryParamType(1);
public static readonly QueryParamType TvShow = new QueryParamType(2);
public static readonly QueryParamType Season = new QueryParamType(3);
public static readonly QueryParamType Episode = new QueryParamType(4);
public static readonly QueryParamType Artist = new QueryParamType(5);
public static readonly QueryParamType Album = new QueryParamType(6);
public static readonly QueryParamType Track = new QueryParamType(7);
public static readonly QueryParamType PhotoAlbum = new QueryParamType(8);
public static readonly QueryParamType Photo = new QueryParamType(9);
private static readonly Dictionary <long, QueryParamType> _knownValues =
new Dictionary <long, QueryParamType> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, QueryParamType> _values =
new ConcurrentDictionary<long, QueryParamType>(_knownValues);
private QueryParamType(long value)
{
Value = value;
}
public long Value { get; }
public static QueryParamType Of(long value)
{
return _values.GetOrAdd(value, _ => new QueryParamType(value));
}
public static implicit operator QueryParamType(long value) => Of(value);
public static implicit operator long(QueryParamType queryparamtype) => queryparamtype.Value;
public static QueryParamType[] 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 QueryParamType);
public bool Equals(QueryParamType? 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();
}
}

View File

@@ -12,52 +12,70 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using LukeHagar.PlexAPI.SDK.Utils;
using Newtonsoft.Json;
using System;
public enum SearchTypes
{
[JsonProperty("movies")]
Movies,
[JsonProperty("music")]
Music,
[JsonProperty("otherVideos")]
OtherVideos,
[JsonProperty("people")]
People,
[JsonProperty("tv")]
Tv,
}
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
public static class SearchTypesExtension
[JsonConverter(typeof(OpenEnumConverter))]
public class SearchTypes : IEquatable<SearchTypes>
{
public static string Value(this SearchTypes value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static readonly SearchTypes Movies = new SearchTypes("movies");
public static readonly SearchTypes Music = new SearchTypes("music");
public static readonly SearchTypes OtherVideos = new SearchTypes("otherVideos");
public static readonly SearchTypes People = new SearchTypes("people");
public static readonly SearchTypes Tv = new SearchTypes("tv");
public static SearchTypes ToEnum(this string value)
{
foreach(var field in typeof(SearchTypes).GetFields())
private static readonly Dictionary <string, SearchTypes> _knownValues =
new Dictionary <string, SearchTypes> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["movies"] = Movies,
["music"] = Music,
["otherVideos"] = OtherVideos,
["people"] = People,
["tv"] = Tv
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, SearchTypes> _values =
new ConcurrentDictionary<string, SearchTypes>(_knownValues);
if (enumVal is SearchTypes)
{
return (SearchTypes)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum SearchTypes");
private SearchTypes(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static SearchTypes Of(string value)
{
return _values.GetOrAdd(value, _ => new SearchTypes(value));
}
public static implicit operator SearchTypes(string value) => Of(value);
public static implicit operator string(SearchTypes searchtypes) => searchtypes.Value;
public static SearchTypes[] 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 SearchTypes);
public bool Equals(SearchTypes? 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();
}
}

View File

@@ -12,6 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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;
public class Services
{

View File

@@ -12,7 +12,10 @@ 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>
/// Setting that indicates the episode ordering for the show.<br/>
///
@@ -26,51 +29,66 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum ShowOrdering
[JsonConverter(typeof(OpenEnumConverter))]
public class ShowOrdering : IEquatable<ShowOrdering>
{
[JsonProperty("None")]
None,
[JsonProperty("tmdbAiring")]
TmdbAiring,
[JsonProperty("aired")]
TvdbAired,
[JsonProperty("dvd")]
TvdbDvd,
[JsonProperty("absolute")]
TvdbAbsolute,
}
public static readonly ShowOrdering None = new ShowOrdering("None");
public static readonly ShowOrdering TmdbAiring = new ShowOrdering("tmdbAiring");
public static readonly ShowOrdering TvdbAired = new ShowOrdering("aired");
public static readonly ShowOrdering TvdbDvd = new ShowOrdering("dvd");
public static readonly ShowOrdering TvdbAbsolute = new ShowOrdering("absolute");
public static class ShowOrderingExtension
{
public static string Value(this ShowOrdering value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static ShowOrdering ToEnum(this string value)
{
foreach(var field in typeof(ShowOrdering).GetFields())
private static readonly Dictionary <string, ShowOrdering> _knownValues =
new Dictionary <string, ShowOrdering> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["None"] = None,
["tmdbAiring"] = TmdbAiring,
["aired"] = TvdbAired,
["dvd"] = TvdbDvd,
["absolute"] = TvdbAbsolute
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, ShowOrdering> _values =
new ConcurrentDictionary<string, ShowOrdering>(_knownValues);
if (enumVal is ShowOrdering)
{
return (ShowOrdering)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum ShowOrdering");
private ShowOrdering(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static ShowOrdering Of(string value)
{
return _values.GetOrAdd(value, _ => new ShowOrdering(value));
}
public static implicit operator ShowOrdering(string value) => Of(value);
public static implicit operator string(ShowOrdering showordering) => showordering.Value;
public static ShowOrdering[] 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 ShowOrdering);
public bool Equals(ShowOrdering? 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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class StartTaskRequest
{

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();
}
}

View File

@@ -12,47 +12,65 @@ 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>
public enum Status
[JsonConverter(typeof(OpenEnumConverter))]
public class Status : IEquatable<Status>
{
[JsonProperty("accepted")]
Accepted,
}
public static readonly Status Accepted = new Status("accepted");
public static class StatusExtension
{
public static string Value(this Status value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static Status ToEnum(this string value)
{
foreach(var field in typeof(Status).GetFields())
private static readonly Dictionary <string, Status> _knownValues =
new Dictionary <string, Status> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["accepted"] = Accepted
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, Status> _values =
new ConcurrentDictionary<string, Status>(_knownValues);
if (enumVal is Status)
{
return (Status)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum Status");
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();
}
}

View File

@@ -11,6 +11,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
{
using 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;
public class StopTaskRequest
{

View File

@@ -12,7 +12,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
using 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>
/// If the accounts Plex Pass subscription is active

View File

@@ -12,77 +12,95 @@ 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>
/// A key representing a specific tag within the section.
/// </summary>
public enum Tag
[JsonConverter(typeof(OpenEnumConverter))]
public class Tag : IEquatable<Tag>
{
[JsonProperty("unwatched")]
Unwatched,
[JsonProperty("newest")]
Newest,
[JsonProperty("recentlyAdded")]
RecentlyAdded,
[JsonProperty("recentlyViewed")]
RecentlyViewed,
[JsonProperty("onDeck")]
OnDeck,
[JsonProperty("collection")]
Collection,
[JsonProperty("edition")]
Edition,
[JsonProperty("year")]
Year,
[JsonProperty("decade")]
Decade,
[JsonProperty("director")]
Director,
[JsonProperty("contentRating")]
ContentRating,
[JsonProperty("rating")]
Rating,
[JsonProperty("resolution")]
Resolution,
[JsonProperty("firstCharacter")]
FirstCharacter,
[JsonProperty("folder")]
Folder,
[JsonProperty("albums")]
Albums,
}
public static readonly Tag Unwatched = new Tag("unwatched");
public static readonly Tag Newest = new Tag("newest");
public static readonly Tag RecentlyAdded = new Tag("recentlyAdded");
public static readonly Tag RecentlyViewed = new Tag("recentlyViewed");
public static readonly Tag OnDeck = new Tag("onDeck");
public static readonly Tag Collection = new Tag("collection");
public static readonly Tag Edition = new Tag("edition");
public static readonly Tag Year = new Tag("year");
public static readonly Tag Decade = new Tag("decade");
public static readonly Tag Director = new Tag("director");
public static readonly Tag ContentRating = new Tag("contentRating");
public static readonly Tag Rating = new Tag("rating");
public static readonly Tag Resolution = new Tag("resolution");
public static readonly Tag FirstCharacter = new Tag("firstCharacter");
public static readonly Tag Folder = new Tag("folder");
public static readonly Tag Albums = new Tag("albums");
public static class TagExtension
{
public static string Value(this Tag value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static Tag ToEnum(this string value)
{
foreach(var field in typeof(Tag).GetFields())
private static readonly Dictionary <string, Tag> _knownValues =
new Dictionary <string, Tag> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["unwatched"] = Unwatched,
["newest"] = Newest,
["recentlyAdded"] = RecentlyAdded,
["recentlyViewed"] = RecentlyViewed,
["onDeck"] = OnDeck,
["collection"] = Collection,
["edition"] = Edition,
["year"] = Year,
["decade"] = Decade,
["director"] = Director,
["contentRating"] = ContentRating,
["rating"] = Rating,
["resolution"] = Resolution,
["firstCharacter"] = FirstCharacter,
["folder"] = Folder,
["albums"] = Albums
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, Tag> _values =
new ConcurrentDictionary<string, Tag>(_knownValues);
if (enumVal is Tag)
{
return (Tag)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum Tag");
private Tag(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static Tag Of(string value)
{
return _values.GetOrAdd(value, _ => new Tag(value));
}
public static implicit operator Tag(string value) => Of(value);
public static implicit operator string(Tag tag) => tag.Value;
public static Tag[] 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 Tag);
public bool Equals(Tag? 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();
}
}

View File

@@ -12,73 +12,91 @@ 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 name of the task to be started.
/// </summary>
public enum TaskName
[JsonConverter(typeof(OpenEnumConverter))]
public class TaskName : IEquatable<TaskName>
{
[JsonProperty("BackupDatabase")]
BackupDatabase,
[JsonProperty("BuildGracenoteCollections")]
BuildGracenoteCollections,
[JsonProperty("CheckForUpdates")]
CheckForUpdates,
[JsonProperty("CleanOldBundles")]
CleanOldBundles,
[JsonProperty("CleanOldCacheFiles")]
CleanOldCacheFiles,
[JsonProperty("DeepMediaAnalysis")]
DeepMediaAnalysis,
[JsonProperty("GenerateAutoTags")]
GenerateAutoTags,
[JsonProperty("GenerateChapterThumbs")]
GenerateChapterThumbs,
[JsonProperty("GenerateMediaIndexFiles")]
GenerateMediaIndexFiles,
[JsonProperty("OptimizeDatabase")]
OptimizeDatabase,
[JsonProperty("RefreshLibraries")]
RefreshLibraries,
[JsonProperty("RefreshLocalMedia")]
RefreshLocalMedia,
[JsonProperty("RefreshPeriodicMetadata")]
RefreshPeriodicMetadata,
[JsonProperty("UpgradeMediaAnalysis")]
UpgradeMediaAnalysis,
}
public static readonly TaskName BackupDatabase = new TaskName("BackupDatabase");
public static readonly TaskName BuildGracenoteCollections = new TaskName("BuildGracenoteCollections");
public static readonly TaskName CheckForUpdates = new TaskName("CheckForUpdates");
public static readonly TaskName CleanOldBundles = new TaskName("CleanOldBundles");
public static readonly TaskName CleanOldCacheFiles = new TaskName("CleanOldCacheFiles");
public static readonly TaskName DeepMediaAnalysis = new TaskName("DeepMediaAnalysis");
public static readonly TaskName GenerateAutoTags = new TaskName("GenerateAutoTags");
public static readonly TaskName GenerateChapterThumbs = new TaskName("GenerateChapterThumbs");
public static readonly TaskName GenerateMediaIndexFiles = new TaskName("GenerateMediaIndexFiles");
public static readonly TaskName OptimizeDatabase = new TaskName("OptimizeDatabase");
public static readonly TaskName RefreshLibraries = new TaskName("RefreshLibraries");
public static readonly TaskName RefreshLocalMedia = new TaskName("RefreshLocalMedia");
public static readonly TaskName RefreshPeriodicMetadata = new TaskName("RefreshPeriodicMetadata");
public static readonly TaskName UpgradeMediaAnalysis = new TaskName("UpgradeMediaAnalysis");
public static class TaskNameExtension
{
public static string Value(this TaskName value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static TaskName ToEnum(this string value)
{
foreach(var field in typeof(TaskName).GetFields())
private static readonly Dictionary <string, TaskName> _knownValues =
new Dictionary <string, TaskName> ()
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
["BackupDatabase"] = BackupDatabase,
["BuildGracenoteCollections"] = BuildGracenoteCollections,
["CheckForUpdates"] = CheckForUpdates,
["CleanOldBundles"] = CleanOldBundles,
["CleanOldCacheFiles"] = CleanOldCacheFiles,
["DeepMediaAnalysis"] = DeepMediaAnalysis,
["GenerateAutoTags"] = GenerateAutoTags,
["GenerateChapterThumbs"] = GenerateChapterThumbs,
["GenerateMediaIndexFiles"] = GenerateMediaIndexFiles,
["OptimizeDatabase"] = OptimizeDatabase,
["RefreshLibraries"] = RefreshLibraries,
["RefreshLocalMedia"] = RefreshLocalMedia,
["RefreshPeriodicMetadata"] = RefreshPeriodicMetadata,
["UpgradeMediaAnalysis"] = UpgradeMediaAnalysis
};
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
private static readonly ConcurrentDictionary<string, TaskName> _values =
new ConcurrentDictionary<string, TaskName>(_knownValues);
if (enumVal is TaskName)
{
return (TaskName)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum TaskName");
private TaskName(string value)
{
if (value == null) throw new ArgumentNullException(nameof(value));
Value = value;
}
public string Value { get; }
public static TaskName Of(string value)
{
return _values.GetOrAdd(value, _ => new TaskName(value));
}
public static implicit operator TaskName(string value) => Of(value);
public static implicit operator string(TaskName taskname) => taskname.Value;
public static TaskName[] 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 TaskName);
public bool Equals(TaskName? 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();
}
}

View File

@@ -10,7 +10,12 @@
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 type of media to retrieve or filter by.<br/>
///
@@ -23,17 +28,73 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
///
/// </remarks>
/// </summary>
public enum Type
[JsonConverter(typeof(OpenEnumConverter))]
public class Type : IEquatable<Type>
{
Movie = 1,
TvShow = 2,
Season = 3,
Episode = 4,
Artist = 5,
Album = 6,
Track = 7,
PhotoAlbum = 8,
Photo = 9,
public static readonly Type Movie = new Type(1);
public static readonly Type TvShow = new Type(2);
public static readonly Type Season = new Type(3);
public static readonly Type Episode = new Type(4);
public static readonly Type Artist = new Type(5);
public static readonly Type Album = new Type(6);
public static readonly Type Track = new Type(7);
public static readonly Type PhotoAlbum = new Type(8);
public static readonly Type Photo = new Type(9);
private static readonly Dictionary <long, Type> _knownValues =
new Dictionary <long, Type> ()
{
[1] = Movie,
[2] = TvShow,
[3] = Season,
[4] = Episode,
[5] = Artist,
[6] = Album,
[7] = Track,
[8] = PhotoAlbum,
[9] = Photo
};
private static readonly ConcurrentDictionary<long, Type> _values =
new ConcurrentDictionary<long, Type>(_knownValues);
private Type(long value)
{
Value = value;
}
public long Value { get; }
public static Type Of(long value)
{
return _values.GetOrAdd(value, _ => new Type(value));
}
public static implicit operator Type(long value) => Of(value);
public static implicit operator long(Type type) => type.Value;
public static Type[] 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 Type);
public bool Equals(Type? 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();
}
}