ci: regenerated with OpenAPI Doc 0.0.3, Speakeasy CLI 1.166.0

This commit is contained in:
speakeasybot
2024-02-05 00:40:10 +00:00
parent 966fd34307
commit 22f8f60b6f
87 changed files with 1811 additions and 358 deletions

View File

@@ -70,10 +70,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

View File

@@ -97,10 +97,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

View File

@@ -59,10 +59,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

View File

@@ -143,7 +143,6 @@ namespace PlexAPI
/// - `resolution`: Items categorized by resolution.<br/>
/// - `firstCharacter`: Items categorized by the first letter.<br/>
/// - `folder`: Items categorized by folder.<br/>
/// - `search?type=1`: Search functionality within the section.<br/>
///
/// </remarks>
/// </summary>
@@ -159,6 +158,33 @@ namespace PlexAPI
/// </summary>
Task<RefreshLibraryResponse> RefreshLibraryAsync(double sectionId);
/// <summary>
/// Search Library
///
/// <remarks>
/// Search for content within a specific section of the library.<br/>
/// <br/>
/// ### Types<br/>
/// Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls:<br/>
/// <br/>
/// - **Type Object Attributes**:<br/>
/// - `type`: Metadata type (if standard Plex type). <br/>
/// - `title`: Title for this content type (e.g., &quot;Movies&quot;).<br/>
/// <br/>
/// - **Filter Objects**:<br/>
/// - Subset of the media query language.<br/>
/// - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`.<br/>
/// <br/>
/// - **Sort Objects**:<br/>
/// - Description of sort fields.<br/>
/// - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`.<br/>
/// <br/>
/// &gt; **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.<br/>
///
/// </remarks>
/// </summary>
Task<SearchLibraryResponse> SearchLibraryAsync(long sectionId, Type type);
/// <summary>
/// Get Items Metadata
///
@@ -201,10 +227,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;
@@ -543,6 +569,46 @@ namespace PlexAPI
}
public async Task<SearchLibraryResponse> SearchLibraryAsync(long sectionId, Type type)
{
var request = new SearchLibraryRequest()
{
SectionId = sectionId,
Type = type,
};
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails();
var urlString = URLBuilder.Build(baseUrl, "/library/sections/{sectionId}/search", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent);
var client = _securityClient;
var httpResponse = await client.SendAsync(httpRequest);
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
var response = new SearchLibraryResponse
{
StatusCode = (int)httpResponse.StatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{
response.Object = JsonConvert.DeserializeObject<SearchLibraryResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
}
return response;
}
return response;
}
public async Task<GetMetadataResponse> GetMetadataAsync(double ratingKey)
{
var request = new GetMetadataRequest()

View File

@@ -90,10 +90,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

View File

@@ -68,10 +68,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

View File

@@ -25,7 +25,7 @@ namespace PlexAPI.Models.Requests
/// type of playlist to create
/// </summary>
[SpeakeasyMetadata("queryParam:style=form,explode=true,name=type")]
public Type Type { get; set; } = default!;
public QueryParamType Type { get; set; } = default!;
/// <summary>
/// whether the playlist is smart or not

View File

@@ -77,6 +77,6 @@ namespace PlexAPI.Models.Requests
public int? Hidden { get; set; }
[JsonProperty("Location")]
public List<Location>? Location { get; set; }
public List<GetLibrariesLocation>? Location { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
public class GetLibrariesLocation
{
[JsonProperty("id")]
public int? Id { get; set; }
[JsonProperty("path")]
public string? Path { get; set; }
}
}

View File

@@ -58,6 +58,9 @@ namespace PlexAPI.Models.Requests
[JsonProperty("viewMode")]
public int? ViewMode { get; set; }
[JsonProperty("mixedParents")]
public bool? MixedParents { get; set; }
[JsonProperty("Metadata")]
public List<GetLibraryItemsMetadata>? Metadata { get; set; }
}

View File

