mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 12:37:46 +00:00
Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c695dbace1 | ||
|
|
835a7430fa | ||
|
|
8c02f6a6ae | ||
|
|
8563e8fef2 | ||
|
|
1f5d4ff03a | ||
|
|
d970db3b6f | ||
|
|
4197184f92 | ||
|
|
bc02ecef34 | ||
|
|
55b5c2b3dd | ||
|
|
67a53e72d5 | ||
|
|
9ccab7b22d | ||
|
|
eb2f6e54a2 | ||
|
|
4b798cbb85 | ||
|
|
a89870d526 | ||
|
|
01b116a71c | ||
|
|
9831457f45 | ||
|
|
653b23dab6 | ||
|
|
86c36c72b7 | ||
|
|
3e00ddc6b1 | ||
|
|
d976a079a9 | ||
|
|
b10d5f7023 | ||
|
|
c431cee288 | ||
|
|
5195de1dca | ||
|
|
43dc47a5a0 | ||
|
|
53157408b3 | ||
|
|
fe81f4dff0 | ||
|
|
c9746b7ad8 | ||
|
|
0ec48b6a1d | ||
|
|
14e54fa017 | ||
|
|
61492e5dad | ||
|
|
f099c01940 | ||
|
|
92be5b3a91 | ||
|
|
a183f389bc | ||
|
|
4a443f6f2e | ||
|
|
b9b7cd1146 | ||
|
|
81c55cb08b | ||
|
|
860991f2a0 | ||
|
|
d25639db53 | ||
|
|
227e2351d5 | ||
|
|
3bd4f51297 | ||
|
|
4828de2345 | ||
|
|
2beb707ed5 |
1
.github/workflows/sdk_generation.yaml
vendored
1
.github/workflows/sdk_generation.yaml
vendored
@@ -24,6 +24,7 @@ jobs:
|
||||
mode: direct
|
||||
set_version: ${{ github.event.inputs.set_version }}
|
||||
speakeasy_version: latest
|
||||
dotnet_version: "8.x"
|
||||
secrets:
|
||||
github_access_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
nuget_api_key: ${{ secrets.NUGET_API_KEY }}
|
||||
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,3 +1,8 @@
|
||||
.env
|
||||
.env.local
|
||||
.DS_Store
|
||||
**/.speakeasy/temp/
|
||||
**/.speakeasy/logs/
|
||||
obj/
|
||||
bin/
|
||||
debug/
|
||||
|
||||
1
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/.name
generated
Normal file
1
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/.name
generated
Normal file
@@ -0,0 +1 @@
|
||||
LukeHagar.PlexAPI.SDK
|
||||
4
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/encodings.xml
generated
Normal file
4
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/encodings.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
||||
</project>
|
||||
8
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/indexLayout.xml
generated
Normal file
8
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/indexLayout.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="UserContentModel">
|
||||
<attachedFolders />
|
||||
<explicitIncludes />
|
||||
<explicitExcludes />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/projectSettingsUpdater.xml
generated
Normal file
6
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/projectSettingsUpdater.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RiderProjectSettingsUpdater">
|
||||
<option name="vcsConfiguration" value="3" />
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/vcs.xml
generated
Normal file
6
.idea/.idea.LukeHagar.PlexAPI.SDK/.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
9160
.speakeasy/gen.lock
9160
.speakeasy/gen.lock
File diff suppressed because one or more lines are too long
@@ -4,22 +4,40 @@ generation:
|
||||
maintainOpenAPIOrder: true
|
||||
usageSnippets:
|
||||
optionalPropertyRendering: withExample
|
||||
sdkInitStyle: constructor
|
||||
useClassNamesForArrayFields: true
|
||||
fixes:
|
||||
nameResolutionDec2023: true
|
||||
nameResolutionFeb2025: false
|
||||
parameterOrderingFeb2024: true
|
||||
requestResponseComponentNamesFeb2024: true
|
||||
securityFeb2025: false
|
||||
sharedErrorComponentsApr2025: false
|
||||
auth:
|
||||
oAuth2ClientCredentialsEnabled: true
|
||||
oAuth2PasswordEnabled: false
|
||||
hoistGlobalSecurity: true
|
||||
schemas:
|
||||
allOfMergeStrategy: shallowMerge
|
||||
requestBodyFieldName: ""
|
||||
tests:
|
||||
generateTests: true
|
||||
generateNewTests: false
|
||||
skipResponseBodyAssertions: false
|
||||
csharp:
|
||||
version: 0.8.2
|
||||
version: 0.19.0
|
||||
additionalDependencies: []
|
||||
author: LukeHagar
|
||||
baseErrorName: PlexAPIError
|
||||
clientServerStatusCodesAsErrors: true
|
||||
defaultErrorName: SDKException
|
||||
disableNamespacePascalCasingApr2024: true
|
||||
dotnetVersion: net8.0
|
||||
enableCancellationToken: false
|
||||
enableSourceLink: true
|
||||
flattenGlobalSecurity: true
|
||||
flatteningOrder: ""
|
||||
httpClientPrefix: Speakeasy
|
||||
imports:
|
||||
option: openapi
|
||||
paths:
|
||||
@@ -31,8 +49,10 @@ csharp:
|
||||
includeDebugSymbols: true
|
||||
inputModelSuffix: input
|
||||
maxMethodParams: 4
|
||||
methodArguments: infer-optional-args
|
||||
outputModelSuffix: output
|
||||
packageName: LukeHagar.PlexAPI.SDK
|
||||
packageTags: Plex Media Server SDK
|
||||
responseFormat: envelope
|
||||
sourceDirectory: ""
|
||||
useNodatime: true
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
speakeasyVersion: 1.404.5
|
||||
speakeasyVersion: 1.650.0
|
||||
sources:
|
||||
my-source:
|
||||
sourceNamespace: my-source
|
||||
@@ -16,26 +16,29 @@ sources:
|
||||
- main
|
||||
plexapi:
|
||||
sourceNamespace: plexapi
|
||||
sourceRevisionDigest: sha256:276a31ab98595ebaf2b1fac4b4f5c3c1c7b55e0431f9074c89b8fbcb55b52d3f
|
||||
sourceBlobDigest: sha256:2bc9e816db669d609d8a5988ebb629578dc5cbbaff191d260b5c63b7ba1bd59b
|
||||
sourceRevisionDigest: sha256:03b08b3b9bc9b0b48588eaa1f2b3774e7809a8ddd6071176c73215531ca535a5
|
||||
sourceBlobDigest: sha256:1e9fb72587f46b9af45ca38a4c3d1c21e02813caf19ac554c1b22f31f415a202
|
||||
tags:
|
||||
- latest
|
||||
- main
|
||||
- speakeasy-sdk-regen-1762467850
|
||||
- 1.1.1
|
||||
targets:
|
||||
plexcsharp:
|
||||
source: plexapi
|
||||
sourceNamespace: plexapi
|
||||
sourceRevisionDigest: sha256:276a31ab98595ebaf2b1fac4b4f5c3c1c7b55e0431f9074c89b8fbcb55b52d3f
|
||||
sourceBlobDigest: sha256:2bc9e816db669d609d8a5988ebb629578dc5cbbaff191d260b5c63b7ba1bd59b
|
||||
sourceRevisionDigest: sha256:03b08b3b9bc9b0b48588eaa1f2b3774e7809a8ddd6071176c73215531ca535a5
|
||||
sourceBlobDigest: sha256:1e9fb72587f46b9af45ca38a4c3d1c21e02813caf19ac554c1b22f31f415a202
|
||||
codeSamplesNamespace: code-samples-csharp-plexcsharp
|
||||
codeSamplesRevisionDigest: sha256:bc6e1a88628b72f211e33c015c1dbc6badafb295aeebf5a0bdafe1b542483c89
|
||||
codeSamplesRevisionDigest: sha256:8a32f0ee4f35ea29b319f361f745d456ee8186d595b8058fb1b172632b747196
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: latest
|
||||
sources:
|
||||
plexapi:
|
||||
inputs:
|
||||
- location: registry.speakeasyapi.dev/plexapi/plexapi/plexapi:main
|
||||
- location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/refs/heads/main/plex-api-spec.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/plexapi/plexapi/plexapi
|
||||
targets:
|
||||
plexcsharp:
|
||||
target: csharp
|
||||
@@ -47,3 +50,5 @@ workflow:
|
||||
output: codeSamples.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/plexapi/plexapi/code-samples-csharp-plexcsharp
|
||||
labelOverride:
|
||||
fixedValue: PlexCSharp
|
||||
|
||||
@@ -3,7 +3,9 @@ speakeasyVersion: latest
|
||||
sources:
|
||||
plexapi:
|
||||
inputs:
|
||||
- location: registry.speakeasyapi.dev/plexapi/plexapi/plexapi:main
|
||||
- location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/refs/heads/main/plex-api-spec.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/plexapi/plexapi/plexapi
|
||||
targets:
|
||||
plexcsharp:
|
||||
target: csharp
|
||||
@@ -15,3 +17,5 @@ targets:
|
||||
output: codeSamples.yaml
|
||||
registry:
|
||||
location: registry.speakeasyapi.dev/plexapi/plexapi/code-samples-csharp-plexcsharp
|
||||
labelOverride:
|
||||
fixedValue: PlexCSharp
|
||||
|
||||
@@ -13,25 +13,23 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.<br/>
|
||||
/// Activities provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// <br/>
|
||||
/// Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.<br/>
|
||||
/// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details:<br/>
|
||||
/// - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity.<br/>
|
||||
/// - They must contain an `type` which is used by clients to distinguish the specific activity.<br/>
|
||||
/// - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)<br/>
|
||||
/// - The may contain a `Response` object which attributes which represent the result of the asynchronous operation.<br/>
|
||||
/// <br/>
|
||||
/// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
@@ -39,34 +37,32 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Get Server Activities
|
||||
/// Get all activities
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get Server Activities
|
||||
/// List all activities on the server. Admins can see all activities but other users can only see their own
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetServerActivitiesResponse> GetServerActivitiesAsync();
|
||||
Task<ListActivitiesResponse> ListActivitiesAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Cancel Server Activities
|
||||
/// Cancel a running activity
|
||||
///
|
||||
/// <remarks>
|
||||
/// Cancel Server Activities
|
||||
/// Cancel a running activity. Admins can cancel all activities but other users can only cancel their own
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<CancelServerActivitiesResponse> CancelServerActivitiesAsync(string activityUUID);
|
||||
Task<CancelActivityResponse> CancelActivityAsync(CancelActivityRequest request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.<br/>
|
||||
/// Activities provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// <br/>
|
||||
/// Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.<br/>
|
||||
/// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details:<br/>
|
||||
/// - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity.<br/>
|
||||
/// - They must contain an `type` which is used by clients to distinguish the specific activity.<br/>
|
||||
/// - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)<br/>
|
||||
/// - The may contain a `Response` object which attributes which represent the result of the asynchronous operation.<br/>
|
||||
/// <br/>
|
||||
/// Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
@@ -74,47 +70,40 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.8.2";
|
||||
private const string _sdkGenVersion = "2.426.2";
|
||||
private const string _openapiDocVersion = "0.0.3";
|
||||
private const string _userAgent = "speakeasy-sdk/csharp 0.8.2 2.426.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||
private string _serverUrl = "";
|
||||
private ISpeakeasyHttpClient _client;
|
||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||
private const string _sdkVersion = "0.19.0";
|
||||
private const string _sdkGenVersion = "2.743.2";
|
||||
private const string _openapiDocVersion = "1.1.1";
|
||||
|
||||
public Activities(ISpeakeasyHttpClient client, Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
|
||||
public Activities(SDKConfig config)
|
||||
{
|
||||
_client = client;
|
||||
_securitySource = securitySource;
|
||||
_serverUrl = serverUrl;
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<GetServerActivitiesResponse> GetServerActivitiesAsync()
|
||||
public async Task<ListActivitiesResponse> ListActivitiesAsync()
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/activities";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("getServerActivities", null, _securitySource);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "listActivities", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
@@ -144,8 +133,18 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetServerActivitiesResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
var response = new GetServerActivitiesResponse()
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
ListActivitiesResponseBody obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<ListActivitiesResponseBody>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into ListActivitiesResponseBody.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new ListActivitiesResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
@@ -155,66 +154,61 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetServerActivitiesBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetServerActivitiesUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
public async Task<CancelActivityResponse> CancelActivityAsync(CancelActivityRequest request)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
if (request == null)
|
||||
{
|
||||
request = new CancelActivityRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<CancelServerActivitiesResponse> CancelServerActivitiesAsync(string activityUUID)
|
||||
{
|
||||
var request = new CancelServerActivitiesRequest()
|
||||
{
|
||||
ActivityUUID = activityUUID,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/activities/{activityUUID}", request);
|
||||
var urlString = URLBuilder.Build(baseUrl, "/activities/{activityId}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (_securitySource != null)
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("cancelServerActivities", null, _securitySource);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "cancelActivity", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
if (_statusCode == 400 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
@@ -242,41 +236,23 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new CancelServerActivitiesResponse()
|
||||
return new CancelActivityResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
else if(responseStatusCode == 400 || responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<CancelServerActivitiesBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<CancelServerActivitiesUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,509 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Hooks;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// API Calls regarding authentication for Plex Media Server<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public interface IAuthentication
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Get a Transient Token
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope);
|
||||
|
||||
/// <summary>
|
||||
/// Get Source Connection Information
|
||||
///
|
||||
/// <remarks>
|
||||
/// If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.<br/>
|
||||
/// Note: requires Plex Media Server >= 1.15.4.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(string source);
|
||||
|
||||
/// <summary>
|
||||
/// Get Token Details
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get the User data from the provided X-Plex-Token
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetTokenDetailsResponse> GetTokenDetailsAsync(string? serverUrl = null);
|
||||
|
||||
/// <summary>
|
||||
/// Get User Sign In Data
|
||||
///
|
||||
/// <remarks>
|
||||
/// Sign in user with username and password and return user data with Plex authentication token
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<PostUsersSignInDataResponse> PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// API Calls regarding authentication for Plex Media Server<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class Authentication: IAuthentication
|
||||
{
|
||||
/// <summary>
|
||||
/// List of server URLs available for the getTokenDetails operation.
|
||||
/// </summary>
|
||||
public static readonly string[] GetTokenDetailsServerList = {
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
/// <summary>
|
||||
/// List of server URLs available for the post-users-sign-in-data operation.
|
||||
/// </summary>
|
||||
public static readonly string[] PostUsersSignInDataServerList = {
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.8.2";
|
||||
private const string _sdkGenVersion = "2.426.2";
|
||||
private const string _openapiDocVersion = "0.0.3";
|
||||
private const string _userAgent = "speakeasy-sdk/csharp 0.8.2 2.426.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||
private string _serverUrl = "";
|
||||
private ISpeakeasyHttpClient _client;
|
||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||
|
||||
public Authentication(ISpeakeasyHttpClient client, Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
|
||||
{
|
||||
_client = client;
|
||||
_securitySource = securitySource;
|
||||
_serverUrl = serverUrl;
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope)
|
||||
{
|
||||
var request = new GetTransientTokenRequest()
|
||||
{
|
||||
Type = type,
|
||||
Scope = scope,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/security/token", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("getTransientToken", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new GetTransientTokenResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetTransientTokenBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetTransientTokenUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(string source)
|
||||
{
|
||||
var request = new GetSourceConnectionInformationRequest()
|
||||
{
|
||||
Source = source,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/security/resources", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("getSourceConnectionInformation", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new GetSourceConnectionInformationResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetSourceConnectionInformationBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetSourceConnectionInformationUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<GetTokenDetailsResponse> GetTokenDetailsAsync(string? serverUrl = null)
|
||||
{
|
||||
string baseUrl = Utilities.TemplateUrl(GetTokenDetailsServerList[0], new Dictionary<string, string>(){
|
||||
});
|
||||
if (serverUrl != null)
|
||||
{
|
||||
baseUrl = serverUrl;
|
||||
}
|
||||
|
||||
var urlString = baseUrl + "/user";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("getTokenDetails", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetTokenDetailsUserPlexAccount>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
var response = new GetTokenDetailsResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.UserPlexAccount = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetTokenDetailsBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetTokenDetailsUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<PostUsersSignInDataResponse> PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null)
|
||||
{
|
||||
request.ClientID ??= SDKConfiguration.ClientID;
|
||||
request.ClientName ??= SDKConfiguration.ClientName;
|
||||
request.ClientVersion ??= SDKConfiguration.ClientVersion;
|
||||
request.ClientPlatform ??= SDKConfiguration.ClientPlatform;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
|
||||
string baseUrl = Utilities.TemplateUrl(PostUsersSignInDataServerList[0], new Dictionary<string, string>(){
|
||||
});
|
||||
if (serverUrl != null)
|
||||
{
|
||||
baseUrl = serverUrl;
|
||||
}
|
||||
var urlString = URLBuilder.Build(baseUrl, "/users/signin", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
var serializedBody = RequestBodySerializer.Serialize(request, "RequestBody", "form", false, true);
|
||||
if (serializedBody != null)
|
||||
{
|
||||
httpRequest.Content = serializedBody;
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("post-users-sign-in-data", null, null);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 201)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<PostUsersSignInDataUserPlexAccount>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include);
|
||||
var response = new PostUsersSignInDataResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.UserPlexAccount = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<PostUsersSignInDataBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<PostUsersSignInDataUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,39 +13,46 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Butler is the task manager of the Plex Media Server Ecosystem.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// The butler is responsible for running periodic tasks. Some tasks run daily, others every few days, and some weekly. These includes database maintenance, metadata updating, thumbnail generation, media analysis, and other tasks.
|
||||
/// </summary>
|
||||
public interface IButler
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Get Butler tasks
|
||||
/// Stop all Butler tasks
|
||||
///
|
||||
/// <remarks>
|
||||
/// Returns a list of butler tasks
|
||||
/// This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetButlerTasksResponse> GetButlerTasksAsync();
|
||||
Task<StopTasksResponse> StopTasksAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get all Butler tasks
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get the list of butler tasks and their scheduling<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetTasksResponse> GetTasksAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Start all Butler tasks
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:<br/>
|
||||
/// <br/>
|
||||
/// 1. Any tasks not scheduled to run on the current day will be skipped.<br/>
|
||||
/// 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.<br/>
|
||||
/// 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.<br/>
|
||||
@@ -53,95 +60,141 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<StartAllTasksResponse> StartAllTasksAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Stop all Butler tasks
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<StopAllTasksResponse> StopAllTasksAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Start a single Butler task
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:<br/>
|
||||
/// 1. Any tasks not scheduled to run on the current day will be skipped.<br/>
|
||||
/// 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.<br/>
|
||||
/// 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.<br/>
|
||||
/// 4. If we are outside the configured window, the task will start immediately.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<StartTaskResponse> StartTaskAsync(TaskName taskName);
|
||||
Task<StartTasksResponse> StartTasksAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Stop a single Butler task
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint.<br/>
|
||||
/// This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<StopTaskResponse> StopTaskAsync(PathParamTaskName taskName);
|
||||
Task<StopTaskResponse> StopTaskAsync(StopTaskRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Start a single Butler task
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will attempt to start a specific Butler task by name.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<StartTaskResponse> StartTaskAsync(StartTaskRequest request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Butler is the task manager of the Plex Media Server Ecosystem.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// The butler is responsible for running periodic tasks. Some tasks run daily, others every few days, and some weekly. These includes database maintenance, metadata updating, thumbnail generation, media analysis, and other tasks.
|
||||
/// </summary>
|
||||
public class Butler: IButler
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.8.2";
|
||||
private const string _sdkGenVersion = "2.426.2";
|
||||
private const string _openapiDocVersion = "0.0.3";
|
||||
private const string _userAgent = "speakeasy-sdk/csharp 0.8.2 2.426.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||
private string _serverUrl = "";
|
||||
private ISpeakeasyHttpClient _client;
|
||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||
private const string _sdkVersion = "0.19.0";
|
||||
private const string _sdkGenVersion = "2.743.2";
|
||||
private const string _openapiDocVersion = "1.1.1";
|
||||
|
||||
public Butler(ISpeakeasyHttpClient client, Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
|
||||
public Butler(SDKConfig config)
|
||||
{
|
||||
_client = client;
|
||||
_securitySource = securitySource;
|
||||
_serverUrl = serverUrl;
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<GetButlerTasksResponse> GetButlerTasksAsync()
|
||||
public async Task<StopTasksResponse> StopTasksAsync()
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/butler";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("getButlerTasks", null, _securitySource);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "stopTasks", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new StopTasksResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<GetTasksResponse> GetTasksAsync()
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/butler";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getTasks", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
@@ -171,8 +224,18 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetButlerTasksResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
var response = new GetButlerTasksResponse()
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
GetTasksResponseBody obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<GetTasksResponseBody>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into GetTasksResponseBody.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new GetTasksResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
@@ -182,63 +245,45 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetButlerTasksBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetButlerTasksUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<StartAllTasksResponse> StartAllTasksAsync()
|
||||
public async Task<StartTasksResponse> StartTasksAsync()
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/butler";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("startAllTasks", null, _securitySource);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "startTasks", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
@@ -266,252 +311,66 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new StartAllTasksResponse()
|
||||
return new StartTasksResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<StartAllTasksBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<StartAllTasksUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
public async Task<StopTaskResponse> StopTaskAsync(StopTaskRequest request)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<StopAllTasksResponse> StopAllTasksAsync()
|
||||
if (request == null)
|
||||
{
|
||||
request = new StopTaskRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/butler";
|
||||
var urlString = URLBuilder.Build(baseUrl, "/butler/{task}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (_securitySource != null)
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("stopAllTasks", null, _securitySource);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "stopTask", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new StopAllTasksResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<StopAllTasksBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<StopAllTasksUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<StartTaskResponse> StartTaskAsync(TaskName taskName)
|
||||
{
|
||||
var request = new StartTaskRequest()
|
||||
{
|
||||
TaskName = taskName,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/butler/{taskName}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("startTask", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(new List<int>{200, 202}.Contains(responseStatusCode))
|
||||
{
|
||||
return new StartTaskResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<StartTaskBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<StartTaskUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<StopTaskResponse> StopTaskAsync(PathParamTaskName taskName)
|
||||
{
|
||||
var request = new StopTaskRequest()
|
||||
{
|
||||
TaskName = taskName,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/butler/{taskName}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("stopTask", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
if (_statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
@@ -546,34 +405,103 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<StopTaskBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<StopTaskUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
public async Task<StartTaskResponse> StartTaskAsync(StartTaskRequest request)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
if (request == null)
|
||||
{
|
||||
request = new StartTaskRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/butler/{task}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "startTask", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(new List<int>{200, 202}.Contains(responseStatusCode))
|
||||
{
|
||||
return new StartTaskResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
162
LukeHagar/PlexAPI/SDK/Collections.cs
Normal file
162
LukeHagar/PlexAPI/SDK/Collections.cs
Normal file
@@ -0,0 +1,162 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Hooks;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// API Operations against the Collections
|
||||
/// </summary>
|
||||
public interface ICollections
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Create collection
|
||||
///
|
||||
/// <remarks>
|
||||
/// Create a collection in the library
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<CreateCollectionResponse> CreateCollectionAsync(CreateCollectionRequest request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// API Operations against the Collections
|
||||
/// </summary>
|
||||
public class Collections: ICollections
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.19.0";
|
||||
private const string _sdkGenVersion = "2.743.2";
|
||||
private const string _openapiDocVersion = "1.1.1";
|
||||
|
||||
public Collections(SDKConfig config)
|
||||
{
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<CreateCollectionResponse> CreateCollectionAsync(CreateCollectionRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new CreateCollectionRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/library/collections", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "createCollection", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
MediaContainerWithMetadata obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<MediaContainerWithMetadata>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into MediaContainerWithMetadata.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new CreateCollectionResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.MediaContainerWithMetadata = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
1519
LukeHagar/PlexAPI/SDK/Content.cs
Normal file
1519
LukeHagar/PlexAPI/SDK/Content.cs
Normal file
File diff suppressed because it is too large
Load Diff
1350
LukeHagar/PlexAPI/SDK/DVRs.cs
Normal file
1350
LukeHagar/PlexAPI/SDK/DVRs.cs
Normal file
File diff suppressed because it is too large
Load Diff
1537
LukeHagar/PlexAPI/SDK/Devices.cs
Normal file
1537
LukeHagar/PlexAPI/SDK/Devices.cs
Normal file
File diff suppressed because it is too large
Load Diff
1032
LukeHagar/PlexAPI/SDK/DownloadQueue.cs
Normal file
1032
LukeHagar/PlexAPI/SDK/DownloadQueue.cs
Normal file
File diff suppressed because it is too large
Load Diff
1032
LukeHagar/PlexAPI/SDK/Epg.cs
Normal file
1032
LukeHagar/PlexAPI/SDK/Epg.cs
Normal file
File diff suppressed because it is too large
Load Diff
257
LukeHagar/PlexAPI/SDK/Events.cs
Normal file
257
LukeHagar/PlexAPI/SDK/Events.cs
Normal file
@@ -0,0 +1,257 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Hooks;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// The server can notify clients in real-time of a wide range of events, from library scanning, to preferences being modified, to changes to media, and many other things. This is also the mechanism by which activity progress is reported.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// <br/>
|
||||
/// Two protocols for receiving the events are available: EventSource (also known as SSE), and WebSocket.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public interface IEvents
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Connect to Eventsource
|
||||
///
|
||||
/// <remarks>
|
||||
/// Connect to the event source to get a stream of events
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetNotificationsResponse> GetNotificationsAsync(GetNotificationsRequest? request = null);
|
||||
|
||||
/// <summary>
|
||||
/// Connect to WebSocket
|
||||
///
|
||||
/// <remarks>
|
||||
/// Connect to the web socket to get a stream of events
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<ConnectWebSocketResponse> ConnectWebSocketAsync(ConnectWebSocketRequest? request = null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The server can notify clients in real-time of a wide range of events, from library scanning, to preferences being modified, to changes to media, and many other things. This is also the mechanism by which activity progress is reported.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// <br/>
|
||||
/// Two protocols for receiving the events are available: EventSource (also known as SSE), and WebSocket.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class Events: IEvents
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.19.0";
|
||||
private const string _sdkGenVersion = "2.743.2";
|
||||
private const string _openapiDocVersion = "1.1.1";
|
||||
|
||||
public Events(SDKConfig config)
|
||||
{
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<GetNotificationsResponse> GetNotificationsAsync(GetNotificationsRequest? request = null)
|
||||
{
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/:/eventsource/notifications", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getNotifications", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/octet-stream", contentType))
|
||||
{
|
||||
var response = new GetNotificationsResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.Bytes = await httpResponse.Content.ReadAsByteArrayAsync();
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<ConnectWebSocketResponse> ConnectWebSocketAsync(ConnectWebSocketRequest? request = null)
|
||||
{
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/:/websocket/notifications", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "connectWebSocket", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/octet-stream", contentType))
|
||||
{
|
||||
var response = new ConnectWebSocketResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.Bytes = await httpResponse.Content.ReadAsByteArrayAsync();
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
481
LukeHagar/PlexAPI/SDK/General.cs
Normal file
481
LukeHagar/PlexAPI/SDK/General.cs
Normal file
@@ -0,0 +1,481 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Hooks;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// General endpoints for basic PMS operation not specific to any media provider
|
||||
/// </summary>
|
||||
public interface IGeneral
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Get PMS info
|
||||
///
|
||||
/// <remarks>
|
||||
/// Information about this PMS setup and configuration
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetServerInfoResponse> GetServerInfoAsync(GetServerInfoRequest? request = null);
|
||||
|
||||
/// <summary>
|
||||
/// Get PMS identity
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get details about this PMS's identity
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetIdentityResponse> GetIdentityAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get Source Connection Information
|
||||
///
|
||||
/// <remarks>
|
||||
/// If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(GetSourceConnectionInformationRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Get Transient Tokens
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.<br/>
|
||||
/// Note: This endpoint responds to all HTTP verbs but POST in preferred
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenRequest request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// General endpoints for basic PMS operation not specific to any media provider
|
||||
/// </summary>
|
||||
public class General: IGeneral
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.19.0";
|
||||
private const string _sdkGenVersion = "2.743.2";
|
||||
private const string _openapiDocVersion = "1.1.1";
|
||||
|
||||
public General(SDKConfig config)
|
||||
{
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<GetServerInfoResponse> GetServerInfoAsync(GetServerInfoRequest? request = null)
|
||||
{
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getServerInfo", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
MediaContainerWithDirectory obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<MediaContainerWithDirectory>(httpResponseBody, NullValueHandling.Include);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into MediaContainerWithDirectory.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new GetServerInfoResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.MediaContainerWithDirectory = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<GetIdentityResponse> GetIdentityAsync()
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/identity";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getIdentity", null, null);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
GetIdentityResponseBody obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<GetIdentityResponseBody>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into GetIdentityResponseBody.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new GetIdentityResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.Object = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(GetSourceConnectionInformationRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new GetSourceConnectionInformationRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/security/resources", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getSourceConnectionInformation", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 403 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
GetSourceConnectionInformationResponseBody obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<GetSourceConnectionInformationResponseBody>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into GetSourceConnectionInformationResponseBody.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new GetSourceConnectionInformationResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.Object = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode == 400 || responseStatusCode == 403 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new GetTransientTokenRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/security/token", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getTransientToken", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 403 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
GetTransientTokenResponseBody obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<GetTransientTokenResponseBody>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into GetTransientTokenResponseBody.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new GetTransientTokenResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.Object = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode == 400 || responseStatusCode == 403 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,34 +17,47 @@ namespace LukeHagar.PlexAPI.SDK.Hooks
|
||||
|
||||
public class HookContext
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; set; }
|
||||
public string BaseURL { get; set; } = "";
|
||||
public string OperationID { get; set; }
|
||||
public List<string>? Oauth2Scopes { get; set; }
|
||||
public Func<object>? SecuritySource { get; set; }
|
||||
|
||||
public HookContext(string operationID, List<string>? oauth2Scopes, Func<object>? securitySource)
|
||||
public HookContext(SDKConfig config, string baseURL, string operationID, List<string>? oauth2Scopes, Func<object>? securitySource)
|
||||
{
|
||||
SDKConfiguration = config;
|
||||
BaseURL = baseURL;
|
||||
OperationID = operationID;
|
||||
Oauth2Scopes = oauth2Scopes;
|
||||
SecuritySource = securitySource;
|
||||
}
|
||||
|
||||
public HookContext(HookContext hookCtx)
|
||||
{
|
||||
SDKConfiguration = hookCtx.SDKConfiguration;
|
||||
BaseURL = hookCtx.BaseURL;
|
||||
OperationID = hookCtx.OperationID;
|
||||
Oauth2Scopes = hookCtx.Oauth2Scopes;
|
||||
SecuritySource = hookCtx.SecuritySource;
|
||||
}
|
||||
}
|
||||
|
||||
public class BeforeRequestContext : HookContext
|
||||
{
|
||||
public BeforeRequestContext(HookContext hookCtx)
|
||||
: base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { }
|
||||
: base(hookCtx) { }
|
||||
}
|
||||
|
||||
public class AfterSuccessContext : HookContext
|
||||
{
|
||||
public AfterSuccessContext(HookContext hookCtx)
|
||||
: base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { }
|
||||
: base(hookCtx) { }
|
||||
}
|
||||
|
||||
public class AfterErrorContext : HookContext
|
||||
{
|
||||
public AfterErrorContext(HookContext hookCtx)
|
||||
: base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { }
|
||||
: base(hookCtx) { }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -76,7 +76,8 @@ namespace LukeHagar.PlexAPI.SDK.Hooks
|
||||
try
|
||||
{
|
||||
request = await hook.BeforeRequestAsync(hookCtx, request);
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("An error occurred while calling BeforeRequestAsync hook", ex);
|
||||
}
|
||||
@@ -102,17 +103,18 @@ namespace LukeHagar.PlexAPI.SDK.Hooks
|
||||
|
||||
public async Task<HttpResponseMessage?> AfterErrorAsync(AfterErrorContext hookCtx, HttpResponseMessage? response, Exception? error)
|
||||
{
|
||||
|
||||
(HttpResponseMessage?, Exception?) responseAndError = (response, error);
|
||||
foreach (var hook in this.afterErrorHooks)
|
||||
{
|
||||
try
|
||||
{
|
||||
responseAndError = await hook.AfterErrorAsync(hookCtx, responseAndError.Item1, responseAndError.Item2);
|
||||
} catch (FailEarlyException)
|
||||
}
|
||||
catch (FailEarlyException)
|
||||
{
|
||||
throw;
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception("An error occurred while calling AfterErrorAsync hook", ex);
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
390
LukeHagar/PlexAPI/SDK/LibraryCollections.cs
Normal file
390
LukeHagar/PlexAPI/SDK/LibraryCollections.cs
Normal file
@@ -0,0 +1,390 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Hooks;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Endpoints for manipulating collections. In addition to these endpoints, `/library/collections/:collectionId/X` will be rerouted to `/library/metadata/:collectionId/X` and respond to those endpoints as well.
|
||||
/// </summary>
|
||||
public interface ILibraryCollections
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Add items to a collection
|
||||
///
|
||||
/// <remarks>
|
||||
/// Add items to a collection by uri
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<AddCollectionItemsResponse> AddCollectionItemsAsync(AddCollectionItemsRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Delete an item from a collection
|
||||
///
|
||||
/// <remarks>
|
||||
/// Delete an item from a collection
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<DeleteCollectionItemResponse> DeleteCollectionItemAsync(DeleteCollectionItemRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Reorder an item in the collection
|
||||
///
|
||||
/// <remarks>
|
||||
/// Reorder items in a collection with one item after another
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<MoveCollectionItemResponse> MoveCollectionItemAsync(MoveCollectionItemRequest request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Endpoints for manipulating collections. In addition to these endpoints, `/library/collections/:collectionId/X` will be rerouted to `/library/metadata/:collectionId/X` and respond to those endpoints as well.
|
||||
/// </summary>
|
||||
public class LibraryCollections: ILibraryCollections
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.19.0";
|
||||
private const string _sdkGenVersion = "2.743.2";
|
||||
private const string _openapiDocVersion = "1.1.1";
|
||||
|
||||
public LibraryCollections(SDKConfig config)
|
||||
{
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<AddCollectionItemsResponse> AddCollectionItemsAsync(AddCollectionItemsRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new AddCollectionItemsRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/library/collections/{collectionId}/items", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Put, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "addCollectionItems", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
MediaContainerWithMetadata obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<MediaContainerWithMetadata>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into MediaContainerWithMetadata.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new AddCollectionItemsResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.MediaContainerWithMetadata = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<DeleteCollectionItemResponse> DeleteCollectionItemAsync(DeleteCollectionItemRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new DeleteCollectionItemRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/library/collections/{collectionId}/items/{itemId}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Put, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "deleteCollectionItem", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
MediaContainerWithMetadata obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<MediaContainerWithMetadata>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into MediaContainerWithMetadata.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new DeleteCollectionItemResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.MediaContainerWithMetadata = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode == 400 || responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<MoveCollectionItemResponse> MoveCollectionItemAsync(MoveCollectionItemRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new MoveCollectionItemRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/library/collections/{collectionId}/items/{itemId}/move", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Put, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "moveCollectionItem", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
MediaContainerWithMetadata obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<MediaContainerWithMetadata>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into MediaContainerWithMetadata.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new MoveCollectionItemResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.MediaContainerWithMetadata = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode == 400 || responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
1336
LukeHagar/PlexAPI/SDK/LibraryPlaylists.cs
Normal file
1336
LukeHagar/PlexAPI/SDK/LibraryPlaylists.cs
Normal file
File diff suppressed because it is too large
Load Diff
460
LukeHagar/PlexAPI/SDK/LiveTV.cs
Normal file
460
LukeHagar/PlexAPI/SDK/LiveTV.cs
Normal file
@@ -0,0 +1,460 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Hooks;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// LiveTV contains the playback sessions of a channel from a DVR device<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public interface ILiveTV
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Get all sessions
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get all livetv sessions and metadata
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetSessionsResponse> GetSessionsAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Get a single session
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get a single livetv session and metadata
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetLiveTVSessionResponse> GetLiveTVSessionAsync(GetLiveTVSessionRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Get a session playlist index
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get a playlist index for playing this session
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetSessionPlaylistIndexResponse> GetSessionPlaylistIndexAsync(GetSessionPlaylistIndexRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Get a single session segment
|
||||
///
|
||||
/// <remarks>
|
||||
/// Get a single LiveTV session segment
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetSessionSegmentResponse> GetSessionSegmentAsync(GetSessionSegmentRequest request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// LiveTV contains the playback sessions of a channel from a DVR device<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class LiveTV: ILiveTV
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.19.0";
|
||||
private const string _sdkGenVersion = "2.743.2";
|
||||
private const string _openapiDocVersion = "1.1.1";
|
||||
|
||||
public LiveTV(SDKConfig config)
|
||||
{
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<GetSessionsResponse> GetSessionsAsync()
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/livetv/sessions";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getSessions", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
MediaContainerWithMetadata obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<MediaContainerWithMetadata>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into MediaContainerWithMetadata.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new GetSessionsResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.MediaContainerWithMetadata = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<GetLiveTVSessionResponse> GetLiveTVSessionAsync(GetLiveTVSessionRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new GetLiveTVSessionRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/livetv/sessions/{sessionId}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getLiveTVSession", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var httpResponseBody = await httpResponse.Content.ReadAsStringAsync();
|
||||
MediaContainerWithMetadata obj;
|
||||
try
|
||||
{
|
||||
obj = ResponseBodyDeserializer.DeserializeNotNull<MediaContainerWithMetadata>(httpResponseBody, NullValueHandling.Ignore);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new ResponseValidationException("Failed to deserialize response body into MediaContainerWithMetadata.", httpResponse, httpResponseBody, ex);
|
||||
}
|
||||
|
||||
var response = new GetLiveTVSessionResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.MediaContainerWithMetadata = obj;
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<GetSessionPlaylistIndexResponse> GetSessionPlaylistIndexAsync(GetSessionPlaylistIndexRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new GetSessionPlaylistIndexRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/livetv/sessions/{sessionId}/{consumerId}/index.m3u8", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getSessionPlaylistIndex", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new GetSessionPlaylistIndexResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
public async Task<GetSessionSegmentResponse> GetSessionSegmentAsync(GetSessionSegmentRequest request)
|
||||
{
|
||||
if (request == null)
|
||||
{
|
||||
request = new GetSessionSegmentRequest();
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/livetv/sessions/{sessionId}/{consumerId}/{segmentId}", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "getSessionSegment", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new GetSessionSegmentResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,228 +13,102 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Submit logs to the Log Handler for Plex Media Server<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// Logging mechanism to allow clients to log to the server
|
||||
/// </summary>
|
||||
public interface ILog
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Logging a single line message.
|
||||
/// Logging a multi-line message to the Plex Media Server log
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will write multiple lines to the main Plex Media Server log in a single request. It takes a set of query strings as would normally sent to the above PUT endpoint as a linefeed-separated block of POST data. The parameters for each query string match as above.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<WriteLogResponse> WriteLogAsync(byte[] request);
|
||||
|
||||
/// <summary>
|
||||
/// Logging a single-line message to the Plex Media Server log
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.<br/>
|
||||
/// <br/>
|
||||
/// Note: This endpoint responds to all HTTP verbs **except POST** but PUT is preferred<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<LogLineResponse> LogLineAsync(Level level, string message, string source);
|
||||
|
||||
/// <summary>
|
||||
/// Logging a multi-line message
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint allows for the batch addition of log entries to the main Plex Media Server log. <br/>
|
||||
/// It accepts a text/plain request body, where each line represents a distinct log entry. <br/>
|
||||
/// Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'. <br/>
|
||||
/// <br/>
|
||||
/// Log entries are separated by a newline character (`\n`). <br/>
|
||||
/// Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters. <br/>
|
||||
/// This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests. <br/>
|
||||
/// <br/>
|
||||
/// The 'level' parameter specifies the log entry's severity or importance, with the following integer values:<br/>
|
||||
/// - `0`: Error - Critical issues that require immediate attention.<br/>
|
||||
/// - `1`: Warning - Important events that are not critical but may indicate potential issues.<br/>
|
||||
/// - `2`: Info - General informational messages about system operation.<br/>
|
||||
/// - `3`: Debug - Detailed information useful for debugging purposes.<br/>
|
||||
/// - `4`: Verbose - Highly detailed diagnostic information for in-depth analysis.<br/>
|
||||
/// <br/>
|
||||
/// The 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module).<br/>
|
||||
/// <br/>
|
||||
/// Example of a single log entry format:<br/>
|
||||
/// `level=4&message=Sample%20log%20entry&source=applicationName`<br/>
|
||||
/// <br/>
|
||||
/// Ensure each parameter is properly URL-encoded to avoid interpretation issues.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<LogMultiLineResponse> LogMultiLineAsync(string request);
|
||||
Task<WriteMessageResponse> WriteMessageAsync(WriteMessageRequest? request = null);
|
||||
|
||||
/// <summary>
|
||||
/// Enabling Papertrail
|
||||
///
|
||||
/// <remarks>
|
||||
/// This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.<br/>
|
||||
/// This endpoint will enable all Plex Media Server logs to be sent to the Papertrail networked logging site for a period of time<br/>
|
||||
/// <br/>
|
||||
/// Note: This endpoint responds to all HTTP verbs but POST is preferred<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<EnablePaperTrailResponse> EnablePaperTrailAsync();
|
||||
Task<EnablePapertrailResponse> EnablePapertrailAsync(EnablePapertrailRequest? request = null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Submit logs to the Log Handler for Plex Media Server<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// Logging mechanism to allow clients to log to the server
|
||||
/// </summary>
|
||||
public class Log: ILog
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.8.2";
|
||||
private const string _sdkGenVersion = "2.426.2";
|
||||
private const string _openapiDocVersion = "0.0.3";
|
||||
private const string _userAgent = "speakeasy-sdk/csharp 0.8.2 2.426.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||
private string _serverUrl = "";
|
||||
private ISpeakeasyHttpClient _client;
|
||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||
private const string _sdkVersion = "0.19.0";
|
||||
private const string _sdkGenVersion = "2.743.2";
|
||||
private const string _openapiDocVersion = "1.1.1";
|
||||
|
||||
public Log(ISpeakeasyHttpClient client, Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
|
||||
public Log(SDKConfig config)
|
||||
{
|
||||
_client = client;
|
||||
_securitySource = securitySource;
|
||||
_serverUrl = serverUrl;
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<LogLineResponse> LogLineAsync(Level level, string message, string source)
|
||||
{
|
||||
var request = new LogLineRequest()
|
||||
{
|
||||
Level = level,
|
||||
Message = message,
|
||||
Source = source,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/log", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("logLine", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new LogLineResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<LogLineBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<LogLineUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<LogMultiLineResponse> LogMultiLineAsync(string request)
|
||||
public async Task<WriteLogResponse> WriteLogAsync(byte[] request)
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
|
||||
var urlString = baseUrl + "/log";
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
|
||||
var serializedBody = RequestBodySerializer.Serialize(request, "Request", "string", false, false);
|
||||
var serializedBody = RequestBodySerializer.Serialize(request, "Request", "raw", false, false);
|
||||
if (serializedBody != null)
|
||||
{
|
||||
httpRequest.Content = serializedBody;
|
||||
}
|
||||
|
||||
if (_securitySource != null)
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("logMultiLine", null, _securitySource);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "writeLog", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
@@ -262,68 +136,62 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new LogMultiLineResponse()
|
||||
return new WriteLogResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<LogMultiLineBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<LogMultiLineUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
public async Task<WriteMessageResponse> WriteMessageAsync(WriteMessageRequest? request = null)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<EnablePaperTrailResponse> EnablePaperTrailAsync()
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/log", request);
|
||||
|
||||
var urlString = baseUrl + "/log/networked";
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Put, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("enablePaperTrail", null, _securitySource);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "writeMessage", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 403 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
if (_statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
@@ -351,41 +219,106 @@ namespace LukeHagar.PlexAPI.SDK
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new EnablePaperTrailResponse()
|
||||
return new WriteMessageResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<EnablePaperTrailBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<EnablePaperTrailUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 403 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
public async Task<EnablePapertrailResponse> EnablePapertrailAsync(EnablePapertrailRequest? request = null)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
request.Accepts ??= SDKConfiguration.Accepts;
|
||||
request.ClientIdentifier ??= SDKConfiguration.ClientIdentifier;
|
||||
request.Product ??= SDKConfiguration.Product;
|
||||
request.Version ??= SDKConfiguration.Version;
|
||||
request.Platform ??= SDKConfiguration.Platform;
|
||||
request.PlatformVersion ??= SDKConfiguration.PlatformVersion;
|
||||
request.Device ??= SDKConfiguration.Device;
|
||||
request.Model ??= SDKConfiguration.Model;
|
||||
request.DeviceVendor ??= SDKConfiguration.DeviceVendor;
|
||||
request.DeviceName ??= SDKConfiguration.DeviceName;
|
||||
request.Marketplace ??= SDKConfiguration.Marketplace;
|
||||
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/log/networked", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", SDKConfiguration.UserAgent);
|
||||
HeaderSerializer.PopulateHeaders(ref httpRequest, request);
|
||||
|
||||
if (SDKConfiguration.SecuritySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(SDKConfiguration.SecuritySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
var hookCtx = new HookContext(SDKConfiguration, baseUrl, "enablePapertrail", null, SDKConfiguration.SecuritySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await SDKConfiguration.Client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 403 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new EnablePapertrailResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 403 || responseStatusCode >= 400 && responseStatusCode < 500)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
else if(responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,38 +3,13 @@
|
||||
<PropertyGroup>
|
||||
<IsPackable>true</IsPackable>
|
||||
<PackageId>LukeHagar.PlexAPI.SDK</PackageId>
|
||||
<Version>0.8.2</Version>
|
||||
<Version>0.19.0</Version>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Authors>LukeHagar</Authors>
|
||||
<Copyright>Copyright (c) LukeHagar 2024</Copyright>
|
||||
<Copyright>Copyright (c) LukeHagar 2025</Copyright>
|
||||
<RepositoryUrl>https://github.com/LukeHagar/plexcsharp.git</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<PackageTags>Plex Media Server SDK</PackageTags>
|
||||
<Description># Plex Media Server OpenAPI Specification
|
||||
|
||||
An Open Source OpenAPI Specification for Plex Media Server
|
||||
|
||||
Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)
|
||||
|
||||
## Documentation
|
||||
|
||||
[API Documentation](https://plexapi.dev)
|
||||
|
||||
## SDKs
|
||||
|
||||
The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the respective repository.
|
||||
|
||||
| Language | Repository | Releases | Other |
|
||||
| --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
|
||||
| Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - |
|
||||
| JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - |
|
||||
| Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |
|
||||
| Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - |
|
||||
| Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - |
|
||||
| PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - |
|
||||
| Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - |
|
||||
| C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | -
|
||||
</Description>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -1,577 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Hooks;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Errors;
|
||||
using LukeHagar.PlexAPI.SDK.Models.Requests;
|
||||
using LukeHagar.PlexAPI.SDK.Utils.Retries;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// API Calls interacting with Plex Media Server Media<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public interface IMedia
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Mark Media Played
|
||||
///
|
||||
/// <remarks>
|
||||
/// This will mark the provided media key as Played.
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<MarkPlayedResponse> MarkPlayedAsync(double key);
|
||||
|
||||
/// <summary>
|
||||
/// Mark Media Unplayed
|
||||
///
|
||||
/// <remarks>
|
||||
/// This will mark the provided media key as Unplayed.
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<MarkUnplayedResponse> MarkUnplayedAsync(double key);
|
||||
|
||||
/// <summary>
|
||||
/// Update Media Play Progress
|
||||
///
|
||||
/// <remarks>
|
||||
/// This API command can be used to update the play progress of a media item.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state);
|
||||
|
||||
/// <summary>
|
||||
/// Get Banner Image
|
||||
///
|
||||
/// <remarks>
|
||||
/// Gets the banner image of the media item
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetBannerImageResponse> GetBannerImageAsync(GetBannerImageRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Get Thumb Image
|
||||
///
|
||||
/// <remarks>
|
||||
/// Gets the thumbnail image of the media item
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
Task<GetThumbImageResponse> GetThumbImageAsync(GetThumbImageRequest request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// API Calls interacting with Plex Media Server Media<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class Media: IMedia
|
||||
{
|
||||
public SDKConfig SDKConfiguration { get; private set; }
|
||||
private const string _language = "csharp";
|
||||
private const string _sdkVersion = "0.8.2";
|
||||
private const string _sdkGenVersion = "2.426.2";
|
||||
private const string _openapiDocVersion = "0.0.3";
|
||||
private const string _userAgent = "speakeasy-sdk/csharp 0.8.2 2.426.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||
private string _serverUrl = "";
|
||||
private ISpeakeasyHttpClient _client;
|
||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||
|
||||
public Media(ISpeakeasyHttpClient client, Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
|
||||
{
|
||||
_client = client;
|
||||
_securitySource = securitySource;
|
||||
_serverUrl = serverUrl;
|
||||
SDKConfiguration = config;
|
||||
}
|
||||
|
||||
public async Task<MarkPlayedResponse> MarkPlayedAsync(double key)
|
||||
{
|
||||
var request = new MarkPlayedRequest()
|
||||
{
|
||||
Key = key,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/:/scrobble", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("markPlayed", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new MarkPlayedResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<MarkPlayedBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<MarkPlayedUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<MarkUnplayedResponse> MarkUnplayedAsync(double key)
|
||||
{
|
||||
var request = new MarkUnplayedRequest()
|
||||
{
|
||||
Key = key,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/:/unscrobble", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("markUnplayed", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new MarkUnplayedResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<MarkUnplayedBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<MarkUnplayedUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state)
|
||||
{
|
||||
var request = new UpdatePlayProgressRequest()
|
||||
{
|
||||
Key = key,
|
||||
Time = time,
|
||||
State = state,
|
||||
};
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/:/progress", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("updatePlayProgress", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
return new UpdatePlayProgressResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<UpdatePlayProgressBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<UpdatePlayProgressUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<GetBannerImageResponse> GetBannerImageAsync(GetBannerImageRequest request)
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/library/metadata/{ratingKey}/banner", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("get-banner-image", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("image/jpeg", contentType))
|
||||
{
|
||||
var response = new GetBannerImageResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.Bytes = await httpResponse.Content.ReadAsByteArrayAsync();
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetBannerImageBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetBannerImageUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
public async Task<GetThumbImageResponse> GetThumbImageAsync(GetThumbImageRequest request)
|
||||
{
|
||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||
var urlString = URLBuilder.Build(baseUrl, "/library/metadata/{ratingKey}/thumb", request);
|
||||
|
||||
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
|
||||
httpRequest.Headers.Add("user-agent", _userAgent);
|
||||
|
||||
if (_securitySource != null)
|
||||
{
|
||||
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
|
||||
}
|
||||
|
||||
var hookCtx = new HookContext("get-thumb-image", null, _securitySource);
|
||||
|
||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
||||
|
||||
HttpResponseMessage httpResponse;
|
||||
try
|
||||
{
|
||||
httpResponse = await _client.SendAsync(httpRequest);
|
||||
int _statusCode = (int)httpResponse.StatusCode;
|
||||
|
||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), httpResponse, null);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
var _httpResponse = await this.SDKConfiguration.Hooks.AfterErrorAsync(new AfterErrorContext(hookCtx), null, error);
|
||||
if (_httpResponse != null)
|
||||
{
|
||||
httpResponse = _httpResponse;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
httpResponse = await this.SDKConfiguration.Hooks.AfterSuccessAsync(new AfterSuccessContext(hookCtx), httpResponse);
|
||||
|
||||
var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
|
||||
int responseStatusCode = (int)httpResponse.StatusCode;
|
||||
if(responseStatusCode == 200)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("image/jpeg", contentType))
|
||||
{
|
||||
var response = new GetThumbImageResponse()
|
||||
{
|
||||
StatusCode = responseStatusCode,
|
||||
ContentType = contentType,
|
||||
RawResponse = httpResponse
|
||||
};
|
||||
response.Bytes = await httpResponse.Content.ReadAsByteArrayAsync();
|
||||
return response;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 400)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetThumbImageBadRequest>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode == 401)
|
||||
{
|
||||
if(Utilities.IsContentTypeMatch("application/json", contentType))
|
||||
{
|
||||
var obj = ResponseBodyDeserializer.Deserialize<GetThumbImageUnauthorized>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
|
||||
obj!.RawResponse = httpResponse;
|
||||
throw obj!;
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
else if(responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
|
||||
{
|
||||
throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
|
||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||
}
|
||||
}
|
||||
}
|
||||
57
LukeHagar/PlexAPI/SDK/Models/Components/Accepts.cs
Normal file
57
LukeHagar/PlexAPI/SDK/Models/Components/Accepts.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public enum Accepts
|
||||
{
|
||||
[JsonProperty("application/json")]
|
||||
ApplicationJson,
|
||||
[JsonProperty("application/xml")]
|
||||
ApplicationXml,
|
||||
}
|
||||
|
||||
public static class AcceptsExtension
|
||||
{
|
||||
public static string Value(this Accepts value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static Accepts ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(Accepts).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 Accepts)
|
||||
{
|
||||
return (Accepts)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum Accepts");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
59
LukeHagar/PlexAPI/SDK/Models/Components/AdvancedSubtitles.cs
Normal file
59
LukeHagar/PlexAPI/SDK/Models/Components/AdvancedSubtitles.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public enum AdvancedSubtitles
|
||||
{
|
||||
[JsonProperty("burn")]
|
||||
Burn,
|
||||
[JsonProperty("text")]
|
||||
Text,
|
||||
[JsonProperty("unknown")]
|
||||
Unknown,
|
||||
}
|
||||
|
||||
public static class AdvancedSubtitlesExtension
|
||||
{
|
||||
public static string Value(this AdvancedSubtitles value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static AdvancedSubtitles ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(AdvancedSubtitles).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 AdvancedSubtitles)
|
||||
{
|
||||
return (AdvancedSubtitles)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum AdvancedSubtitles");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
57
LukeHagar/PlexAPI/SDK/Models/Components/AiringsType.cs
Normal file
57
LukeHagar/PlexAPI/SDK/Models/Components/AiringsType.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public enum AiringsType
|
||||
{
|
||||
[JsonProperty("New Airings Only")]
|
||||
NewAiringsOnly,
|
||||
[JsonProperty("New and Repeat Airings")]
|
||||
NewAndRepeatAirings,
|
||||
}
|
||||
|
||||
public static class AiringsTypeExtension
|
||||
{
|
||||
public static string Value(this AiringsType value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static AiringsType ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(AiringsType).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 AiringsType)
|
||||
{
|
||||
return (AiringsType)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum AiringsType");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
20
LukeHagar/PlexAPI/SDK/Models/Components/BoolInt.cs
Normal file
20
LukeHagar/PlexAPI/SDK/Models/Components/BoolInt.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
|
||||
public enum BoolInt
|
||||
{
|
||||
Zero = 0,
|
||||
One = 1,
|
||||
}
|
||||
|
||||
}
|
||||
42
LukeHagar/PlexAPI/SDK/Models/Components/Channel.cs
Normal file
42
LukeHagar/PlexAPI/SDK/Models/Components/Channel.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class Channel
|
||||
{
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonProperty("callSign")]
|
||||
public string? CallSign { get; set; }
|
||||
|
||||
[JsonProperty("channelVcn")]
|
||||
public string? ChannelVcn { get; set; }
|
||||
|
||||
[JsonProperty("hd")]
|
||||
public bool? Hd { get; set; }
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("language")]
|
||||
public string? Language { get; set; }
|
||||
|
||||
[JsonProperty("thumb")]
|
||||
public string? Thumb { get; set; }
|
||||
}
|
||||
}
|
||||
30
LukeHagar/PlexAPI/SDK/Models/Components/ChannelMapping.cs
Normal file
30
LukeHagar/PlexAPI/SDK/Models/Components/ChannelMapping.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class ChannelMapping
|
||||
{
|
||||
|
||||
[JsonProperty("channelKey")]
|
||||
public string? ChannelKey { get; set; }
|
||||
|
||||
[JsonProperty("deviceIdentifier")]
|
||||
public string? DeviceIdentifier { get; set; }
|
||||
|
||||
[JsonProperty("enabled")]
|
||||
public string? Enabled { get; set; }
|
||||
|
||||
[JsonProperty("lineupIdentifier")]
|
||||
public string? LineupIdentifier { get; set; }
|
||||
}
|
||||
}
|
||||
84
LukeHagar/PlexAPI/SDK/Models/Components/Composite.cs
Normal file
84
LukeHagar/PlexAPI/SDK/Models/Components/Composite.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
|
||||
public class Composite
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Limit composite to specified metadata types
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=type")]
|
||||
public long? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The image type
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=format")]
|
||||
public Models.Components.Format? Format { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 6 character hex RGB value for background color for image
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=backgroundColor")]
|
||||
public string? BackgroundColor { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The width of the intra-image border
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=border")]
|
||||
public long? Border { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of columns to construct in the composite image
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=cols")]
|
||||
public long? Cols { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Where to crop source images to fit into composite image proportions
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=crop")]
|
||||
public Crop? Crop { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The height of the image
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=height")]
|
||||
public long? Height { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The default image type to use as the sources
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=media")]
|
||||
public CompositeMedia? Media { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Allow repetion of images if there are not enough source images to fill grid
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=repeat")]
|
||||
public bool? Repeat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of rows to construct in the composite image
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=rows")]
|
||||
public long? Rows { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The width of the image
|
||||
/// </summary>
|
||||
[SpeakeasyMetadata("queryParam:name=width")]
|
||||
public long? Width { get; set; }
|
||||
}
|
||||
}
|
||||
62
LukeHagar/PlexAPI/SDK/Models/Components/CompositeMedia.cs
Normal file
62
LukeHagar/PlexAPI/SDK/Models/Components/CompositeMedia.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// The default image type to use as the sources
|
||||
/// </summary>
|
||||
public enum CompositeMedia
|
||||
{
|
||||
[JsonProperty("thumb")]
|
||||
Thumb,
|
||||
[JsonProperty("art")]
|
||||
Art,
|
||||
[JsonProperty("banner")]
|
||||
Banner,
|
||||
}
|
||||
|
||||
public static class CompositeMediaExtension
|
||||
{
|
||||
public static string Value(this CompositeMedia value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static CompositeMedia ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(CompositeMedia).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 CompositeMedia)
|
||||
{
|
||||
return (CompositeMedia)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum CompositeMedia");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
60
LukeHagar/PlexAPI/SDK/Models/Components/Crop.cs
Normal file
60
LukeHagar/PlexAPI/SDK/Models/Components/Crop.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Where to crop source images to fit into composite image proportions
|
||||
/// </summary>
|
||||
public enum Crop
|
||||
{
|
||||
[JsonProperty("center")]
|
||||
Center,
|
||||
[JsonProperty("top")]
|
||||
Top,
|
||||
}
|
||||
|
||||
public static class CropExtension
|
||||
{
|
||||
public static string Value(this Crop value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static Crop ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(Crop).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 Crop)
|
||||
{
|
||||
return (Crop)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum Crop");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
59
LukeHagar/PlexAPI/SDK/Models/Components/Decision.cs
Normal file
59
LukeHagar/PlexAPI/SDK/Models/Components/Decision.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public enum Decision
|
||||
{
|
||||
[JsonProperty("directplay")]
|
||||
Directplay,
|
||||
[JsonProperty("transcode")]
|
||||
Transcode,
|
||||
[JsonProperty("none")]
|
||||
None,
|
||||
}
|
||||
|
||||
public static class DecisionExtension
|
||||
{
|
||||
public static string Value(this Decision value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static Decision ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(Decision).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 Decision)
|
||||
{
|
||||
return (Decision)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum Decision");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
207
LukeHagar/PlexAPI/SDK/Models/Components/Default.cs
Normal file
207
LukeHagar/PlexAPI/SDK/Models/Components/Default.cs
Normal file
@@ -0,0 +1,207 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
|
||||
public class DefaultType
|
||||
{
|
||||
private DefaultType(string value) { Value = value; }
|
||||
|
||||
public string Value { get; private set; }
|
||||
|
||||
public static DefaultType Str { get { return new DefaultType("str"); } }
|
||||
|
||||
public static DefaultType Number { get { return new DefaultType("number"); } }
|
||||
|
||||
public static DefaultType Boolean { get { return new DefaultType("boolean"); } }
|
||||
|
||||
public override string ToString() { return Value; }
|
||||
public static implicit operator String(DefaultType v) { return v.Value; }
|
||||
public static DefaultType FromString(string v) {
|
||||
switch(v) {
|
||||
case "str": return Str;
|
||||
case "number": return Number;
|
||||
case "boolean": return Boolean;
|
||||
default: throw new ArgumentException("Invalid value for DefaultType");
|
||||
}
|
||||
}
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
if (obj == null || GetType() != obj.GetType())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return Value.Equals(((DefaultType)obj).Value);
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return Value.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The default value of this setting
|
||||
/// </summary>
|
||||
[JsonConverter(typeof(Default.DefaultConverter))]
|
||||
public class Default
|
||||
{
|
||||
public Default(DefaultType type)
|
||||
{
|
||||
Type = type;
|
||||
}
|
||||
|
||||
[SpeakeasyMetadata("form:explode=true")]
|
||||
public string? Str { get; set; }
|
||||
|
||||
[SpeakeasyMetadata("form:explode=true")]
|
||||
public double? Number { get; set; }
|
||||
|
||||
[SpeakeasyMetadata("form:explode=true")]
|
||||
public bool? Boolean { get; set; }
|
||||
|
||||
public DefaultType Type { get; set; }
|
||||
public static Default CreateStr(string str)
|
||||
{
|
||||
DefaultType typ = DefaultType.Str;
|
||||
|
||||
Default res = new Default(typ);
|
||||
res.Str = str;
|
||||
return res;
|
||||
}
|
||||
public static Default CreateNumber(double number)
|
||||
{
|
||||
DefaultType typ = DefaultType.Number;
|
||||
|
||||
Default res = new Default(typ);
|
||||
res.Number = number;
|
||||
return res;
|
||||
}
|
||||
public static Default CreateBoolean(bool boolean)
|
||||
{
|
||||
DefaultType typ = DefaultType.Boolean;
|
||||
|
||||
Default res = new Default(typ);
|
||||
res.Boolean = boolean;
|
||||
return res;
|
||||
}
|
||||
|
||||
public class DefaultConverter : JsonConverter
|
||||
{
|
||||
public override bool CanConvert(System.Type objectType) => objectType == typeof(Default);
|
||||
|
||||
public override bool CanRead => true;
|
||||
|
||||
public override object? ReadJson(JsonReader reader, System.Type objectType, object? existingValue, JsonSerializer serializer)
|
||||
{
|
||||
if (reader.TokenType == JsonToken.Null)
|
||||
{
|
||||
throw new InvalidOperationException("Received unexpected null JSON value");
|
||||
}
|
||||
|
||||
var json = JRaw.Create(reader).ToString();
|
||||
var fallbackCandidates = new List<(System.Type, object, string)>();
|
||||
|
||||
if (json[0] == '"' && json[^1] == '"'){
|
||||
return new Default(DefaultType.Str)
|
||||
{
|
||||
Str = json[1..^1]
|
||||
};
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var converted = Convert.ToDouble(json);
|
||||
return new Default(DefaultType.Number)
|
||||
{
|
||||
Number = converted
|
||||
};
|
||||
}
|
||||
catch (System.FormatException)
|
||||
{
|
||||
// try next option
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var converted = Convert.ToBoolean(json);
|
||||
return new Default(DefaultType.Boolean)
|
||||
{
|
||||
Boolean = converted
|
||||
};
|
||||
}
|
||||
catch (System.FormatException)
|
||||
{
|
||||
// try next option
|
||||
}
|
||||
|
||||
if (fallbackCandidates.Count > 0)
|
||||
{
|
||||
fallbackCandidates.Sort((a, b) => ResponseBodyDeserializer.CompareFallbackCandidates(a.Item1, b.Item1, json));
|
||||
foreach(var (deserializationType, returnObject, propertyName) in fallbackCandidates)
|
||||
{
|
||||
try
|
||||
{
|
||||
return ResponseBodyDeserializer.DeserializeUndiscriminatedUnionFallback(deserializationType, returnObject, propertyName, json);
|
||||
}
|
||||
catch (ResponseBodyDeserializer.DeserializationException)
|
||||
{
|
||||
// try next fallback option
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new InvalidOperationException("Could not deserialize into any supported types.");
|
||||
}
|
||||
|
||||
public override void WriteJson(JsonWriter writer, object? value, JsonSerializer serializer)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
throw new InvalidOperationException("Unexpected null JSON value.");
|
||||
}
|
||||
|
||||
Default res = (Default)value;
|
||||
|
||||
if (res.Str != null)
|
||||
{
|
||||
writer.WriteRawValue(Utilities.SerializeJSON(res.Str));
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.Number != null)
|
||||
{
|
||||
writer.WriteRawValue(Utilities.SerializeJSON(res.Number));
|
||||
return;
|
||||
}
|
||||
|
||||
if (res.Boolean != null)
|
||||
{
|
||||
writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -7,25 +7,21 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// The direction of the sort. Can be either `asc` or `desc`.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// This default diction of this sort
|
||||
/// </summary>
|
||||
public enum DefaultDirection
|
||||
{
|
||||
[JsonProperty("asc")]
|
||||
Ascending,
|
||||
Asc,
|
||||
[JsonProperty("desc")]
|
||||
Descending,
|
||||
Desc,
|
||||
}
|
||||
|
||||
public static class DefaultDirectionExtension
|
||||
59
LukeHagar/PlexAPI/SDK/Models/Components/Device.cs
Normal file
59
LukeHagar/PlexAPI/SDK/Models/Components/Device.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Device
|
||||
{
|
||||
|
||||
[JsonProperty("ChannelMapping")]
|
||||
public List<Models.Components.ChannelMapping>? ChannelMapping { get; set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("lastSeenAt")]
|
||||
public long? LastSeenAt { get; set; }
|
||||
|
||||
[JsonProperty("make")]
|
||||
public string? Make { get; set; }
|
||||
|
||||
[JsonProperty("model")]
|
||||
public string? Model { get; set; }
|
||||
|
||||
[JsonProperty("modelNumber")]
|
||||
public string? ModelNumber { get; set; }
|
||||
|
||||
[JsonProperty("protocol")]
|
||||
public string? Protocol { get; set; }
|
||||
|
||||
[JsonProperty("sources")]
|
||||
public string? Sources { get; set; }
|
||||
|
||||
[JsonProperty("state")]
|
||||
public string? State { get; set; }
|
||||
|
||||
[JsonProperty("status")]
|
||||
public string? Status { get; set; }
|
||||
|
||||
[JsonProperty("tuners")]
|
||||
public string? Tuners { get; set; }
|
||||
|
||||
[JsonProperty("uri")]
|
||||
public string? Uri { get; set; }
|
||||
|
||||
[JsonProperty("uuid")]
|
||||
public string? Uuid { get; set; }
|
||||
}
|
||||
}
|
||||
68
LukeHagar/PlexAPI/SDK/Models/Components/Directory.cs
Normal file
68
LukeHagar/PlexAPI/SDK/Models/Components/Directory.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Directory
|
||||
{
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
[JsonProperty("art")]
|
||||
public string? Art { get; set; }
|
||||
|
||||
[JsonProperty("content")]
|
||||
public bool? Content { get; set; }
|
||||
|
||||
[JsonProperty("filter")]
|
||||
public string? Filter { get; set; }
|
||||
|
||||
[JsonProperty("hasPrefs")]
|
||||
public bool? HasPrefs { get; set; }
|
||||
|
||||
[JsonProperty("hasStoreServices")]
|
||||
public bool? HasStoreServices { get; set; }
|
||||
|
||||
[JsonProperty("hubKey")]
|
||||
public string? HubKey { get; set; }
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("lastAccessedAt")]
|
||||
public long? LastAccessedAt { get; set; }
|
||||
|
||||
[JsonProperty("Pivot")]
|
||||
public List<Pivot>? Pivot { get; set; }
|
||||
|
||||
[JsonProperty("share")]
|
||||
public long? Share { get; set; }
|
||||
|
||||
[JsonProperty("thumb")]
|
||||
public string? Thumb { get; set; }
|
||||
|
||||
[JsonProperty("titleBar")]
|
||||
public string? TitleBar { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
35
LukeHagar/PlexAPI/SDK/Models/Components/Dvr.cs
Normal file
35
LukeHagar/PlexAPI/SDK/Models/Components/Dvr.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Dvr
|
||||
{
|
||||
|
||||
[JsonProperty("Device")]
|
||||
public List<Models.Components.Device>? Device { get; set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("language")]
|
||||
public string? Language { get; set; }
|
||||
|
||||
[JsonProperty("lineup")]
|
||||
public string? Lineup { get; set; }
|
||||
|
||||
[JsonProperty("uuid")]
|
||||
public string? Uuid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// OK
|
||||
/// </summary>
|
||||
public class DvrRequestHandlerSlashGetResponses200
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public DvrRequestHandlerSlashGetResponses200MediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class DvrRequestHandlerSlashGetResponses200MediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public DvrRequestHandlerSlashGetResponses200MediaContainerMediaContainer? MediaContainer { get; set; }
|
||||
|
||||
[JsonProperty("DVR")]
|
||||
public List<Models.Components.Dvr>? Dvr { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class DvrRequestHandlerSlashGetResponses200MediaContainerMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A status indicator. If present and non-zero, indicates an error
|
||||
/// </summary>
|
||||
[JsonProperty("status")]
|
||||
public long? Status { get; set; }
|
||||
}
|
||||
}
|
||||
90
LukeHagar/PlexAPI/SDK/Models/Components/Filter.cs
Normal file
90
LukeHagar/PlexAPI/SDK/Models/Components/Filter.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Each `Filter` object contains a description of the filter. Note that it is not an exhaustive list of the full media query language, but an important subset useful for top-level API.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class Filter
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The title for the filter.
|
||||
/// </summary>
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
[JsonProperty("art")]
|
||||
public string? Art { get; set; }
|
||||
|
||||
[JsonProperty("content")]
|
||||
public bool? Content { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This represents the filter name used for the filter, which can be used to construct complex media queries with.
|
||||
/// </summary>
|
||||
[JsonProperty("filter")]
|
||||
public string? FilterValue { get; set; }
|
||||
|
||||
[JsonProperty("hasPrefs")]
|
||||
public bool? HasPrefs { get; set; }
|
||||
|
||||
[JsonProperty("hasStoreServices")]
|
||||
public bool? HasStoreServices { get; set; }
|
||||
|
||||
[JsonProperty("hubKey")]
|
||||
public string? HubKey { get; set; }
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This provides the endpoint where the possible range of values for the filter can be retrieved (e.g. for a "Genre" filter, it returns a list of all the genres in the library). This will include a `type` argument that matches the metadata type of the Type element.
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("lastAccessedAt")]
|
||||
public long? LastAccessedAt { get; set; }
|
||||
|
||||
[JsonProperty("Pivot")]
|
||||
public List<FilterPivot>? Pivot { get; set; }
|
||||
|
||||
[JsonProperty("share")]
|
||||
public long? Share { get; set; }
|
||||
|
||||
[JsonProperty("thumb")]
|
||||
public string? Thumb { get; set; }
|
||||
|
||||
[JsonProperty("titleBar")]
|
||||
public string? TitleBar { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is either `string`, `integer`, or `boolean`, and describes the type of values used for the filter.
|
||||
/// </summary>
|
||||
[JsonProperty("filterType")]
|
||||
public string? FilterType { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
36
LukeHagar/PlexAPI/SDK/Models/Components/FilterPivot.cs
Normal file
36
LukeHagar/PlexAPI/SDK/Models/Components/FilterPivot.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class FilterPivot
|
||||
{
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
[JsonProperty("context")]
|
||||
public string? Context { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public string? Id { get; set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("symbol")]
|
||||
public string? Symbol { get; set; }
|
||||
}
|
||||
}
|
||||
60
LukeHagar/PlexAPI/SDK/Models/Components/Format.cs
Normal file
60
LukeHagar/PlexAPI/SDK/Models/Components/Format.cs
Normal file
@@ -0,0 +1,60 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// The image type
|
||||
/// </summary>
|
||||
public enum Format
|
||||
{
|
||||
[JsonProperty("jpg")]
|
||||
Jpg,
|
||||
[JsonProperty("png")]
|
||||
Png,
|
||||
}
|
||||
|
||||
public static class FormatExtension
|
||||
{
|
||||
public static string Value(this Format value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static Format ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(Format).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 Format)
|
||||
{
|
||||
return (Format)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum Format");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
25
LukeHagar/PlexAPI/SDK/Models/Components/GetResponses200.cs
Normal file
25
LukeHagar/PlexAPI/SDK/Models/Components/GetResponses200.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// OK
|
||||
/// </summary>
|
||||
public class GetResponses200
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public GetResponses200MediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class GetResponses200Hub
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Whether this hub is visible on the home screen<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// - all: Visible to all users<br/>
|
||||
/// - none: Visible to no users<br/>
|
||||
/// - admin: Visible to only admin users<br/>
|
||||
/// - shared: Visible to shared users<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("homeVisibility")]
|
||||
public Models.Components.HomeVisibility? HomeVisibility { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The identifier for this hub
|
||||
/// </summary>
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this hub is visible to admin user home
|
||||
/// </summary>
|
||||
[JsonProperty("promotedToOwnHome")]
|
||||
public bool? PromotedToOwnHome { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this hub is promoted to all for recommendations
|
||||
/// </summary>
|
||||
[JsonProperty("promotedToRecommended")]
|
||||
public bool? PromotedToRecommended { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether this hub is visible to shared user's home
|
||||
/// </summary>
|
||||
[JsonProperty("promotedToSharedHome")]
|
||||
public bool? PromotedToSharedHome { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The visibility of this hub in recommendations:<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// - all: Visible to all users<br/>
|
||||
/// - none: Visible to no users<br/>
|
||||
/// - admin: Visible to only admin users<br/>
|
||||
/// - shared: Visible to shared users<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("recommendationsVisibility")]
|
||||
public Models.Components.RecommendationsVisibility? RecommendationsVisibility { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The title of this hub
|
||||
/// </summary>
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class GetResponses200MediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Hub")]
|
||||
public List<GetResponses200Hub>? Hub { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// OK
|
||||
/// </summary>
|
||||
public class HistoryAllGetResponses200
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public HistoryAllGetResponses200MediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class HistoryAllGetResponses200MediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Metadata")]
|
||||
public List<HistoryAllGetResponses200Metadata>? Metadata { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class HistoryAllGetResponses200Metadata
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The account id of this playback
|
||||
/// </summary>
|
||||
[JsonProperty("accountID")]
|
||||
public long? AccountID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The device id which played the item
|
||||
/// </summary>
|
||||
[JsonProperty("deviceID")]
|
||||
public long? DeviceID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The key for this individual history item
|
||||
/// </summary>
|
||||
[JsonProperty("historyKey")]
|
||||
public string? HistoryKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The metadata key for the item played
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The library section id containing the item played
|
||||
/// </summary>
|
||||
[JsonProperty("librarySectionID")]
|
||||
public string? LibrarySectionID { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The originally available at of the item played
|
||||
/// </summary>
|
||||
[JsonProperty("originallyAvailableAt")]
|
||||
public string? OriginallyAvailableAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The rating key for the item played
|
||||
/// </summary>
|
||||
[JsonProperty("ratingKey")]
|
||||
public string? RatingKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The thumb of the item played
|
||||
/// </summary>
|
||||
[JsonProperty("thumb")]
|
||||
public string? Thumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The title of the item played
|
||||
/// </summary>
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The metadata type of the item played
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time when the item was played
|
||||
/// </summary>
|
||||
[JsonProperty("viewedAt")]
|
||||
public long? ViewedAt { get; set; }
|
||||
}
|
||||
}
|
||||
72
LukeHagar/PlexAPI/SDK/Models/Components/HomeVisibility.cs
Normal file
72
LukeHagar/PlexAPI/SDK/Models/Components/HomeVisibility.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this hub is visible on the home screen<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// - all: Visible to all users<br/>
|
||||
/// - none: Visible to no users<br/>
|
||||
/// - admin: Visible to only admin users<br/>
|
||||
/// - shared: Visible to shared users<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public enum HomeVisibility
|
||||
{
|
||||
[JsonProperty("all")]
|
||||
All,
|
||||
[JsonProperty("none")]
|
||||
None,
|
||||
[JsonProperty("admin")]
|
||||
Admin,
|
||||
[JsonProperty("shared")]
|
||||
Shared,
|
||||
}
|
||||
|
||||
public static class HomeVisibilityExtension
|
||||
{
|
||||
public static string Value(this HomeVisibility value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static HomeVisibility ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(HomeVisibility).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 HomeVisibility)
|
||||
{
|
||||
return (HomeVisibility)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum HomeVisibility");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
103
LukeHagar/PlexAPI/SDK/Models/Components/Hub.cs
Normal file
103
LukeHagar/PlexAPI/SDK/Models/Components/Hub.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class Hub
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// A title for this grouping of content
|
||||
/// </summary>
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the items contained in this hub, or possibly `mixed` if there are multiple types
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
[JsonProperty("context")]
|
||||
public string? Context { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A unique identifier for the hub
|
||||
/// </summary>
|
||||
[JsonProperty("hubIdentifier")]
|
||||
public string? HubIdentifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A key at which the exact content currently displayed can be fetched again. This is particularly important when a hub is marked as random and requesting the `key` may get different results. It's otherwise optional.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("hubKey")]
|
||||
public string? HubKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The key at which all of the content for this hub can be retrieved
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("Metadata")]
|
||||
public List<Models.Components.Metadata>? Metadata { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// "A boolean indicating that the hub contains more than what's included in the current response."<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("more")]
|
||||
public bool? More { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicating if the hub should be promoted to the user's homescreen
|
||||
/// </summary>
|
||||
[JsonProperty("promoted")]
|
||||
public bool? Promoted { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicating that the contents of the hub may change on each request
|
||||
/// </summary>
|
||||
[JsonProperty("random")]
|
||||
public bool? Random { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A suggestion on how this hub's contents might be displayed by a client. Some examples include `hero`, `list`, `spotlight`, and `upsell`
|
||||
/// </summary>
|
||||
[JsonProperty("style")]
|
||||
public string? Style { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The subtype of the items contained in this hub, or possibly `mixed` if there are multiple types
|
||||
/// </summary>
|
||||
[JsonProperty("subtype")]
|
||||
public string? Subtype { get; set; }
|
||||
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
44
LukeHagar/PlexAPI/SDK/Models/Components/Image.cs
Normal file
44
LukeHagar/PlexAPI/SDK/Models/Components/Image.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// Images such as movie posters and background artwork are represented by Image elements.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class Image
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Describes both the purpose and intended presentation of the image.
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public ImageType? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Title to use for accessibility.
|
||||
/// </summary>
|
||||
[JsonProperty("alt")]
|
||||
public string? Alt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The relative path or absolute url for the image.
|
||||
/// </summary>
|
||||
[JsonProperty("url")]
|
||||
public string? Url { get; set; }
|
||||
}
|
||||
}
|
||||
66
LukeHagar/PlexAPI/SDK/Models/Components/ImageType.cs
Normal file
66
LukeHagar/PlexAPI/SDK/Models/Components/ImageType.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Describes both the purpose and intended presentation of the image.
|
||||
/// </summary>
|
||||
public enum ImageType
|
||||
{
|
||||
[JsonProperty("background")]
|
||||
Background,
|
||||
[JsonProperty("banner")]
|
||||
Banner,
|
||||
[JsonProperty("clearLogo")]
|
||||
ClearLogo,
|
||||
[JsonProperty("coverPoster")]
|
||||
CoverPoster,
|
||||
[JsonProperty("snapshot")]
|
||||
Snapshot,
|
||||
}
|
||||
|
||||
public static class ImageTypeExtension
|
||||
{
|
||||
public static string Value(this ImageType value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static ImageType ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(ImageType).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 ImageType)
|
||||
{
|
||||
return (ImageType)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum ImageType");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
409
LukeHagar/PlexAPI/SDK/Models/Components/Items.cs
Normal file
409
LukeHagar/PlexAPI/SDK/Models/Components/Items.cs
Normal file
@@ -0,0 +1,409 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Items in a library are referred to as "metadata items." These metadata items are distinct from "media items" which represent actual instances of media that can be consumed. Consider a TV library that has a single video file in it for a particular episode of a show. The library has a single media item, but it has three metadata items: one for the show, one for the season, and one for the episode. Consider a movie library that has two video files in it: the same movie, but two different resolutions. The library has a single metadata item for the movie, but that metadata item has two media items, one for each resolution. Additionally a "media item" will have one or more "media parts" where the the parts are intended to be watched together, such as a CD1 and CD2 parts of the same movie.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// <br/>
|
||||
/// Note that when a metadata item has multiple media items, those media items should be isomorphic. That is, a 4K version and 1080p version of a movie are different versions of the same movie. They have the same duration, same summary, same rating, etc. and they can generally be considered interchangeable. A theatrical release vs. director's cut vs. unrated version on the other hand would be separate metadata items.<br/>
|
||||
/// <br/>
|
||||
/// Metadata items can often live in a hierarchy with relationships between them. For example, the metadata item for an episodes is associated with a season metadata item which is associated with a show metadata item. A similar hierarchy exists with track, album, and artist and photos and photo album. The relationships may be expressed via relative terms and absolute terms. For example, "leaves" refer to metadata items which has associated media (there is no media for a season nor show). A show will have "children" in the form of seasons and a season will have "children" in the form of episodes and episodes have "parent" in the form of a season which has a "parent" in the form of a show. Similarly, a show has "grandchildren" in the form of episodse and an episode has a "grandparent" in the form of a show.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class Items
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The title of the item (e.g. “300” or “The Simpsons”)
|
||||
/// </summary>
|
||||
[JsonProperty("title")]
|
||||
public object? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the video item, such as `movie`, `episode`, or `clip`.
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public object? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, contains the disc number for a track on multi-disc albums.
|
||||
/// </summary>
|
||||
[JsonProperty("absoluteIndex")]
|
||||
public long? AbsoluteIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// In units of seconds since the epoch, returns the time at which the item was added to the library.
|
||||
/// </summary>
|
||||
[JsonProperty("addedAt")]
|
||||
public long? AddedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for the background artwork for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("art")]
|
||||
public object? Art { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Some rating systems separate reviewer ratings from audience ratings
|
||||
/// </summary>
|
||||
[JsonProperty("audienceRating")]
|
||||
public double? AudienceRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A URI representing the image to be shown with the audience rating (e.g. rottentomatoes://image.rating.spilled).
|
||||
/// </summary>
|
||||
[JsonProperty("audienceRatingImage")]
|
||||
public object? AudienceRatingImage { get; set; }
|
||||
|
||||
[JsonProperty("Autotag")]
|
||||
public List<Tag>? Autotag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a banner graphic for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("banner")]
|
||||
public object? Banner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, indicates the source for the chapters in the media file. Can be media (the chapters were embedded in the media itself), agent (a metadata agent computed them), or mixed (a combination of the two).
|
||||
/// </summary>
|
||||
[JsonProperty("chapterSource")]
|
||||
public object? ChapterSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a composite image for descendent items (e.g. photo albums or playlists).
|
||||
/// </summary>
|
||||
[JsonProperty("composite")]
|
||||
public object? Composite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If known, the content rating (e.g. MPAA) for an item.
|
||||
/// </summary>
|
||||
[JsonProperty("contentRating")]
|
||||
public object? ContentRating { get; set; }
|
||||
|
||||
[JsonProperty("Country")]
|
||||
public List<Tag>? Country { get; set; }
|
||||
|
||||
[JsonProperty("Director")]
|
||||
public List<Tag>? Director { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the duration for the item, in units of milliseconds.
|
||||
/// </summary>
|
||||
[JsonProperty("duration")]
|
||||
public long? Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Typically only seen in metadata at a library's top level
|
||||
/// </summary>
|
||||
[JsonProperty("Filter")]
|
||||
public List<Filter>? Filter { get; set; }
|
||||
|
||||
[JsonProperty("Genre")]
|
||||
public List<Tag>? Genre { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `art` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentArt")]
|
||||
public string? GrandparentArt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `hero` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentHero")]
|
||||
public string? GrandparentHero { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `key` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentKey")]
|
||||
public string? GrandparentKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `ratingKey` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentRatingKey")]
|
||||
public string? GrandparentRatingKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `theme` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentTheme")]
|
||||
public string? GrandparentTheme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `thumb` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentThumb")]
|
||||
public string? GrandparentThumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `title` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentTitle")]
|
||||
public string? GrandparentTitle { get; set; }
|
||||
|
||||
[JsonProperty("Guid")]
|
||||
public List<Tag>? Guid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a hero image for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("hero")]
|
||||
public object? Hero { get; set; }
|
||||
|
||||
[JsonProperty("Image")]
|
||||
public List<Image>? Image { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, this represents the episode number for episodes, season number for seasons, or track number for audio tracks.
|
||||
/// </summary>
|
||||
[JsonProperty("index")]
|
||||
public long? Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The key at which the item's details can be fetched. In many cases a metadata item may be passed without all the details (such as in a hub) and this key corresponds to the endpoint to fetch additional details.
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public object? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a user has watched or listened to an item, this contains a timestamp (epoch seconds) for that last consumption time.
|
||||
/// </summary>
|
||||
[JsonProperty("lastViewedAt")]
|
||||
public long? LastViewedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For shows and seasons, contains the number of total episodes.
|
||||
/// </summary>
|
||||
[JsonProperty("leafCount")]
|
||||
public long? LeafCount { get; set; }
|
||||
|
||||
[JsonProperty("Media")]
|
||||
public List<Media>? Media { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, in the format YYYY-MM-DD [HH:MM:SS] (the hours/minutes/seconds part is not always present). The air date, or a higher resolution release date for an item, depending on type. For example, episodes usually have air date like 1979-08-10 (we don't use epoch seconds because media existed prior to 1970). In some cases, recorded over-the-air content has higher resolution air date which includes a time component. Albums and movies may have day-resolution release dates as well.
|
||||
/// </summary>
|
||||
[JsonProperty("originallyAvailableAt")]
|
||||
public object? OriginallyAvailableAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, used to indicate an item's original title, e.g. a movie's foreign title.
|
||||
/// </summary>
|
||||
[JsonProperty("originalTitle")]
|
||||
public object? OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `hero` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentHero")]
|
||||
public string? ParentHero { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `index` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentIndex")]
|
||||
public long? ParentIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `key` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentKey")]
|
||||
public string? ParentKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `ratingKey` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentRatingKey")]
|
||||
public string? ParentRatingKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `thumb` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentThumb")]
|
||||
public string? ParentThumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `title` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentTitle")]
|
||||
public string? ParentTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the item has a primary extra; for a movie, this is a trailer, and for a music track it is a music video. The URL points to the metadata details endpoint for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("primaryExtraKey")]
|
||||
public object? PrimaryExtraKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Prompt to give the user for this directory (such as `Search Movies`)
|
||||
/// </summary>
|
||||
[JsonProperty("prompt")]
|
||||
public string? Prompt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the rating for the item. The exact meaning and representation depends on where the rating was sourced from.
|
||||
/// </summary>
|
||||
[JsonProperty("rating")]
|
||||
public double? Rating { get; set; }
|
||||
|
||||
[JsonProperty("Rating")]
|
||||
public List<Tag>? RatingArray { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of ratings under this metadata
|
||||
/// </summary>
|
||||
[JsonProperty("ratingCount")]
|
||||
public long? RatingCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, indicates an image to be shown with the rating. This is passed back as a small set of defined URI values, e.g. rottentomatoes://image.rating.rotten.
|
||||
/// </summary>
|
||||
[JsonProperty("ratingImage")]
|
||||
public object? RatingImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is the opaque string to be passed into timeline, scrobble, and rating endpoints to identify them. While it often appears to be numeric, this is not guaranteed.
|
||||
/// </summary>
|
||||
[JsonProperty("ratingKey")]
|
||||
public object? RatingKey { get; set; }
|
||||
|
||||
[JsonProperty("Role")]
|
||||
public List<Tag>? Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates this is a search directory
|
||||
/// </summary>
|
||||
[JsonProperty("search")]
|
||||
public bool? Search { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used by old clients to provide nested menus allowing for primative (but structured) navigation.
|
||||
/// </summary>
|
||||
[JsonProperty("secondary")]
|
||||
public bool? Secondary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When found on a show item, indicates that the children (seasons) should be skipped in favor of the grandchildren (episodes). Useful for mini-series, etc.
|
||||
/// </summary>
|
||||
[JsonProperty("skipChildren")]
|
||||
public bool? SkipChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present on an episode or track item, indicates parent should be skipped in favor of grandparent (show).
|
||||
/// </summary>
|
||||
[JsonProperty("skipParent")]
|
||||
public bool? SkipParent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Typically only seen in metadata at a library's top level
|
||||
/// </summary>
|
||||
[JsonProperty("Sort")]
|
||||
public List<Sort>? Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the studio or label which produced an item (e.g. movie studio for movies, record label for albums).
|
||||
/// </summary>
|
||||
[JsonProperty("studio")]
|
||||
public object? Studio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The subtype of the video item, such as `photo` when the video item is in a photo library
|
||||
/// </summary>
|
||||
[JsonProperty("subtype")]
|
||||
public object? Subtype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the extended textual information about the item (e.g. movie plot, artist biography, album review).
|
||||
/// </summary>
|
||||
[JsonProperty("summary")]
|
||||
public object? Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, a pithy one-liner about the item (usually only seen for movies).
|
||||
/// </summary>
|
||||
[JsonProperty("tagline")]
|
||||
public object? Tagline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for theme music for the item (usually only for TV shows).
|
||||
/// </summary>
|
||||
[JsonProperty("theme")]
|
||||
public object? Theme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for the poster or thumbnail for the item. When available for types like movie, it will be the poster graphic, but fall-back to the extracted media thumbnail.
|
||||
/// </summary>
|
||||
[JsonProperty("thumb")]
|
||||
public object? Thumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whene present, this is the string used for sorting the item. It's usually the title with any leading articles removed (e.g. “Simpsons”).
|
||||
/// </summary>
|
||||
[JsonProperty("titleSort")]
|
||||
public object? TitleSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// In units of seconds since the epoch, returns the time at which the item was last changed (e.g. had its metadata updated).
|
||||
/// </summary>
|
||||
[JsonProperty("updatedAt")]
|
||||
public long? UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When the user has rated an item, this contains the user rating
|
||||
/// </summary>
|
||||
[JsonProperty("userRating")]
|
||||
public double? UserRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a users has completed watched or listened to an item, this attribute contains the number of consumptions.
|
||||
/// </summary>
|
||||
[JsonProperty("viewCount")]
|
||||
public long? ViewCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For shows and seasons, contains the number of viewed episodes.
|
||||
/// </summary>
|
||||
[JsonProperty("viewedLeafCount")]
|
||||
public long? ViewedLeafCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a user is in the process of viewing or listening to this item, this attribute contains the current offset, in units of milliseconds.
|
||||
/// </summary>
|
||||
[JsonProperty("viewOffset")]
|
||||
public long? ViewOffset { get; set; }
|
||||
|
||||
[JsonProperty("Writer")]
|
||||
public List<Tag>? Writer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the year associated with the item's release (e.g. release year for a movie).
|
||||
/// </summary>
|
||||
[JsonProperty("year")]
|
||||
public long? Year { get; set; }
|
||||
|
||||
[JsonProperty("MetadataItem")]
|
||||
public List<Items>? MetadataItem { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
86
LukeHagar/PlexAPI/SDK/Models/Components/LibrarySection.cs
Normal file
86
LukeHagar/PlexAPI/SDK/Models/Components/LibrarySection.cs
Normal file
@@ -0,0 +1,86 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class LibrarySection
|
||||
{
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
[JsonProperty("agent")]
|
||||
public string? Agent { get; set; }
|
||||
|
||||
[JsonProperty("allowSync")]
|
||||
public bool? AllowSync { get; set; }
|
||||
|
||||
[JsonProperty("art")]
|
||||
public string? Art { get; set; }
|
||||
|
||||
[JsonProperty("composite")]
|
||||
public string? Composite { get; set; }
|
||||
|
||||
[JsonProperty("content")]
|
||||
public bool? Content { get; set; }
|
||||
|
||||
[JsonProperty("contentChangedAt")]
|
||||
public long? ContentChangedAt { get; set; }
|
||||
|
||||
[JsonProperty("createdAt")]
|
||||
public long? CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("directory")]
|
||||
public bool? Directory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether this section has filtering capabilities
|
||||
/// </summary>
|
||||
[JsonProperty("filters")]
|
||||
public bool? Filters { get; set; }
|
||||
|
||||
[JsonProperty("hidden")]
|
||||
public bool? Hidden { get; set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("language")]
|
||||
public string? Language { get; set; }
|
||||
|
||||
[JsonProperty("Location")]
|
||||
public List<LibrarySectionLocation>? Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether this library section is currently scanning
|
||||
/// </summary>
|
||||
[JsonProperty("refreshing")]
|
||||
public bool? Refreshing { get; set; }
|
||||
|
||||
[JsonProperty("scannedAt")]
|
||||
public long? ScannedAt { get; set; }
|
||||
|
||||
[JsonProperty("scanner")]
|
||||
public string? Scanner { get; set; }
|
||||
|
||||
[JsonProperty("thumb")]
|
||||
public string? Thumb { get; set; }
|
||||
|
||||
[JsonProperty("updatedAt")]
|
||||
public long? UpdatedAt { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a top-level location on disk where media in this library section is stored
|
||||
/// </summary>
|
||||
public class LibrarySectionLocation
|
||||
{
|
||||
|
||||
[JsonProperty("id")]
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The path of where this directory exists on disk
|
||||
/// </summary>
|
||||
[JsonProperty("path")]
|
||||
public object? Path { get; set; }
|
||||
}
|
||||
}
|
||||
52
LukeHagar/PlexAPI/SDK/Models/Components/Lineup.cs
Normal file
52
LukeHagar/PlexAPI/SDK/Models/Components/Lineup.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class Lineup
|
||||
{
|
||||
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of this object (`lineup` in this case)
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// - `-1`: N/A<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// - `0`: Over the air<br/>
|
||||
/// - `1`: Cable<br/>
|
||||
/// - `2`: Satellite<br/>
|
||||
/// - `3`: IPTV<br/>
|
||||
/// - `4`: Virtual<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("lineupType")]
|
||||
public Models.Components.LineupType? LineupType { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
public string? Location { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The uuid of this lineup
|
||||
/// </summary>
|
||||
[JsonProperty("uuid")]
|
||||
public string? Uuid { get; set; }
|
||||
}
|
||||
}
|
||||
36
LukeHagar/PlexAPI/SDK/Models/Components/LineupType.cs
Normal file
36
LukeHagar/PlexAPI/SDK/Models/Components/LineupType.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
|
||||
/// <summary>
|
||||
/// - `-1`: N/A<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// - `0`: Over the air<br/>
|
||||
/// - `1`: Cable<br/>
|
||||
/// - `2`: Satellite<br/>
|
||||
/// - `3`: IPTV<br/>
|
||||
/// - `4`: Virtual<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public enum LineupType
|
||||
{
|
||||
Minus1 = -1,
|
||||
Zero = 0,
|
||||
One = 1,
|
||||
Two = 2,
|
||||
Three = 3,
|
||||
Four = 4,
|
||||
}
|
||||
|
||||
}
|
||||
59
LukeHagar/PlexAPI/SDK/Models/Components/Location.cs
Normal file
59
LukeHagar/PlexAPI/SDK/Models/Components/Location.cs
Normal file
@@ -0,0 +1,59 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public enum Location
|
||||
{
|
||||
[JsonProperty("lan")]
|
||||
Lan,
|
||||
[JsonProperty("wan")]
|
||||
Wan,
|
||||
[JsonProperty("cellular")]
|
||||
Cellular,
|
||||
}
|
||||
|
||||
public static class LocationExtension
|
||||
{
|
||||
public static string Value(this Location value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static Location ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(Location).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 Location)
|
||||
{
|
||||
return (Location)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum Location");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
84
LukeHagar/PlexAPI/SDK/Models/Components/Media.cs
Normal file
84
LukeHagar/PlexAPI/SDK/Models/Components/Media.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `Media` represents an one or more media files (parts) and is a child of a metadata item. There aren't necessarily any guaranteed attributes on media elements since the attributes will vary based on the type. The possible attributes are not documented here, but they typically have self-evident names. High-level media information that can be used for badging and flagging, such as `videoResolution` and codecs, is included on the media element.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class Media
|
||||
{
|
||||
|
||||
[JsonProperty("aspectRatio")]
|
||||
public double? AspectRatio { get; set; }
|
||||
|
||||
[JsonProperty("audioChannels")]
|
||||
public long? AudioChannels { get; set; }
|
||||
|
||||
[JsonProperty("audioCodec")]
|
||||
public object? AudioCodec { get; set; }
|
||||
|
||||
[JsonProperty("audioProfile")]
|
||||
public object? AudioProfile { get; set; }
|
||||
|
||||
[JsonProperty("bitrate")]
|
||||
public long? Bitrate { get; set; }
|
||||
|
||||
[JsonProperty("container")]
|
||||
public object? Container { get; set; }
|
||||
|
||||
[JsonProperty("duration")]
|
||||
public long? Duration { get; set; }
|
||||
|
||||
[JsonProperty("has64bitOffsets")]
|
||||
public bool? Has64bitOffsets { get; set; }
|
||||
|
||||
[JsonProperty("hasVoiceActivity")]
|
||||
public bool? HasVoiceActivity { get; set; }
|
||||
|
||||
[JsonProperty("height")]
|
||||
public long? Height { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public long? Id { get; set; }
|
||||
|
||||
[JsonProperty("optimizedForStreaming")]
|
||||
public bool? OptimizedForStreaming { get; set; }
|
||||
|
||||
[JsonProperty("Part")]
|
||||
public List<Part>? Part { get; set; }
|
||||
|
||||
[JsonProperty("videoCodec")]
|
||||
public object? VideoCodec { get; set; }
|
||||
|
||||
[JsonProperty("videoFrameRate")]
|
||||
public object? VideoFrameRate { get; set; }
|
||||
|
||||
[JsonProperty("videoProfile")]
|
||||
public object? VideoProfile { get; set; }
|
||||
|
||||
[JsonProperty("videoResolution")]
|
||||
public object? VideoResolution { get; set; }
|
||||
|
||||
[JsonProperty("width")]
|
||||
public long? Width { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
53
LukeHagar/PlexAPI/SDK/Models/Components/MediaContainer.cs
Normal file
53
LukeHagar/PlexAPI/SDK/Models/Components/MediaContainer.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class MediaContainerWithArtwork
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithArtworkMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithArtworkMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Metadata")]
|
||||
public List<MediaContainerWithArtworkMetadata>? Metadata { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class MediaContainerWithArtworkMetadata
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The title of the item
|
||||
/// </summary>
|
||||
[JsonProperty("title")]
|
||||
public string? Title { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
public MediaContainerWithArtworkType? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The path to the artwork
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public enum MediaContainerWithArtworkType
|
||||
{
|
||||
[JsonProperty("image")]
|
||||
Image,
|
||||
}
|
||||
|
||||
public static class MediaContainerWithArtworkTypeExtension
|
||||
{
|
||||
public static string Value(this MediaContainerWithArtworkType value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static MediaContainerWithArtworkType ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(MediaContainerWithArtworkType).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 MediaContainerWithArtworkType)
|
||||
{
|
||||
return (MediaContainerWithArtworkType)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum MediaContainerWithArtworkType");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is commonly found as the root of a response and is a pretty generic container. Common attributes include `identifier` and things related to paging (`offset`, `size`, `totalSize`).<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// <br/>
|
||||
/// It is also common for a `MediaContainer` to contain attributes "hoisted" from its children. If every element in the container would have had the same attribute, then that attribute can be present on the container instead of being repeated on every element. For example, an album's list of tracks might include `parentTitle` on the container since all of the tracks have the same album title. A container may have a `source` attribute when all of the items came from the same source. Generally speaking, when looking for an attribute on an item, if the attribute wasn't found then the container should be checked for that attribute as well.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithDecision
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithDecisionMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public enum MediaContainerWithDecisionDecision
|
||||
{
|
||||
[JsonProperty("copy")]
|
||||
Copy,
|
||||
[JsonProperty("transcode")]
|
||||
Transcode,
|
||||
[JsonProperty("burn")]
|
||||
Burn,
|
||||
[JsonProperty("unavailable")]
|
||||
Unavailable,
|
||||
[JsonProperty("ignore")]
|
||||
Ignore,
|
||||
[JsonProperty("none")]
|
||||
None,
|
||||
}
|
||||
|
||||
public static class MediaContainerWithDecisionDecisionExtension
|
||||
{
|
||||
public static string Value(this MediaContainerWithDecisionDecision value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static MediaContainerWithDecisionDecision ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(MediaContainerWithDecisionDecision).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 MediaContainerWithDecisionDecision)
|
||||
{
|
||||
return (MediaContainerWithDecisionDecision)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum MediaContainerWithDecisionDecision");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System;
|
||||
|
||||
public enum MediaContainerWithDecisionLocation
|
||||
{
|
||||
[JsonProperty("direct")]
|
||||
Direct,
|
||||
[JsonProperty("sidecar-subs")]
|
||||
SidecarSubs,
|
||||
[JsonProperty("segments-video")]
|
||||
SegmentsVideo,
|
||||
[JsonProperty("segments-audio")]
|
||||
SegmentsAudio,
|
||||
[JsonProperty("segments-av")]
|
||||
SegmentsAv,
|
||||
[JsonProperty("segments-subs")]
|
||||
SegmentsSubs,
|
||||
[JsonProperty("embedded")]
|
||||
Embedded,
|
||||
[JsonProperty("sidecar")]
|
||||
Sidecar,
|
||||
}
|
||||
|
||||
public static class MediaContainerWithDecisionLocationExtension
|
||||
{
|
||||
public static string Value(this MediaContainerWithDecisionLocation value)
|
||||
{
|
||||
return ((JsonPropertyAttribute)value.GetType().GetMember(value.ToString())[0].GetCustomAttributes(typeof(JsonPropertyAttribute), false)[0]).PropertyName ?? value.ToString();
|
||||
}
|
||||
|
||||
public static MediaContainerWithDecisionLocation ToEnum(this string value)
|
||||
{
|
||||
foreach(var field in typeof(MediaContainerWithDecisionLocation).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 MediaContainerWithDecisionLocation)
|
||||
{
|
||||
return (MediaContainerWithDecisionLocation)enumVal;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new Exception($"Unknown value {value} for enum MediaContainerWithDecisionLocation");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `Media` represents an one or more media files (parts) and is a child of a metadata item. There aren't necessarily any guaranteed attributes on media elements since the attributes will vary based on the type. The possible attributes are not documented here, but they typically have self-evident names. High-level media information that can be used for badging and flagging, such as `videoResolution` and codecs, is included on the media element.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithDecisionMedia
|
||||
{
|
||||
|
||||
[JsonProperty("aspectRatio")]
|
||||
public double? AspectRatio { get; set; }
|
||||
|
||||
[JsonProperty("audioChannels")]
|
||||
public long? AudioChannels { get; set; }
|
||||
|
||||
[JsonProperty("audioCodec")]
|
||||
public object? AudioCodec { get; set; }
|
||||
|
||||
[JsonProperty("audioProfile")]
|
||||
public object? AudioProfile { get; set; }
|
||||
|
||||
[JsonProperty("bitrate")]
|
||||
public long? Bitrate { get; set; }
|
||||
|
||||
[JsonProperty("container")]
|
||||
public object? Container { get; set; }
|
||||
|
||||
[JsonProperty("duration")]
|
||||
public long? Duration { get; set; }
|
||||
|
||||
[JsonProperty("has64bitOffsets")]
|
||||
public bool? Has64bitOffsets { get; set; }
|
||||
|
||||
[JsonProperty("hasVoiceActivity")]
|
||||
public bool? HasVoiceActivity { get; set; }
|
||||
|
||||
[JsonProperty("height")]
|
||||
public long? Height { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public long? Id { get; set; }
|
||||
|
||||
[JsonProperty("optimizedForStreaming")]
|
||||
public bool? OptimizedForStreaming { get; set; }
|
||||
|
||||
[JsonProperty("Part")]
|
||||
public List<MediaContainerWithDecisionPart>? Part { get; set; }
|
||||
|
||||
[JsonProperty("videoCodec")]
|
||||
public object? VideoCodec { get; set; }
|
||||
|
||||
[JsonProperty("videoFrameRate")]
|
||||
public object? VideoFrameRate { get; set; }
|
||||
|
||||
[JsonProperty("videoProfile")]
|
||||
public object? VideoProfile { get; set; }
|
||||
|
||||
[JsonProperty("videoResolution")]
|
||||
public object? VideoResolution { get; set; }
|
||||
|
||||
[JsonProperty("width")]
|
||||
public long? Width { get; set; }
|
||||
|
||||
[JsonProperty("abr")]
|
||||
public bool? Abr { get; set; }
|
||||
|
||||
[JsonProperty("resourceSession")]
|
||||
public string? ResourceSession { get; set; }
|
||||
|
||||
[JsonProperty("selected")]
|
||||
public bool? Selected { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithDecisionMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The maximum available bitrate when the decision was rendered.
|
||||
/// </summary>
|
||||
[JsonProperty("availableBandwidth")]
|
||||
public long? AvailableBandwidth { get; set; }
|
||||
|
||||
[JsonProperty("directPlayDecisionCode")]
|
||||
public long? DirectPlayDecisionCode { get; set; }
|
||||
|
||||
[JsonProperty("directPlayDecisionText")]
|
||||
public string? DirectPlayDecisionText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The overall decision. 1xxx are playback can succeed, 2xxx are a general error (such as insufficient bandwidth), 3xxx are errors in direct play, and 4xxx are errors in transcodes. Same codes are used in all.
|
||||
/// </summary>
|
||||
[JsonProperty("generalDecisionCode")]
|
||||
public long? GeneralDecisionCode { get; set; }
|
||||
|
||||
[JsonProperty("generalDecisionText")]
|
||||
public string? GeneralDecisionText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The code indicating the status of evaluation of playback when client indicates `hasMDE=1`
|
||||
/// </summary>
|
||||
[JsonProperty("mdeDecisionCode")]
|
||||
public long? MdeDecisionCode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Descriptive text for the above code
|
||||
/// </summary>
|
||||
[JsonProperty("mdeDecisionText")]
|
||||
public string? MdeDecisionText { get; set; }
|
||||
|
||||
[JsonProperty("Metadata")]
|
||||
public List<MediaContainerWithDecisionMetadata>? Metadata { get; set; }
|
||||
|
||||
[JsonProperty("transcodeDecisionCode")]
|
||||
public long? TranscodeDecisionCode { get; set; }
|
||||
|
||||
[JsonProperty("transcodeDecisionText")]
|
||||
public string? TranscodeDecisionText { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,406 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Items in a library are referred to as "metadata items." These metadata items are distinct from "media items" which represent actual instances of media that can be consumed. Consider a TV library that has a single video file in it for a particular episode of a show. The library has a single media item, but it has three metadata items: one for the show, one for the season, and one for the episode. Consider a movie library that has two video files in it: the same movie, but two different resolutions. The library has a single metadata item for the movie, but that metadata item has two media items, one for each resolution. Additionally a "media item" will have one or more "media parts" where the the parts are intended to be watched together, such as a CD1 and CD2 parts of the same movie.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// <br/>
|
||||
/// Note that when a metadata item has multiple media items, those media items should be isomorphic. That is, a 4K version and 1080p version of a movie are different versions of the same movie. They have the same duration, same summary, same rating, etc. and they can generally be considered interchangeable. A theatrical release vs. director's cut vs. unrated version on the other hand would be separate metadata items.<br/>
|
||||
/// <br/>
|
||||
/// Metadata items can often live in a hierarchy with relationships between them. For example, the metadata item for an episodes is associated with a season metadata item which is associated with a show metadata item. A similar hierarchy exists with track, album, and artist and photos and photo album. The relationships may be expressed via relative terms and absolute terms. For example, "leaves" refer to metadata items which has associated media (there is no media for a season nor show). A show will have "children" in the form of seasons and a season will have "children" in the form of episodes and episodes have "parent" in the form of a season which has a "parent" in the form of a show. Similarly, a show has "grandchildren" in the form of episodse and an episode has a "grandparent" in the form of a show.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithDecisionMetadata
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// The title of the item (e.g. “300” or “The Simpsons”)
|
||||
/// </summary>
|
||||
[JsonProperty("title")]
|
||||
public object? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the video item, such as `movie`, `episode`, or `clip`.
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public object? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, contains the disc number for a track on multi-disc albums.
|
||||
/// </summary>
|
||||
[JsonProperty("absoluteIndex")]
|
||||
public long? AbsoluteIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// In units of seconds since the epoch, returns the time at which the item was added to the library.
|
||||
/// </summary>
|
||||
[JsonProperty("addedAt")]
|
||||
public long? AddedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for the background artwork for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("art")]
|
||||
public object? Art { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Some rating systems separate reviewer ratings from audience ratings
|
||||
/// </summary>
|
||||
[JsonProperty("audienceRating")]
|
||||
public double? AudienceRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A URI representing the image to be shown with the audience rating (e.g. rottentomatoes://image.rating.spilled).
|
||||
/// </summary>
|
||||
[JsonProperty("audienceRatingImage")]
|
||||
public object? AudienceRatingImage { get; set; }
|
||||
|
||||
[JsonProperty("Autotag")]
|
||||
public List<Tag>? Autotag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a banner graphic for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("banner")]
|
||||
public object? Banner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, indicates the source for the chapters in the media file. Can be media (the chapters were embedded in the media itself), agent (a metadata agent computed them), or mixed (a combination of the two).
|
||||
/// </summary>
|
||||
[JsonProperty("chapterSource")]
|
||||
public object? ChapterSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a composite image for descendent items (e.g. photo albums or playlists).
|
||||
/// </summary>
|
||||
[JsonProperty("composite")]
|
||||
public object? Composite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If known, the content rating (e.g. MPAA) for an item.
|
||||
/// </summary>
|
||||
[JsonProperty("contentRating")]
|
||||
public object? ContentRating { get; set; }
|
||||
|
||||
[JsonProperty("Country")]
|
||||
public List<Tag>? Country { get; set; }
|
||||
|
||||
[JsonProperty("Director")]
|
||||
public List<Tag>? Director { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the duration for the item, in units of milliseconds.
|
||||
/// </summary>
|
||||
[JsonProperty("duration")]
|
||||
public long? Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Typically only seen in metadata at a library's top level
|
||||
/// </summary>
|
||||
[JsonProperty("Filter")]
|
||||
public List<Filter>? Filter { get; set; }
|
||||
|
||||
[JsonProperty("Genre")]
|
||||
public List<Tag>? Genre { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `art` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentArt")]
|
||||
public string? GrandparentArt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `hero` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentHero")]
|
||||
public string? GrandparentHero { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `key` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentKey")]
|
||||
public string? GrandparentKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `ratingKey` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentRatingKey")]
|
||||
public string? GrandparentRatingKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `theme` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentTheme")]
|
||||
public string? GrandparentTheme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `thumb` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentThumb")]
|
||||
public string? GrandparentThumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `title` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentTitle")]
|
||||
public string? GrandparentTitle { get; set; }
|
||||
|
||||
[JsonProperty("Guid")]
|
||||
public List<Tag>? Guid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a hero image for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("hero")]
|
||||
public object? Hero { get; set; }
|
||||
|
||||
[JsonProperty("Image")]
|
||||
public List<Image>? Image { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, this represents the episode number for episodes, season number for seasons, or track number for audio tracks.
|
||||
/// </summary>
|
||||
[JsonProperty("index")]
|
||||
public long? Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The key at which the item's details can be fetched. In many cases a metadata item may be passed without all the details (such as in a hub) and this key corresponds to the endpoint to fetch additional details.
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public object? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a user has watched or listened to an item, this contains a timestamp (epoch seconds) for that last consumption time.
|
||||
/// </summary>
|
||||
[JsonProperty("lastViewedAt")]
|
||||
public long? LastViewedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For shows and seasons, contains the number of total episodes.
|
||||
/// </summary>
|
||||
[JsonProperty("leafCount")]
|
||||
public long? LeafCount { get; set; }
|
||||
|
||||
[JsonProperty("Media")]
|
||||
public List<MediaContainerWithDecisionMedia>? Media { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, in the format YYYY-MM-DD [HH:MM:SS] (the hours/minutes/seconds part is not always present). The air date, or a higher resolution release date for an item, depending on type. For example, episodes usually have air date like 1979-08-10 (we don't use epoch seconds because media existed prior to 1970). In some cases, recorded over-the-air content has higher resolution air date which includes a time component. Albums and movies may have day-resolution release dates as well.
|
||||
/// </summary>
|
||||
[JsonProperty("originallyAvailableAt")]
|
||||
public object? OriginallyAvailableAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, used to indicate an item's original title, e.g. a movie's foreign title.
|
||||
/// </summary>
|
||||
[JsonProperty("originalTitle")]
|
||||
public object? OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `hero` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentHero")]
|
||||
public string? ParentHero { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `index` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentIndex")]
|
||||
public long? ParentIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `key` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentKey")]
|
||||
public string? ParentKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `ratingKey` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentRatingKey")]
|
||||
public string? ParentRatingKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `thumb` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentThumb")]
|
||||
public string? ParentThumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `title` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentTitle")]
|
||||
public string? ParentTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the item has a primary extra; for a movie, this is a trailer, and for a music track it is a music video. The URL points to the metadata details endpoint for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("primaryExtraKey")]
|
||||
public object? PrimaryExtraKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Prompt to give the user for this directory (such as `Search Movies`)
|
||||
/// </summary>
|
||||
[JsonProperty("prompt")]
|
||||
public string? Prompt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the rating for the item. The exact meaning and representation depends on where the rating was sourced from.
|
||||
/// </summary>
|
||||
[JsonProperty("rating")]
|
||||
public double? Rating { get; set; }
|
||||
|
||||
[JsonProperty("Rating")]
|
||||
public List<Tag>? RatingArray { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of ratings under this metadata
|
||||
/// </summary>
|
||||
[JsonProperty("ratingCount")]
|
||||
public long? RatingCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, indicates an image to be shown with the rating. This is passed back as a small set of defined URI values, e.g. rottentomatoes://image.rating.rotten.
|
||||
/// </summary>
|
||||
[JsonProperty("ratingImage")]
|
||||
public object? RatingImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is the opaque string to be passed into timeline, scrobble, and rating endpoints to identify them. While it often appears to be numeric, this is not guaranteed.
|
||||
/// </summary>
|
||||
[JsonProperty("ratingKey")]
|
||||
public object? RatingKey { get; set; }
|
||||
|
||||
[JsonProperty("Role")]
|
||||
public List<Tag>? Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates this is a search directory
|
||||
/// </summary>
|
||||
[JsonProperty("search")]
|
||||
public bool? Search { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used by old clients to provide nested menus allowing for primative (but structured) navigation.
|
||||
/// </summary>
|
||||
[JsonProperty("secondary")]
|
||||
public bool? Secondary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When found on a show item, indicates that the children (seasons) should be skipped in favor of the grandchildren (episodes). Useful for mini-series, etc.
|
||||
/// </summary>
|
||||
[JsonProperty("skipChildren")]
|
||||
public bool? SkipChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present on an episode or track item, indicates parent should be skipped in favor of grandparent (show).
|
||||
/// </summary>
|
||||
[JsonProperty("skipParent")]
|
||||
public bool? SkipParent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Typically only seen in metadata at a library's top level
|
||||
/// </summary>
|
||||
[JsonProperty("Sort")]
|
||||
public List<Sort>? Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the studio or label which produced an item (e.g. movie studio for movies, record label for albums).
|
||||
/// </summary>
|
||||
[JsonProperty("studio")]
|
||||
public object? Studio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The subtype of the video item, such as `photo` when the video item is in a photo library
|
||||
/// </summary>
|
||||
[JsonProperty("subtype")]
|
||||
public object? Subtype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the extended textual information about the item (e.g. movie plot, artist biography, album review).
|
||||
/// </summary>
|
||||
[JsonProperty("summary")]
|
||||
public object? Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, a pithy one-liner about the item (usually only seen for movies).
|
||||
/// </summary>
|
||||
[JsonProperty("tagline")]
|
||||
public object? Tagline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for theme music for the item (usually only for TV shows).
|
||||
/// </summary>
|
||||
[JsonProperty("theme")]
|
||||
public object? Theme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for the poster or thumbnail for the item. When available for types like movie, it will be the poster graphic, but fall-back to the extracted media thumbnail.
|
||||
/// </summary>
|
||||
[JsonProperty("thumb")]
|
||||
public object? Thumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whene present, this is the string used for sorting the item. It's usually the title with any leading articles removed (e.g. “Simpsons”).
|
||||
/// </summary>
|
||||
[JsonProperty("titleSort")]
|
||||
public object? TitleSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// In units of seconds since the epoch, returns the time at which the item was last changed (e.g. had its metadata updated).
|
||||
/// </summary>
|
||||
[JsonProperty("updatedAt")]
|
||||
public long? UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When the user has rated an item, this contains the user rating
|
||||
/// </summary>
|
||||
[JsonProperty("userRating")]
|
||||
public double? UserRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a users has completed watched or listened to an item, this attribute contains the number of consumptions.
|
||||
/// </summary>
|
||||
[JsonProperty("viewCount")]
|
||||
public long? ViewCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For shows and seasons, contains the number of viewed episodes.
|
||||
/// </summary>
|
||||
[JsonProperty("viewedLeafCount")]
|
||||
public long? ViewedLeafCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a user is in the process of viewing or listening to this item, this attribute contains the current offset, in units of milliseconds.
|
||||
/// </summary>
|
||||
[JsonProperty("viewOffset")]
|
||||
public long? ViewOffset { get; set; }
|
||||
|
||||
[JsonProperty("Writer")]
|
||||
public List<Tag>? Writer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the year associated with the item's release (e.g. release year for a movie).
|
||||
/// </summary>
|
||||
[JsonProperty("year")]
|
||||
public long? Year { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `Part` represents a particular file or "part" of a media item. The part is the playable unit of the media hierarchy. Suppose that a movie library contains a movie that is broken up into files, reminiscent of a movie split across two BDs. The metadata item represents information about the movie, the media item represents this instance of the movie at this resolution and quality, and the part items represent the two playable files. If another media were added which contained the joining of these two parts transcoded down to a lower resolution, then this metadata would contain 2 medias, one with 2 parts and one with 1 part.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithDecisionPart
|
||||
{
|
||||
|
||||
[JsonProperty("audioProfile")]
|
||||
public object? AudioProfile { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The container of the media file, such as `mp4` or `mkv`
|
||||
/// </summary>
|
||||
[JsonProperty("container")]
|
||||
public object? Container { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The duration of the media item, in milliseconds
|
||||
/// </summary>
|
||||
[JsonProperty("duration")]
|
||||
public long? Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The local file path at which the part is stored on the server
|
||||
/// </summary>
|
||||
[JsonProperty("file")]
|
||||
public object? File { get; set; }
|
||||
|
||||
[JsonProperty("has64bitOffsets")]
|
||||
public bool? Has64bitOffsets { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The key from which the media can be streamed
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public object? Key { get; set; }
|
||||
|
||||
[JsonProperty("optimizedForStreaming")]
|
||||
public bool? OptimizedForStreaming { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The size of the media, in bytes
|
||||
/// </summary>
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
[JsonProperty("Stream")]
|
||||
public List<MediaContainerWithDecisionStream>? Stream { get; set; }
|
||||
|
||||
[JsonProperty("videoProfile")]
|
||||
public object? VideoProfile { get; set; }
|
||||
|
||||
[JsonProperty("decision")]
|
||||
public Decision? Decision { get; set; }
|
||||
|
||||
[JsonProperty("selected")]
|
||||
public bool? Selected { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `Stream` represents a particular stream from a media item, such as the video stream, audio stream, or subtitle stream. The stream may either be part of the file represented by the parent `Part` or, especially for subtitles, an external file. The stream contains more detailed information about the specific stream. For example, a video may include the `aspectRatio` at the `Media` level, but detailed information about the video stream like the color space will be included on the `Stream` for the video stream. Note that photos do not have streams (mostly as an optimization).<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithDecisionStream
|
||||
{
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("audioChannelLayout")]
|
||||
public object? AudioChannelLayout { get; set; }
|
||||
|
||||
[JsonProperty("bitDepth")]
|
||||
public long? BitDepth { get; set; }
|
||||
|
||||
[JsonProperty("bitrate")]
|
||||
public long? Bitrate { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For subtitle streams only. If `true` then the server can attempt to automatically sync the subtitle timestamps with the video.
|
||||
/// </summary>
|
||||
[JsonProperty("canAutoSync")]
|
||||
public bool? CanAutoSync { get; set; }
|
||||
|
||||
[JsonProperty("chromaLocation")]
|
||||
public object? ChromaLocation { get; set; }
|
||||
|
||||
[JsonProperty("chromaSubsampling")]
|
||||
public object? ChromaSubsampling { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The codec of the stream, such as `h264` or `aac`
|
||||
/// </summary>
|
||||
[JsonProperty("codec")]
|
||||
public object? Codec { get; set; }
|
||||
|
||||
[JsonProperty("colorPrimaries")]
|
||||
public object? ColorPrimaries { get; set; }
|
||||
|
||||
[JsonProperty("colorRange")]
|
||||
public object? ColorRange { get; set; }
|
||||
|
||||
[JsonProperty("colorSpace")]
|
||||
public object? ColorSpace { get; set; }
|
||||
|
||||
[JsonProperty("colorTrc")]
|
||||
public object? ColorTrc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A friendly name for the stream, often comprised of the language and codec information
|
||||
/// </summary>
|
||||
[JsonProperty("displayTitle")]
|
||||
public object? DisplayTitle { get; set; }
|
||||
|
||||
[JsonProperty("frameRate")]
|
||||
public double? FrameRate { get; set; }
|
||||
|
||||
[JsonProperty("hasScalingMatrix")]
|
||||
public object? HasScalingMatrix { get; set; }
|
||||
|
||||
[JsonProperty("height")]
|
||||
public long? Height { get; set; }
|
||||
|
||||
[JsonProperty("id")]
|
||||
public long? Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the stream is part of the `Part` and not an external resource, the index of the stream within that part
|
||||
/// </summary>
|
||||
[JsonProperty("index")]
|
||||
public long? Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the stream is independently streamable, the key from which it can be streamed
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public object? Key { get; set; }
|
||||
|
||||
[JsonProperty("language")]
|
||||
public object? Language { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The three character language code for the stream contents
|
||||
/// </summary>
|
||||
[JsonProperty("languageCode")]
|
||||
public object? LanguageCode { get; set; }
|
||||
|
||||
[JsonProperty("level")]
|
||||
public long? Level { get; set; }
|
||||
|
||||
[JsonProperty("profile")]
|
||||
public object? Profile { get; set; }
|
||||
|
||||
[JsonProperty("refFrames")]
|
||||
public long? RefFrames { get; set; }
|
||||
|
||||
[JsonProperty("samplingRate")]
|
||||
public long? SamplingRate { get; set; }
|
||||
|
||||
[JsonProperty("selected")]
|
||||
public bool? Selected { get; set; }
|
||||
|
||||
[JsonProperty("streamIdentifier")]
|
||||
public long? StreamIdentifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A number indicating the type of the stream. `1` for video, `2` for audio, `3` for subtitles, `4` for lyrics
|
||||
/// </summary>
|
||||
[JsonProperty("streamType")]
|
||||
public long? StreamType { get; set; }
|
||||
|
||||
[JsonProperty("width")]
|
||||
public long? Width { get; set; }
|
||||
|
||||
[JsonProperty("decision")]
|
||||
public MediaContainerWithDecisionDecision? Decision { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
public MediaContainerWithDecisionLocation? Location { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class MediaContainerWithDevice
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithDeviceMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public class MediaContainerWithDeviceDevice
|
||||
{
|
||||
|
||||
[JsonProperty("ChannelMapping")]
|
||||
public List<Models.Components.ChannelMapping>? ChannelMapping { get; set; }
|
||||
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
[JsonProperty("lastSeenAt")]
|
||||
public long? LastSeenAt { get; set; }
|
||||
|
||||
[JsonProperty("make")]
|
||||
public string? Make { get; set; }
|
||||
|
||||
[JsonProperty("model")]
|
||||
public string? Model { get; set; }
|
||||
|
||||
[JsonProperty("modelNumber")]
|
||||
public string? ModelNumber { get; set; }
|
||||
|
||||
[JsonProperty("protocol")]
|
||||
public string? Protocol { get; set; }
|
||||
|
||||
[JsonProperty("sources")]
|
||||
public string? Sources { get; set; }
|
||||
|
||||
[JsonProperty("state")]
|
||||
public string? State { get; set; }
|
||||
|
||||
[JsonProperty("status")]
|
||||
public string? Status { get; set; }
|
||||
|
||||
[JsonProperty("tuners")]
|
||||
public string? Tuners { get; set; }
|
||||
|
||||
[JsonProperty("uri")]
|
||||
public string? Uri { get; set; }
|
||||
|
||||
[JsonProperty("uuid")]
|
||||
public string? Uuid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithDeviceMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Device")]
|
||||
public List<MediaContainerWithDeviceDevice>? Device { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class MediaContainerWithDirectory
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithDirectoryMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithDirectoryMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Directory")]
|
||||
public List<Models.Components.Directory>? Directory { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
/// <summary>
|
||||
/// OK
|
||||
/// </summary>
|
||||
public class MediaContainerWithHubs
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithHubsMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithHubsMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Hub")]
|
||||
public List<Models.Components.Hub>? Hub { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class MediaContainerWithLineup
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithLineupMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithLineupMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Lineup")]
|
||||
public List<Models.Components.Lineup>? Lineup { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The UUID of this set lineups
|
||||
/// </summary>
|
||||
[JsonProperty("uuid")]
|
||||
public string? Uuid { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class MediaContainerWithMetadata
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithMetadataMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithMetadataMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Metadata")]
|
||||
public List<Models.Components.Metadata>? Metadata { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class MediaContainerWithNestedMetadata
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithNestedMetadataMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithNestedMetadataMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("MetadataItem")]
|
||||
public List<MetadataItem>? MetadataItem { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class MediaContainerWithPlaylistMetadata
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithPlaylistMetadataMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// `MediaContainer` is the root element of most Plex API responses. It serves as a generic container for various types of content (Metadata, Hubs, Directories, etc.) and includes pagination information (offset, size, totalSize) when applicable.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// Common attributes: - identifier: Unique identifier for this container - size: Number of items in this response page - totalSize: Total number of items available (for pagination) - offset: Starting index of this page (for pagination)<br/>
|
||||
/// The container often "hoists" common attributes from its children. For example, if all tracks in a container share the same album title, the `parentTitle` attribute may appear on the MediaContainer rather than being repeated on each track.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithPlaylistMetadataMediaContainer
|
||||
{
|
||||
|
||||
[JsonProperty("identifier")]
|
||||
public string? Identifier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The offset of where this container page starts among the total objects available. Also provided in the `X-Plex-Container-Start` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("offset")]
|
||||
public long? Offset { get; set; }
|
||||
|
||||
[JsonProperty("size")]
|
||||
public long? Size { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The total size of objects available. Also provided in the `X-Plex-Container-Total-Size` header.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
[JsonProperty("totalSize")]
|
||||
public long? TotalSize { get; set; }
|
||||
|
||||
[JsonProperty("Metadata")]
|
||||
public List<MediaContainerWithPlaylistMetadataMetadata>? Metadata { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,430 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Items in a library are referred to as "metadata items." These metadata items are distinct from "media items" which represent actual instances of media that can be consumed. Consider a TV library that has a single video file in it for a particular episode of a show. The library has a single media item, but it has three metadata items: one for the show, one for the season, and one for the episode. Consider a movie library that has two video files in it: the same movie, but two different resolutions. The library has a single metadata item for the movie, but that metadata item has two media items, one for each resolution. Additionally a "media item" will have one or more "media parts" where the the parts are intended to be watched together, such as a CD1 and CD2 parts of the same movie.<br/>
|
||||
///
|
||||
/// <remarks>
|
||||
/// <br/>
|
||||
/// Note that when a metadata item has multiple media items, those media items should be isomorphic. That is, a 4K version and 1080p version of a movie are different versions of the same movie. They have the same duration, same summary, same rating, etc. and they can generally be considered interchangeable. A theatrical release vs. director's cut vs. unrated version on the other hand would be separate metadata items.<br/>
|
||||
/// <br/>
|
||||
/// Metadata items can often live in a hierarchy with relationships between them. For example, the metadata item for an episodes is associated with a season metadata item which is associated with a show metadata item. A similar hierarchy exists with track, album, and artist and photos and photo album. The relationships may be expressed via relative terms and absolute terms. For example, "leaves" refer to metadata items which has associated media (there is no media for a season nor show). A show will have "children" in the form of seasons and a season will have "children" in the form of episodes and episodes have "parent" in the form of a season which has a "parent" in the form of a show. Similarly, a show has "grandchildren" in the form of episodse and an episode has a "grandparent" in the form of a show.<br/>
|
||||
///
|
||||
/// </remarks>
|
||||
/// </summary>
|
||||
public class MediaContainerWithPlaylistMetadataMetadata
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// If we return this as true then this playlist cannot be altered or deleted directly by the client.
|
||||
/// </summary>
|
||||
[JsonProperty("readOnly")]
|
||||
public bool? ReadOnly { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a composite image for descendent items (e.g. photo albums or playlists).
|
||||
/// </summary>
|
||||
[JsonProperty("composite")]
|
||||
public object? Composite { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the duration for the item, in units of milliseconds.
|
||||
/// </summary>
|
||||
[JsonProperty("duration")]
|
||||
public long? Duration { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The key at which the item's details can be fetched. In many cases a metadata item may be passed without all the details (such as in a hub) and this key corresponds to the endpoint to fetch additional details.
|
||||
/// </summary>
|
||||
[JsonProperty("key")]
|
||||
public object? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For shows and seasons, contains the number of total episodes.
|
||||
/// </summary>
|
||||
[JsonProperty("leafCount")]
|
||||
public long? LeafCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the playlist.
|
||||
/// </summary>
|
||||
[JsonProperty("playlistType")]
|
||||
public Models.Components.PlaylistType? PlaylistType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the playlist is smart.
|
||||
/// </summary>
|
||||
[JsonProperty("smart")]
|
||||
public bool? Smart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If this is a special playlist, this returns its type (e.g. favorites).
|
||||
/// </summary>
|
||||
[JsonProperty("specialPlaylistType")]
|
||||
public string? SpecialPlaylistType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The title of the item (e.g. “300” or “The Simpsons”)
|
||||
/// </summary>
|
||||
[JsonProperty("title")]
|
||||
public object? Title { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The type of the video item, such as `movie`, `episode`, or `clip`.
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
public object? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, contains the disc number for a track on multi-disc albums.
|
||||
/// </summary>
|
||||
[JsonProperty("absoluteIndex")]
|
||||
public long? AbsoluteIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// In units of seconds since the epoch, returns the time at which the item was added to the library.
|
||||
/// </summary>
|
||||
[JsonProperty("addedAt")]
|
||||
public long? AddedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for the background artwork for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("art")]
|
||||
public object? Art { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Some rating systems separate reviewer ratings from audience ratings
|
||||
/// </summary>
|
||||
[JsonProperty("audienceRating")]
|
||||
public double? AudienceRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A URI representing the image to be shown with the audience rating (e.g. rottentomatoes://image.rating.spilled).
|
||||
/// </summary>
|
||||
[JsonProperty("audienceRatingImage")]
|
||||
public object? AudienceRatingImage { get; set; }
|
||||
|
||||
[JsonProperty("Autotag")]
|
||||
public List<Tag>? Autotag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a banner graphic for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("banner")]
|
||||
public object? Banner { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, indicates the source for the chapters in the media file. Can be media (the chapters were embedded in the media itself), agent (a metadata agent computed them), or mixed (a combination of the two).
|
||||
/// </summary>
|
||||
[JsonProperty("chapterSource")]
|
||||
public object? ChapterSource { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If known, the content rating (e.g. MPAA) for an item.
|
||||
/// </summary>
|
||||
[JsonProperty("contentRating")]
|
||||
public object? ContentRating { get; set; }
|
||||
|
||||
[JsonProperty("Country")]
|
||||
public List<Tag>? Country { get; set; }
|
||||
|
||||
[JsonProperty("Director")]
|
||||
public List<Tag>? Director { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Typically only seen in metadata at a library's top level
|
||||
/// </summary>
|
||||
[JsonProperty("Filter")]
|
||||
public List<Filter>? Filter { get; set; }
|
||||
|
||||
[JsonProperty("Genre")]
|
||||
public List<Tag>? Genre { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `art` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentArt")]
|
||||
public string? GrandparentArt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `hero` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentHero")]
|
||||
public string? GrandparentHero { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `key` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentKey")]
|
||||
public string? GrandparentKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `ratingKey` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentRatingKey")]
|
||||
public string? GrandparentRatingKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `theme` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentTheme")]
|
||||
public string? GrandparentTheme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `thumb` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentThumb")]
|
||||
public string? GrandparentThumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `title` of the grandparent
|
||||
/// </summary>
|
||||
[JsonProperty("grandparentTitle")]
|
||||
public string? GrandparentTitle { get; set; }
|
||||
|
||||
[JsonProperty("Guid")]
|
||||
public List<Tag>? Guid { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for a hero image for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("hero")]
|
||||
public object? Hero { get; set; }
|
||||
|
||||
[JsonProperty("Image")]
|
||||
public List<Image>? Image { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, this represents the episode number for episodes, season number for seasons, or track number for audio tracks.
|
||||
/// </summary>
|
||||
[JsonProperty("index")]
|
||||
public long? Index { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a user has watched or listened to an item, this contains a timestamp (epoch seconds) for that last consumption time.
|
||||
/// </summary>
|
||||
[JsonProperty("lastViewedAt")]
|
||||
public long? LastViewedAt { get; set; }
|
||||
|
||||
[JsonProperty("Media")]
|
||||
public List<Media>? Media { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, in the format YYYY-MM-DD [HH:MM:SS] (the hours/minutes/seconds part is not always present). The air date, or a higher resolution release date for an item, depending on type. For example, episodes usually have air date like 1979-08-10 (we don't use epoch seconds because media existed prior to 1970). In some cases, recorded over-the-air content has higher resolution air date which includes a time component. Albums and movies may have day-resolution release dates as well.
|
||||
/// </summary>
|
||||
[JsonProperty("originallyAvailableAt")]
|
||||
public object? OriginallyAvailableAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, used to indicate an item's original title, e.g. a movie's foreign title.
|
||||
/// </summary>
|
||||
[JsonProperty("originalTitle")]
|
||||
public object? OriginalTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `hero` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentHero")]
|
||||
public string? ParentHero { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `index` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentIndex")]
|
||||
public long? ParentIndex { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `key` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentKey")]
|
||||
public string? ParentKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `ratingKey` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentRatingKey")]
|
||||
public string? ParentRatingKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `thumb` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentThumb")]
|
||||
public string? ParentThumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The `title` of the parent
|
||||
/// </summary>
|
||||
[JsonProperty("parentTitle")]
|
||||
public string? ParentTitle { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the item has a primary extra; for a movie, this is a trailer, and for a music track it is a music video. The URL points to the metadata details endpoint for the item.
|
||||
/// </summary>
|
||||
[JsonProperty("primaryExtraKey")]
|
||||
public object? PrimaryExtraKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Prompt to give the user for this directory (such as `Search Movies`)
|
||||
/// </summary>
|
||||
[JsonProperty("prompt")]
|
||||
public string? Prompt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the rating for the item. The exact meaning and representation depends on where the rating was sourced from.
|
||||
/// </summary>
|
||||
[JsonProperty("rating")]
|
||||
public double? Rating { get; set; }
|
||||
|
||||
[JsonProperty("Rating")]
|
||||
public List<Tag>? RatingArray { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of ratings under this metadata
|
||||
/// </summary>
|
||||
[JsonProperty("ratingCount")]
|
||||
public long? RatingCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, indicates an image to be shown with the rating. This is passed back as a small set of defined URI values, e.g. rottentomatoes://image.rating.rotten.
|
||||
/// </summary>
|
||||
[JsonProperty("ratingImage")]
|
||||
public object? RatingImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This is the opaque string to be passed into timeline, scrobble, and rating endpoints to identify them. While it often appears to be numeric, this is not guaranteed.
|
||||
/// </summary>
|
||||
[JsonProperty("ratingKey")]
|
||||
public object? RatingKey { get; set; }
|
||||
|
||||
[JsonProperty("Role")]
|
||||
public List<Tag>? Role { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates this is a search directory
|
||||
/// </summary>
|
||||
[JsonProperty("search")]
|
||||
public bool? Search { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used by old clients to provide nested menus allowing for primative (but structured) navigation.
|
||||
/// </summary>
|
||||
[JsonProperty("secondary")]
|
||||
public bool? Secondary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When found on a show item, indicates that the children (seasons) should be skipped in favor of the grandchildren (episodes). Useful for mini-series, etc.
|
||||
/// </summary>
|
||||
[JsonProperty("skipChildren")]
|
||||
public bool? SkipChildren { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present on an episode or track item, indicates parent should be skipped in favor of grandparent (show).
|
||||
/// </summary>
|
||||
[JsonProperty("skipParent")]
|
||||
public bool? SkipParent { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Typically only seen in metadata at a library's top level
|
||||
/// </summary>
|
||||
[JsonProperty("Sort")]
|
||||
public List<Sort>? Sort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the studio or label which produced an item (e.g. movie studio for movies, record label for albums).
|
||||
/// </summary>
|
||||
[JsonProperty("studio")]
|
||||
public object? Studio { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The subtype of the video item, such as `photo` when the video item is in a photo library
|
||||
/// </summary>
|
||||
[JsonProperty("subtype")]
|
||||
public object? Subtype { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the extended textual information about the item (e.g. movie plot, artist biography, album review).
|
||||
/// </summary>
|
||||
[JsonProperty("summary")]
|
||||
public object? Summary { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, a pithy one-liner about the item (usually only seen for movies).
|
||||
/// </summary>
|
||||
[JsonProperty("tagline")]
|
||||
public object? Tagline { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for theme music for the item (usually only for TV shows).
|
||||
/// </summary>
|
||||
[JsonProperty("theme")]
|
||||
public object? Theme { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the URL for the poster or thumbnail for the item. When available for types like movie, it will be the poster graphic, but fall-back to the extracted media thumbnail.
|
||||
/// </summary>
|
||||
[JsonProperty("thumb")]
|
||||
public object? Thumb { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whene present, this is the string used for sorting the item. It's usually the title with any leading articles removed (e.g. “Simpsons”).
|
||||
/// </summary>
|
||||
[JsonProperty("titleSort")]
|
||||
public object? TitleSort { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// In units of seconds since the epoch, returns the time at which the item was last changed (e.g. had its metadata updated).
|
||||
/// </summary>
|
||||
[JsonProperty("updatedAt")]
|
||||
public long? UpdatedAt { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When the user has rated an item, this contains the user rating
|
||||
/// </summary>
|
||||
[JsonProperty("userRating")]
|
||||
public double? UserRating { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a users has completed watched or listened to an item, this attribute contains the number of consumptions.
|
||||
/// </summary>
|
||||
[JsonProperty("viewCount")]
|
||||
public long? ViewCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// For shows and seasons, contains the number of viewed episodes.
|
||||
/// </summary>
|
||||
[JsonProperty("viewedLeafCount")]
|
||||
public long? ViewedLeafCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When a user is in the process of viewing or listening to this item, this attribute contains the current offset, in units of milliseconds.
|
||||
/// </summary>
|
||||
[JsonProperty("viewOffset")]
|
||||
public long? ViewOffset { get; set; }
|
||||
|
||||
[JsonProperty("Writer")]
|
||||
public List<Tag>? Writer { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// When present, the year associated with the item's release (e.g. release year for a movie).
|
||||
/// </summary>
|
||||
[JsonProperty("year")]
|
||||
public long? Year { get; set; }
|
||||
|
||||
[JsonProperty("additionalProperties")]
|
||||
public Dictionary<string, object>? AdditionalProperties { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost when
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
#nullable enable
|
||||
namespace LukeHagar.PlexAPI.SDK.Models.Components
|
||||
{
|
||||
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||
using LukeHagar.PlexAPI.SDK.Utils;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
public class MediaContainerWithSettings
|
||||
{
|
||||
|
||||
[JsonProperty("MediaContainer")]
|
||||
public MediaContainerWithSettingsMediaContainer? MediaContainer { get; set; }
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user