Compare commits

...

11 Commits

Author SHA1 Message Date
speakeasybot
2b03eae316 ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.390.7 2024-09-06 00:00:16 +00:00
Luke Hagar
e2d3ad2f38 Merge pull request #3 from JasonLandbridge/patch-1 2024-09-05 14:59:12 -05:00
Jason Landbridge
5d60461459 Update workflow.yaml 2024-09-05 15:05:52 +02:00
speakeasybot
ec1b25e152 ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.383.2 2024-08-30 00:10:10 +00:00
speakeasybot
cc8bc7366d ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.378.1 2024-08-25 00:10:39 +00:00
speakeasybot
322299ad95 ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.377.3 2024-08-23 00:09:43 +00:00
Luke Hagar
7585dd0b5c Regenerated SDK with small changes 2024-06-27 14:39:09 +00:00
Luke Hagar
367dc248c3 migrated to v15 2024-03-18 15:10:45 -07:00
speakeasy-bot
f8e29c091a 🐝 Add license. 2024-02-23 15:37:32 +00:00
speakeasy-bot
dbb35ebe78 🐝 Update gen.yaml 2024-02-23 15:37:31 +00:00
speakeasy-bot
499ba706e2 🐝 Update workflow file 2024-02-23 15:37:31 +00:00
1087 changed files with 25281 additions and 6242 deletions

View File

@@ -1,29 +1,25 @@
name: Generate name: Generate
permissions: permissions:
checks: write checks: write
contents: write contents: write
pull-requests: write pull-requests: write
statuses: write statuses: write
"on": "on":
workflow_dispatch: workflow_dispatch:
inputs: inputs:
force: force:
description: Force generation of SDKs description: Force generation of SDKs
type: boolean type: boolean
default: false default: false
schedule: schedule:
- cron: 0 0 * * * - cron: 0 0 * * *
jobs: jobs:
generate: generate:
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-generation.yaml@v14 uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
with: with:
force: ${{ github.event.inputs.force }} force: ${{ github.event.inputs.force }}
languages: | mode: direct
- csharp speakeasy_version: latest
mode: direct secrets:
openapi_docs: | github_access_token: ${{ secrets.GITHUB_TOKEN }}
- https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/plex-media-server-spec-dereferenced.yaml speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
speakeasy_version: latest
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,25 @@
configVersion: 2.0.0 configVersion: 2.0.0
generation: generation:
sdkClassName: Plex-API sdkClassName: PlexAPI
maintainOpenAPIOrder: true maintainOpenAPIOrder: true
usageSnippets: usageSnippets:
optionalPropertyRendering: withExample optionalPropertyRendering: withExample
useClassNamesForArrayFields: true useClassNamesForArrayFields: true
fixes: fixes:
nameResolutionDec2023: false nameResolutionDec2023: true
parameterOrderingFeb2024: true
requestResponseComponentNamesFeb2024: true
auth:
oAuth2ClientCredentialsEnabled: true
csharp: csharp:
version: 0.1.5 version: 0.5.0
additionalDependencies: []
author: LukeHagar author: LukeHagar
clientServerStatusCodesAsErrors: true
disableNamespacePascalCasingApr2024: true
dotnetVersion: net5.0 dotnetVersion: net5.0
enableSourceLink: false
flattenGlobalSecurity: true
imports: imports:
option: openapi option: openapi
paths: paths:
@@ -19,7 +28,10 @@ csharp:
operations: Models/Requests operations: Models/Requests
shared: Models/Components shared: Models/Components
webhooks: Models/Webhooks webhooks: Models/Webhooks
includeDebugSymbols: false
inputModelSuffix: input inputModelSuffix: input
maxMethodParams: 4 maxMethodParams: 4
outputModelSuffix: output outputModelSuffix: output
packageName: Plex-API packageName: PlexAPI
packageTags: ""
responseFormat: envelope

29
.speakeasy/workflow.lock Normal file
View File

@@ -0,0 +1,29 @@
speakeasyVersion: 1.390.7
sources:
my-source:
sourceNamespace: my-source
sourceRevisionDigest: sha256:b6aa1692c74a84d3ce118d305f77944189e0749c6f95a2c57bddb8c606ab8df6
sourceBlobDigest: sha256:370cb4409748c4811372a81d94f1a84f60b538087c23f2cb24f72082bcc827f6
tags:
- latest
- main
targets:
plexcsharp:
source: my-source
sourceNamespace: my-source
sourceRevisionDigest: sha256:b6aa1692c74a84d3ce118d305f77944189e0749c6f95a2c57bddb8c606ab8df6
sourceBlobDigest: sha256:370cb4409748c4811372a81d94f1a84f60b538087c23f2cb24f72082bcc827f6
outLocation: /github/workspace/repo
workflow:
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
my-source:
inputs:
- location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/output/plex-media-server-spec-dereferenced.yaml
registry:
location: registry.speakeasyapi.dev/lukehagar/lukehagar/my-source
targets:
plexcsharp:
target: csharp
source: my-source

12
.speakeasy/workflow.yaml Normal file
View File

@@ -0,0 +1,12 @@
workflowVersion: 1.0.0
speakeasyVersion: latest
sources:
my-source:
inputs:
- location: https://raw.githubusercontent.com/LukeHagar/plex-api-spec/main/output/plex-media-server-spec-dereferenced.yaml
registry:
location: registry.speakeasyapi.dev/lukehagar/lukehagar/my-source
targets:
plexcsharp:
target: csharp
source: my-source

26
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,26 @@
# Contributing to This Repository
Thank you for your interest in contributing to this repository. Please note that this repository contains generated code. As such, we do not accept direct changes or pull requests. Instead, we encourage you to follow the guidelines below to report issues and suggest improvements.
## How to Report Issues
If you encounter any bugs or have suggestions for improvements, please open an issue on GitHub. When reporting an issue, please provide as much detail as possible to help us reproduce the problem. This includes:
- A clear and descriptive title
- Steps to reproduce the issue
- Expected and actual behavior
- Any relevant logs, screenshots, or error messages
- Information about your environment (e.g., operating system, software versions)
- For example can be collected using the `npx envinfo` command from your terminal if you have Node.js installed
## Issue Triage and Upstream Fixes
We will review and triage issues as quickly as possible. Our goal is to address bugs and incorporate improvements in the upstream source code. Fixes will be included in the next generation of the generated code.
## Contact
If you have any questions or need further assistance, please feel free to reach out by opening an issue.
Thank you for your understanding and cooperation!
The Maintainers