@@ -83,6 +83,27 @@ namespace PlexAPI.Models.Requests
[JsonProperty("ratingImage")]
public string? RatingImage { get; set; }
[JsonProperty("grandparentRatingKey")]
public string? GrandparentRatingKey { get; set; }
[JsonProperty("grandparentGuid")]
public string? GrandparentGuid { get; set; }
[JsonProperty("grandparentKey")]
public string? GrandparentKey { get; set; }
[JsonProperty("grandparentTitle")]
public string? GrandparentTitle { get; set; }
[JsonProperty("grandparentThumb")]
public string? GrandparentThumb { get; set; }
[JsonProperty("grandparentArt")]
public string? GrandparentArt { get; set; }
[JsonProperty("grandparentTheme")]
public string? GrandparentTheme { get; set; }
[JsonProperty("Media")]
public List<GetLibraryItemsMedia>? Media { get; set; }
@@ -118,5 +139,53 @@ namespace PlexAPI.Models.Requests
[JsonProperty("skipCount")]
public int? SkipCount { get; set; }
[JsonProperty("index")]
public int? Index { get; set; }
[JsonProperty("theme")]
public string? Theme { get; set; }
[JsonProperty("leafCount")]
public int? LeafCount { get; set; }
[JsonProperty("viewedLeafCount")]
public int? ViewedLeafCount { get; set; }
[JsonProperty("childCount")]
public int? ChildCount { get; set; }
[JsonProperty("hasPremiumExtras")]
public string? HasPremiumExtras { get; set; }
[JsonProperty("hasPremiumPrimaryExtra")]
public string? HasPremiumPrimaryExtra { get; set; }
[JsonProperty("parentRatingKey")]
public string? ParentRatingKey { get; set; }
[JsonProperty("parentGuid")]
public string? ParentGuid { get; set; }
[JsonProperty("parentStudio")]
public string? ParentStudio { get; set; }
[JsonProperty("parentKey")]
public string? ParentKey { get; set; }
[JsonProperty("parentTitle")]
public string? ParentTitle { get; set; }
[JsonProperty("parentIndex")]
public int? ParentIndex { get; set; }
[JsonProperty("parentYear")]
public int? ParentYear { get; set; }
[JsonProperty("parentThumb")]
public string? ParentThumb { get; set; }
[JsonProperty("parentTheme")]
public string? ParentTheme { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
public class GetPinErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
using System.Collections.Generic;
/// <summary>
/// X-Plex-Client-Identifier is missing
/// </summary>
public class GetPinPlexTvResponseBody
{
[JsonProperty("errors")]
public List<GetPinErrors>? Errors { get; set; }
}
}

View File

@@ -0,0 +1,36 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using PlexAPI.Utils;
public class GetPinRequest
{
/// <summary>
/// Plex Authentication Token
/// </summary>
[SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier")]
public string XPlexClientIdentifier { get; set; } = default!;
/// <summary>
/// Determines the kind of code returned by the API call<br/>
///
/// <remarks>
/// Strong codes are used for Pin authentication flows<br/>
/// Non-Strong codes are used for `Plex.tv/link`<br/>
///
/// </remarks>
/// </summary>
[SpeakeasyMetadata("queryParam:style=form,explode=true,name=strong")]
public bool? Strong { get; set; }
}
}

View File

@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using System.Net.Http;
using System;
public class GetPinResponse
{
/// <summary>
/// HTTP response content type for this operation
/// </summary>
public string? ContentType { get; set; } = default!;
/// <summary>
/// HTTP response status code for this operation
/// </summary>
public int StatusCode { get; set; } = default!;
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
public HttpResponseMessage RawResponse { get; set; } = default!;
/// <summary>
/// The Pin
/// </summary>
public GetPinResponseBody? TwoHundredApplicationJsonObject { get; set; }
/// <summary>
/// X-Plex-Client-Identifier is missing
/// </summary>
public GetPinPlexTvResponseBody? FourHundredApplicationJsonObject { get; set; }
}
}

View File

@@ -0,0 +1,70 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
using System;
/// <summary>
/// The Pin
/// </summary>
public class GetPinResponseBody
{
/// <summary>
/// PinID for use with authentication
/// </summary>
[JsonProperty("id")]
public double? Id { get; set; }
[JsonProperty("code")]
public string? Code { get; set; }
[JsonProperty("product")]
public string? Product { get; set; }
[JsonProperty("trusted")]
public bool? Trusted { get; set; }
/// <summary>
/// a link to a QR code hosted on plex.tv <br/>
///
/// <remarks>
/// The QR code redirects to the relevant `plex.tv/link` authentication page<br/>
/// Which then prompts the user for the 4 Digit Link Pin<br/>
///
/// </remarks>
/// </summary>
[JsonProperty("qr")]
public string? Qr { get; set; }
[JsonProperty("clientIdentifier")]
public string? ClientIdentifier { get; set; }
[JsonProperty("location")]
public Location? Location { get; set; }
[JsonProperty("expiresIn")]
public double? ExpiresIn { get; set; }
[JsonProperty("createdAt")]
public DateTime? CreatedAt { get; set; }
[JsonProperty("expiresAt")]
public DateTime? ExpiresAt { get; set; }
[JsonProperty("authToken")]
public string? AuthToken { get; set; }
[JsonProperty("newRegistration")]
public string? NewRegistration { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
public class GetTokenErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using PlexAPI.Utils;
public class GetTokenRequest
{
/// <summary>
/// The PinID to retrieve an access token for
/// </summary>
[SpeakeasyMetadata("pathParam:style=simple,explode=false,name=pinID")]
public string PinID { get; set; } = default!;
/// <summary>
/// Plex Authentication Token
/// </summary>
[SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier")]
public string XPlexClientIdentifier { get; set; } = default!;
}
}

View File

@@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using System.Net.Http;
using System;
public class GetTokenResponse
{
/// <summary>
/// HTTP response content type for this operation
/// </summary>
public string? ContentType { get; set; } = default!;
/// <summary>
/// HTTP response status code for this operation
/// </summary>
public int StatusCode { get; set; } = default!;
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
public HttpResponseMessage RawResponse { get; set; } = default!;
/// <summary>
/// X-Plex-Client-Identifier is missing
/// </summary>
public GetTokenResponseBody? Object { get; set; }
}
}

View File

@@ -0,0 +1,25 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
using System.Collections.Generic;
/// <summary>
/// X-Plex-Client-Identifier is missing
/// </summary>
public class GetTokenResponseBody
{
[JsonProperty("errors")]
public List<GetTokenErrors>? Errors { get; set; }
}
}

View File

@@ -0,0 +1,58 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
using System;
/// <summary>
/// `delegation` - This is the only supported `type` parameter.
/// </summary>
public enum GetTransientTokenQueryParamType
{
[JsonProperty("delegation")]
Delegation,
}
public static class GetTransientTokenQueryParamTypeExtension
{
public static string Value(this GetTransientTokenQueryParamType value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static GetTransientTokenQueryParamType ToEnum(this string value)
{
foreach(var field in typeof(GetTransientTokenQueryParamType).GetFields())
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
if (enumVal is GetTransientTokenQueryParamType)
{
return (GetTransientTokenQueryParamType)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum GetTransientTokenQueryParamType");
}
}
}

View File

@@ -19,7 +19,7 @@ namespace PlexAPI.Models.Requests
/// `delegation` - This is the only supported `type` parameter.
/// </summary>
[SpeakeasyMetadata("queryParam:style=form,explode=true,name=type")]
public QueryParamType Type { get; set; } = default!;
public GetTransientTokenQueryParamType Type { get; set; } = default!;
/// <summary>
/// `all` - This is the only supported `scope` parameter.

View File

@@ -15,10 +15,34 @@ namespace PlexAPI.Models.Requests
public class Location
{
[JsonProperty("id")]
public int? Id { get; set; }
[JsonProperty("code")]
public string? Code { get; set; }
[JsonProperty("path")]
public string? Path { get; set; }
[JsonProperty("european_union_member")]
public bool? EuropeanUnionMember { get; set; }
[JsonProperty("continent_code")]
public string? ContinentCode { get; set; }
[JsonProperty("country")]
public string? Country { get; set; }
[JsonProperty("city")]
public string? City { get; set; }
[JsonProperty("time_zone")]
public string? TimeZone { get; set; }
[JsonProperty("postal_code")]
public double? PostalCode { get; set; }
[JsonProperty("in_privacy_restricted_country")]
public bool? InPrivacyRestrictedCountry { get; set; }
[JsonProperty("subdivisions")]
public string? Subdivisions { get; set; }
[JsonProperty("coordinates")]
public string? Coordinates { get; set; }
}
}

View File

@@ -14,12 +14,16 @@ namespace PlexAPI.Models.Requests
using System;
/// <summary>
/// `delegation` - This is the only supported `type` parameter.
/// type of playlist to create
/// </summary>
public enum QueryParamType
{
[JsonProperty("delegation")]
Delegation,
[JsonProperty("audio")]
Audio,
[JsonProperty("video")]
Video,
[JsonProperty("photo")]
Photo,
}
public static class QueryParamTypeExtension