184
NUGET.md Normal file
View File

@@ -0,0 +1,184 @@
# PlexAPI
<!-- Start SDK Example Usage [usage] -->
## SDK Example Usage
### Example
```csharp
using PlexAPI;
using PlexAPI.Models.Components;
var sdk = new PlexAPISDK(
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40"
);
var res = await sdk.Server.GetServerCapabilitiesAsync();
// handle response
```
<!-- End SDK Example Usage [usage] -->
<!-- Start Global Parameters [global-parameters] -->
## Global Parameters
## Global Parameters
A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.
For example, you can set `X-Plex-Client-Identifier` to `"gcgzw5rz2xovp84b4vha3a40"` at SDK initialization and then you do not have to pass the same value on calls to operations like `GetServerResources`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.
### Available Globals
The following global parameter is available.
| Name | Type | Required | Description |
| ---- | ---- |:--------:| ----------- |
| xPlexClientIdentifier | string | | The unique identifier for the client application
This is used to track the client application and its usage
(UUID, serial number, or other number unique per device)
|
### Example
```csharp
using PlexAPI;
using PlexAPI.Models.Requests;
using PlexAPI.Models.Components;
var sdk = new PlexAPISDK(
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40"
);
GetServerResourcesRequest req = new GetServerResourcesRequest() {
XPlexToken = "CV5xoxjTpFKUzBTShsaf",
IncludeHttps = PlexAPI.Models.Requests.IncludeHttps.One,
IncludeRelay = PlexAPI.Models.Requests.IncludeRelay.One,
IncludeIPv6 = PlexAPI.Models.Requests.IncludeIPv6.One,
};
var res = await sdk.Plex.GetServerResourcesAsync(req);
// handle response
```
<!-- End Global Parameters [global-parameters] -->
<!-- Start Error Handling [errors] -->
## Error Handling
Handling errors in this SDK should largely match your expectations. All operations return a response object or thow an exception. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate type.
| Error Object | Status Code | Content Type |
| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
| PlexAPI.Models.Errors.GetServerCapabilitiesResponseBody | 401 | application/json |
| PlexAPI.Models.Errors.SDKException | 4xx-5xx | */* |
### Example
```csharp
using PlexAPI;
using PlexAPI.Models.Components;
using System;
using PlexAPI.Models.Errors;
var sdk = new PlexAPISDK(
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40"
);
try
{
var res = await sdk.Server.GetServerCapabilitiesAsync();
// handle response
}
catch (Exception ex)
{
if (ex is Models.Errors.GetServerCapabilitiesResponseBody)
{
// handle exception
}
else if (ex is PlexAPI.Models.Errors.SDKException)
{
// handle exception
}
}
```
<!-- End Error Handling [errors] -->
<!-- Start Server Selection [server] -->
## Server Selection
### Select Server by Index
You can override the default server globally by passing a server index to the `serverIndex: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
| # | Server | Variables |
| - | ------ | --------- |
| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `https`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) |
#### Variables
Some of the server options above contain variables. If you want to set the values of those variables, the following options are provided for doing so:
* `protocol: ServerProtocol`
* `ip: string`
* `port: string`
### Override Server URL Per-Client
The default server can also be overridden globally by passing a URL to the `serverUrl: str` optional parameter when initializing the SDK client instance. For example:
### Override Server URL Per-Operation
The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:
```csharp
using PlexAPI;
using PlexAPI.Models.Components;
var sdk = new PlexAPISDK(
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40"
);
var res = await sdk.Plex.GetCompanionsDataAsync(serverUrl: "https://plex.tv/api/v2");
// handle response
```
<!-- End Server Selection [server] -->
<!-- Start Authentication [security] -->
## Authentication
### Per-Client Security Schemes
This SDK supports the following security scheme globally:
| Name | Type | Scheme |
| ------------- | ------------- | ------------- |
| `AccessToken` | apiKey | API key |
To authenticate with the API the `AccessToken` parameter must be set when initializing the SDK client instance. For example:
```csharp
using PlexAPI;
using PlexAPI.Models.Components;
var sdk = new PlexAPISDK(
accessToken: "<YOUR_API_KEY_HERE>",
xPlexClientIdentifier: "gcgzw5rz2xovp84b4vha3a40"
);
var res = await sdk.Server.GetServerCapabilitiesAsync();
// handle response
```
<!-- End Authentication [security] -->
<!-- Placeholder for Future Speakeasy SDK Sections -->

View File

@@ -1,7 +1,6 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
@@ -11,8 +10,13 @@
namespace PlexAPI namespace PlexAPI
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Hooks;
using PlexAPI.Models.Components;
using PlexAPI.Models.Errors;
using PlexAPI.Models.Requests; using PlexAPI.Models.Requests;
using PlexAPI.Utils.Retries;
using PlexAPI.Utils; using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -70,71 +74,113 @@ namespace PlexAPI
{ {
public SDKConfig SDKConfiguration { get; private set; } public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp"; private const string _language = "csharp";
private const string _sdkVersion = "0.1.5"; private const string _sdkVersion = "0.5.0";
private const string _sdkGenVersion = "2.237.3"; private const string _sdkGenVersion = "2.409.8";
private const string _openapiDocVersion = "0.0.3"; private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API"; private const string _userAgent = "speakeasy-sdk/csharp 0.5.0 2.409.8 0.0.3 PlexAPI";
private string _serverUrl = ""; private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient; private ISpeakeasyHttpClient _client;
private ISpeakeasyHttpClient _securityClient; private Func<PlexAPI.Models.Components.Security>? _securitySource;
public Activities(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config) public Activities(ISpeakeasyHttpClient client, Func<PlexAPI.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
{ {
_defaultClient = defaultClient; _client = client;
_securityClient = securityClient; _securitySource = securitySource;
_serverUrl = serverUrl; _serverUrl = serverUrl;
SDKConfiguration = config; SDKConfiguration = config;
} }
public async Task<GetServerActivitiesResponse> GetServerActivitiesAsync() public async Task<GetServerActivitiesResponse> GetServerActivitiesAsync()
{ {
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = baseUrl + "/activities"; var urlString = baseUrl + "/activities";
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(httpRequest); }
var hookCtx = new HookContext("getServerActivities", 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new GetServerActivitiesResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, if(Utilities.IsContentTypeMatch("application/json", contentType))
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.TwoHundredApplicationJsonObject = JsonConvert.DeserializeObject<GetServerActivitiesResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); var obj = ResponseBodyDeserializer.Deserialize<Models.Requests.GetServerActivitiesResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new GetServerActivitiesResponse()
{
StatusCode = responseStatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
response.Object = obj;
return response;
} }
else
return response;
}
if((response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.FourHundredAndOneApplicationJsonObject = JsonConvert.DeserializeObject<GetServerActivitiesActivitiesResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
return response; else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<Models.Errors.GetServerActivitiesResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
} }
public async Task<CancelServerActivitiesResponse> CancelServerActivitiesAsync(string activityUUID) public async Task<CancelServerActivitiesResponse> CancelServerActivitiesAsync(string activityUUID)
{ {
@@ -142,42 +188,83 @@ namespace PlexAPI
{ {
ActivityUUID = activityUUID, ActivityUUID = activityUUID,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/activities/{activityUUID}", request); var urlString = URLBuilder.Build(baseUrl, "/activities/{activityUUID}", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(httpRequest); }
var hookCtx = new HookContext("cancelServerActivities", 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new CancelServerActivitiesResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new CancelServerActivitiesResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<CancelServerActivitiesResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<CancelServerActivitiesResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
} }
} }

489
PlexAPI/Authentication.cs Normal file
View File

@@ -0,0 +1,489 @@
//------------------------------------------------------------------------------
// <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 PlexAPI
{
using Newtonsoft.Json;
using PlexAPI.Hooks;
using PlexAPI.Models.Components;
using PlexAPI.Models.Errors;
using PlexAPI.Models.Requests;
using PlexAPI.Utils.Retries;
using PlexAPI.Utils;
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&apos;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 &gt;= 1.15.4.<br/>
///
/// </remarks>
/// </summary>
Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(string source);
/// <summary>
/// Get User Data By Token
///
/// <remarks>
/// Get the User data from the provided X-Plex-Token
/// </remarks>
/// </summary>
Task<GetUserDetailsResponse> GetUserDetailsAsync(string xPlexToken, string? serverUrl = null);
/// <summary>
/// Get User SignIn Data
///
/// <remarks>
/// Sign in user with username and password and return user data with Plex authentication token
/// </remarks>
/// </summary>
Task<PostUsersSignInDataResponse> PostUsersSignInDataAsync(string? xPlexClientIdentifier = null, PostUsersSignInDataRequestBody? requestBody = 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 getUserDetails operation.
/// </summary>
public static readonly string[] GetUserDetailsServerList = {
"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.5.0";
private const string _sdkGenVersion = "2.409.8";
private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.5.0 2.409.8 0.0.3 PlexAPI";
private string _serverUrl = "";
private ISpeakeasyHttpClient _client;
private Func<PlexAPI.Models.Components.Security>? _securitySource;
public Authentication(ISpeakeasyHttpClient client, Func<PlexAPI.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 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<GetTransientTokenResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new 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 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<GetSourceConnectionInformationResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
public async Task<GetUserDetailsResponse> GetUserDetailsAsync(string xPlexToken, string? serverUrl = null)
{
var request = new GetUserDetailsRequest()
{
XPlexToken = xPlexToken,
};
string baseUrl = Utilities.TemplateUrl(GetUserDetailsServerList[0], new Dictionary<string, string>(){
});
if (serverUrl != null)
{
baseUrl = serverUrl;
}
var urlString = URLBuilder.Build(baseUrl, "/user", 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("getUserDetails", 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<GetUserDetailsUserPlexAccount>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new GetUserDetailsResponse()
{
StatusCode = responseStatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
response.UserPlexAccount = obj;
return response;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<GetUserDetailsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
public async Task<PostUsersSignInDataResponse> PostUsersSignInDataAsync(string? xPlexClientIdentifier = null, PostUsersSignInDataRequestBody? requestBody = null, string? serverUrl = null)
{
var request = new PostUsersSignInDataRequest()
{
XPlexClientIdentifier = xPlexClientIdentifier,
RequestBody = requestBody,
};
request.XPlexClientIdentifier ??= SDKConfiguration.XPlexClientIdentifier;
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.Ignore);
var response = new PostUsersSignInDataResponse()
{
StatusCode = responseStatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
response.UserPlexAccount = obj;
return response;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<PostUsersSignInDataResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
}
}

View File

@@ -1,7 +1,6 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
@@ -11,8 +10,13 @@
namespace PlexAPI namespace PlexAPI
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Hooks;
using PlexAPI.Models.Components;
using PlexAPI.Models.Errors;
using PlexAPI.Models.Requests; using PlexAPI.Models.Requests;
using PlexAPI.Utils.Retries;
using PlexAPI.Utils; using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -97,151 +101,277 @@ namespace PlexAPI
{ {
public SDKConfig SDKConfiguration { get; private set; } public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp"; private const string _language = "csharp";
private const string _sdkVersion = "0.1.5"; private const string _sdkVersion = "0.5.0";
private const string _sdkGenVersion = "2.237.3"; private const string _sdkGenVersion = "2.409.8";
private const string _openapiDocVersion = "0.0.3"; private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API"; private const string _userAgent = "speakeasy-sdk/csharp 0.5.0 2.409.8 0.0.3 PlexAPI";
private string _serverUrl = ""; private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient; private ISpeakeasyHttpClient _client;
private ISpeakeasyHttpClient _securityClient; private Func<PlexAPI.Models.Components.Security>? _securitySource;
public Butler(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config) public Butler(ISpeakeasyHttpClient client, Func<PlexAPI.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
{ {
_defaultClient = defaultClient; _client = client;
_securityClient = securityClient; _securitySource = securitySource;
_serverUrl = serverUrl; _serverUrl = serverUrl;
SDKConfiguration = config; SDKConfiguration = config;
} }
public async Task<GetButlerTasksResponse> GetButlerTasksAsync() public async Task<GetButlerTasksResponse> GetButlerTasksAsync()
{ {
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = baseUrl + "/butler"; var urlString = baseUrl + "/butler";
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(httpRequest); }
var hookCtx = new HookContext("getButlerTasks", 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new GetButlerTasksResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, if(Utilities.IsContentTypeMatch("application/json", contentType))
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.TwoHundredApplicationJsonObject = JsonConvert.DeserializeObject<GetButlerTasksResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); var obj = ResponseBodyDeserializer.Deserialize<Models.Requests.GetButlerTasksResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new GetButlerTasksResponse()
{
StatusCode = responseStatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
response.Object = obj;
return response;
} }
else
return response;
}
if((response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.FourHundredAndOneApplicationJsonObject = JsonConvert.DeserializeObject<GetButlerTasksButlerResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
return response; else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<Models.Errors.GetButlerTasksResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
} }
public async Task<StartAllTasksResponse> StartAllTasksAsync() public async Task<StartAllTasksResponse> StartAllTasksAsync()
{ {
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = baseUrl + "/butler"; var urlString = baseUrl + "/butler";
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(httpRequest); }
var hookCtx = new HookContext("startAllTasks", 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new StartAllTasksResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new StartAllTasksResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<StartAllTasksResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<StartAllTasksResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
public async Task<StopAllTasksResponse> StopAllTasksAsync() public async Task<StopAllTasksResponse> StopAllTasksAsync()
{ {
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = baseUrl + "/butler"; var urlString = baseUrl + "/butler";
var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(httpRequest); }
var hookCtx = new HookContext("stopAllTasks", 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new StopAllTasksResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new StopAllTasksResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<StopAllTasksResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<StopAllTasksResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
public async Task<StartTaskResponse> StartTaskAsync(TaskName taskName) public async Task<StartTaskResponse> StartTaskAsync(TaskName taskName)
{ {
@@ -249,43 +379,84 @@ namespace PlexAPI
{ {
TaskName = taskName, TaskName = taskName,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/butler/{taskName}", request); var urlString = URLBuilder.Build(baseUrl, "/butler/{taskName}", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new StartTaskResponse if(new List<int>{200, 202}.Contains(responseStatusCode))
{ {
StatusCode = (int)httpResponse.StatusCode, return new StartTaskResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 202) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<StartTaskResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<StartTaskResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
public async Task<StopTaskResponse> StopTaskAsync(PathParamTaskName taskName) public async Task<StopTaskResponse> StopTaskAsync(PathParamTaskName taskName)
{ {
@@ -293,42 +464,83 @@ namespace PlexAPI
{ {
TaskName = taskName, TaskName = taskName,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/butler/{taskName}", request); var urlString = URLBuilder.Build(baseUrl, "/butler/{taskName}", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Delete, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(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)
{
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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new StopTaskResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new StopTaskResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400) || (response.StatusCode == 404))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<StopTaskResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<StopTaskResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
} }
} }

View File

@@ -0,0 +1,36 @@
namespace PlexAPI.Hooks
{
/// <summary>
/// Hook Registration File.
/// </summary>
/// <remarks>
/// This file is only ever generated once on the first generation and then is free to be modified.
/// Any hooks you wish to add should be registered in the InitHooks function. Feel free to define them
/// in this file or in separate files in the Hooks folder.
/// </remarks>
public static class HookRegistration
{
/// <summary>
/// Initializes hooks.
/// </summary>
/// <remarks>
/// Add hooks by calling `PlexAPI.Hooks.Register&lt;HookInterface&gt;(myHook);`
/// where `I&lt;HookInterface&gt;` is one of the following interfaces defined in HookTypes.cs:
/// - ISDKInitHook
/// - IBeforeRequestHook
/// - IAfterSuccess
/// - IAfterError
/// and `myHook` an instance that implements that specific interface.
/// </remarks>
public static void InitHooks(IHooks hooks)
{
// var myHook = new MyHook();
// hooks.RegisterSDKInitHook(myHook);
// hooks.RegisterBeforeRequestHook(myHook);
// hooks.RegisterAfterSuccessHook(myHook);
// hooks.RegisterAfterErrorHook(myHook;
}
}
}

View File

@@ -0,0 +1,98 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Hooks
{
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
using PlexAPI.Utils;
public class HookContext
{
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)
{
OperationID = operationID;
Oauth2Scopes = oauth2Scopes;
SecuritySource = securitySource;
}
}
public class BeforeRequestContext : HookContext
{
public BeforeRequestContext(HookContext hookCtx)
: base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { }
}
public class AfterSuccessContext : HookContext
{
public AfterSuccessContext(HookContext hookCtx)
: base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { }
}
public class AfterErrorContext : HookContext
{
public AfterErrorContext(HookContext hookCtx)
: base(hookCtx.OperationID, hookCtx.Oauth2Scopes, hookCtx.SecuritySource) { }
}
/// <summary>
/// SDKInit hook is called when the SDK is initializing.
/// The hook can modify and return a new baseUrl and HTTP client to be used by the SDK.
/// </summary>
public interface ISDKInitHook
{
(string, ISpeakeasyHttpClient) SDKInit(string baseUrl, ISpeakeasyHttpClient client);
}
/// <summary>
/// BeforeRequestAsync hook is called before the SDK sends a request.
/// The hook can modify the request before it is sent or throw an exception to stop the request from being sent.
/// </summary>
public interface IBeforeRequestHook
{
Task<HttpRequestMessage> BeforeRequestAsync(BeforeRequestContext hookCtx, HttpRequestMessage request);
}
/// <summary>
/// AfterSuccessAsync is called after the SDK receives a response.
/// The hook can modify the response before it is handled or throw an exception to stop the response from being handled.
/// </summary>
public interface IAfterSuccessHook
{
Task<HttpResponseMessage> AfterSuccessAsync(AfterSuccessContext hookCtx, HttpResponseMessage response);
}
/// <summary>
/// AfterErrorAsync is called after the SDK encounters an error, or a non-successful response.
/// The hook can modify the response, if available, otherwise modify the error.
/// All hooks are called sequentially. If an error is returned, it will be passed to the subsequent hook implementing IAfterErrorHook.
/// If you want to prevent other AfterError hooks from being run, you can throw an FailEarlyException instead.
/// </summary>
public interface IAfterErrorHook
{
Task<(HttpResponseMessage?, Exception?)> AfterErrorAsync(AfterErrorContext hookCtx, HttpResponseMessage? response, Exception? error);
}
public interface IHooks
{
void RegisterSDKInitHook(ISDKInitHook hook);
void RegisterBeforeRequestHook(IBeforeRequestHook hook);
void RegisterAfterSuccessHook(IAfterSuccessHook hook);
void RegisterAfterErrorHook(IAfterErrorHook hook);
}
}

129
PlexAPI/Hooks/SDKHooks.cs Normal file
View File

@@ -0,0 +1,129 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Hooks
{
using PlexAPI.Utils;
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Threading.Tasks;
public sealed class FailEarlyException : Exception {}
public class SDKHooks: IHooks
{
public List<ISDKInitHook> sdkInitHooks;
public List<IBeforeRequestHook> beforeRequestHooks;
public List<IAfterSuccessHook> afterSuccessHooks;
public List<IAfterErrorHook> afterErrorHooks;
public SDKHooks()
{
this.sdkInitHooks = new List<ISDKInitHook>();
this.beforeRequestHooks = new List<IBeforeRequestHook>();
this.afterSuccessHooks = new List<IAfterSuccessHook>();
this.afterErrorHooks = new List<IAfterErrorHook>();
HookRegistration.InitHooks(this);
}
public void RegisterSDKInitHook(ISDKInitHook hook)
{
this.sdkInitHooks.Add(hook);
}
public void RegisterBeforeRequestHook(IBeforeRequestHook hook)
{
this.beforeRequestHooks.Add(hook);
}
public void RegisterAfterSuccessHook(IAfterSuccessHook hook)
{
this.afterSuccessHooks.Add(hook);
}
public void RegisterAfterErrorHook(IAfterErrorHook hook)
{
this.afterErrorHooks.Add(hook);
}
public (string, ISpeakeasyHttpClient) SDKInit(string baseUrl, ISpeakeasyHttpClient client)
{
var urlAndClient = (baseUrl, client);
foreach (var hook in this.sdkInitHooks)
{
try
{
urlAndClient = hook.SDKInit(urlAndClient.Item1, urlAndClient.Item2);
} catch (Exception ex)
{
throw new Exception("An error occurred while calling SDKInit hook.", ex);
}
}
return urlAndClient;
}
public async Task<HttpRequestMessage> BeforeRequestAsync(BeforeRequestContext hookCtx, HttpRequestMessage request)
{
foreach (var hook in this.beforeRequestHooks)
{
try
{
request = await hook.BeforeRequestAsync(hookCtx, request);
} catch (Exception ex)
{
throw new Exception("An error occurred while calling BeforeRequestAsync hook", ex);
}
}
return request;
}
public async Task<HttpResponseMessage> AfterSuccessAsync(AfterSuccessContext hookCtx, HttpResponseMessage response)
{
foreach (var hook in this.afterSuccessHooks)
{
try
{
response = await hook.AfterSuccessAsync(hookCtx, response);
}
catch (Exception ex)
{
throw new Exception("An error occurred while calling AfterSuccessAsync hook.", ex);
}
}
return response;
}
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)
{
throw;
} catch (Exception ex)
{
throw new Exception("An error occurred while calling AfterErrorAsync hook", ex);
}
}
if (responseAndError.Item2 != null)
{
throw responseAndError.Item2;
}
return responseAndError.Item1;
}
}
}

View File

@@ -1,7 +1,6 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
@@ -11,8 +10,13 @@
namespace PlexAPI namespace PlexAPI
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Hooks;
using PlexAPI.Models.Components;
using PlexAPI.Models.Errors;
using PlexAPI.Models.Requests; using PlexAPI.Models.Requests;
using PlexAPI.Utils.Retries;
using PlexAPI.Utils; using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -59,22 +63,21 @@ namespace PlexAPI
{ {
public SDKConfig SDKConfiguration { get; private set; } public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp"; private const string _language = "csharp";
private const string _sdkVersion = "0.1.5"; private const string _sdkVersion = "0.5.0";
private const string _sdkGenVersion = "2.237.3"; private const string _sdkGenVersion = "2.409.8";
private const string _openapiDocVersion = "0.0.3"; private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API"; private const string _userAgent = "speakeasy-sdk/csharp 0.5.0 2.409.8 0.0.3 PlexAPI";
private string _serverUrl = ""; private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient; private ISpeakeasyHttpClient _client;
private ISpeakeasyHttpClient _securityClient; private Func<PlexAPI.Models.Components.Security>? _securitySource;
public Hubs(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config) public Hubs(ISpeakeasyHttpClient client, Func<PlexAPI.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
{ {
_defaultClient = defaultClient; _client = client;
_securityClient = securityClient; _securitySource = securitySource;
_serverUrl = serverUrl; _serverUrl = serverUrl;
SDKConfiguration = config; SDKConfiguration = config;
} }
public async Task<GetGlobalHubsResponse> GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null) public async Task<GetGlobalHubsResponse> GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null)
{ {
@@ -83,52 +86,94 @@ namespace PlexAPI
Count = count, Count = count,
OnlyTransient = onlyTransient, OnlyTransient = onlyTransient,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/hubs", request); var urlString = URLBuilder.Build(baseUrl, "/hubs", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(httpRequest); }
var hookCtx = new HookContext("getGlobalHubs", 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new GetGlobalHubsResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, if(Utilities.IsContentTypeMatch("application/json", contentType))
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.TwoHundredApplicationJsonObject = JsonConvert.DeserializeObject<GetGlobalHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); var obj = ResponseBodyDeserializer.Deserialize<Models.Requests.GetGlobalHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new GetGlobalHubsResponse()
{
StatusCode = responseStatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
response.Object = obj;
return response;
} }
else
return response;
}
if((response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.FourHundredAndOneApplicationJsonObject = JsonConvert.DeserializeObject<GetGlobalHubsHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
return response; else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<Models.Errors.GetGlobalHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
} }
public async Task<GetLibraryHubsResponse> GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null) public async Task<GetLibraryHubsResponse> GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null)
{ {
@@ -138,51 +183,93 @@ namespace PlexAPI
Count = count, Count = count,
OnlyTransient = onlyTransient, OnlyTransient = onlyTransient,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/hubs/sections/{sectionId}", request); var urlString = URLBuilder.Build(baseUrl, "/hubs/sections/{sectionId}", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(httpRequest); }
var hookCtx = new HookContext("getLibraryHubs", 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new GetLibraryHubsResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, if(Utilities.IsContentTypeMatch("application/json", contentType))
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.TwoHundredApplicationJsonObject = JsonConvert.DeserializeObject<GetLibraryHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); var obj = ResponseBodyDeserializer.Deserialize<Models.Requests.GetLibraryHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
var response = new GetLibraryHubsResponse()
{
StatusCode = responseStatusCode,
ContentType = contentType,
RawResponse = httpResponse
};
response.Object = obj;
return response;
} }
else
return response;
}
if((response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.FourHundredAndOneApplicationJsonObject = JsonConvert.DeserializeObject<GetLibraryHubsHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
return response; else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<Models.Errors.GetLibraryHubsResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
} }
} }
} }

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,6 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
@@ -11,8 +10,13 @@
namespace PlexAPI namespace PlexAPI
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Hooks;
using PlexAPI.Models.Components;
using PlexAPI.Models.Errors;
using PlexAPI.Models.Requests; using PlexAPI.Models.Requests;
using PlexAPI.Utils.Retries;
using PlexAPI.Utils; using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -90,22 +94,21 @@ namespace PlexAPI
{ {
public SDKConfig SDKConfiguration { get; private set; } public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp"; private const string _language = "csharp";
private const string _sdkVersion = "0.1.5"; private const string _sdkVersion = "0.5.0";
private const string _sdkGenVersion = "2.237.3"; private const string _sdkGenVersion = "2.409.8";
private const string _openapiDocVersion = "0.0.3"; private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API"; private const string _userAgent = "speakeasy-sdk/csharp 0.5.0 2.409.8 0.0.3 PlexAPI";
private string _serverUrl = ""; private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient; private ISpeakeasyHttpClient _client;
private ISpeakeasyHttpClient _securityClient; private Func<PlexAPI.Models.Components.Security>? _securitySource;
public Log(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config) public Log(ISpeakeasyHttpClient client, Func<PlexAPI.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
{ {
_defaultClient = defaultClient; _client = client;
_securityClient = securityClient; _securitySource = securitySource;
_serverUrl = serverUrl; _serverUrl = serverUrl;
SDKConfiguration = config; SDKConfiguration = config;
} }
public async Task<LogLineResponse> LogLineAsync(Level level, string message, string source) public async Task<LogLineResponse> LogLineAsync(Level level, string message, string source)
{ {
@@ -115,131 +118,253 @@ namespace PlexAPI
Message = message, Message = message,
Source = source, Source = source,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/log", request); var urlString = URLBuilder.Build(baseUrl, "/log", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new LogLineResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new LogLineResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<LogLineResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
} }
return response; else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
}
public async Task<LogMultiLineResponse> LogMultiLineAsync(string request)
{
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails();
var urlString = baseUrl + "/log";
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
httpRequest.Headers.Add("user-agent", _userAgent);
var serializedBody = RequestBodySerializer.Serialize(request, "Request", "string");
if (serializedBody == null)
{ {
throw new ArgumentNullException("request body is required"); throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<LogLineResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
} }
else else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
public async Task<LogMultiLineResponse> LogMultiLineAsync(string request)
{
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = baseUrl + "/log";
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
httpRequest.Headers.Add("user-agent", _userAgent);
var serializedBody = RequestBodySerializer.Serialize(request, "Request", "string", false, false);
if (serializedBody != null)
{ {
httpRequest.Content = serializedBody; httpRequest.Content = serializedBody;
} }
var client = _securityClient; if (_securitySource != null)
{
var httpResponse = await client.SendAsync(httpRequest); httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
}
var hookCtx = new HookContext("logMultiLine", 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new LogMultiLineResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new LogMultiLineResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<LogMultiLineResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<LogMultiLineResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
public async Task<EnablePaperTrailResponse> EnablePaperTrailAsync() public async Task<EnablePaperTrailResponse> EnablePaperTrailAsync()
{ {
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = baseUrl + "/log/networked"; var urlString = baseUrl + "/log/networked";
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(httpRequest); }
var hookCtx = new HookContext("enablePaperTrail", 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 == 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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new EnablePaperTrailResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new EnablePaperTrailResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400) || (response.StatusCode == 403))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<EnablePaperTrailResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode == 403 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<EnablePaperTrailResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
} }
} }

View File

@@ -1,7 +1,6 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
@@ -11,8 +10,13 @@
namespace PlexAPI namespace PlexAPI
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Hooks;
using PlexAPI.Models.Components;
using PlexAPI.Models.Errors;
using PlexAPI.Models.Requests; using PlexAPI.Models.Requests;
using PlexAPI.Utils.Retries;
using PlexAPI.Utils; using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http.Headers; using System.Net.Http.Headers;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
@@ -55,6 +59,24 @@ namespace PlexAPI
/// </remarks> /// </remarks>
/// </summary> /// </summary>
Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state); 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> /// <summary>
@@ -68,22 +90,21 @@ namespace PlexAPI
{ {
public SDKConfig SDKConfiguration { get; private set; } public SDKConfig SDKConfiguration { get; private set; }
private const string _language = "csharp"; private const string _language = "csharp";
private const string _sdkVersion = "0.1.5"; private const string _sdkVersion = "0.5.0";
private const string _sdkGenVersion = "2.237.3"; private const string _sdkGenVersion = "2.409.8";
private const string _openapiDocVersion = "0.0.3"; private const string _openapiDocVersion = "0.0.3";
private const string _userAgent = "speakeasy-sdk/csharp 0.1.5 2.237.3 0.0.3 Plex-API"; private const string _userAgent = "speakeasy-sdk/csharp 0.5.0 2.409.8 0.0.3 PlexAPI";
private string _serverUrl = ""; private string _serverUrl = "";
private ISpeakeasyHttpClient _defaultClient; private ISpeakeasyHttpClient _client;
private ISpeakeasyHttpClient _securityClient; private Func<PlexAPI.Models.Components.Security>? _securitySource;
public Media(ISpeakeasyHttpClient defaultClient, ISpeakeasyHttpClient securityClient, string serverUrl, SDKConfig config) public Media(ISpeakeasyHttpClient client, Func<PlexAPI.Models.Components.Security>? securitySource, string serverUrl, SDKConfig config)
{ {
_defaultClient = defaultClient; _client = client;
_securityClient = securityClient; _securitySource = securitySource;
_serverUrl = serverUrl; _serverUrl = serverUrl;
SDKConfiguration = config; SDKConfiguration = config;
} }
public async Task<MarkPlayedResponse> MarkPlayedAsync(double key) public async Task<MarkPlayedResponse> MarkPlayedAsync(double key)
{ {
@@ -91,43 +112,84 @@ namespace PlexAPI
{ {
Key = key, Key = key,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/:/scrobble", request); var urlString = URLBuilder.Build(baseUrl, "/:/scrobble", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new MarkPlayedResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new MarkPlayedResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<MarkPlayedResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<MarkPlayedResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
public async Task<MarkUnplayedResponse> MarkUnplayedAsync(double key) public async Task<MarkUnplayedResponse> MarkUnplayedAsync(double key)
{ {
@@ -135,43 +197,84 @@ namespace PlexAPI
{ {
Key = key, Key = key,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/:/unscrobble", request); var urlString = URLBuilder.Build(baseUrl, "/:/unscrobble", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new MarkUnplayedResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new MarkUnplayedResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<MarkUnplayedResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<MarkUnplayedResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
public async Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state) public async Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state)
{ {
@@ -181,42 +284,263 @@ namespace PlexAPI
Time = time, Time = time,
State = state, State = state,
}; };
string baseUrl = this.SDKConfiguration.GetTemplatedServerDetails(); string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
var urlString = URLBuilder.Build(baseUrl, "/:/progress", request); var urlString = URLBuilder.Build(baseUrl, "/:/progress", request);
var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString);
httpRequest.Headers.Add("user-agent", _userAgent); httpRequest.Headers.Add("user-agent", _userAgent);
if (_securitySource != null)
var client = _securityClient; {
httpRequest = new SecurityMetadata(_securitySource).Apply(httpRequest);
var httpResponse = await client.SendAsync(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; var contentType = httpResponse.Content.Headers.ContentType?.MediaType;
int responseStatusCode = (int)httpResponse.StatusCode;
var response = new UpdatePlayProgressResponse if(responseStatusCode == 200)
{ {
StatusCode = (int)httpResponse.StatusCode, return new UpdatePlayProgressResponse()
ContentType = contentType,
RawResponse = httpResponse
};
if((response.StatusCode == 200) || (response.StatusCode == 400))
{
return response;
}
if((response.StatusCode == 401))
{
if(Utilities.IsContentTypeMatch("application/json",response.ContentType))
{ {
response.Object = JsonConvert.DeserializeObject<UpdatePlayProgressResponseBody>(await httpResponse.Content.ReadAsStringAsync(), new JsonSerializerSettings(){ NullValueHandling = NullValueHandling.Ignore, Converters = new JsonConverter[] { new FlexibleObjectDeserializer(), new EnumSerializer() }}); StatusCode = responseStatusCode,
} ContentType = contentType,
RawResponse = httpResponse
return response; };
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<UpdatePlayProgressResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new 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;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<GetBannerImageResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new 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;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else if(responseStatusCode == 400 || responseStatusCode >= 400 && responseStatusCode < 500 || responseStatusCode >= 500 && responseStatusCode < 600)
{
throw new SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
else if(responseStatusCode == 401)
{
if(Utilities.IsContentTypeMatch("application/json", contentType))
{
var obj = ResponseBodyDeserializer.Deserialize<GetThumbImageResponseBody>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore);
obj!.RawResponse = httpResponse;
throw obj!;
}
else
{
throw new SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
}
}
else
{
throw new SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
} }
return response;
} }
} }
} }

View File

@@ -1,7 +1,6 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
@@ -15,7 +14,7 @@ namespace PlexAPI.Models.Components
public class Security public class Security
{ {
[SpeakeasyMetadata("security:scheme=true,type=apiKey,subType=header,name=X-Plex-Token")] [SpeakeasyMetadata("security:scheme=true,type=apiKey,subType=query,name=X-Plex-Token")]
public string AccessToken { get; set; } = default!; public string? AccessToken { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class AddPlaylistContentsErrors public class AddPlaylistContentsErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class AddPlaylistContentsPlaylistsResponseBody public class AddPlaylistContentsResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<AddPlaylistContentsErrors>? Errors { get; set; } public List<AddPlaylistContentsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class ApplyUpdatesErrors public class ApplyUpdatesErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class ApplyUpdatesResponseBody public class ApplyUpdatesResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<ApplyUpdatesErrors>? Errors { get; set; } public List<ApplyUpdatesErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class CancelServerActivitiesErrors public class CancelServerActivitiesErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class CancelServerActivitiesResponseBody public class CancelServerActivitiesResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<CancelServerActivitiesErrors>? Errors { get; set; } public List<CancelServerActivitiesErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class CheckForUpdatesErrors public class CheckForUpdatesErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class CheckForUpdatesResponseBody public class CheckForUpdatesResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<CheckForUpdatesErrors>? Errors { get; set; } public List<CheckForUpdatesErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class ClearPlaylistContentsErrors public class ClearPlaylistContentsErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class ClearPlaylistContentsResponseBody public class ClearPlaylistContentsResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<ClearPlaylistContentsErrors>? Errors { get; set; } public List<ClearPlaylistContentsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class CreatePlaylistErrors public class CreatePlaylistErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class CreatePlaylistPlaylistsResponseBody public class CreatePlaylistResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<CreatePlaylistErrors>? Errors { get; set; } public List<CreatePlaylistErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class DeleteLibraryErrors public class DeleteLibraryErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class DeleteLibraryResponseBody public class DeleteLibraryResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<DeleteLibraryErrors>? Errors { get; set; } public List<DeleteLibraryErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class DeletePlaylistErrors public class DeletePlaylistErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class DeletePlaylistResponseBody public class DeletePlaylistResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<DeletePlaylistErrors>? Errors { get; set; } public List<DeletePlaylistErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class EnablePaperTrailErrors public class EnablePaperTrailErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class EnablePaperTrailResponseBody public class EnablePaperTrailResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<EnablePaperTrailErrors>? Errors { get; set; } public List<EnablePaperTrailErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class Errors public class Errors
{ {

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetAllLibrariesErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetAllLibrariesResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetAllLibrariesErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetAvailableClientsErrors public class GetAvailableClientsErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetAvailableClientsServerResponseBody public class GetAvailableClientsResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetAvailableClientsErrors>? Errors { get; set; } public List<GetAvailableClientsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetBandwidthStatisticsErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetBandwidthStatisticsResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetBandwidthStatisticsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetBannerImageErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetBannerImageResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetBannerImageErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetButlerTasksErrors public class GetButlerTasksErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetButlerTasksButlerResponseBody public class GetButlerTasksResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetButlerTasksErrors>? Errors { get; set; } public List<GetButlerTasksErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetCompanionsDataErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetServerIdentityServerResponseBody public class GetCompanionsDataResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetServerIdentityErrors>? Errors { get; set; } public List<GetCompanionsDataErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetDevicesErrors public class GetDevicesErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetDevicesServerResponseBody public class GetDevicesResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetDevicesErrors>? Errors { get; set; } public List<GetDevicesErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetFileHashErrors public class GetFileHashErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetFileHashResponseBody public class GetFileHashResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetFileHashErrors>? Errors { get; set; } public List<GetFileHashErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,18 +1,18 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetLibrariesErrors public class GetGeoDataErrors
{ {
[JsonProperty("code")] [JsonProperty("code")]

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetGeoDataResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetGeoDataErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetGlobalHubsErrors public class GetGlobalHubsErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetGlobalHubsHubsResponseBody public class GetGlobalHubsResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetGlobalHubsErrors>? Errors { get; set; } public List<GetGlobalHubsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,18 +1,18 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetLibraryErrors public class GetHomeDataErrors
{ {
[JsonProperty("code")] [JsonProperty("code")]

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetHomeDataResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetHomeDataErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetLibraryDetailsErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetLibraryDetailsResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetLibraryDetailsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetLibraryHubsErrors public class GetLibraryHubsErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetLibraryHubsHubsResponseBody public class GetLibraryHubsResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetLibraryHubsErrors>? Errors { get; set; } public List<GetLibraryHubsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetLibraryItemsErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetLibraryItemsResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetLibraryItemsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetMediaProvidersErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetMediaProvidersResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetMediaProvidersErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetMetaDataByRatingKeyErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetMetaDataByRatingKeyResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetMetaDataByRatingKeyErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetMetadataChildrenErrors public class GetMetadataChildrenErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetMetadataChildrenLibraryResponseBody public class GetMetadataChildrenResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetMetadataChildrenErrors>? Errors { get; set; } public List<GetMetadataChildrenErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetMyPlexAccountErrors public class GetMyPlexAccountErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetMyPlexAccountServerResponseBody public class GetMyPlexAccountResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetMyPlexAccountErrors>? Errors { get; set; } public List<GetMyPlexAccountErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetOnDeckErrors public class GetOnDeckErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetOnDeckLibraryResponseBody public class GetOnDeckResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetOnDeckErrors>? Errors { get; set; } public List<GetOnDeckErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetPinErrors
{
[JsonProperty("code")]
public long? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public long? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Bad Request response when the X-Plex-Client-Identifier is missing
/// </summary>
public class GetPinResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetPinErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetPlaylistContentsErrors public class GetPlaylistContentsErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetPlaylistContentsPlaylistsResponseBody public class GetPlaylistContentsResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetPlaylistContentsErrors>? Errors { get; set; } public List<GetPlaylistContentsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetPlaylistErrors public class GetPlaylistErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetPlaylistPlaylistsResponseBody public class GetPlaylistResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetPlaylistErrors>? Errors { get; set; } public List<GetPlaylistErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetPlaylistsErrors public class GetPlaylistsErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetPlaylistsPlaylistsResponseBody public class GetPlaylistsResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetPlaylistsErrors>? Errors { get; set; } public List<GetPlaylistsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetRecentlyAddedErrors public class GetRecentlyAddedErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetRecentlyAddedLibraryResponseBody public class GetRecentlyAddedResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetRecentlyAddedErrors>? Errors { get; set; } public List<GetRecentlyAddedErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetRefreshLibraryMetadataErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetRefreshLibraryMetadataResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetRefreshLibraryMetadataErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetResizedPhotoErrors public class GetResizedPhotoErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetResizedPhotoResponseBody public class GetResizedPhotoResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetResizedPhotoErrors>? Errors { get; set; } public List<GetResizedPhotoErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetResourcesStatisticsErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetResourcesStatisticsResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetResourcesStatisticsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -0,0 +1,27 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetSearchLibraryErrors
{
[JsonProperty("code")]
public double? Code { get; set; }
[JsonProperty("message")]
public string? Message { get; set; }
[JsonProperty("status")]
public double? Status { get; set; }
}
}

View File

@@ -0,0 +1,34 @@
//------------------------------------------------------------------------------
// <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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary>
public class GetSearchLibraryResponseBody : Exception
{
[JsonProperty("errors")]
public List<GetSearchLibraryErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetSearchResultsErrors public class GetSearchResultsErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetSearchResultsSearchResponseBody public class GetSearchResultsResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetSearchResultsErrors>? Errors { get; set; } public List<GetSearchResultsErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetServerActivitiesErrors public class GetServerActivitiesErrors
{ {

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetServerActivitiesActivitiesResponseBody public class GetServerActivitiesResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<GetServerActivitiesErrors>? Errors { get; set; } public List<GetServerActivitiesErrors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View File

@@ -1,25 +1,34 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Models.Errors;
using PlexAPI.Utils;
using System.Collections.Generic; using System.Collections.Generic;
using System.Net.Http;
using System;
/// <summary> /// <summary>
/// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query.
/// </summary> /// </summary>
public class GetServerCapabilitiesServerResponseBody public class GetServerCapabilitiesResponseBody : Exception
{ {
[JsonProperty("errors")] [JsonProperty("errors")]
public List<Errors>? Errors { get; set; } public List<Errors>? Errors { get; set; }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
} }
} }

View 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 PlexAPI.Models.Errors
{
using Newtonsoft.Json;
using PlexAPI.Utils;
using System.Net.Http;
using System;
/// <summary>
/// Request Timeout
/// </summary>
public class GetServerIdentityResponseBody : Exception
{
[JsonProperty("code")]
public long? Code { get; set; }
[JsonProperty("message")]
private string? _message { get; set; }
public override string Message { get {return _message ?? "";} }
/// <summary>
/// Raw HTTP response; suitable for custom response parsing
/// </summary>
[JsonProperty("-")]
public HttpResponseMessage? RawResponse { get; set; }
}
}

View File

@@ -1,16 +1,16 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// <auto-generated> // <auto-generated>
// This code was generated by Speakeasy (https://speakeasyapi.dev). DO NOT EDIT. // 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 // Changes to this file may cause incorrect behavior and will be lost when
// the code is regenerated. // the code is regenerated.
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#nullable enable #nullable enable
namespace PlexAPI.Models.Requests namespace PlexAPI.Models.Errors
{ {
using Newtonsoft.Json; using Newtonsoft.Json;
using PlexAPI.Utils;
public class GetServerListErrors public class GetServerListErrors
{ {

Some files were not shown because too many files have changed in this diff Show More