View File

@@ -0,0 +1,58 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
using System.Collections.Generic;
public class SearchLibraryMediaContainer
{
[JsonProperty("size")]
public int? Size { get; set; }
[JsonProperty("allowSync")]
public bool? AllowSync { get; set; }
[JsonProperty("art")]
public string? Art { get; set; }
[JsonProperty("identifier")]
public string? Identifier { get; set; }
[JsonProperty("mediaTagPrefix")]
public string? MediaTagPrefix { get; set; }
[JsonProperty("mediaTagVersion")]
public int? MediaTagVersion { get; set; }
[JsonProperty("nocache")]
public bool? Nocache { get; set; }
[JsonProperty("thumb")]
public string? Thumb { get; set; }
[JsonProperty("title1")]
public string? Title1 { get; set; }
[JsonProperty("title2")]
public string? Title2 { get; set; }
[JsonProperty("viewGroup")]
public string? ViewGroup { get; set; }
[JsonProperty("viewMode")]
public int? ViewMode { get; set; }
[JsonProperty("Metadata")]
public List<SearchLibraryMetadata>? Metadata { get; set; }
}
}

View File

@@ -0,0 +1,78 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
public class SearchLibraryMetadata
{
[JsonProperty("ratingKey")]
public string? RatingKey { get; set; }
[JsonProperty("key")]
public string? Key { get; set; }
[JsonProperty("parentRatingKey")]
public string? ParentRatingKey { get; set; }
[JsonProperty("guid")]
public string? Guid { get; set; }
[JsonProperty("parentGuid")]
public string? ParentGuid { get; set; }
[JsonProperty("parentStudio")]
public string? ParentStudio { get; set; }
[JsonProperty("type")]
public string? Type { get; set; }
[JsonProperty("title")]
public string? Title { get; set; }
[JsonProperty("parentKey")]
public string? ParentKey { get; set; }
[JsonProperty("parentTitle")]
public string? ParentTitle { get; set; }
[JsonProperty("summary")]
public string? Summary { get; set; }
[JsonProperty("index")]
public int? Index { get; set; }
[JsonProperty("parentIndex")]
public int? ParentIndex { get; set; }
[JsonProperty("parentYear")]
public int? ParentYear { get; set; }
[JsonProperty("thumb")]
public string? Thumb { get; set; }
[JsonProperty("art")]
public string? Art { get; set; }
[JsonProperty("parentThumb")]
public string? ParentThumb { get; set; }
[JsonProperty("parentTheme")]
public string? ParentTheme { get; set; }
[JsonProperty("addedAt")]
public int? AddedAt { get; set; }
[JsonProperty("updatedAt")]
public int? UpdatedAt { get; set; }
}
}

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using PlexAPI.Utils;
public class SearchLibraryRequest
{
/// <summary>
/// the Id of the library to query
/// </summary>
[SpeakeasyMetadata("pathParam:style=simple,explode=false,name=sectionId")]
public long SectionId { get; set; } = default!;
/// <summary>
/// Plex content type to search for
/// </summary>
[SpeakeasyMetadata("queryParam:style=form,explode=true,name=type")]
public Type Type { get; set; } = default!;
}
}

View File

@@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using System.Net.Http;
using System;
public class SearchLibraryResponse
{
/// <summary>
/// HTTP response content type for this operation
/// </summary>
public string? ContentType { get; set; } = default!;
/// <summary>
/// HTTP response status code for this operation
/// </summary>
public int StatusCode { get; set; } = default!;
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
public HttpResponseMessage RawResponse { get; set; } = default!;
/// <summary>
/// The contents of the library by section and type
/// </summary>
public SearchLibraryResponseBody? Object { get; set; }
}
}

View File

@@ -0,0 +1,24 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
/// <summary>
/// The contents of the library by section and type
/// </summary>
public class SearchLibraryResponseBody
{
[JsonProperty("MediaContainer")]
public SearchLibraryMediaContainer? MediaContainer { get; set; }
}
}

View File

@@ -56,8 +56,6 @@ namespace PlexAPI.Models.Requests
FirstCharacter,
[JsonProperty("folder")]
Folder,
[JsonProperty("search?type=1")]
SearchTypeEqual1,
}
public static class TagExtension

View File

@@ -10,53 +10,16 @@
#nullable enable
namespace PlexAPI.Models.Requests
{
using Newtonsoft.Json;
using System;
/// <summary>
/// type of playlist to create
/// Plex content type to search for
/// </summary>
public enum Type
{
[JsonProperty("audio")]
Audio,
[JsonProperty("video")]
Video,
[JsonProperty("photo")]
Photo,
}
public static class TypeExtension
{
public static string Value(this Type value)
{
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
}
public static Type ToEnum(this string value)
{
foreach(var field in typeof(Type).GetFields())
{
var attributes = field.GetCustomAttributes(typeof(JsonPropertyAttribute), false);
if (attributes.Length == 0)
{
continue;
}
var attribute = attributes[0] as JsonPropertyAttribute;
if (attribute != null && attribute.PropertyName == value)
{
var enumVal = field.GetValue(null);
if (enumVal is Type)
{
return (Type)enumVal;
}
}
}
throw new Exception($"Unknown value {value} for enum Type");
}
One = 1,
Two = 2,
Three = 3,
Four = 4,
}
}

View File

@@ -142,10 +142,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

44
PlexAPI/Plex.cs Normal file
View File

@@ -0,0 +1,44 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI
{
using PlexAPI.Utils;
using System;
public interface IPlex
{
public ITv Tv { get; }
}
public class Plex: IPlex
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;
public ITv Tv { get; private set; }
public Plex(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config)
{
_defaultClient = defaultClient;
_securityClient = securityClient;
_serverUrl = serverUrl;
SDKConfiguration = config;
Tv = new Tv(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
}
}
}

View File

@@ -2,7 +2,7 @@
<PropertyGroup>
<IsPackable>true</IsPackable>
<PackageId>Plex-API</PackageId>
<Version>0.1.5</Version>
<Version>0.2.0</Version>
<Authors>LukeHagar</Authors>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>

View File

@@ -151,6 +151,7 @@ namespace PlexAPI
/// </remarks>
/// </summary>
public ILog Log { get; }
public IPlex Plex { get; }
/// <summary>
/// Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as &quot;all albums from 2017&quot;). <br/>
@@ -235,11 +236,12 @@ namespace PlexAPI
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private int _serverIndex = 0;
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;
public IServer Server { get; private set; }
@@ -250,6 +252,7 @@ namespace PlexAPI
public ISearch Search { get; private set; }
public ILibrary Library { get; private set; }
public ILog Log { get; private set; }
public IPlex Plex { get; private set; }
public IPlaylists Playlists { get; private set; }
public ISecurity Security { get; private set; }
public ISessions Sessions { get; private set; }
@@ -258,8 +261,15 @@ namespace PlexAPI
public PlexAPISDK(Security? security = null, int? serverIndex = null, ServerProtocol? protocol = null, string? ip = null, string? port = null, string? serverUrl = null, Dictionary<string, string>? urlParams = null, ISpeakeasyHttpClient? client = null)
{
if (serverUrl != null) {
if (urlParams != null) {
if (serverIndex != null)
{
_serverIndex = serverIndex.Value;
}
if (serverUrl != null)
{
if (urlParams != null)
{
serverUrl = Utilities.TemplateUrl(serverUrl, urlParams);
}
_serverUrl = serverUrl;
@@ -276,15 +286,16 @@ namespace PlexAPI
_defaultClient = new SpeakeasyHttpClient(client);
_securityClient = _defaultClient;
if(security != null)
{
_securityClient = SecuritySerializer.Apply(_defaultClient, security);
}
SDKConfiguration = new SDKConfig()
{
ServerDefaults = serverDefaults,
serverIndex = _serverIndex,
serverUrl = _serverUrl
};
@@ -296,6 +307,7 @@ namespace PlexAPI
Search = new Search(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
Library = new Library(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
Log = new Log(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
Plex = new Plex(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
Playlists = new Playlists(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
Security = new Security(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
Sessions = new Sessions(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
@@ -303,4 +315,4 @@ namespace PlexAPI
Video = new Video(_defaultClient, _securityClient, _serverUrl, SDKConfiguration);
}
}
}
}

View File

@@ -83,10 +83,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

View File

@@ -36,7 +36,7 @@ namespace PlexAPI
///
/// </remarks>
/// </summary>
Task<GetTransientTokenResponse> GetTransientTokenAsync(QueryParamType type, Scope scope);
Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope);
/// <summary>
/// Get Source Connection Information
@@ -61,10 +61,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;
@@ -78,7 +78,7 @@ namespace PlexAPI
}
public async Task<GetTransientTokenResponse> GetTransientTokenAsync(QueryParamType type, Scope scope)
public async Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope)
{
var request = new GetTransientTokenRequest()
{

View File

@@ -113,10 +113,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

View File

@@ -76,10 +76,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

185
PlexAPI/Tv.cs Normal file
View File

@@ -0,0 +1,185 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT.
//
// Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
#nullable enable
namespace PlexAPI
{
using Newtonsoft.Json;
using PlexAPI.Models.Requests;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http.Headers;
using System.Net.Http;
using System.Threading.Tasks;
using System;
public interface ITv
{
/// <summary>
/// Get a Pin
///
/// <remarks>
/// Retrieve a Pin from Plex.tv for authentication flows
/// </remarks>
/// </summary>
Task<GetPinResponse> GetPinAsync(string xPlexClientIdentifier, bool? strong = null, string? serverUrl = null);
/// <summary>
/// Get Access Token
///
/// <remarks>
/// Retrieve an Access Token from Plex.tv after the Pin has already been authenticated
/// </remarks>
/// </summary>
Task<GetTokenResponse> GetTokenAsync(string pinID, string xPlexClientIdentifier, string? serverUrl = null);
}
public class Tv: ITv
{
/**
* GetPinServerList contains the list of server urls available to the SDK.
*/
public static readonly string[] GetPinServerList = {
"https://plex.tv/api/v2",
};
/**
* GetTokenServerList contains the list of server urls available to the SDK.
*/
public static readonly string[] GetTokenServerList = {
"https://plex.tv/api/v2",
};
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;
public Tv(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config)
{
_defaultClient = defaultClient;
_securityClient = securityClient;
_serverUrl = serverUrl;
SDKConfiguration = config;
}
public async Task<GetPinResponse> GetPinAsync(string xPlexClientIdentifier, bool? strong = null, string? serverUrl = null)
{
var request = new GetPinRequest()
{
XPlexClientIdentifier = xPlexClientIdentifier,
Strong = strong,
};
string baseUrl = Utilities.TemplateUrl(GetPinServerList[0], new Dictionary<string, string>(){
});
if (serverUrl != null)
{
baseUrl = serverUrl;
}
var urlString = URLBuilder.Build(baseUrl, "/pins", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
httpRequest.Headers.Add("user-agent", _userAgent);
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
var client = _securityClient;
var httpResponse = await client.SendAsync(httpRequest);
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
var response = new GetPinResponse
{
StatusCode = (int)httpResponse.StatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{
response.TwoHundredApplicationJsonObject = JsonConvert.DeserializeObject<GetPinResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
}
return response;
}
if((response.StatusCode == 400))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{
response.FourHundredApplicationJsonObject = JsonConvert.DeserializeObject<GetPinPlexTvResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
}
return response;
}
return response;
}
public async Task<GetTokenResponse> GetTokenAsync(string pinID, string xPlexClientIdentifier, string? serverUrl = null)
{
var request = new GetTokenRequest()
{
PinID = pinID,
XPlexClientIdentifier = xPlexClientIdentifier,
};
string baseUrl = Utilities.TemplateUrl(GetTokenServerList[0], new Dictionary<string, string>(){
});
if (serverUrl != null)
{
baseUrl = serverUrl;
}
var urlString = URLBuilder.Build(baseUrl, "/pins/{pinID}", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent);
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
var client = _securityClient;
var httpResponse = await client.SendAsync(httpRequest);
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
var response = new GetTokenResponse
{
StatusCode = (int)httpResponse.StatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200))
{
return response;
}
if((response.StatusCode == 400))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{
response.Object = JsonConvert.DeserializeObject<GetTokenResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }});
}
return response;
}
return response;
}
}
}

View File

@@ -70,10 +70,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;

View File

@@ -58,10 +58,10 @@ namespace PlexAPI
{
public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp";
private const string _sdkVersion = "0.1.5";
private const string _sdkGenVersion = "2.237.3";
private const string _sdkVersion = "0.2.0";
private const string _sdkGenVersion = "2.248.6";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API";
private const string _userAgent = "speakeasy-sdk/csharp 0.2.0 2.248.6 0.0.3 Plex-API";
private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient;
private ISpeakeasyHttpClient _securityClient;