diff --git a/.gitignore b/.gitignore index f70eb92..ec33833 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.env +.env.local .DS_Store **/.speakeasy/temp/ **/.speakeasy/logs/ diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 058ec10..e5f2f26 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 5a8dbcbc-e0ee-41f0-9d84-b8b50567d1e9 management: - docChecksum: 77bdddd188d0778dc73b7f7906e1677c + docChecksum: addaf2dfdac23cef2e234b64492b9c90 docVersion: 0.0.3 - speakeasyVersion: 1.598.3 - generationVersion: 2.674.3 - releaseVersion: 0.16.1 - configChecksum: 641f6f04797332d3e0349120f669df14 + speakeasyVersion: 1.615.2 + generationVersion: 2.698.4 + releaseVersion: 0.17.0 + configChecksum: 7f0dd0408cb0f26d25de26ed646400b6 repoURL: https://github.com/LukeHagar/plexcsharp.git repoSubDirectory: . published: true @@ -14,12 +14,12 @@ features: csharp: additionalDependencies: 0.1.0 constsAndDefaults: 0.0.1 - core: 3.11.2 + core: 3.12.2 deprecations: 2.81.2 enums: 2.82.0 - errors: 0.2.1 + errors: 1.0.0 flattening: 2.81.3 - globalSecurity: 2.83.7 + globalSecurity: 2.83.8 globalSecurityCallbacks: 0.1.0 globalSecurityFlattening: 0.1.0 globalServerURLs: 2.82.4 @@ -28,7 +28,7 @@ features: methodServerURLs: 2.82.1 nameOverrides: 2.81.2 nullables: 0.1.1 - openEnums: 0.1.0 + openEnums: 0.1.1 responseFormat: 0.0.4 sdkHooks: 0.2.0 unions: 0.2.2 @@ -317,10 +317,12 @@ generatedFiles: - LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchErrors.cs - LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchSearchErrors.cs - LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchUnauthorized.cs + - LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs - LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataAuthenticationErrors.cs - LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataBadRequest.cs - LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataErrors.cs - LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataUnauthorized.cs + - LukeHagar/PlexAPI/SDK/Models/Errors/ResponseValidationException.cs - LukeHagar/PlexAPI/SDK/Models/Errors/SDKException.cs - LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksBadRequest.cs - LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksButlerErrors.cs diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 676d402..f657b69 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -16,12 +16,13 @@ generation: auth: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false + hoistGlobalSecurity: true tests: generateTests: true generateNewTests: false skipResponseBodyAssertions: false csharp: - version: 0.16.1 + version: 0.17.0 additionalDependencies: [] author: LukeHagar baseErrorName: PlexAPIError @@ -32,6 +33,7 @@ csharp: enableSourceLink: true flattenGlobalSecurity: true flatteningOrder: "" + httpClientPrefix: Speakeasy imports: option: openapi paths: diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 2ec5dd7..edc1325 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.598.3 +speakeasyVersion: 1.615.2 sources: my-source: sourceNamespace: my-source @@ -16,19 +16,19 @@ sources: - main plexapi: sourceNamespace: plexapi - sourceRevisionDigest: sha256:b4fa89a3571fbdcb4228800772a5fe1c292170babcd3e055161ae54402f89577 - sourceBlobDigest: sha256:f84dd2bfdaea4074454cea3c7fbc6c9e05515c5e9e961abb4923b77f8faf48f1 + sourceRevisionDigest: sha256:5125adfea1b0daea399c6ecf755e32795de6b4131465ae6a1f32ad73b3bc7787 + sourceBlobDigest: sha256:95cea18b6e5f7d76d35db0aba5bcb59e72cf204451a2b09a99be0e3e9ec1f4c0 tags: - latest - - speakeasy-sdk-regen-1754526448 + - speakeasy-sdk-regen-1757895932 targets: plexcsharp: source: plexapi sourceNamespace: plexapi - sourceRevisionDigest: sha256:b4fa89a3571fbdcb4228800772a5fe1c292170babcd3e055161ae54402f89577 - sourceBlobDigest: sha256:f84dd2bfdaea4074454cea3c7fbc6c9e05515c5e9e961abb4923b77f8faf48f1 + sourceRevisionDigest: sha256:5125adfea1b0daea399c6ecf755e32795de6b4131465ae6a1f32ad73b3bc7787 + sourceBlobDigest: sha256:95cea18b6e5f7d76d35db0aba5bcb59e72cf204451a2b09a99be0e3e9ec1f4c0 codeSamplesNamespace: code-samples-csharp-plexcsharp - codeSamplesRevisionDigest: sha256:8985bab43884b8a617bc2cf572f4eec3606eb77113fc8be80465ef446d95a656 + codeSamplesRevisionDigest: sha256:41c049f80e89195d5537bfbc2aa652942aeb669534f6c7d22e2172361fd708aa workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/LukeHagar/PlexAPI/SDK/Activities.cs b/LukeHagar/PlexAPI/SDK/Activities.cs index 79ff258..3ed5e66 100644 --- a/LukeHagar/PlexAPI/SDK/Activities.cs +++ b/LukeHagar/PlexAPI/SDK/Activities.cs @@ -74,8 +74,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Activities(SDKConfig config) @@ -137,7 +137,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerActivitiesResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerActivitiesResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetServerActivitiesResponse() { StatusCode = responseStatusCode, @@ -148,40 +158,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerActivitiesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerActivitiesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerActivitiesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerActivitiesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerActivitiesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerActivitiesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task CancelServerActivitiesAsync(string activityUUID) @@ -238,7 +268,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new CancelServerActivitiesResponse() { StatusCode = responseStatusCode, @@ -250,34 +280,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + CancelServerActivitiesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into CancelServerActivitiesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new CancelServerActivitiesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + CancelServerActivitiesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into CancelServerActivitiesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new CancelServerActivitiesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Authentication.cs b/LukeHagar/PlexAPI/SDK/Authentication.cs index 50b4a70..a8b6e08 100644 --- a/LukeHagar/PlexAPI/SDK/Authentication.cs +++ b/LukeHagar/PlexAPI/SDK/Authentication.cs @@ -95,8 +95,8 @@ namespace LukeHagar.PlexAPI.SDK }; public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Authentication(SDKConfig config) @@ -159,7 +159,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new GetTransientTokenResponse() { StatusCode = responseStatusCode, @@ -171,34 +171,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTransientTokenBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTransientTokenBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTransientTokenBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTransientTokenUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTransientTokenUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTransientTokenUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetSourceConnectionInformationAsync(string source) @@ -255,7 +275,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new GetSourceConnectionInformationResponse() { StatusCode = responseStatusCode, @@ -267,34 +287,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSourceConnectionInformationBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSourceConnectionInformationBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSourceConnectionInformationBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSourceConnectionInformationUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSourceConnectionInformationUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSourceConnectionInformationUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTokenDetailsAsync(string? serverUrl = null) @@ -356,7 +396,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTokenDetailsUserPlexAccount obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTokenDetailsUserPlexAccount.", httpResponse, httpResponseBody, ex); + } + var response = new GetTokenDetailsResponse() { StatusCode = responseStatusCode, @@ -367,40 +417,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTokenDetailsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTokenDetailsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTokenDetailsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTokenDetailsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTokenDetailsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTokenDetailsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task PostUsersSignInDataAsync(PostUsersSignInDataRequest request, string? serverUrl = null) @@ -464,7 +534,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PostUsersSignInDataUserPlexAccount obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PostUsersSignInDataUserPlexAccount.", httpResponse, httpResponseBody, ex); + } + var response = new PostUsersSignInDataResponse() { StatusCode = responseStatusCode, @@ -475,40 +555,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PostUsersSignInDataBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PostUsersSignInDataBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new PostUsersSignInDataBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PostUsersSignInDataUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PostUsersSignInDataUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new PostUsersSignInDataUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Butler.cs b/LukeHagar/PlexAPI/SDK/Butler.cs index 4bf13cf..5f4d12f 100644 --- a/LukeHagar/PlexAPI/SDK/Butler.cs +++ b/LukeHagar/PlexAPI/SDK/Butler.cs @@ -103,8 +103,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Butler(SDKConfig config) @@ -166,7 +166,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetButlerTasksResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetButlerTasksResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetButlerTasksResponse() { StatusCode = responseStatusCode, @@ -177,40 +187,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetButlerTasksBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetButlerTasksBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetButlerTasksBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetButlerTasksUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetButlerTasksUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetButlerTasksUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task StartAllTasksAsync() @@ -264,7 +294,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new StartAllTasksResponse() { StatusCode = responseStatusCode, @@ -276,34 +306,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StartAllTasksBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StartAllTasksBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StartAllTasksBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StartAllTasksUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StartAllTasksUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StartAllTasksUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task StopAllTasksAsync() @@ -357,7 +407,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new StopAllTasksResponse() { StatusCode = responseStatusCode, @@ -369,34 +419,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StopAllTasksBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StopAllTasksBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StopAllTasksBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StopAllTasksUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StopAllTasksUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StopAllTasksUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task StartTaskAsync(TaskName taskName) @@ -453,7 +523,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(new List{200, 202}.Contains(responseStatusCode)) - { + { return new StartTaskResponse() { StatusCode = responseStatusCode, @@ -465,34 +535,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StartTaskBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StartTaskBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StartTaskBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StartTaskUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StartTaskUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StartTaskUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task StopTaskAsync(PathParamTaskName taskName) @@ -549,7 +639,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new StopTaskResponse() { StatusCode = responseStatusCode, @@ -561,34 +651,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StopTaskBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StopTaskBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StopTaskBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StopTaskUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StopTaskUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StopTaskUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Hubs.cs b/LukeHagar/PlexAPI/SDK/Hubs.cs index c9d68a5..15a5d64 100644 --- a/LukeHagar/PlexAPI/SDK/Hubs.cs +++ b/LukeHagar/PlexAPI/SDK/Hubs.cs @@ -73,8 +73,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Hubs(SDKConfig config) @@ -140,7 +140,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGlobalHubsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGlobalHubsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetGlobalHubsResponse() { StatusCode = responseStatusCode, @@ -151,40 +161,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGlobalHubsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGlobalHubsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetGlobalHubsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGlobalHubsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGlobalHubsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetGlobalHubsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetRecentlyAddedAsync(GetRecentlyAddedRequest request) @@ -240,7 +270,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetRecentlyAddedResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetRecentlyAddedResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetRecentlyAddedResponse() { StatusCode = responseStatusCode, @@ -251,18 +291,18 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400 || responseStatusCode == 401 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null) @@ -324,7 +364,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryHubsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryHubsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetLibraryHubsResponse() { StatusCode = responseStatusCode, @@ -335,40 +385,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryHubsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryHubsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetLibraryHubsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryHubsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryHubsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetLibraryHubsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Library.cs b/LukeHagar/PlexAPI/SDK/Library.cs index 6954f3b..9cec07c 100644 --- a/LukeHagar/PlexAPI/SDK/Library.cs +++ b/LukeHagar/PlexAPI/SDK/Library.cs @@ -321,8 +321,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Library(SDKConfig config) @@ -385,7 +385,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new GetFileHashResponse() { StatusCode = responseStatusCode, @@ -397,34 +397,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetFileHashBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetFileHashBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetFileHashBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetFileHashUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetFileHashUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetFileHashUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request) @@ -480,7 +500,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetRecentlyAddedLibraryResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetRecentlyAddedLibraryResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetRecentlyAddedLibraryResponse() { StatusCode = responseStatusCode, @@ -491,40 +521,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetRecentlyAddedLibraryBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetRecentlyAddedLibraryBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetRecentlyAddedLibraryBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetRecentlyAddedLibraryUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetRecentlyAddedLibraryUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetRecentlyAddedLibraryUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetAllLibrariesAsync() @@ -581,7 +631,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetAllLibrariesResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetAllLibrariesResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetAllLibrariesResponse() { StatusCode = responseStatusCode, @@ -592,40 +652,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetAllLibrariesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetAllLibrariesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetAllLibrariesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetAllLibrariesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetAllLibrariesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetAllLibrariesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = LukeHagar.PlexAPI.SDK.Models.Requests.IncludeDetails.Zero) @@ -686,7 +766,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryDetailsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryDetailsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetLibraryDetailsResponse() { StatusCode = responseStatusCode, @@ -697,40 +787,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryDetailsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryDetailsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetLibraryDetailsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryDetailsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryDetailsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetLibraryDetailsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task DeleteLibraryAsync(int sectionKey) @@ -787,7 +897,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new DeleteLibraryResponse() { StatusCode = responseStatusCode, @@ -799,34 +909,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + DeleteLibraryBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into DeleteLibraryBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new DeleteLibraryBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + DeleteLibraryUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into DeleteLibraryUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new DeleteLibraryUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetLibraryItemsAsync(GetLibraryItemsRequest request) @@ -882,7 +1012,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryItemsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryItemsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetLibraryItemsResponse() { StatusCode = responseStatusCode, @@ -893,40 +1033,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryItemsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryItemsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetLibraryItemsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibraryItemsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibraryItemsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetLibraryItemsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetLibrarySectionsAllAsync(GetLibrarySectionsAllRequest request) @@ -982,7 +1142,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibrarySectionsAllResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibrarySectionsAllResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetLibrarySectionsAllResponse() { StatusCode = responseStatusCode, @@ -993,40 +1163,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibrarySectionsAllBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibrarySectionsAllBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetLibrarySectionsAllBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetLibrarySectionsAllUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetLibrarySectionsAllUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetLibrarySectionsAllUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null) @@ -1084,7 +1274,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new GetRefreshLibraryMetadataResponse() { StatusCode = responseStatusCode, @@ -1096,34 +1286,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetRefreshLibraryMetadataBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetRefreshLibraryMetadataBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetRefreshLibraryMetadataBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetRefreshLibraryMetadataUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetRefreshLibraryMetadataUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetRefreshLibraryMetadataUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type) @@ -1184,7 +1394,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchLibraryResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchLibraryResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetSearchLibraryResponse() { StatusCode = responseStatusCode, @@ -1195,40 +1415,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchLibraryBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchLibraryBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSearchLibraryBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchLibraryUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchLibraryUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSearchLibraryUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetGenresLibraryAsync(int sectionKey, GetGenresLibraryQueryParamType type) @@ -1289,7 +1529,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGenresLibraryResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGenresLibraryResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetGenresLibraryResponse() { StatusCode = responseStatusCode, @@ -1300,40 +1550,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGenresLibraryBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGenresLibraryBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetGenresLibraryBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGenresLibraryUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGenresLibraryUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetGenresLibraryUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetCountriesLibraryAsync(int sectionKey, GetCountriesLibraryQueryParamType type) @@ -1394,7 +1664,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetCountriesLibraryResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetCountriesLibraryResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetCountriesLibraryResponse() { StatusCode = responseStatusCode, @@ -1405,40 +1685,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetCountriesLibraryBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetCountriesLibraryBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetCountriesLibraryBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetCountriesLibraryUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetCountriesLibraryUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetCountriesLibraryUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetActorsLibraryAsync(int sectionKey, GetActorsLibraryQueryParamType type) @@ -1499,7 +1799,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetActorsLibraryResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetActorsLibraryResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetActorsLibraryResponse() { StatusCode = responseStatusCode, @@ -1510,40 +1820,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetActorsLibraryBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetActorsLibraryBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetActorsLibraryBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetActorsLibraryUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetActorsLibraryUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetActorsLibraryUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetSearchAllLibrariesAsync(GetSearchAllLibrariesRequest request) @@ -1600,7 +1930,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchAllLibrariesResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchAllLibrariesResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetSearchAllLibrariesResponse() { StatusCode = responseStatusCode, @@ -1611,40 +1951,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchAllLibrariesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchAllLibrariesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSearchAllLibrariesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchAllLibrariesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchAllLibrariesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSearchAllLibrariesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetMediaMetaDataAsync(GetMediaMetaDataRequest request) @@ -1700,7 +2060,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMediaMetaDataResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMediaMetaDataResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetMediaMetaDataResponse() { StatusCode = responseStatusCode, @@ -1711,40 +2081,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMediaMetaDataBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMediaMetaDataBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetMediaMetaDataBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMediaMetaDataUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMediaMetaDataUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetMediaMetaDataUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetMediaArtsAsync(long ratingKey) @@ -1804,7 +2194,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMediaArtsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMediaArtsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetMediaArtsResponse() { StatusCode = responseStatusCode, @@ -1815,18 +2215,18 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task PostMediaArtsAsync(long ratingKey, string? url = null, byte[]? requestBody = null) @@ -1891,7 +2291,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new PostMediaArtsResponse() { StatusCode = responseStatusCode, @@ -1901,14 +2301,14 @@ namespace LukeHagar.PlexAPI.SDK } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetMediaPostersAsync(long ratingKey) @@ -1968,7 +2368,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMediaPostersResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMediaPostersResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetMediaPostersResponse() { StatusCode = responseStatusCode, @@ -1979,18 +2389,18 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task PostMediaPosterAsync(long ratingKey, string? url = null, byte[]? requestBody = null) @@ -2055,7 +2465,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new PostMediaPosterResponse() { StatusCode = responseStatusCode, @@ -2065,14 +2475,14 @@ namespace LukeHagar.PlexAPI.SDK } else if(responseStatusCode == 404 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetMetadataChildrenAsync(double ratingKey, string? includeElements = null) @@ -2133,7 +2543,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMetadataChildrenResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMetadataChildrenResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetMetadataChildrenResponse() { StatusCode = responseStatusCode, @@ -2144,40 +2564,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMetadataChildrenBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMetadataChildrenBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetMetadataChildrenBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMetadataChildrenUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMetadataChildrenUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetMetadataChildrenUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, GetTopWatchedContentQueryParamIncludeGuids? includeGuids = LukeHagar.PlexAPI.SDK.Models.Requests.GetTopWatchedContentQueryParamIncludeGuids.Disable) @@ -2238,7 +2678,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTopWatchedContentResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTopWatchedContentResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetTopWatchedContentResponse() { StatusCode = responseStatusCode, @@ -2249,40 +2699,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTopWatchedContentBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTopWatchedContentBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTopWatchedContentBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTopWatchedContentUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTopWatchedContentUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTopWatchedContentUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Log.cs b/LukeHagar/PlexAPI/SDK/Log.cs index f7aab15..854cfc5 100644 --- a/LukeHagar/PlexAPI/SDK/Log.cs +++ b/LukeHagar/PlexAPI/SDK/Log.cs @@ -96,8 +96,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Log(SDKConfig config) @@ -161,7 +161,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new LogLineResponse() { StatusCode = responseStatusCode, @@ -173,34 +173,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + LogLineBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into LogLineBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new LogLineBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + LogLineUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into LogLineUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new LogLineUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task LogMultiLineAsync(string request) @@ -260,7 +280,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new LogMultiLineResponse() { StatusCode = responseStatusCode, @@ -272,34 +292,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + LogMultiLineBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into LogMultiLineBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new LogMultiLineBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + LogMultiLineUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into LogMultiLineUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new LogMultiLineUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task EnablePaperTrailAsync() @@ -353,7 +393,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new EnablePaperTrailResponse() { StatusCode = responseStatusCode, @@ -365,34 +405,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + EnablePaperTrailBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into EnablePaperTrailBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new EnablePaperTrailBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + EnablePaperTrailUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into EnablePaperTrailUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new EnablePaperTrailUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 403 || responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/LukeHagar.PlexAPI.SDK.csproj b/LukeHagar/PlexAPI/SDK/LukeHagar.PlexAPI.SDK.csproj index a1ff45e..9fc435f 100644 --- a/LukeHagar/PlexAPI/SDK/LukeHagar.PlexAPI.SDK.csproj +++ b/LukeHagar/PlexAPI/SDK/LukeHagar.PlexAPI.SDK.csproj @@ -3,7 +3,7 @@ true LukeHagar.PlexAPI.SDK - 0.16.1 + 0.17.0 net8.0 LukeHagar Copyright (c) LukeHagar 2025 diff --git a/LukeHagar/PlexAPI/SDK/Media.cs b/LukeHagar/PlexAPI/SDK/Media.cs index 2a81d0d..086b790 100644 --- a/LukeHagar/PlexAPI/SDK/Media.cs +++ b/LukeHagar/PlexAPI/SDK/Media.cs @@ -90,8 +90,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Media(SDKConfig config) @@ -153,7 +153,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new MarkPlayedResponse() { StatusCode = responseStatusCode, @@ -165,34 +165,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + MarkPlayedBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into MarkPlayedBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new MarkPlayedBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + MarkPlayedUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into MarkPlayedUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new MarkPlayedUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task MarkUnplayedAsync(double key) @@ -249,7 +269,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new MarkUnplayedResponse() { StatusCode = responseStatusCode, @@ -261,34 +281,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + MarkUnplayedBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into MarkUnplayedBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new MarkUnplayedBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + MarkUnplayedUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into MarkUnplayedUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new MarkUnplayedUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task UpdatePlayProgressAsync(string key, double time, string state) @@ -347,7 +387,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new UpdatePlayProgressResponse() { StatusCode = responseStatusCode, @@ -359,34 +399,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UpdatePlayProgressBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UpdatePlayProgressBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new UpdatePlayProgressBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UpdatePlayProgressUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UpdatePlayProgressUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new UpdatePlayProgressUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetBannerImageAsync(GetBannerImageRequest request) @@ -453,40 +513,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetBannerImageBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetBannerImageBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetBannerImageBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetBannerImageUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetBannerImageUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetBannerImageUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetThumbImageAsync(GetThumbImageRequest request) @@ -553,40 +633,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetThumbImageBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetThumbImageBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetThumbImageBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetThumbImageUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetThumbImageUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetThumbImageUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsBadRequest.cs index bf9c2b8..07936e7 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class AddPlaylistContentsBadRequest : Exception - { + public class AddPlaylistContentsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class AddPlaylistContentsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public AddPlaylistContentsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use AddPlaylistContentsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public AddPlaylistContentsBadRequest( + AddPlaylistContentsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsUnauthorized.cs index cef7fd1..3f4b332 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class AddPlaylistContentsUnauthorized : Exception - { + public class AddPlaylistContentsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class AddPlaylistContentsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public AddPlaylistContentsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use AddPlaylistContentsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public AddPlaylistContentsUnauthorized( + AddPlaylistContentsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesBadRequest.cs index e4a28ff..dafda25 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class ApplyUpdatesBadRequest : Exception - { + public class ApplyUpdatesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class ApplyUpdatesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public ApplyUpdatesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use ApplyUpdatesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public ApplyUpdatesBadRequest( + ApplyUpdatesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesUnauthorized.cs index 3908545..5c9da4e 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class ApplyUpdatesUnauthorized : Exception - { + public class ApplyUpdatesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class ApplyUpdatesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public ApplyUpdatesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use ApplyUpdatesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public ApplyUpdatesUnauthorized( + ApplyUpdatesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesBadRequest.cs index 894a59d..f85cb89 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class CancelServerActivitiesBadRequest : Exception - { + public class CancelServerActivitiesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class CancelServerActivitiesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public CancelServerActivitiesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use CancelServerActivitiesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public CancelServerActivitiesBadRequest( + CancelServerActivitiesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesUnauthorized.cs index 81e509c..a4cd9d3 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class CancelServerActivitiesUnauthorized : Exception - { + public class CancelServerActivitiesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class CancelServerActivitiesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public CancelServerActivitiesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use CancelServerActivitiesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public CancelServerActivitiesUnauthorized( + CancelServerActivitiesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesBadRequest.cs index 43367c9..468917f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class CheckForUpdatesBadRequest : Exception - { + public class CheckForUpdatesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class CheckForUpdatesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public CheckForUpdatesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use CheckForUpdatesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public CheckForUpdatesBadRequest( + CheckForUpdatesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesUnauthorized.cs index 5835d2d..1ad8164 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class CheckForUpdatesUnauthorized : Exception - { + public class CheckForUpdatesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class CheckForUpdatesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public CheckForUpdatesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use CheckForUpdatesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public CheckForUpdatesUnauthorized( + CheckForUpdatesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsBadRequest.cs index 96d1ee6..de06e8f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class ClearPlaylistContentsBadRequest : Exception - { + public class ClearPlaylistContentsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class ClearPlaylistContentsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public ClearPlaylistContentsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use ClearPlaylistContentsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public ClearPlaylistContentsBadRequest( + ClearPlaylistContentsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsUnauthorized.cs index d3b3d68..2f30e4e 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class ClearPlaylistContentsUnauthorized : Exception - { + public class ClearPlaylistContentsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class ClearPlaylistContentsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public ClearPlaylistContentsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use ClearPlaylistContentsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public ClearPlaylistContentsUnauthorized( + ClearPlaylistContentsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistBadRequest.cs index 2463cdc..2812584 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class CreatePlaylistBadRequest : Exception - { + public class CreatePlaylistBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class CreatePlaylistBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public CreatePlaylistBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use CreatePlaylistBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public CreatePlaylistBadRequest( + CreatePlaylistBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistUnauthorized.cs index 99ac563..99de2fd 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class CreatePlaylistUnauthorized : Exception - { + public class CreatePlaylistUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class CreatePlaylistUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public CreatePlaylistUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use CreatePlaylistUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public CreatePlaylistUnauthorized( + CreatePlaylistUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryBadRequest.cs index 8ed6c21..f72dba9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class DeleteLibraryBadRequest : Exception - { + public class DeleteLibraryBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class DeleteLibraryBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public DeleteLibraryBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use DeleteLibraryBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public DeleteLibraryBadRequest( + DeleteLibraryBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryUnauthorized.cs index dd0df27..20ba7cd 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class DeleteLibraryUnauthorized : Exception - { + public class DeleteLibraryUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class DeleteLibraryUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public DeleteLibraryUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use DeleteLibraryUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public DeleteLibraryUnauthorized( + DeleteLibraryUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistBadRequest.cs index 08cdf1e..611c039 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class DeletePlaylistBadRequest : Exception - { + public class DeletePlaylistBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class DeletePlaylistBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public DeletePlaylistBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use DeletePlaylistBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public DeletePlaylistBadRequest( + DeletePlaylistBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistUnauthorized.cs index 7e3ccbe..8d70cf2 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class DeletePlaylistUnauthorized : Exception - { + public class DeletePlaylistUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class DeletePlaylistUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public DeletePlaylistUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use DeletePlaylistUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public DeletePlaylistUnauthorized( + DeletePlaylistUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailBadRequest.cs index 7fb5748..329ae8a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class EnablePaperTrailBadRequest : Exception - { + public class EnablePaperTrailBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class EnablePaperTrailBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public EnablePaperTrailBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use EnablePaperTrailBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public EnablePaperTrailBadRequest( + EnablePaperTrailBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailUnauthorized.cs index 5291767..357827b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class EnablePaperTrailUnauthorized : Exception - { + public class EnablePaperTrailUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class EnablePaperTrailUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public EnablePaperTrailUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use EnablePaperTrailUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public EnablePaperTrailUnauthorized( + EnablePaperTrailUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryBadRequest.cs index 7800096..2b3a606 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetActorsLibraryBadRequest : Exception - { + public class GetActorsLibraryBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetActorsLibraryBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetActorsLibraryBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetActorsLibraryBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetActorsLibraryBadRequest( + GetActorsLibraryBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryUnauthorized.cs index 2d133c6..9b85419 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetActorsLibraryUnauthorized : Exception - { + public class GetActorsLibraryUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetActorsLibraryUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetActorsLibraryUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetActorsLibraryUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetActorsLibraryUnauthorized( + GetActorsLibraryUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesBadRequest.cs index 7d7167d..bea5532 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetAllLibrariesBadRequest : Exception - { + public class GetAllLibrariesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetAllLibrariesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetAllLibrariesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetAllLibrariesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetAllLibrariesBadRequest( + GetAllLibrariesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesUnauthorized.cs index dd8610a..89fe9ba 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetAllLibrariesUnauthorized : Exception - { + public class GetAllLibrariesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetAllLibrariesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetAllLibrariesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetAllLibrariesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetAllLibrariesUnauthorized( + GetAllLibrariesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsBadRequest.cs index 82b10ae..94c64aa 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetAvailableClientsBadRequest : Exception - { + public class GetAvailableClientsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetAvailableClientsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetAvailableClientsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetAvailableClientsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetAvailableClientsBadRequest( + GetAvailableClientsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsUnauthorized.cs index e04a736..696f8da 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetAvailableClientsUnauthorized : Exception - { + public class GetAvailableClientsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetAvailableClientsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetAvailableClientsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetAvailableClientsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetAvailableClientsUnauthorized( + GetAvailableClientsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsBadRequest.cs index 1b439b1..6b8c80b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetBandwidthStatisticsBadRequest : Exception - { + public class GetBandwidthStatisticsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetBandwidthStatisticsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetBandwidthStatisticsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetBandwidthStatisticsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetBandwidthStatisticsBadRequest( + GetBandwidthStatisticsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsUnauthorized.cs index 14248a1..be6b713 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetBandwidthStatisticsUnauthorized : Exception - { + public class GetBandwidthStatisticsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetBandwidthStatisticsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetBandwidthStatisticsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetBandwidthStatisticsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetBandwidthStatisticsUnauthorized( + GetBandwidthStatisticsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageBadRequest.cs index adf3e6d..e52eb8c 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetBannerImageBadRequest : Exception - { + public class GetBannerImageBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetBannerImageBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetBannerImageBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetBannerImageBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetBannerImageBadRequest( + GetBannerImageBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageUnauthorized.cs index 9c76dd1..cc7d9db 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetBannerImageUnauthorized : Exception - { + public class GetBannerImageUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetBannerImageUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetBannerImageUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetBannerImageUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetBannerImageUnauthorized( + GetBannerImageUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksBadRequest.cs index 625af94..ff9610f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetButlerTasksBadRequest : Exception - { + public class GetButlerTasksBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetButlerTasksBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetButlerTasksBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetButlerTasksBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetButlerTasksBadRequest( + GetButlerTasksBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksUnauthorized.cs index 1bcdfd7..ec2411f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetButlerTasksUnauthorized : Exception - { + public class GetButlerTasksUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetButlerTasksUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetButlerTasksUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetButlerTasksUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetButlerTasksUnauthorized( + GetButlerTasksUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataBadRequest.cs index d65bab1..f4c82f9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetCompanionsDataBadRequest : Exception - { + public class GetCompanionsDataBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetCompanionsDataBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetCompanionsDataBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetCompanionsDataBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetCompanionsDataBadRequest( + GetCompanionsDataBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataUnauthorized.cs index 99839ae..e48df4c 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetCompanionsDataUnauthorized : Exception - { + public class GetCompanionsDataUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetCompanionsDataUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetCompanionsDataUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetCompanionsDataUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetCompanionsDataUnauthorized( + GetCompanionsDataUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryBadRequest.cs index ea8f1c4..e42f8ee 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetCountriesLibraryBadRequest : Exception - { + public class GetCountriesLibraryBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetCountriesLibraryBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetCountriesLibraryBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetCountriesLibraryBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetCountriesLibraryBadRequest( + GetCountriesLibraryBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryUnauthorized.cs index 0d09dbe..7d70925 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetCountriesLibraryUnauthorized : Exception - { + public class GetCountriesLibraryUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetCountriesLibraryUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetCountriesLibraryUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetCountriesLibraryUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetCountriesLibraryUnauthorized( + GetCountriesLibraryUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesBadRequest.cs index d903889..85534ae 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetDevicesBadRequest : Exception - { + public class GetDevicesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetDevicesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetDevicesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetDevicesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetDevicesBadRequest( + GetDevicesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesUnauthorized.cs index 1738828..a9fd14a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetDevicesUnauthorized : Exception - { + public class GetDevicesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetDevicesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetDevicesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetDevicesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetDevicesUnauthorized( + GetDevicesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashBadRequest.cs index 06cbcbb..35dceb5 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetFileHashBadRequest : Exception - { + public class GetFileHashBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetFileHashBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetFileHashBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetFileHashBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetFileHashBadRequest( + GetFileHashBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashUnauthorized.cs index 2a8b309..eda5b59 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetFileHashUnauthorized : Exception - { + public class GetFileHashUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetFileHashUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetFileHashUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetFileHashUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetFileHashUnauthorized( + GetFileHashUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryBadRequest.cs index 3657581..a02d6b9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetGenresLibraryBadRequest : Exception - { + public class GetGenresLibraryBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetGenresLibraryBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetGenresLibraryBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetGenresLibraryBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetGenresLibraryBadRequest( + GetGenresLibraryBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryUnauthorized.cs index d5c05b1..89ec64a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetGenresLibraryUnauthorized : Exception - { + public class GetGenresLibraryUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetGenresLibraryUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetGenresLibraryUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetGenresLibraryUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetGenresLibraryUnauthorized( + GetGenresLibraryUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataBadRequest.cs index 0d54d2c..258b4c1 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetGeoDataBadRequest : Exception - { + public class GetGeoDataBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetGeoDataBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetGeoDataBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetGeoDataBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetGeoDataBadRequest( + GetGeoDataBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataUnauthorized.cs index 97f6f09..cb5f4e1 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetGeoDataUnauthorized : Exception - { + public class GetGeoDataUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetGeoDataUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetGeoDataUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetGeoDataUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetGeoDataUnauthorized( + GetGeoDataUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsBadRequest.cs index 6d2cb4e..b0c842d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetGlobalHubsBadRequest : Exception - { + public class GetGlobalHubsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetGlobalHubsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetGlobalHubsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetGlobalHubsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetGlobalHubsBadRequest( + GetGlobalHubsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsUnauthorized.cs index 0598275..2b7a473 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetGlobalHubsUnauthorized : Exception - { + public class GetGlobalHubsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetGlobalHubsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetGlobalHubsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetGlobalHubsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetGlobalHubsUnauthorized( + GetGlobalHubsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataBadRequest.cs index bdb1a9e..50ea2f9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetHomeDataBadRequest : Exception - { + public class GetHomeDataBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetHomeDataBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetHomeDataBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetHomeDataBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetHomeDataBadRequest( + GetHomeDataBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataUnauthorized.cs index da59e3d..1ecd07c 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetHomeDataUnauthorized : Exception - { + public class GetHomeDataUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetHomeDataUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetHomeDataUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetHomeDataUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetHomeDataUnauthorized( + GetHomeDataUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsBadRequest.cs index 648e40f..8e47d71 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetLibraryDetailsBadRequest : Exception - { + public class GetLibraryDetailsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetLibraryDetailsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetLibraryDetailsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetLibraryDetailsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetLibraryDetailsBadRequest( + GetLibraryDetailsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsUnauthorized.cs index 498a3d3..d089ef3 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetLibraryDetailsUnauthorized : Exception - { + public class GetLibraryDetailsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetLibraryDetailsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetLibraryDetailsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetLibraryDetailsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetLibraryDetailsUnauthorized( + GetLibraryDetailsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsBadRequest.cs index c178aad..8d9b120 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetLibraryHubsBadRequest : Exception - { + public class GetLibraryHubsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetLibraryHubsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetLibraryHubsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetLibraryHubsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetLibraryHubsBadRequest( + GetLibraryHubsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsUnauthorized.cs index 37890d0..c7ba10c 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetLibraryHubsUnauthorized : Exception - { + public class GetLibraryHubsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetLibraryHubsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetLibraryHubsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetLibraryHubsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetLibraryHubsUnauthorized( + GetLibraryHubsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsBadRequest.cs index a8c0bfe..5599666 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetLibraryItemsBadRequest : Exception - { + public class GetLibraryItemsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetLibraryItemsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetLibraryItemsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetLibraryItemsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetLibraryItemsBadRequest( + GetLibraryItemsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsUnauthorized.cs index d930209..8bad1b0 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetLibraryItemsUnauthorized : Exception - { + public class GetLibraryItemsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetLibraryItemsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetLibraryItemsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetLibraryItemsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetLibraryItemsUnauthorized( + GetLibraryItemsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllBadRequest.cs index b0755a4..1988c3d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetLibrarySectionsAllBadRequest : Exception - { + public class GetLibrarySectionsAllBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetLibrarySectionsAllBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetLibrarySectionsAllBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetLibrarySectionsAllBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetLibrarySectionsAllBadRequest( + GetLibrarySectionsAllBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllUnauthorized.cs index 8cf4827..a171728 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetLibrarySectionsAllUnauthorized : Exception - { + public class GetLibrarySectionsAllUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetLibrarySectionsAllUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetLibrarySectionsAllUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetLibrarySectionsAllUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetLibrarySectionsAllUnauthorized( + GetLibrarySectionsAllUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataBadRequest.cs index 91e7a69..cb1dda8 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetMediaMetaDataBadRequest : Exception - { + public class GetMediaMetaDataBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetMediaMetaDataBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetMediaMetaDataBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetMediaMetaDataBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetMediaMetaDataBadRequest( + GetMediaMetaDataBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataUnauthorized.cs index b38b9cd..c0082be 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetMediaMetaDataUnauthorized : Exception - { + public class GetMediaMetaDataUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetMediaMetaDataUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetMediaMetaDataUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetMediaMetaDataUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetMediaMetaDataUnauthorized( + GetMediaMetaDataUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersBadRequest.cs index 350d23b..9b33b1d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetMediaProvidersBadRequest : Exception - { + public class GetMediaProvidersBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetMediaProvidersBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetMediaProvidersBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetMediaProvidersBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetMediaProvidersBadRequest( + GetMediaProvidersBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersUnauthorized.cs index 56199c8..a911ba1 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetMediaProvidersUnauthorized : Exception - { + public class GetMediaProvidersUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetMediaProvidersUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetMediaProvidersUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetMediaProvidersUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetMediaProvidersUnauthorized( + GetMediaProvidersUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenBadRequest.cs index eb55787..de27fd2 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetMetadataChildrenBadRequest : Exception - { + public class GetMetadataChildrenBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetMetadataChildrenBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetMetadataChildrenBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetMetadataChildrenBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetMetadataChildrenBadRequest( + GetMetadataChildrenBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenUnauthorized.cs index 22a3072..4da851f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetMetadataChildrenUnauthorized : Exception - { + public class GetMetadataChildrenUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetMetadataChildrenUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetMetadataChildrenUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetMetadataChildrenUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetMetadataChildrenUnauthorized( + GetMetadataChildrenUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountBadRequest.cs index 9017b73..957ba0f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetMyPlexAccountBadRequest : Exception - { + public class GetMyPlexAccountBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetMyPlexAccountBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetMyPlexAccountBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetMyPlexAccountBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetMyPlexAccountBadRequest( + GetMyPlexAccountBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountUnauthorized.cs index a29808b..59b80d7 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetMyPlexAccountUnauthorized : Exception - { + public class GetMyPlexAccountUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetMyPlexAccountUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetMyPlexAccountUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetMyPlexAccountUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetMyPlexAccountUnauthorized( + GetMyPlexAccountUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPinBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPinBadRequest.cs index 94fdc03..811cd5e 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPinBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPinBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetPinBadRequest : Exception - { + public class GetPinBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetPinBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetPinBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetPinBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetPinBadRequest( + GetPinBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistBadRequest.cs index be4f6d3..51ba7ed 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetPlaylistBadRequest : Exception - { + public class GetPlaylistBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetPlaylistBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetPlaylistBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetPlaylistBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetPlaylistBadRequest( + GetPlaylistBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsBadRequest.cs index 74763fe..077d89a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetPlaylistContentsBadRequest : Exception - { + public class GetPlaylistContentsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetPlaylistContentsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetPlaylistContentsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetPlaylistContentsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetPlaylistContentsBadRequest( + GetPlaylistContentsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsUnauthorized.cs index 0d198db..7ae2a75 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetPlaylistContentsUnauthorized : Exception - { + public class GetPlaylistContentsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetPlaylistContentsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetPlaylistContentsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetPlaylistContentsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetPlaylistContentsUnauthorized( + GetPlaylistContentsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistUnauthorized.cs index e1fae4c..dfa213f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetPlaylistUnauthorized : Exception - { + public class GetPlaylistUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetPlaylistUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetPlaylistUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetPlaylistUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetPlaylistUnauthorized( + GetPlaylistUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsBadRequest.cs index 8d98cf3..8d7a0f6 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetPlaylistsBadRequest : Exception - { + public class GetPlaylistsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetPlaylistsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetPlaylistsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetPlaylistsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetPlaylistsBadRequest( + GetPlaylistsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsUnauthorized.cs index 71ff7e6..b9a2ffc 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetPlaylistsUnauthorized : Exception - { + public class GetPlaylistsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetPlaylistsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetPlaylistsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetPlaylistsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetPlaylistsUnauthorized( + GetPlaylistsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryBadRequest.cs index 74b9912..704a9b7 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetRecentlyAddedLibraryBadRequest : Exception - { + public class GetRecentlyAddedLibraryBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetRecentlyAddedLibraryBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetRecentlyAddedLibraryBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetRecentlyAddedLibraryBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetRecentlyAddedLibraryBadRequest( + GetRecentlyAddedLibraryBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryUnauthorized.cs index 76fbd33..8d582e6 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetRecentlyAddedLibraryUnauthorized : Exception - { + public class GetRecentlyAddedLibraryUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetRecentlyAddedLibraryUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetRecentlyAddedLibraryUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetRecentlyAddedLibraryUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetRecentlyAddedLibraryUnauthorized( + GetRecentlyAddedLibraryUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataBadRequest.cs index 234e3e8..abe8c55 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetRefreshLibraryMetadataBadRequest : Exception - { + public class GetRefreshLibraryMetadataBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetRefreshLibraryMetadataBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetRefreshLibraryMetadataBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetRefreshLibraryMetadataBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetRefreshLibraryMetadataBadRequest( + GetRefreshLibraryMetadataBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataUnauthorized.cs index d84f5f6..84ae6f9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetRefreshLibraryMetadataUnauthorized : Exception - { + public class GetRefreshLibraryMetadataUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetRefreshLibraryMetadataUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetRefreshLibraryMetadataUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetRefreshLibraryMetadataUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetRefreshLibraryMetadataUnauthorized( + GetRefreshLibraryMetadataUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoBadRequest.cs index 8d3ef03..53c3e90 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetResizedPhotoBadRequest : Exception - { + public class GetResizedPhotoBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetResizedPhotoBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetResizedPhotoBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetResizedPhotoBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetResizedPhotoBadRequest( + GetResizedPhotoBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoUnauthorized.cs index 6251c57..10fee73 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetResizedPhotoUnauthorized : Exception - { + public class GetResizedPhotoUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetResizedPhotoUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetResizedPhotoUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetResizedPhotoUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetResizedPhotoUnauthorized( + GetResizedPhotoUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsBadRequest.cs index 0103133..357515d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetResourcesStatisticsBadRequest : Exception - { + public class GetResourcesStatisticsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetResourcesStatisticsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetResourcesStatisticsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetResourcesStatisticsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetResourcesStatisticsBadRequest( + GetResourcesStatisticsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsUnauthorized.cs index 4059c49..25d41ab 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetResourcesStatisticsUnauthorized : Exception - { + public class GetResourcesStatisticsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetResourcesStatisticsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetResourcesStatisticsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetResourcesStatisticsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetResourcesStatisticsUnauthorized( + GetResourcesStatisticsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesBadRequest.cs index 9fda213..7912c6a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetSearchAllLibrariesBadRequest : Exception - { + public class GetSearchAllLibrariesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetSearchAllLibrariesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSearchAllLibrariesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSearchAllLibrariesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSearchAllLibrariesBadRequest( + GetSearchAllLibrariesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesUnauthorized.cs index e970273..d93dd47 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetSearchAllLibrariesUnauthorized : Exception - { + public class GetSearchAllLibrariesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetSearchAllLibrariesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSearchAllLibrariesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSearchAllLibrariesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSearchAllLibrariesUnauthorized( + GetSearchAllLibrariesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryBadRequest.cs index 1df9352..3f2e252 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetSearchLibraryBadRequest : Exception - { + public class GetSearchLibraryBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetSearchLibraryBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSearchLibraryBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSearchLibraryBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSearchLibraryBadRequest( + GetSearchLibraryBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryUnauthorized.cs index dda9491..99810a2 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetSearchLibraryUnauthorized : Exception - { + public class GetSearchLibraryUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetSearchLibraryUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSearchLibraryUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSearchLibraryUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSearchLibraryUnauthorized( + GetSearchLibraryUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsBadRequest.cs index b3660aa..0277a0a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetSearchResultsBadRequest : Exception - { + public class GetSearchResultsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetSearchResultsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSearchResultsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSearchResultsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSearchResultsBadRequest( + GetSearchResultsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsUnauthorized.cs index 74fdccf..bce7a1d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetSearchResultsUnauthorized : Exception - { + public class GetSearchResultsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetSearchResultsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSearchResultsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSearchResultsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSearchResultsUnauthorized( + GetSearchResultsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesBadRequest.cs index 67ab9dc..bee9579 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetServerActivitiesBadRequest : Exception - { + public class GetServerActivitiesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetServerActivitiesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerActivitiesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerActivitiesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerActivitiesBadRequest( + GetServerActivitiesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesUnauthorized.cs index bbc546b..25acfbb 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetServerActivitiesUnauthorized : Exception - { + public class GetServerActivitiesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetServerActivitiesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerActivitiesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerActivitiesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerActivitiesUnauthorized( + GetServerActivitiesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesBadRequest.cs index 7eaa054..3b39ed1 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetServerCapabilitiesBadRequest : Exception - { + public class GetServerCapabilitiesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetServerCapabilitiesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerCapabilitiesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerCapabilitiesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerCapabilitiesBadRequest( + GetServerCapabilitiesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesUnauthorized.cs index 7fe6ddc..f624e17 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetServerCapabilitiesUnauthorized : Exception - { + public class GetServerCapabilitiesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetServerCapabilitiesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerCapabilitiesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerCapabilitiesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerCapabilitiesUnauthorized( + GetServerCapabilitiesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerIdentityRequestTimeout.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerIdentityRequestTimeout.cs index 80b33bc..0193c42 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerIdentityRequestTimeout.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerIdentityRequestTimeout.cs @@ -13,19 +13,14 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using Newtonsoft.Json; using System; using System.Net.Http; - - /// - /// Request Timeout - /// - public class GetServerIdentityRequestTimeout : Exception - { + public class GetServerIdentityRequestTimeoutPayload + { [JsonProperty("code")] public int? Code { get; set; } [JsonProperty("message")] - private string? _message { get; set; } - public override string Message { get {return _message ?? "";} } + public string? Message { get; set; } /// /// Raw HTTP response; suitable for custom response parsing @@ -33,4 +28,47 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Request Timeout + /// + public class GetServerIdentityRequestTimeout : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerIdentityRequestTimeoutPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerIdentityRequestTimeout.Payload.Code instead.")] + public int? Code { get; set; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerIdentityRequestTimeout.Payload.Message instead.")] + private string? _message { get; set; } + + private static string ErrorMessage(GetServerIdentityRequestTimeoutPayload payload, string body) + { + string? message = payload.Message; + if (!string.IsNullOrEmpty(message)) + { + return message; + } + + return "API error occurred"; + } + + public GetServerIdentityRequestTimeout( + GetServerIdentityRequestTimeoutPayload payload, + HttpResponseMessage rawResponse, + string body + ): base(ErrorMessage(payload, body), rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Code = payload.Code; + _message = payload.Message; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListBadRequest.cs index b7fff47..23e74b1 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetServerListBadRequest : Exception - { + public class GetServerListBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetServerListBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerListBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerListBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerListBadRequest( + GetServerListBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListUnauthorized.cs index de9712e..dd16486 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetServerListUnauthorized : Exception - { + public class GetServerListUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetServerListUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerListUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerListUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerListUnauthorized( + GetServerListUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesBadRequest.cs index bc74e81..f3d8e05 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetServerPreferencesBadRequest : Exception - { + public class GetServerPreferencesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetServerPreferencesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerPreferencesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerPreferencesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerPreferencesBadRequest( + GetServerPreferencesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesUnauthorized.cs index 43ccd49..c7a4e98 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetServerPreferencesUnauthorized : Exception - { + public class GetServerPreferencesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetServerPreferencesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerPreferencesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerPreferencesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerPreferencesUnauthorized( + GetServerPreferencesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesBadRequest.cs index ae6d816..130d1bf 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetServerResourcesBadRequest : Exception - { + public class GetServerResourcesBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetServerResourcesBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerResourcesBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerResourcesBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerResourcesBadRequest( + GetServerResourcesBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesUnauthorized.cs index 496c2ab..0debe67 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetServerResourcesUnauthorized : Exception - { + public class GetServerResourcesUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetServerResourcesUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetServerResourcesUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetServerResourcesUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetServerResourcesUnauthorized( + GetServerResourcesUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryBadRequest.cs index c17cea8..51b650d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetSessionHistoryBadRequest : Exception - { + public class GetSessionHistoryBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetSessionHistoryBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSessionHistoryBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSessionHistoryBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSessionHistoryBadRequest( + GetSessionHistoryBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryUnauthorized.cs index 8bc9c30..6ef1c8e 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetSessionHistoryUnauthorized : Exception - { + public class GetSessionHistoryUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetSessionHistoryUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSessionHistoryUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSessionHistoryUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSessionHistoryUnauthorized( + GetSessionHistoryUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsBadRequest.cs index a6de189..eeb9c7a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetSessionsBadRequest : Exception - { + public class GetSessionsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetSessionsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSessionsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSessionsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSessionsBadRequest( + GetSessionsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsUnauthorized.cs index ff644a9..1dd75f3 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetSessionsUnauthorized : Exception - { + public class GetSessionsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetSessionsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSessionsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSessionsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSessionsUnauthorized( + GetSessionsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationBadRequest.cs index d48e9f9..f4c8bd7 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetSourceConnectionInformationBadRequest : Exception - { + public class GetSourceConnectionInformationBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetSourceConnectionInformationBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSourceConnectionInformationBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSourceConnectionInformationBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSourceConnectionInformationBadRequest( + GetSourceConnectionInformationBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationUnauthorized.cs index cc51487..a95a2a5 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetSourceConnectionInformationUnauthorized : Exception - { + public class GetSourceConnectionInformationUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetSourceConnectionInformationUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetSourceConnectionInformationUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetSourceConnectionInformationUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetSourceConnectionInformationUnauthorized( + GetSourceConnectionInformationUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsBadRequest.cs index 721604f..ea80ae4 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetStatisticsBadRequest : Exception - { + public class GetStatisticsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetStatisticsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetStatisticsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetStatisticsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetStatisticsBadRequest( + GetStatisticsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsUnauthorized.cs index 9679209..8b29782 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetStatisticsUnauthorized : Exception - { + public class GetStatisticsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetStatisticsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetStatisticsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetStatisticsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetStatisticsUnauthorized( + GetStatisticsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageBadRequest.cs index c844db4..81964e9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetThumbImageBadRequest : Exception - { + public class GetThumbImageBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetThumbImageBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetThumbImageBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetThumbImageBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetThumbImageBadRequest( + GetThumbImageBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageUnauthorized.cs index 0e8d730..f8b1f1f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetThumbImageUnauthorized : Exception - { + public class GetThumbImageUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetThumbImageUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetThumbImageUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetThumbImageUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetThumbImageUnauthorized( + GetThumbImageUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineBadRequest.cs index 275bbbd..74f38fe 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetTimelineBadRequest : Exception - { + public class GetTimelineBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetTimelineBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTimelineBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTimelineBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTimelineBadRequest( + GetTimelineBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineUnauthorized.cs index 4bd688a..28ac44c 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetTimelineUnauthorized : Exception - { + public class GetTimelineUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetTimelineUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTimelineUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTimelineUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTimelineUnauthorized( + GetTimelineUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdBadRequest.cs index 626f8d7..a886f9c 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetTokenByPinIdBadRequest : Exception - { + public class GetTokenByPinIdBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetTokenByPinIdBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTokenByPinIdBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTokenByPinIdBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTokenByPinIdBadRequest( + GetTokenByPinIdBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdResponseBody.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdResponseBody.cs index c74538d..501aebb 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdResponseBody.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdResponseBody.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Not Found or Expired - /// - public class GetTokenByPinIdResponseBody : Exception - { + public class GetTokenByPinIdResponseBodyPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Not Found or Expired + /// + public class GetTokenByPinIdResponseBody : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTokenByPinIdResponseBodyPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTokenByPinIdResponseBody.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTokenByPinIdResponseBody( + GetTokenByPinIdResponseBodyPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsBadRequest.cs index 0ae82af..a299dad 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetTokenDetailsBadRequest : Exception - { + public class GetTokenDetailsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetTokenDetailsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTokenDetailsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTokenDetailsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTokenDetailsBadRequest( + GetTokenDetailsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsUnauthorized.cs index d1522e4..5c51705 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetTokenDetailsUnauthorized : Exception - { + public class GetTokenDetailsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetTokenDetailsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTokenDetailsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTokenDetailsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTokenDetailsUnauthorized( + GetTokenDetailsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentBadRequest.cs index 522a6f7..5f667ea 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetTopWatchedContentBadRequest : Exception - { + public class GetTopWatchedContentBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetTopWatchedContentBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTopWatchedContentBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTopWatchedContentBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTopWatchedContentBadRequest( + GetTopWatchedContentBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentUnauthorized.cs index 195feec..4491dab 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetTopWatchedContentUnauthorized : Exception - { + public class GetTopWatchedContentUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetTopWatchedContentUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTopWatchedContentUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTopWatchedContentUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTopWatchedContentUnauthorized( + GetTopWatchedContentUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsBadRequest.cs index 0ca116e..3841cac 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetTranscodeSessionsBadRequest : Exception - { + public class GetTranscodeSessionsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetTranscodeSessionsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTranscodeSessionsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTranscodeSessionsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTranscodeSessionsBadRequest( + GetTranscodeSessionsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsUnauthorized.cs index f9fee9a..599eeda 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetTranscodeSessionsUnauthorized : Exception - { + public class GetTranscodeSessionsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetTranscodeSessionsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTranscodeSessionsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTranscodeSessionsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTranscodeSessionsUnauthorized( + GetTranscodeSessionsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenBadRequest.cs index c4700a7..e7ed5ba 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetTransientTokenBadRequest : Exception - { + public class GetTransientTokenBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetTransientTokenBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTransientTokenBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTransientTokenBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTransientTokenBadRequest( + GetTransientTokenBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenUnauthorized.cs index 9f1ea99..285ec60 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetTransientTokenUnauthorized : Exception - { + public class GetTransientTokenUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetTransientTokenUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetTransientTokenUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetTransientTokenUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetTransientTokenUnauthorized( + GetTransientTokenUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusBadRequest.cs index c6db8e8..0025e6f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetUpdateStatusBadRequest : Exception - { + public class GetUpdateStatusBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetUpdateStatusBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetUpdateStatusBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetUpdateStatusBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetUpdateStatusBadRequest( + GetUpdateStatusBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusUnauthorized.cs index 473659a..3f3fdfa 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetUpdateStatusUnauthorized : Exception - { + public class GetUpdateStatusUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetUpdateStatusUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetUpdateStatusUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetUpdateStatusUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetUpdateStatusUnauthorized( + GetUpdateStatusUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsBadRequest.cs index 90bef3b..de5054b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetUserFriendsBadRequest : Exception - { + public class GetUserFriendsBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetUserFriendsBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetUserFriendsBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetUserFriendsBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetUserFriendsBadRequest( + GetUserFriendsBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsUnauthorized.cs index e81c717..1a93fd9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetUserFriendsUnauthorized : Exception - { + public class GetUserFriendsUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetUserFriendsUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetUserFriendsUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetUserFriendsUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetUserFriendsUnauthorized( + GetUserFriendsUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersBadRequest.cs index 773cbb2..78e786f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetUsersBadRequest : Exception - { + public class GetUsersBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetUsersBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetUsersBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetUsersBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetUsersBadRequest( + GetUsersBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersUnauthorized.cs index a2f359a..51280d9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetUsersUnauthorized : Exception - { + public class GetUsersUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetUsersUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetUsersUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetUsersUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetUsersUnauthorized( + GetUsersUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListBadRequest.cs index d60c59e..158a21f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class GetWatchListBadRequest : Exception - { + public class GetWatchListBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class GetWatchListBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetWatchListBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetWatchListBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetWatchListBadRequest( + GetWatchListBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListUnauthorized.cs index 1c4ff27..b1bc0f5 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class GetWatchListUnauthorized : Exception - { + public class GetWatchListUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class GetWatchListUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public GetWatchListUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use GetWatchListUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public GetWatchListUnauthorized( + GetWatchListUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/LogLineBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/LogLineBadRequest.cs index 75be6da..76b0c0e 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/LogLineBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/LogLineBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class LogLineBadRequest : Exception - { + public class LogLineBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class LogLineBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public LogLineBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use LogLineBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public LogLineBadRequest( + LogLineBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/LogLineUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/LogLineUnauthorized.cs index 48e75ae..f374199 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/LogLineUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/LogLineUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class LogLineUnauthorized : Exception - { + public class LogLineUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class LogLineUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public LogLineUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use LogLineUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public LogLineUnauthorized( + LogLineUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineBadRequest.cs index 43ab5ae..e472478 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class LogMultiLineBadRequest : Exception - { + public class LogMultiLineBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class LogMultiLineBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public LogMultiLineBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use LogMultiLineBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public LogMultiLineBadRequest( + LogMultiLineBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineUnauthorized.cs index e92f478..8c824b5 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class LogMultiLineUnauthorized : Exception - { + public class LogMultiLineUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class LogMultiLineUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public LogMultiLineUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use LogMultiLineUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public LogMultiLineUnauthorized( + LogMultiLineUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedBadRequest.cs index d96ced8..ea53e83 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class MarkPlayedBadRequest : Exception - { + public class MarkPlayedBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class MarkPlayedBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public MarkPlayedBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use MarkPlayedBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public MarkPlayedBadRequest( + MarkPlayedBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedUnauthorized.cs index 7e38760..c19342b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class MarkPlayedUnauthorized : Exception - { + public class MarkPlayedUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class MarkPlayedUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public MarkPlayedUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use MarkPlayedUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public MarkPlayedUnauthorized( + MarkPlayedUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedBadRequest.cs index 715be6a..2bf7a16 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class MarkUnplayedBadRequest : Exception - { + public class MarkUnplayedBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class MarkUnplayedBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public MarkUnplayedBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use MarkUnplayedBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public MarkUnplayedBadRequest( + MarkUnplayedBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedUnauthorized.cs index e248c2b..8a707b9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class MarkUnplayedUnauthorized : Exception - { + public class MarkUnplayedUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class MarkUnplayedUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public MarkUnplayedUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use MarkUnplayedUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public MarkUnplayedUnauthorized( + MarkUnplayedUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchBadRequest.cs index 0260219..17e7949 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class PerformSearchBadRequest : Exception - { + public class PerformSearchBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class PerformSearchBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public PerformSearchBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PerformSearchBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public PerformSearchBadRequest( + PerformSearchBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchUnauthorized.cs index e6d7d90..689942c 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class PerformSearchUnauthorized : Exception - { + public class PerformSearchUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class PerformSearchUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public PerformSearchUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PerformSearchUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public PerformSearchUnauthorized( + PerformSearchUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchBadRequest.cs index ccb5294..7eb46ae 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class PerformVoiceSearchBadRequest : Exception - { + public class PerformVoiceSearchBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class PerformVoiceSearchBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public PerformVoiceSearchBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PerformVoiceSearchBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public PerformVoiceSearchBadRequest( + PerformVoiceSearchBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchUnauthorized.cs index 6bd0c32..bc7d0dd 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class PerformVoiceSearchUnauthorized : Exception - { + public class PerformVoiceSearchUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class PerformVoiceSearchUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public PerformVoiceSearchUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PerformVoiceSearchUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public PerformVoiceSearchUnauthorized( + PerformVoiceSearchUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs new file mode 100644 index 0000000..9ab673b --- /dev/null +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs @@ -0,0 +1,80 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +#nullable enable +namespace LukeHagar.PlexAPI.SDK.Models.Errors +{ + using System; + using System.Net.Http; + using System.Net.Http.Headers; + + public class PlexAPIError : Exception + { + /// + /// Error Message + /// + public override string Message { get; } + + /// + /// HTTP status code + /// + public int StatusCode { get; } + + /// + /// HTTP headers + /// + public HttpResponseHeaders Headers { get; } + + /// + /// HTTP content type + /// + public string? ContentType { get; } + + /// + /// Raw response + /// + public HttpResponseMessage RawResponse { get; } + + /// + /// HTTP response body + /// + public string Body { get; } + + public PlexAPIError( + string message, + HttpResponseMessage rawResponse, + string body + ) : this(message, rawResponse, body, null) {} + + public PlexAPIError( + string message, + HttpResponseMessage rawResponse, + string body, + Exception? innerException + ) : base(message, innerException) + { + Message = message; + RawResponse = rawResponse; + StatusCode = (int)rawResponse.StatusCode; + Headers = rawResponse.Headers; + ContentType = rawResponse.Content.Headers.ContentType?.MediaType; + Body = body; + } + + /// + /// Detailed Error Message + /// + public override string ToString() + { + var innerMessage = string.IsNullOrEmpty(InnerException?.Message) ? "" : $"\n{InnerException.Message}"; + return $"Status: {StatusCode}. {Message}{innerMessage}"; + } + + } +} diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataBadRequest.cs index 56de82d..8c68811 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class PostUsersSignInDataBadRequest : Exception - { + public class PostUsersSignInDataBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class PostUsersSignInDataBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public PostUsersSignInDataBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PostUsersSignInDataBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public PostUsersSignInDataBadRequest( + PostUsersSignInDataBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataUnauthorized.cs index 2b08381..3936706 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class PostUsersSignInDataUnauthorized : Exception - { + public class PostUsersSignInDataUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class PostUsersSignInDataUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public PostUsersSignInDataUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use PostUsersSignInDataUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public PostUsersSignInDataUnauthorized( + PostUsersSignInDataUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/ResponseValidationException.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/ResponseValidationException.cs new file mode 100644 index 0000000..def940b --- /dev/null +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/ResponseValidationException.cs @@ -0,0 +1,29 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +#nullable enable +namespace LukeHagar.PlexAPI.SDK.Models.Errors +{ + using System; + using System.Net.Http; + + /// + /// Raised if the response data could not be deserialized into the expected model. + /// + public class ResponseValidationException : PlexAPIError + { + + public ResponseValidationException( + string message, + HttpResponseMessage rawResponse, + string body, + Exception innerException + ): base(message, rawResponse, body, innerException) {} + } +} diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/SDKException.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/SDKException.cs index eae9c7b..3d87b1f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/SDKException.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/SDKException.cs @@ -6,36 +6,22 @@ // the code is regenerated. // //------------------------------------------------------------------------------ + #nullable enable namespace LukeHagar.PlexAPI.SDK.Models.Errors { using System; using System.Net.Http; - public class SDKException : Exception + public class SDKException : PlexAPIError { - - public override string Message { get; } - public int StatusCode { get; set; } - public string Body { get; set; } - public HttpResponseMessage RawResponse { get; set; } = default!; - public SDKException(string message, int statusCode, string body, HttpResponseMessage rawResponse) - { - Message = message; - this.StatusCode = statusCode; - StatusCode = statusCode; - Body = body; - RawResponse = rawResponse; - } - - public override string ToString(){ - var body = ""; - if (Body.Length > 0) - { - body += $"\n{Body}"; - } - return Message + ": Status " + StatusCode + body; - } - + /// + /// Default API exception. + /// + public SDKException( + string message, + HttpResponseMessage rawResponse, + string body + ): base(message, rawResponse, body) {} } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksBadRequest.cs index 193f839..2e87637 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class StartAllTasksBadRequest : Exception - { + public class StartAllTasksBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class StartAllTasksBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StartAllTasksBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StartAllTasksBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StartAllTasksBadRequest( + StartAllTasksBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksUnauthorized.cs index 3feed44..0527c9a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class StartAllTasksUnauthorized : Exception - { + public class StartAllTasksUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class StartAllTasksUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StartAllTasksUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StartAllTasksUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StartAllTasksUnauthorized( + StartAllTasksUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskBadRequest.cs index 1a748a1..d670414 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class StartTaskBadRequest : Exception - { + public class StartTaskBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class StartTaskBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StartTaskBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StartTaskBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StartTaskBadRequest( + StartTaskBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskUnauthorized.cs index af4524a..9044c59 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class StartTaskUnauthorized : Exception - { + public class StartTaskUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class StartTaskUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StartTaskUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StartTaskUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StartTaskUnauthorized( + StartTaskUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeBadRequest.cs index de05246..e07de52 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class StartUniversalTranscodeBadRequest : Exception - { + public class StartUniversalTranscodeBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class StartUniversalTranscodeBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StartUniversalTranscodeBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StartUniversalTranscodeBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StartUniversalTranscodeBadRequest( + StartUniversalTranscodeBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeUnauthorized.cs index bd9597b..a2d2185 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class StartUniversalTranscodeUnauthorized : Exception - { + public class StartUniversalTranscodeUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class StartUniversalTranscodeUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StartUniversalTranscodeUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StartUniversalTranscodeUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StartUniversalTranscodeUnauthorized( + StartUniversalTranscodeUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksBadRequest.cs index b033f2e..c79b479 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class StopAllTasksBadRequest : Exception - { + public class StopAllTasksBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class StopAllTasksBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StopAllTasksBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StopAllTasksBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StopAllTasksBadRequest( + StopAllTasksBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksUnauthorized.cs index f5aaee2..da2383d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class StopAllTasksUnauthorized : Exception - { + public class StopAllTasksUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class StopAllTasksUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StopAllTasksUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StopAllTasksUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StopAllTasksUnauthorized( + StopAllTasksUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskBadRequest.cs index 2f20e98..090b50d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class StopTaskBadRequest : Exception - { + public class StopTaskBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class StopTaskBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StopTaskBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StopTaskBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StopTaskBadRequest( + StopTaskBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskUnauthorized.cs index 4ff327c..60bd046 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class StopTaskUnauthorized : Exception - { + public class StopTaskUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class StopTaskUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StopTaskUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StopTaskUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StopTaskUnauthorized( + StopTaskUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionBadRequest.cs index 6873015..5b805fa 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class StopTranscodeSessionBadRequest : Exception - { + public class StopTranscodeSessionBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class StopTranscodeSessionBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StopTranscodeSessionBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StopTranscodeSessionBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StopTranscodeSessionBadRequest( + StopTranscodeSessionBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionUnauthorized.cs index 08b31e8..9ed7dbd 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class StopTranscodeSessionUnauthorized : Exception - { + public class StopTranscodeSessionUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class StopTranscodeSessionUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public StopTranscodeSessionUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use StopTranscodeSessionUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public StopTranscodeSessionUnauthorized( + StopTranscodeSessionUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressBadRequest.cs index 7048318..b08174b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class UpdatePlayProgressBadRequest : Exception - { + public class UpdatePlayProgressBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class UpdatePlayProgressBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public UpdatePlayProgressBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use UpdatePlayProgressBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public UpdatePlayProgressBadRequest( + UpdatePlayProgressBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressUnauthorized.cs index a376e41..1945233 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class UpdatePlayProgressUnauthorized : Exception - { + public class UpdatePlayProgressUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class UpdatePlayProgressUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public UpdatePlayProgressUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use UpdatePlayProgressUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public UpdatePlayProgressUnauthorized( + UpdatePlayProgressUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistBadRequest.cs index 3458b36..544b69b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class UpdatePlaylistBadRequest : Exception - { + public class UpdatePlaylistBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class UpdatePlaylistBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public UpdatePlaylistBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use UpdatePlaylistBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public UpdatePlaylistBadRequest( + UpdatePlaylistBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistUnauthorized.cs index b6cf141..2d7f08d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class UpdatePlaylistUnauthorized : Exception - { + public class UpdatePlaylistUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class UpdatePlaylistUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public UpdatePlaylistUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use UpdatePlaylistUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public UpdatePlaylistUnauthorized( + UpdatePlaylistUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistBadRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistBadRequest.cs index f828eaf..0ca0792 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistBadRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistBadRequest.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Bad Request - A parameter was not specified, or was specified incorrectly. - /// - public class UploadPlaylistBadRequest : Exception - { + public class UploadPlaylistBadRequestPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Bad Request - A parameter was not specified, or was specified incorrectly. + /// + public class UploadPlaylistBadRequest : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public UploadPlaylistBadRequestPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use UploadPlaylistBadRequest.Payload.Errors instead.")] + public List? Errors { get; set; } + + public UploadPlaylistBadRequest( + UploadPlaylistBadRequestPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistUnauthorized.cs b/LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistUnauthorized.cs index 6f77ea2..dbf0508 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistUnauthorized.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistUnauthorized.cs @@ -15,13 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors using System; using System.Collections.Generic; using System.Net.Http; - - /// - /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. - /// - public class UploadPlaylistUnauthorized : Exception - { + public class UploadPlaylistUnauthorizedPayload + { [JsonProperty("errors")] public List? Errors { get; set; } @@ -31,4 +27,32 @@ namespace LukeHagar.PlexAPI.SDK.Models.Errors [JsonProperty("-")] public HttpResponseMessage? RawResponse { get; set; } } + + /// + /// Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + /// + public class UploadPlaylistUnauthorized : PlexAPIError + { + /// + /// The original data that was passed to this exception. + /// + public UploadPlaylistUnauthorizedPayload Payload { get; } + + [Obsolete("This field will be removed in a future release, please migrate away from it as soon as possible. Use UploadPlaylistUnauthorized.Payload.Errors instead.")] + public List? Errors { get; set; } + + public UploadPlaylistUnauthorized( + UploadPlaylistUnauthorizedPayload payload, + HttpResponseMessage rawResponse, + string body + ): base("API error occurred", rawResponse, body) + { + Payload = payload; + + #pragma warning disable CS0618 + Errors = payload.Errors; + #pragma warning restore CS0618 + } + } + } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/CreatePlaylistQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/CreatePlaylistQueryParamType.cs index 4d62411..2d219b9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/CreatePlaylistQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/CreatePlaylistQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// type of playlist to create /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/Filter.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/Filter.cs index ea99090..41e7ca8 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/Filter.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/Filter.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// Filter /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/FlattenSeasons.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/FlattenSeasons.cs index 2a23be4..b13550f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/FlattenSeasons.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/FlattenSeasons.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetActorsLibraryQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetActorsLibraryQueryParamType.cs index aad85b1..0910698 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetActorsLibraryQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetActorsLibraryQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetAllLibrariesType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetAllLibrariesType.cs index 4347452..382a449 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetAllLibrariesType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetAllLibrariesType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The library type /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetCountriesLibraryQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetCountriesLibraryQueryParamType.cs index 2ce666d..406d92c 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetCountriesLibraryQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetCountriesLibraryQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetGenresLibraryQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetGenresLibraryQueryParamType.cs index efbff91..4ab2d63 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetGenresLibraryQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetGenresLibraryQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsLibraryOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsLibraryOptimizedForStreaming.cs index c0e6ba1..80eedbc 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsLibraryOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsLibraryOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetLibraryItemsLibraryOptimizedForStreamingType { private GetLibraryItemsLibraryOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetLibraryItemsLibraryOptimizedForStreamingType GetLibraryItemsOptimizedForStreaming1 { get { return new GetLibraryItemsLibraryOptimizedForStreamingType("get-library-items_optimizedForStreaming_1"); } } - + public static GetLibraryItemsLibraryOptimizedForStreamingType Boolean { get { return new GetLibraryItemsLibraryOptimizedForStreamingType("boolean"); } } - + public static GetLibraryItemsLibraryOptimizedForStreamingType Null { get { return new GetLibraryItemsLibraryOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -64,8 +64,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// ///
[JsonConverter(typeof(GetLibraryItemsLibraryOptimizedForStreaming.GetLibraryItemsLibraryOptimizedForStreamingConverter))] - public class GetLibraryItemsLibraryOptimizedForStreaming { - public GetLibraryItemsLibraryOptimizedForStreaming(GetLibraryItemsLibraryOptimizedForStreamingType type) { + public class GetLibraryItemsLibraryOptimizedForStreaming + { + public GetLibraryItemsLibraryOptimizedForStreaming(GetLibraryItemsLibraryOptimizedForStreamingType type) + { Type = type; } @@ -76,17 +78,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetLibraryItemsLibraryOptimizedForStreamingType Type { get; set; } - - - public static GetLibraryItemsLibraryOptimizedForStreaming CreateGetLibraryItemsOptimizedForStreaming1(GetLibraryItemsOptimizedForStreaming1 getLibraryItemsOptimizedForStreaming1) { + public static GetLibraryItemsLibraryOptimizedForStreaming CreateGetLibraryItemsOptimizedForStreaming1(GetLibraryItemsOptimizedForStreaming1 getLibraryItemsOptimizedForStreaming1) + { GetLibraryItemsLibraryOptimizedForStreamingType typ = GetLibraryItemsLibraryOptimizedForStreamingType.GetLibraryItemsOptimizedForStreaming1; GetLibraryItemsLibraryOptimizedForStreaming res = new GetLibraryItemsLibraryOptimizedForStreaming(typ); res.GetLibraryItemsOptimizedForStreaming1 = getLibraryItemsOptimizedForStreaming1; return res; } - - public static GetLibraryItemsLibraryOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetLibraryItemsLibraryOptimizedForStreaming CreateBoolean(bool boolean) + { GetLibraryItemsLibraryOptimizedForStreamingType typ = GetLibraryItemsLibraryOptimizedForStreamingType.Boolean; GetLibraryItemsLibraryOptimizedForStreaming res = new GetLibraryItemsLibraryOptimizedForStreaming(typ); @@ -94,7 +95,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetLibraryItemsLibraryOptimizedForStreaming CreateNull() { + public static GetLibraryItemsLibraryOptimizedForStreaming CreateNull() + { GetLibraryItemsLibraryOptimizedForStreamingType typ = GetLibraryItemsLibraryOptimizedForStreamingType.Null; return new GetLibraryItemsLibraryOptimizedForStreaming(typ); } @@ -178,23 +180,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetLibraryItemsLibraryOptimizedForStreaming res = (GetLibraryItemsLibraryOptimizedForStreaming)value; if (GetLibraryItemsLibraryOptimizedForStreamingType.FromString(res.Type).Equals(GetLibraryItemsLibraryOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.GetLibraryItemsOptimizedForStreaming1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.GetLibraryItemsOptimizedForStreaming1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsLibraryResponseType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsLibraryResponseType.cs index 356294e..6d5f034 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsLibraryResponseType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsLibraryResponseType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class GetLibraryItemsLibraryResponseType : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsOptimizedForStreaming.cs index 1a723ed..438a2c3 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetLibraryItemsOptimizedForStreamingType { private GetLibraryItemsOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetLibraryItemsOptimizedForStreamingType OptimizedForStreaming1 { get { return new GetLibraryItemsOptimizedForStreamingType("optimizedForStreaming_1"); } } - + public static GetLibraryItemsOptimizedForStreamingType Boolean { get { return new GetLibraryItemsOptimizedForStreamingType("boolean"); } } - + public static GetLibraryItemsOptimizedForStreamingType Null { get { return new GetLibraryItemsOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -60,8 +60,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true ///
[JsonConverter(typeof(GetLibraryItemsOptimizedForStreaming.GetLibraryItemsOptimizedForStreamingConverter))] - public class GetLibraryItemsOptimizedForStreaming { - public GetLibraryItemsOptimizedForStreaming(GetLibraryItemsOptimizedForStreamingType type) { + public class GetLibraryItemsOptimizedForStreaming + { + public GetLibraryItemsOptimizedForStreaming(GetLibraryItemsOptimizedForStreamingType type) + { Type = type; } @@ -72,17 +74,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetLibraryItemsOptimizedForStreamingType Type { get; set; } - - - public static GetLibraryItemsOptimizedForStreaming CreateOptimizedForStreaming1(OptimizedForStreaming1 optimizedForStreaming1) { + public static GetLibraryItemsOptimizedForStreaming CreateOptimizedForStreaming1(OptimizedForStreaming1 optimizedForStreaming1) + { GetLibraryItemsOptimizedForStreamingType typ = GetLibraryItemsOptimizedForStreamingType.OptimizedForStreaming1; GetLibraryItemsOptimizedForStreaming res = new GetLibraryItemsOptimizedForStreaming(typ); res.OptimizedForStreaming1 = optimizedForStreaming1; return res; } - - public static GetLibraryItemsOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetLibraryItemsOptimizedForStreaming CreateBoolean(bool boolean) + { GetLibraryItemsOptimizedForStreamingType typ = GetLibraryItemsOptimizedForStreamingType.Boolean; GetLibraryItemsOptimizedForStreaming res = new GetLibraryItemsOptimizedForStreaming(typ); @@ -90,7 +91,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetLibraryItemsOptimizedForStreaming CreateNull() { + public static GetLibraryItemsOptimizedForStreaming CreateNull() + { GetLibraryItemsOptimizedForStreamingType typ = GetLibraryItemsOptimizedForStreamingType.Null; return new GetLibraryItemsOptimizedForStreaming(typ); } @@ -174,23 +176,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetLibraryItemsOptimizedForStreaming res = (GetLibraryItemsOptimizedForStreaming)value; if (GetLibraryItemsOptimizedForStreamingType.FromString(res.Type).Equals(GetLibraryItemsOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.OptimizedForStreaming1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.OptimizedForStreaming1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsQueryParamType.cs index 7a11912..e1520c8 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsType.cs index a267327..bb317b9 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media content in the Plex library. This can represent videos, music, or photos.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryOptimizedForStreaming.cs index 68f1f94..e3f1acf 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetLibrarySectionsAllLibraryOptimizedForStreamingType { private GetLibrarySectionsAllLibraryOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetLibrarySectionsAllLibraryOptimizedForStreamingType GetLibrarySectionsAllOptimizedForStreamingLibrary1 { get { return new GetLibrarySectionsAllLibraryOptimizedForStreamingType("get-library-sections-all_optimizedForStreaming_Library_1"); } } - + public static GetLibrarySectionsAllLibraryOptimizedForStreamingType Boolean { get { return new GetLibrarySectionsAllLibraryOptimizedForStreamingType("boolean"); } } - + public static GetLibrarySectionsAllLibraryOptimizedForStreamingType Null { get { return new GetLibrarySectionsAllLibraryOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -60,8 +60,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true ///
[JsonConverter(typeof(GetLibrarySectionsAllLibraryOptimizedForStreaming.GetLibrarySectionsAllLibraryOptimizedForStreamingConverter))] - public class GetLibrarySectionsAllLibraryOptimizedForStreaming { - public GetLibrarySectionsAllLibraryOptimizedForStreaming(GetLibrarySectionsAllLibraryOptimizedForStreamingType type) { + public class GetLibrarySectionsAllLibraryOptimizedForStreaming + { + public GetLibrarySectionsAllLibraryOptimizedForStreaming(GetLibrarySectionsAllLibraryOptimizedForStreamingType type) + { Type = type; } @@ -72,17 +74,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetLibrarySectionsAllLibraryOptimizedForStreamingType Type { get; set; } - - - public static GetLibrarySectionsAllLibraryOptimizedForStreaming CreateGetLibrarySectionsAllOptimizedForStreamingLibrary1(GetLibrarySectionsAllOptimizedForStreamingLibrary1 getLibrarySectionsAllOptimizedForStreamingLibrary1) { + public static GetLibrarySectionsAllLibraryOptimizedForStreaming CreateGetLibrarySectionsAllOptimizedForStreamingLibrary1(GetLibrarySectionsAllOptimizedForStreamingLibrary1 getLibrarySectionsAllOptimizedForStreamingLibrary1) + { GetLibrarySectionsAllLibraryOptimizedForStreamingType typ = GetLibrarySectionsAllLibraryOptimizedForStreamingType.GetLibrarySectionsAllOptimizedForStreamingLibrary1; GetLibrarySectionsAllLibraryOptimizedForStreaming res = new GetLibrarySectionsAllLibraryOptimizedForStreaming(typ); res.GetLibrarySectionsAllOptimizedForStreamingLibrary1 = getLibrarySectionsAllOptimizedForStreamingLibrary1; return res; } - - public static GetLibrarySectionsAllLibraryOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetLibrarySectionsAllLibraryOptimizedForStreaming CreateBoolean(bool boolean) + { GetLibrarySectionsAllLibraryOptimizedForStreamingType typ = GetLibrarySectionsAllLibraryOptimizedForStreamingType.Boolean; GetLibrarySectionsAllLibraryOptimizedForStreaming res = new GetLibrarySectionsAllLibraryOptimizedForStreaming(typ); @@ -90,7 +91,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetLibrarySectionsAllLibraryOptimizedForStreaming CreateNull() { + public static GetLibrarySectionsAllLibraryOptimizedForStreaming CreateNull() + { GetLibrarySectionsAllLibraryOptimizedForStreamingType typ = GetLibrarySectionsAllLibraryOptimizedForStreamingType.Null; return new GetLibrarySectionsAllLibraryOptimizedForStreaming(typ); } @@ -174,23 +176,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetLibrarySectionsAllLibraryOptimizedForStreaming res = (GetLibrarySectionsAllLibraryOptimizedForStreaming)value; if (GetLibrarySectionsAllLibraryOptimizedForStreamingType.FromString(res.Type).Equals(GetLibrarySectionsAllLibraryOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.GetLibrarySectionsAllOptimizedForStreamingLibrary1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.GetLibrarySectionsAllOptimizedForStreamingLibrary1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryResponseType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryResponseType.cs index 13cd001..b425831 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryResponseType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryResponseType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class GetLibrarySectionsAllLibraryResponseType : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryType.cs index 46a123c..fff0d2a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllLibraryType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media content in the Plex library. This can represent videos, music, or photos.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllOptimizedForStreaming.cs index f6b9e73..41b9c95 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetLibrarySectionsAllOptimizedForStreamingType { private GetLibrarySectionsAllOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetLibrarySectionsAllOptimizedForStreamingType GetLibrarySectionsAllOptimizedForStreaming1 { get { return new GetLibrarySectionsAllOptimizedForStreamingType("get-library-sections-all_optimizedForStreaming_1"); } } - + public static GetLibrarySectionsAllOptimizedForStreamingType Boolean { get { return new GetLibrarySectionsAllOptimizedForStreamingType("boolean"); } } - + public static GetLibrarySectionsAllOptimizedForStreamingType Null { get { return new GetLibrarySectionsAllOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -60,8 +60,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true ///
[JsonConverter(typeof(GetLibrarySectionsAllOptimizedForStreaming.GetLibrarySectionsAllOptimizedForStreamingConverter))] - public class GetLibrarySectionsAllOptimizedForStreaming { - public GetLibrarySectionsAllOptimizedForStreaming(GetLibrarySectionsAllOptimizedForStreamingType type) { + public class GetLibrarySectionsAllOptimizedForStreaming + { + public GetLibrarySectionsAllOptimizedForStreaming(GetLibrarySectionsAllOptimizedForStreamingType type) + { Type = type; } @@ -72,17 +74,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetLibrarySectionsAllOptimizedForStreamingType Type { get; set; } - - - public static GetLibrarySectionsAllOptimizedForStreaming CreateGetLibrarySectionsAllOptimizedForStreaming1(GetLibrarySectionsAllOptimizedForStreaming1 getLibrarySectionsAllOptimizedForStreaming1) { + public static GetLibrarySectionsAllOptimizedForStreaming CreateGetLibrarySectionsAllOptimizedForStreaming1(GetLibrarySectionsAllOptimizedForStreaming1 getLibrarySectionsAllOptimizedForStreaming1) + { GetLibrarySectionsAllOptimizedForStreamingType typ = GetLibrarySectionsAllOptimizedForStreamingType.GetLibrarySectionsAllOptimizedForStreaming1; GetLibrarySectionsAllOptimizedForStreaming res = new GetLibrarySectionsAllOptimizedForStreaming(typ); res.GetLibrarySectionsAllOptimizedForStreaming1 = getLibrarySectionsAllOptimizedForStreaming1; return res; } - - public static GetLibrarySectionsAllOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetLibrarySectionsAllOptimizedForStreaming CreateBoolean(bool boolean) + { GetLibrarySectionsAllOptimizedForStreamingType typ = GetLibrarySectionsAllOptimizedForStreamingType.Boolean; GetLibrarySectionsAllOptimizedForStreaming res = new GetLibrarySectionsAllOptimizedForStreaming(typ); @@ -90,7 +91,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetLibrarySectionsAllOptimizedForStreaming CreateNull() { + public static GetLibrarySectionsAllOptimizedForStreaming CreateNull() + { GetLibrarySectionsAllOptimizedForStreamingType typ = GetLibrarySectionsAllOptimizedForStreamingType.Null; return new GetLibrarySectionsAllOptimizedForStreaming(typ); } @@ -174,23 +176,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetLibrarySectionsAllOptimizedForStreaming res = (GetLibrarySectionsAllOptimizedForStreaming)value; if (GetLibrarySectionsAllOptimizedForStreamingType.FromString(res.Type).Equals(GetLibrarySectionsAllOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.GetLibrarySectionsAllOptimizedForStreaming1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.GetLibrarySectionsAllOptimizedForStreaming1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllQueryParamType.cs index a8377a3..1e9682f 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibrarySectionsAllQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataLibraryOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataLibraryOptimizedForStreaming.cs index 2ce0ba2..b4448f1 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataLibraryOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataLibraryOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetMediaMetaDataLibraryOptimizedForStreamingType { private GetMediaMetaDataLibraryOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetMediaMetaDataLibraryOptimizedForStreamingType GetMediaMetaDataOptimizedForStreamingLibrary1 { get { return new GetMediaMetaDataLibraryOptimizedForStreamingType("get-media-meta-data_optimizedForStreaming_Library_1"); } } - + public static GetMediaMetaDataLibraryOptimizedForStreamingType Boolean { get { return new GetMediaMetaDataLibraryOptimizedForStreamingType("boolean"); } } - + public static GetMediaMetaDataLibraryOptimizedForStreamingType Null { get { return new GetMediaMetaDataLibraryOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -64,8 +64,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// ///
[JsonConverter(typeof(GetMediaMetaDataLibraryOptimizedForStreaming.GetMediaMetaDataLibraryOptimizedForStreamingConverter))] - public class GetMediaMetaDataLibraryOptimizedForStreaming { - public GetMediaMetaDataLibraryOptimizedForStreaming(GetMediaMetaDataLibraryOptimizedForStreamingType type) { + public class GetMediaMetaDataLibraryOptimizedForStreaming + { + public GetMediaMetaDataLibraryOptimizedForStreaming(GetMediaMetaDataLibraryOptimizedForStreamingType type) + { Type = type; } @@ -76,17 +78,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetMediaMetaDataLibraryOptimizedForStreamingType Type { get; set; } - - - public static GetMediaMetaDataLibraryOptimizedForStreaming CreateGetMediaMetaDataOptimizedForStreamingLibrary1(GetMediaMetaDataOptimizedForStreamingLibrary1 getMediaMetaDataOptimizedForStreamingLibrary1) { + public static GetMediaMetaDataLibraryOptimizedForStreaming CreateGetMediaMetaDataOptimizedForStreamingLibrary1(GetMediaMetaDataOptimizedForStreamingLibrary1 getMediaMetaDataOptimizedForStreamingLibrary1) + { GetMediaMetaDataLibraryOptimizedForStreamingType typ = GetMediaMetaDataLibraryOptimizedForStreamingType.GetMediaMetaDataOptimizedForStreamingLibrary1; GetMediaMetaDataLibraryOptimizedForStreaming res = new GetMediaMetaDataLibraryOptimizedForStreaming(typ); res.GetMediaMetaDataOptimizedForStreamingLibrary1 = getMediaMetaDataOptimizedForStreamingLibrary1; return res; } - - public static GetMediaMetaDataLibraryOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetMediaMetaDataLibraryOptimizedForStreaming CreateBoolean(bool boolean) + { GetMediaMetaDataLibraryOptimizedForStreamingType typ = GetMediaMetaDataLibraryOptimizedForStreamingType.Boolean; GetMediaMetaDataLibraryOptimizedForStreaming res = new GetMediaMetaDataLibraryOptimizedForStreaming(typ); @@ -94,7 +95,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetMediaMetaDataLibraryOptimizedForStreaming CreateNull() { + public static GetMediaMetaDataLibraryOptimizedForStreaming CreateNull() + { GetMediaMetaDataLibraryOptimizedForStreamingType typ = GetMediaMetaDataLibraryOptimizedForStreamingType.Null; return new GetMediaMetaDataLibraryOptimizedForStreaming(typ); } @@ -178,23 +180,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetMediaMetaDataLibraryOptimizedForStreaming res = (GetMediaMetaDataLibraryOptimizedForStreaming)value; if (GetMediaMetaDataLibraryOptimizedForStreamingType.FromString(res.Type).Equals(GetMediaMetaDataLibraryOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.GetMediaMetaDataOptimizedForStreamingLibrary1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.GetMediaMetaDataOptimizedForStreamingLibrary1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataLibraryType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataLibraryType.cs index 54abe7b..e54cc61 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataLibraryType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataLibraryType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class GetMediaMetaDataLibraryType : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataOptimizedForStreaming.cs index 639d5d2..6344101 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetMediaMetaDataOptimizedForStreamingType { private GetMediaMetaDataOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetMediaMetaDataOptimizedForStreamingType GetMediaMetaDataOptimizedForStreaming1 { get { return new GetMediaMetaDataOptimizedForStreamingType("get-media-meta-data_optimizedForStreaming_1"); } } - + public static GetMediaMetaDataOptimizedForStreamingType Boolean { get { return new GetMediaMetaDataOptimizedForStreamingType("boolean"); } } - + public static GetMediaMetaDataOptimizedForStreamingType Null { get { return new GetMediaMetaDataOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -60,8 +60,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true ///
[JsonConverter(typeof(GetMediaMetaDataOptimizedForStreaming.GetMediaMetaDataOptimizedForStreamingConverter))] - public class GetMediaMetaDataOptimizedForStreaming { - public GetMediaMetaDataOptimizedForStreaming(GetMediaMetaDataOptimizedForStreamingType type) { + public class GetMediaMetaDataOptimizedForStreaming + { + public GetMediaMetaDataOptimizedForStreaming(GetMediaMetaDataOptimizedForStreamingType type) + { Type = type; } @@ -72,17 +74,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetMediaMetaDataOptimizedForStreamingType Type { get; set; } - - - public static GetMediaMetaDataOptimizedForStreaming CreateGetMediaMetaDataOptimizedForStreaming1(GetMediaMetaDataOptimizedForStreaming1 getMediaMetaDataOptimizedForStreaming1) { + public static GetMediaMetaDataOptimizedForStreaming CreateGetMediaMetaDataOptimizedForStreaming1(GetMediaMetaDataOptimizedForStreaming1 getMediaMetaDataOptimizedForStreaming1) + { GetMediaMetaDataOptimizedForStreamingType typ = GetMediaMetaDataOptimizedForStreamingType.GetMediaMetaDataOptimizedForStreaming1; GetMediaMetaDataOptimizedForStreaming res = new GetMediaMetaDataOptimizedForStreaming(typ); res.GetMediaMetaDataOptimizedForStreaming1 = getMediaMetaDataOptimizedForStreaming1; return res; } - - public static GetMediaMetaDataOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetMediaMetaDataOptimizedForStreaming CreateBoolean(bool boolean) + { GetMediaMetaDataOptimizedForStreamingType typ = GetMediaMetaDataOptimizedForStreamingType.Boolean; GetMediaMetaDataOptimizedForStreaming res = new GetMediaMetaDataOptimizedForStreaming(typ); @@ -90,7 +91,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetMediaMetaDataOptimizedForStreaming CreateNull() { + public static GetMediaMetaDataOptimizedForStreaming CreateNull() + { GetMediaMetaDataOptimizedForStreamingType typ = GetMediaMetaDataOptimizedForStreamingType.Null; return new GetMediaMetaDataOptimizedForStreaming(typ); } @@ -174,23 +176,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetMediaMetaDataOptimizedForStreaming res = (GetMediaMetaDataOptimizedForStreaming)value; if (GetMediaMetaDataOptimizedForStreamingType.FromString(res.Type).Equals(GetMediaMetaDataOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.GetMediaMetaDataOptimizedForStreaming1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.GetMediaMetaDataOptimizedForStreaming1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataType.cs index 3dcaf7e..cded03e 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaMetaDataType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media content in the Plex library. This can represent videos, music, or photos.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetPlaylistContentsQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetPlaylistContentsQueryParamType.cs index 6136aee..28a7869 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetPlaylistContentsQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetPlaylistContentsQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedHubsResponseType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedHubsResponseType.cs index 2577e46..dfc5552 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedHubsResponseType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedHubsResponseType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class GetRecentlyAddedHubsResponseType : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedHubsType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedHubsType.cs index 638bb6f..99ac550 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedHubsType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedHubsType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media content in the Plex library. This can represent videos, music, or photos.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedOptimizedForStreaming.cs index 2613eb5..cc467f2 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetRecentlyAddedOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetRecentlyAddedOptimizedForStreamingType { private GetRecentlyAddedOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetRecentlyAddedOptimizedForStreamingType GetRecentlyAddedOptimizedForStreaming1 { get { return new GetRecentlyAddedOptimizedForStreamingType("get-recently-added_optimizedForStreaming_1"); } } - + public static GetRecentlyAddedOptimizedForStreamingType Boolean { get { return new GetRecentlyAddedOptimizedForStreamingType("boolean"); } } - + public static GetRecentlyAddedOptimizedForStreamingType Null { get { return new GetRecentlyAddedOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -60,8 +60,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true ///
[JsonConverter(typeof(GetRecentlyAddedOptimizedForStreaming.GetRecentlyAddedOptimizedForStreamingConverter))] - public class GetRecentlyAddedOptimizedForStreaming { - public GetRecentlyAddedOptimizedForStreaming(GetRecentlyAddedOptimizedForStreamingType type) { + public class GetRecentlyAddedOptimizedForStreaming + { + public GetRecentlyAddedOptimizedForStreaming(GetRecentlyAddedOptimizedForStreamingType type) + { Type = type; } @@ -72,17 +74,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetRecentlyAddedOptimizedForStreamingType Type { get; set; } - - - public static GetRecentlyAddedOptimizedForStreaming CreateGetRecentlyAddedOptimizedForStreaming1(GetRecentlyAddedOptimizedForStreaming1 getRecentlyAddedOptimizedForStreaming1) { + public static GetRecentlyAddedOptimizedForStreaming CreateGetRecentlyAddedOptimizedForStreaming1(GetRecentlyAddedOptimizedForStreaming1 getRecentlyAddedOptimizedForStreaming1) + { GetRecentlyAddedOptimizedForStreamingType typ = GetRecentlyAddedOptimizedForStreamingType.GetRecentlyAddedOptimizedForStreaming1; GetRecentlyAddedOptimizedForStreaming res = new GetRecentlyAddedOptimizedForStreaming(typ); res.GetRecentlyAddedOptimizedForStreaming1 = getRecentlyAddedOptimizedForStreaming1; return res; } - - public static GetRecentlyAddedOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetRecentlyAddedOptimizedForStreaming CreateBoolean(bool boolean) + { GetRecentlyAddedOptimizedForStreamingType typ = GetRecentlyAddedOptimizedForStreamingType.Boolean; GetRecentlyAddedOptimizedForStreaming res = new GetRecentlyAddedOptimizedForStreaming(typ); @@ -90,7 +91,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetRecentlyAddedOptimizedForStreaming CreateNull() { + public static GetRecentlyAddedOptimizedForStreaming CreateNull() + { GetRecentlyAddedOptimizedForStreamingType typ = GetRecentlyAddedOptimizedForStreamingType.Null; return new GetRecentlyAddedOptimizedForStreaming(typ); } @@ -174,23 +176,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetRecentlyAddedOptimizedForStreaming res = (GetRecentlyAddedOptimizedForStreaming)value; if (GetRecentlyAddedOptimizedForStreamingType.FromString(res.Type).Equals(GetRecentlyAddedOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.GetRecentlyAddedOptimizedForStreaming1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.GetRecentlyAddedOptimizedForStreaming1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesFlattenSeasons.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesFlattenSeasons.cs index 789891a..20ce29b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesFlattenSeasons.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesFlattenSeasons.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesLibraryOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesLibraryOptimizedForStreaming.cs index 20d6e6c..4caa948 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesLibraryOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesLibraryOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetSearchAllLibrariesLibraryOptimizedForStreamingType { private GetSearchAllLibrariesLibraryOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetSearchAllLibrariesLibraryOptimizedForStreamingType GetSearchAllLibrariesOptimizedForStreamingLibrary1 { get { return new GetSearchAllLibrariesLibraryOptimizedForStreamingType("get-search-all-libraries_optimizedForStreaming_Library_1"); } } - + public static GetSearchAllLibrariesLibraryOptimizedForStreamingType Boolean { get { return new GetSearchAllLibrariesLibraryOptimizedForStreamingType("boolean"); } } - + public static GetSearchAllLibrariesLibraryOptimizedForStreamingType Null { get { return new GetSearchAllLibrariesLibraryOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -64,8 +64,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// ///
[JsonConverter(typeof(GetSearchAllLibrariesLibraryOptimizedForStreaming.GetSearchAllLibrariesLibraryOptimizedForStreamingConverter))] - public class GetSearchAllLibrariesLibraryOptimizedForStreaming { - public GetSearchAllLibrariesLibraryOptimizedForStreaming(GetSearchAllLibrariesLibraryOptimizedForStreamingType type) { + public class GetSearchAllLibrariesLibraryOptimizedForStreaming + { + public GetSearchAllLibrariesLibraryOptimizedForStreaming(GetSearchAllLibrariesLibraryOptimizedForStreamingType type) + { Type = type; } @@ -76,17 +78,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetSearchAllLibrariesLibraryOptimizedForStreamingType Type { get; set; } - - - public static GetSearchAllLibrariesLibraryOptimizedForStreaming CreateGetSearchAllLibrariesOptimizedForStreamingLibrary1(GetSearchAllLibrariesOptimizedForStreamingLibrary1 getSearchAllLibrariesOptimizedForStreamingLibrary1) { + public static GetSearchAllLibrariesLibraryOptimizedForStreaming CreateGetSearchAllLibrariesOptimizedForStreamingLibrary1(GetSearchAllLibrariesOptimizedForStreamingLibrary1 getSearchAllLibrariesOptimizedForStreamingLibrary1) + { GetSearchAllLibrariesLibraryOptimizedForStreamingType typ = GetSearchAllLibrariesLibraryOptimizedForStreamingType.GetSearchAllLibrariesOptimizedForStreamingLibrary1; GetSearchAllLibrariesLibraryOptimizedForStreaming res = new GetSearchAllLibrariesLibraryOptimizedForStreaming(typ); res.GetSearchAllLibrariesOptimizedForStreamingLibrary1 = getSearchAllLibrariesOptimizedForStreamingLibrary1; return res; } - - public static GetSearchAllLibrariesLibraryOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetSearchAllLibrariesLibraryOptimizedForStreaming CreateBoolean(bool boolean) + { GetSearchAllLibrariesLibraryOptimizedForStreamingType typ = GetSearchAllLibrariesLibraryOptimizedForStreamingType.Boolean; GetSearchAllLibrariesLibraryOptimizedForStreaming res = new GetSearchAllLibrariesLibraryOptimizedForStreaming(typ); @@ -94,7 +95,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetSearchAllLibrariesLibraryOptimizedForStreaming CreateNull() { + public static GetSearchAllLibrariesLibraryOptimizedForStreaming CreateNull() + { GetSearchAllLibrariesLibraryOptimizedForStreamingType typ = GetSearchAllLibrariesLibraryOptimizedForStreamingType.Null; return new GetSearchAllLibrariesLibraryOptimizedForStreaming(typ); } @@ -178,23 +180,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetSearchAllLibrariesLibraryOptimizedForStreaming res = (GetSearchAllLibrariesLibraryOptimizedForStreaming)value; if (GetSearchAllLibrariesLibraryOptimizedForStreamingType.FromString(res.Type).Equals(GetSearchAllLibrariesLibraryOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.GetSearchAllLibrariesOptimizedForStreamingLibrary1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.GetSearchAllLibrariesOptimizedForStreamingLibrary1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesLibraryType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesLibraryType.cs index 4670cbe..5f14ba0 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesLibraryType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesLibraryType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class GetSearchAllLibrariesLibraryType : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesOptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesOptimizedForStreaming.cs index 531d4c0..b8e8e01 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesOptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesOptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class GetSearchAllLibrariesOptimizedForStreamingType { private GetSearchAllLibrariesOptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static GetSearchAllLibrariesOptimizedForStreamingType GetSearchAllLibrariesOptimizedForStreaming1 { get { return new GetSearchAllLibrariesOptimizedForStreamingType("get-search-all-libraries_optimizedForStreaming_1"); } } - + public static GetSearchAllLibrariesOptimizedForStreamingType Boolean { get { return new GetSearchAllLibrariesOptimizedForStreamingType("boolean"); } } - + public static GetSearchAllLibrariesOptimizedForStreamingType Null { get { return new GetSearchAllLibrariesOptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -60,8 +60,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true ///
[JsonConverter(typeof(GetSearchAllLibrariesOptimizedForStreaming.GetSearchAllLibrariesOptimizedForStreamingConverter))] - public class GetSearchAllLibrariesOptimizedForStreaming { - public GetSearchAllLibrariesOptimizedForStreaming(GetSearchAllLibrariesOptimizedForStreamingType type) { + public class GetSearchAllLibrariesOptimizedForStreaming + { + public GetSearchAllLibrariesOptimizedForStreaming(GetSearchAllLibrariesOptimizedForStreamingType type) + { Type = type; } @@ -72,17 +74,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public GetSearchAllLibrariesOptimizedForStreamingType Type { get; set; } - - - public static GetSearchAllLibrariesOptimizedForStreaming CreateGetSearchAllLibrariesOptimizedForStreaming1(GetSearchAllLibrariesOptimizedForStreaming1 getSearchAllLibrariesOptimizedForStreaming1) { + public static GetSearchAllLibrariesOptimizedForStreaming CreateGetSearchAllLibrariesOptimizedForStreaming1(GetSearchAllLibrariesOptimizedForStreaming1 getSearchAllLibrariesOptimizedForStreaming1) + { GetSearchAllLibrariesOptimizedForStreamingType typ = GetSearchAllLibrariesOptimizedForStreamingType.GetSearchAllLibrariesOptimizedForStreaming1; GetSearchAllLibrariesOptimizedForStreaming res = new GetSearchAllLibrariesOptimizedForStreaming(typ); res.GetSearchAllLibrariesOptimizedForStreaming1 = getSearchAllLibrariesOptimizedForStreaming1; return res; } - - public static GetSearchAllLibrariesOptimizedForStreaming CreateBoolean(bool boolean) { + public static GetSearchAllLibrariesOptimizedForStreaming CreateBoolean(bool boolean) + { GetSearchAllLibrariesOptimizedForStreamingType typ = GetSearchAllLibrariesOptimizedForStreamingType.Boolean; GetSearchAllLibrariesOptimizedForStreaming res = new GetSearchAllLibrariesOptimizedForStreaming(typ); @@ -90,7 +91,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static GetSearchAllLibrariesOptimizedForStreaming CreateNull() { + public static GetSearchAllLibrariesOptimizedForStreaming CreateNull() + { GetSearchAllLibrariesOptimizedForStreamingType typ = GetSearchAllLibrariesOptimizedForStreamingType.Null; return new GetSearchAllLibrariesOptimizedForStreaming(typ); } @@ -174,23 +176,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + GetSearchAllLibrariesOptimizedForStreaming res = (GetSearchAllLibrariesOptimizedForStreaming)value; if (GetSearchAllLibrariesOptimizedForStreamingType.FromString(res.Type).Equals(GetSearchAllLibrariesOptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.GetSearchAllLibrariesOptimizedForStreaming1 != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.GetSearchAllLibrariesOptimizedForStreaming1)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesShowOrdering.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesShowOrdering.cs index b15f19f..bfaeba4 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesShowOrdering.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesShowOrdering.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// Setting that indicates the episode ordering for the show.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesType.cs index de9d14b..9cae99d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchAllLibrariesType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media content in the Plex library. This can represent videos, music, or photos.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchLibraryQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchLibraryQueryParamType.cs index aadc954..957a88d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchLibraryQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetSearchLibraryQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsAuthenticationResponseStatus.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsAuthenticationResponseStatus.cs index 72c0193..0e273d8 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsAuthenticationResponseStatus.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsAuthenticationResponseStatus.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// String representation of subscriptionActive /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsAuthenticationStatus.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsAuthenticationStatus.cs index c60bc18..2c44092 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsAuthenticationStatus.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsAuthenticationStatus.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// String representation of subscriptionActive /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsStatus.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsStatus.cs index 387ef60..2f06ef3 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsStatus.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenDetailsStatus.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class GetTokenDetailsStatus : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTopWatchedContentQueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTopWatchedContentQueryParamType.cs index 6b9886c..48bdda4 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTopWatchedContentQueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTopWatchedContentQueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/Level.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/Level.cs index f1044c7..00f6719 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/Level.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/Level.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// An integer log level to write to the PMS log with.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/Libtype.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/Libtype.cs index 81138f1..6998629 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/Libtype.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/Libtype.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of library to filter. Can be "movie" or "show", or all if not present.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/MailingListStatus.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/MailingListStatus.cs index 14d761f..3a4a58e 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/MailingListStatus.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/MailingListStatus.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// Your current mailing list status (active or unsubscribed) /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/OptimizedForStreaming.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/OptimizedForStreaming.cs index f0b1dfd..dc2ee5d 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/OptimizedForStreaming.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/OptimizedForStreaming.cs @@ -17,17 +17,17 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Generic; using System.Numerics; using System.Reflection; - public class OptimizedForStreamingType { private OptimizedForStreamingType(string value) { Value = value; } public string Value { get; private set; } + public static OptimizedForStreamingType One { get { return new OptimizedForStreamingType("1"); } } - + public static OptimizedForStreamingType Boolean { get { return new OptimizedForStreamingType("boolean"); } } - + public static OptimizedForStreamingType Null { get { return new OptimizedForStreamingType("null"); } } public override string ToString() { return Value; } @@ -60,8 +60,10 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests /// Has this media been optimized for streaming. NOTE: This can be 0, 1, false or true ///
[JsonConverter(typeof(OptimizedForStreaming.OptimizedForStreamingConverter))] - public class OptimizedForStreaming { - public OptimizedForStreaming(OptimizedForStreamingType type) { + public class OptimizedForStreaming + { + public OptimizedForStreaming(OptimizedForStreamingType type) + { Type = type; } @@ -72,17 +74,16 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Boolean { get; set; } public OptimizedForStreamingType Type { get; set; } - - - public static OptimizedForStreaming CreateOne(One one) { + public static OptimizedForStreaming CreateOne(One one) + { OptimizedForStreamingType typ = OptimizedForStreamingType.One; OptimizedForStreaming res = new OptimizedForStreaming(typ); res.One = one; return res; } - - public static OptimizedForStreaming CreateBoolean(bool boolean) { + public static OptimizedForStreaming CreateBoolean(bool boolean) + { OptimizedForStreamingType typ = OptimizedForStreamingType.Boolean; OptimizedForStreaming res = new OptimizedForStreaming(typ); @@ -90,7 +91,8 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests return res; } - public static OptimizedForStreaming CreateNull() { + public static OptimizedForStreaming CreateNull() + { OptimizedForStreamingType typ = OptimizedForStreamingType.Null; return new OptimizedForStreaming(typ); } @@ -174,23 +176,25 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests writer.WriteRawValue("null"); return; } + OptimizedForStreaming res = (OptimizedForStreaming)value; if (OptimizedForStreamingType.FromString(res.Type).Equals(OptimizedForStreamingType.Null)) { writer.WriteRawValue("null"); return; } + if (res.One != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.One)); return; } + if (res.Boolean != null) { writer.WriteRawValue(Utilities.SerializeJSON(res.Boolean)); return; } - } } diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/PathParamTaskName.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/PathParamTaskName.cs index e8acc48..3673857 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/PathParamTaskName.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/PathParamTaskName.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The name of the task to be started. /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/PlaylistType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/PlaylistType.cs index 2a2fe82..7aa60ff 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/PlaylistType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/PlaylistType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// limit to a type of playlist. /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataAuthenticationResponseStatus.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataAuthenticationResponseStatus.cs index 2edfcb8..f57c2ed 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataAuthenticationResponseStatus.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataAuthenticationResponseStatus.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// String representation of subscriptionActive /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataAuthenticationStatus.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataAuthenticationStatus.cs index a7099fc..759c94b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataAuthenticationStatus.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataAuthenticationStatus.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// String representation of subscriptionActive /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataMailingListStatus.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataMailingListStatus.cs index 4a4a72f..a9edd48 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataMailingListStatus.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataMailingListStatus.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// Your current mailing list status (active or unsubscribed) /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataState.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataState.cs index 540c7dd..082104e 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataState.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataState.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class PostUsersSignInDataState : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataStatus.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataStatus.cs index a61c747..b5b6700 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataStatus.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataStatus.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class PostUsersSignInDataStatus : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/QueryParamSmart.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/QueryParamSmart.cs index e78aabe..5ea201a 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/QueryParamSmart.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/QueryParamSmart.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// type of playlists to return (default is all). /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/QueryParamType.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/QueryParamType.cs index 9090393..8105c45 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/QueryParamType.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/QueryParamType.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/SearchTypes.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/SearchTypes.cs index 5e238cb..edd0019 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/SearchTypes.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/SearchTypes.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + [JsonConverter(typeof(OpenEnumConverter))] public class SearchTypes : IEquatable { diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/ShowOrdering.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/ShowOrdering.cs index c2b5e97..a1b7177 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/ShowOrdering.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/ShowOrdering.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// Setting that indicates the episode ordering for the show.
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/State.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/State.cs index 8394e4a..53e515b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/State.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/State.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The state of the media item /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/Status.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/Status.cs index 3fb937e..3abf75b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/Status.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/Status.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// Current friend request status /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/Tag.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/Tag.cs index 87e561c..7529ea8 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/Tag.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/Tag.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// A key representing a specific tag within the section. /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/TaskName.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/TaskName.cs index 8d0a0f0..151ef64 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/TaskName.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/TaskName.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// the name of the task to be started. /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/Type.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/Type.cs index d96a070..c41b850 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/Type.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/Type.cs @@ -15,7 +15,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; - + /// /// The type of media to retrieve or filter by.
/// diff --git a/LukeHagar/PlexAPI/SDK/Playlists.cs b/LukeHagar/PlexAPI/SDK/Playlists.cs index 1315ffc..8305a53 100644 --- a/LukeHagar/PlexAPI/SDK/Playlists.cs +++ b/LukeHagar/PlexAPI/SDK/Playlists.cs @@ -148,8 +148,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Playlists(SDKConfig config) @@ -210,7 +210,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + CreatePlaylistResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into CreatePlaylistResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new CreatePlaylistResponse() { StatusCode = responseStatusCode, @@ -221,40 +231,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + CreatePlaylistBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into CreatePlaylistBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new CreatePlaylistBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + CreatePlaylistUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into CreatePlaylistUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new CreatePlaylistUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null) @@ -315,7 +345,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetPlaylistsResponse() { StatusCode = responseStatusCode, @@ -326,40 +366,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetPlaylistsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetPlaylistsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetPlaylistAsync(double playlistID) @@ -419,7 +479,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetPlaylistResponse() { StatusCode = responseStatusCode, @@ -430,40 +500,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetPlaylistBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetPlaylistUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task DeletePlaylistAsync(double playlistID) @@ -520,7 +610,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 204) - { + { return new DeletePlaylistResponse() { StatusCode = responseStatusCode, @@ -532,34 +622,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + DeletePlaylistBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into DeletePlaylistBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new DeletePlaylistBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + DeletePlaylistUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into DeletePlaylistUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new DeletePlaylistUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null) @@ -618,7 +728,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new UpdatePlaylistResponse() { StatusCode = responseStatusCode, @@ -630,34 +740,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UpdatePlaylistBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UpdatePlaylistBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new UpdatePlaylistBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UpdatePlaylistUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UpdatePlaylistUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new UpdatePlaylistUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type) @@ -718,7 +848,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistContentsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistContentsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetPlaylistContentsResponse() { StatusCode = responseStatusCode, @@ -729,40 +869,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistContentsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistContentsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetPlaylistContentsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPlaylistContentsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPlaylistContentsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetPlaylistContentsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task ClearPlaylistContentsAsync(double playlistID) @@ -819,7 +979,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new ClearPlaylistContentsResponse() { StatusCode = responseStatusCode, @@ -831,34 +991,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ClearPlaylistContentsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ClearPlaylistContentsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new ClearPlaylistContentsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ClearPlaylistContentsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ClearPlaylistContentsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new ClearPlaylistContentsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null) @@ -920,7 +1100,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + AddPlaylistContentsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into AddPlaylistContentsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new AddPlaylistContentsResponse() { StatusCode = responseStatusCode, @@ -931,40 +1121,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + AddPlaylistContentsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into AddPlaylistContentsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new AddPlaylistContentsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + AddPlaylistContentsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into AddPlaylistContentsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new AddPlaylistContentsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task UploadPlaylistAsync(string path, QueryParamForce force, long sectionID = 1) @@ -1023,7 +1233,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new UploadPlaylistResponse() { StatusCode = responseStatusCode, @@ -1035,34 +1245,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UploadPlaylistBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UploadPlaylistBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new UploadPlaylistBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + UploadPlaylistUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into UploadPlaylistUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new UploadPlaylistUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Plex.cs b/LukeHagar/PlexAPI/SDK/Plex.cs index fc858d5..d5eaa6f 100644 --- a/LukeHagar/PlexAPI/SDK/Plex.cs +++ b/LukeHagar/PlexAPI/SDK/Plex.cs @@ -143,8 +143,8 @@ namespace LukeHagar.PlexAPI.SDK }; public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Plex(SDKConfig config) @@ -211,7 +211,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetCompanionsDataResponse() { StatusCode = responseStatusCode, @@ -222,40 +232,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetCompanionsDataBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetCompanionsDataBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetCompanionsDataBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetCompanionsDataUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetCompanionsDataUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetCompanionsDataUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetUserFriendsAsync(string? serverUrl = null) @@ -317,7 +347,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetUserFriendsResponse() { StatusCode = responseStatusCode, @@ -328,40 +368,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetUserFriendsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetUserFriendsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetUserFriendsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetUserFriendsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetUserFriendsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetUserFriendsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetGeoDataAsync(string? serverUrl = null) @@ -418,7 +478,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGeoDataGeoData obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGeoDataGeoData.", httpResponse, httpResponseBody, ex); + } + var response = new GetGeoDataResponse() { StatusCode = responseStatusCode, @@ -429,40 +499,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGeoDataBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGeoDataBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetGeoDataBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetGeoDataUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetGeoDataUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetGeoDataUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetHomeDataAsync() @@ -519,7 +609,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetHomeDataResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetHomeDataResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetHomeDataResponse() { StatusCode = responseStatusCode, @@ -530,40 +630,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetHomeDataBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetHomeDataBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetHomeDataBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetHomeDataUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetHomeDataUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetHomeDataUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetServerResourcesAsync(string clientID, IncludeHttps? includeHttps = LukeHagar.PlexAPI.SDK.Models.Requests.IncludeHttps.Disable, IncludeRelay? includeRelay = LukeHagar.PlexAPI.SDK.Models.Requests.IncludeRelay.Disable, IncludeIPv6? includeIPv6 = LukeHagar.PlexAPI.SDK.Models.Requests.IncludeIPv6.Disable, string? serverUrl = null) @@ -632,7 +752,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize>(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + List obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull>(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into List.", httpResponse, httpResponseBody, ex); + } + var response = new GetServerResourcesResponse() { StatusCode = responseStatusCode, @@ -643,40 +773,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerResourcesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerResourcesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerResourcesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerResourcesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerResourcesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerResourcesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetPinAsync(GetPinRequest request, string? serverUrl = null) @@ -733,7 +883,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPinAuthPinContainer obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPinAuthPinContainer.", httpResponse, httpResponseBody, ex); + } + var response = new GetPinResponse() { StatusCode = responseStatusCode, @@ -744,29 +904,39 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetPinBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetPinBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetPinBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null) @@ -823,7 +993,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTokenByPinIdAuthPinContainer obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTokenByPinIdAuthPinContainer.", httpResponse, httpResponseBody, ex); + } + var response = new GetTokenByPinIdResponse() { StatusCode = responseStatusCode, @@ -834,40 +1014,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTokenByPinIdBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTokenByPinIdBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTokenByPinIdBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 404) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTokenByPinIdResponseBodyPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTokenByPinIdResponseBodyPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTokenByPinIdResponseBody(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/PlexAPI.cs b/LukeHagar/PlexAPI/SDK/PlexAPI.cs index f1ecd56..04ff0e8 100644 --- a/LukeHagar/PlexAPI/SDK/PlexAPI.cs +++ b/LukeHagar/PlexAPI/SDK/PlexAPI.cs @@ -292,8 +292,8 @@ namespace LukeHagar.PlexAPI.SDK public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public IServer Server { get; private set; } public IMedia Media { get; private set; } diff --git a/LukeHagar/PlexAPI/SDK/SDKConfig.cs b/LukeHagar/PlexAPI/SDK/SDKConfig.cs index bc923bf..c16a111 100644 --- a/LukeHagar/PlexAPI/SDK/SDKConfig.cs +++ b/LukeHagar/PlexAPI/SDK/SDKConfig.cs @@ -52,7 +52,7 @@ namespace LukeHagar.PlexAPI.SDK {"port", "32400"}, }, }; - UserAgent = "speakeasy-sdk/csharp 0.16.1 2.674.3 0.0.3 LukeHagar.PlexAPI.SDK"; + UserAgent = "speakeasy-sdk/csharp 0.17.0 2.698.4 0.0.3 LukeHagar.PlexAPI.SDK"; SecuritySource = null; Hooks = new SDKHooks(); RetryConfig = null; diff --git a/LukeHagar/PlexAPI/SDK/Search.cs b/LukeHagar/PlexAPI/SDK/Search.cs index 057d788..6e2d087 100644 --- a/LukeHagar/PlexAPI/SDK/Search.cs +++ b/LukeHagar/PlexAPI/SDK/Search.cs @@ -87,8 +87,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Search(SDKConfig config) @@ -152,7 +152,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new PerformSearchResponse() { StatusCode = responseStatusCode, @@ -164,34 +164,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PerformSearchBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PerformSearchBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new PerformSearchBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PerformSearchUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PerformSearchUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new PerformSearchUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = 3D) @@ -250,7 +270,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new PerformVoiceSearchResponse() { StatusCode = responseStatusCode, @@ -262,34 +282,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PerformVoiceSearchBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PerformVoiceSearchBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new PerformVoiceSearchBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + PerformVoiceSearchUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into PerformVoiceSearchUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new PerformVoiceSearchUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetSearchResultsAsync(string query) @@ -349,7 +389,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchResultsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchResultsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetSearchResultsResponse() { StatusCode = responseStatusCode, @@ -360,40 +410,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchResultsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchResultsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSearchResultsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSearchResultsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSearchResultsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSearchResultsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Server.cs b/LukeHagar/PlexAPI/SDK/Server.cs index ee3a434..45848ed 100644 --- a/LukeHagar/PlexAPI/SDK/Server.cs +++ b/LukeHagar/PlexAPI/SDK/Server.cs @@ -126,8 +126,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Server(SDKConfig config) @@ -189,7 +189,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerCapabilitiesResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerCapabilitiesResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetServerCapabilitiesResponse() { StatusCode = responseStatusCode, @@ -200,40 +210,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerCapabilitiesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerCapabilitiesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerCapabilitiesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerCapabilitiesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerCapabilitiesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerCapabilitiesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetServerPreferencesAsync() @@ -290,7 +320,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerPreferencesResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerPreferencesResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetServerPreferencesResponse() { StatusCode = responseStatusCode, @@ -301,40 +341,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerPreferencesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerPreferencesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerPreferencesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerPreferencesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerPreferencesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerPreferencesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetAvailableClientsAsync() @@ -391,7 +451,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetAvailableClientsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetAvailableClientsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetAvailableClientsResponse() { StatusCode = responseStatusCode, @@ -402,40 +472,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetAvailableClientsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetAvailableClientsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetAvailableClientsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetAvailableClientsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetAvailableClientsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetAvailableClientsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetDevicesAsync() @@ -492,7 +582,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetDevicesResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetDevicesResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetDevicesResponse() { StatusCode = responseStatusCode, @@ -503,40 +603,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetDevicesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetDevicesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetDevicesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetDevicesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetDevicesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetDevicesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetServerIdentityAsync() @@ -588,7 +708,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerIdentityResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerIdentityResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetServerIdentityResponse() { StatusCode = responseStatusCode, @@ -599,29 +729,39 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 408) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerIdentityRequestTimeoutPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerIdentityRequestTimeoutPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerIdentityRequestTimeout(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetMyPlexAccountAsync() @@ -678,7 +818,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMyPlexAccountResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMyPlexAccountResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetMyPlexAccountResponse() { StatusCode = responseStatusCode, @@ -689,40 +839,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMyPlexAccountBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMyPlexAccountBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetMyPlexAccountBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMyPlexAccountUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMyPlexAccountUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetMyPlexAccountUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetResizedPhotoAsync(GetResizedPhotoRequest request) @@ -775,7 +945,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new GetResizedPhotoResponse() { StatusCode = responseStatusCode, @@ -787,34 +957,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetResizedPhotoBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetResizedPhotoBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetResizedPhotoBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetResizedPhotoUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetResizedPhotoUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetResizedPhotoUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetMediaProvidersAsync(string xPlexToken) @@ -876,7 +1066,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMediaProvidersResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMediaProvidersResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetMediaProvidersResponse() { StatusCode = responseStatusCode, @@ -887,40 +1087,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMediaProvidersBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMediaProvidersBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetMediaProvidersBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetMediaProvidersUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetMediaProvidersUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetMediaProvidersUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetServerListAsync() @@ -977,7 +1197,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerListResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerListResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetServerListResponse() { StatusCode = responseStatusCode, @@ -988,40 +1218,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerListBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerListBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerListBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetServerListUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetServerListUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetServerListUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Sessions.cs b/LukeHagar/PlexAPI/SDK/Sessions.cs index 913c4c4..391b485 100644 --- a/LukeHagar/PlexAPI/SDK/Sessions.cs +++ b/LukeHagar/PlexAPI/SDK/Sessions.cs @@ -80,8 +80,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Sessions(SDKConfig config) @@ -143,7 +143,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSessionsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSessionsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetSessionsResponse() { StatusCode = responseStatusCode, @@ -154,40 +164,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSessionsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSessionsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSessionsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSessionsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSessionsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSessionsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null) @@ -250,7 +280,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSessionHistoryResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSessionHistoryResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetSessionHistoryResponse() { StatusCode = responseStatusCode, @@ -261,40 +301,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSessionHistoryBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSessionHistoryBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSessionHistoryBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetSessionHistoryUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetSessionHistoryUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetSessionHistoryUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetTranscodeSessionsAsync() @@ -351,7 +411,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTranscodeSessionsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTranscodeSessionsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetTranscodeSessionsResponse() { StatusCode = responseStatusCode, @@ -362,40 +432,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTranscodeSessionsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTranscodeSessionsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTranscodeSessionsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTranscodeSessionsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTranscodeSessionsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTranscodeSessionsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task StopTranscodeSessionAsync(string sessionKey) @@ -452,7 +542,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 204) - { + { return new StopTranscodeSessionResponse() { StatusCode = responseStatusCode, @@ -464,34 +554,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StopTranscodeSessionBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StopTranscodeSessionBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StopTranscodeSessionBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StopTranscodeSessionUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StopTranscodeSessionUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StopTranscodeSessionUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Statistics.cs b/LukeHagar/PlexAPI/SDK/Statistics.cs index 6b3ee96..70f220a 100644 --- a/LukeHagar/PlexAPI/SDK/Statistics.cs +++ b/LukeHagar/PlexAPI/SDK/Statistics.cs @@ -71,8 +71,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Statistics(SDKConfig config) @@ -137,7 +137,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetStatisticsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetStatisticsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetStatisticsResponse() { StatusCode = responseStatusCode, @@ -148,40 +158,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetStatisticsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetStatisticsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetStatisticsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetStatisticsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetStatisticsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetStatisticsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetResourcesStatisticsAsync(long? timespan = null) @@ -241,7 +271,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetResourcesStatisticsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetResourcesStatisticsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetResourcesStatisticsResponse() { StatusCode = responseStatusCode, @@ -252,40 +292,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetResourcesStatisticsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetResourcesStatisticsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetResourcesStatisticsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetResourcesStatisticsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetResourcesStatisticsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetResourcesStatisticsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task GetBandwidthStatisticsAsync(long? timespan = null) @@ -345,7 +405,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetBandwidthStatisticsResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetBandwidthStatisticsResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetBandwidthStatisticsResponse() { StatusCode = responseStatusCode, @@ -356,40 +426,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetBandwidthStatisticsBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetBandwidthStatisticsBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetBandwidthStatisticsBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetBandwidthStatisticsUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetBandwidthStatisticsUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetBandwidthStatisticsUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Updater.cs b/LukeHagar/PlexAPI/SDK/Updater.cs index 02df953..498c662 100644 --- a/LukeHagar/PlexAPI/SDK/Updater.cs +++ b/LukeHagar/PlexAPI/SDK/Updater.cs @@ -74,8 +74,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Updater(SDKConfig config) @@ -137,7 +137,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetUpdateStatusResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetUpdateStatusResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetUpdateStatusResponse() { StatusCode = responseStatusCode, @@ -148,40 +158,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetUpdateStatusBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetUpdateStatusBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetUpdateStatusBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetUpdateStatusUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetUpdateStatusUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetUpdateStatusUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task CheckForUpdatesAsync(Download? download = null) @@ -238,7 +268,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new CheckForUpdatesResponse() { StatusCode = responseStatusCode, @@ -250,34 +280,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + CheckForUpdatesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into CheckForUpdatesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new CheckForUpdatesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + CheckForUpdatesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into CheckForUpdatesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new CheckForUpdatesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null) @@ -335,7 +385,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new ApplyUpdatesResponse() { StatusCode = responseStatusCode, @@ -347,34 +397,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ApplyUpdatesBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ApplyUpdatesBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new ApplyUpdatesBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Include); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + ApplyUpdatesUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Include); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into ApplyUpdatesUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new ApplyUpdatesUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 500 || responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Users.cs b/LukeHagar/PlexAPI/SDK/Users.cs index 6e823b3..2f3de29 100644 --- a/LukeHagar/PlexAPI/SDK/Users.cs +++ b/LukeHagar/PlexAPI/SDK/Users.cs @@ -45,8 +45,8 @@ namespace LukeHagar.PlexAPI.SDK }; public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Users(SDKConfig config) @@ -119,40 +119,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetUsersBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetUsersBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetUsersBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetUsersUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetUsersUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetUsersUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Utils/ResponseBodyDeserializer.cs b/LukeHagar/PlexAPI/SDK/Utils/ResponseBodyDeserializer.cs index 3faafd0..2e1e7ed 100644 --- a/LukeHagar/PlexAPI/SDK/Utils/ResponseBodyDeserializer.cs +++ b/LukeHagar/PlexAPI/SDK/Utils/ResponseBodyDeserializer.cs @@ -28,6 +28,16 @@ namespace LukeHagar.PlexAPI.SDK.Utils return JsonConvert.DeserializeObject(json, new JsonSerializerSettings(){ NullValueHandling = nullValueHandling, MissingMemberHandling = missingMemberHandling, Converters = Utilities.GetJsonDeserializers(typeof(T))}); } + public static T DeserializeNotNull(string json, NullValueHandling nullValueHandling=NullValueHandling.Ignore, MissingMemberHandling missingMemberHandling=MissingMemberHandling.Ignore) + { + var result = ResponseBodyDeserializer.Deserialize(json, nullValueHandling, missingMemberHandling); + if (result == null) + { + throw new Exception($"Deserialization error: {typeof(T).Name} cannot be null."); + } + return result!; + } + public sealed class MissingMemberException : Exception { public MissingMemberException() : base("Missing member.") { } diff --git a/LukeHagar/PlexAPI/SDK/Utils/SpeakeasyHttpClient.cs b/LukeHagar/PlexAPI/SDK/Utils/SpeakeasyHttpClient.cs index 8b804ab..55e71e9 100644 --- a/LukeHagar/PlexAPI/SDK/Utils/SpeakeasyHttpClient.cs +++ b/LukeHagar/PlexAPI/SDK/Utils/SpeakeasyHttpClient.cs @@ -19,6 +19,9 @@ namespace LukeHagar.PlexAPI.SDK.Utils /// /// Sends an HTTP request asynchronously. /// + /// + /// When overriding this method, use HttpCompletionOption.ResponseHeadersRead to support streaming response bodies. + /// /// The HTTP request message to send. /// The value of the TResult parameter contains the HTTP response message. Task SendAsync(HttpRequestMessage request); @@ -46,7 +49,7 @@ namespace LukeHagar.PlexAPI.SDK.Utils public virtual async Task SendAsync(HttpRequestMessage request) { - return await httpClient.SendAsync(request); + return await httpClient.SendAsync(request, HttpCompletionOption.ResponseHeadersRead); } public virtual async Task CloneAsync(HttpRequestMessage request) diff --git a/LukeHagar/PlexAPI/SDK/Utils/URLBuilder.cs b/LukeHagar/PlexAPI/SDK/Utils/URLBuilder.cs index c386358..a797bd7 100644 --- a/LukeHagar/PlexAPI/SDK/Utils/URLBuilder.cs +++ b/LukeHagar/PlexAPI/SDK/Utils/URLBuilder.cs @@ -55,7 +55,7 @@ namespace LukeHagar.PlexAPI.SDK.Utils { foreach (var key in parameters.Keys) { - url = url.Replace($"{{{key}}}", parameters[key]); + url = url.Replace($"{{{key}}}", Uri.EscapeDataString(parameters[key])); } return url; @@ -68,7 +68,7 @@ namespace LukeHagar.PlexAPI.SDK.Utils { foreach (var value in queryParams[key]) { - queries.Add($"{key}={value}"); + queries.Add($"{key}={WebUtility.UrlEncode(Utilities.ToString(value))}"); } } @@ -114,7 +114,7 @@ namespace LukeHagar.PlexAPI.SDK.Utils case "json": parameters.Add( metadata.Name ?? prop.Name, - WebUtility.UrlEncode(Utilities.SerializeJSON(val)) + Utilities.SerializeJSON(val) ); break; default: diff --git a/LukeHagar/PlexAPI/SDK/Video.cs b/LukeHagar/PlexAPI/SDK/Video.cs index 9c90c24..d0853f7 100644 --- a/LukeHagar/PlexAPI/SDK/Video.cs +++ b/LukeHagar/PlexAPI/SDK/Video.cs @@ -62,8 +62,8 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Video(SDKConfig config) @@ -121,7 +121,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new GetTimelineResponse() { StatusCode = responseStatusCode, @@ -133,34 +133,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTimelineBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTimelineBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTimelineBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetTimelineUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetTimelineUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetTimelineUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } public async Task StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request) @@ -213,7 +233,7 @@ namespace LukeHagar.PlexAPI.SDK var contentType = httpResponse.Content.Headers.ContentType?.MediaType; int responseStatusCode = (int)httpResponse.StatusCode; if(responseStatusCode == 200) - { + { return new StartUniversalTranscodeResponse() { StatusCode = responseStatusCode, @@ -225,34 +245,54 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StartUniversalTranscodeBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StartUniversalTranscodeBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StartUniversalTranscodeBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + StartUniversalTranscodeUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into StartUniversalTranscodeUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new StartUniversalTranscodeUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Watchlist.cs b/LukeHagar/PlexAPI/SDK/Watchlist.cs index 922071f..83de1a4 100644 --- a/LukeHagar/PlexAPI/SDK/Watchlist.cs +++ b/LukeHagar/PlexAPI/SDK/Watchlist.cs @@ -55,12 +55,12 @@ namespace LukeHagar.PlexAPI.SDK /// List of server URLs available for the get-watch-list operation. ///
public static readonly string[] GetWatchListServerList = { - "https://metadata.provider.plex.tv", + "https://discover.provider.plex.tv", }; public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.16.1"; - private const string _sdkGenVersion = "2.674.3"; + private const string _sdkVersion = "0.17.0"; + private const string _sdkGenVersion = "2.698.4"; private const string _openapiDocVersion = "0.0.3"; public Watchlist(SDKConfig config) @@ -127,7 +127,17 @@ namespace LukeHagar.PlexAPI.SDK { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetWatchListResponseBody obj; + try + { + obj = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetWatchListResponseBody.", httpResponse, httpResponseBody, ex); + } + var response = new GetWatchListResponse() { StatusCode = responseStatusCode, @@ -138,40 +148,60 @@ namespace LukeHagar.PlexAPI.SDK return response; } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 400) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetWatchListBadRequestPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetWatchListBadRequestPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetWatchListBadRequest(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode == 401) { if(Utilities.IsContentTypeMatch("application/json", contentType)) { - var obj = ResponseBodyDeserializer.Deserialize(await httpResponse.Content.ReadAsStringAsync(), NullValueHandling.Ignore); - obj!.RawResponse = httpResponse; - throw obj!; + var httpResponseBody = await httpResponse.Content.ReadAsStringAsync(); + GetWatchListUnauthorizedPayload payload; + try + { + payload = ResponseBodyDeserializer.DeserializeNotNull(httpResponseBody, NullValueHandling.Ignore); + } + catch (Exception ex) + { + throw new ResponseValidationException("Failed to deserialize response body into GetWatchListUnauthorizedPayload.", httpResponse, httpResponseBody, ex); + } + + payload.RawResponse = httpResponse; + throw new GetWatchListUnauthorized(payload, httpResponse, httpResponseBody); } - throw new Models.Errors.SDKException("Unknown content type received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown content type received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 400 && responseStatusCode < 500) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } else if(responseStatusCode >= 500 && responseStatusCode < 600) { - throw new Models.Errors.SDKException("API error occurred", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("API error occurred", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } - throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); + throw new Models.Errors.SDKException("Unknown status code received", httpResponse, await httpResponse.Content.ReadAsStringAsync()); } } } \ No newline at end of file diff --git a/NUGET.md b/NUGET.md index 2eca7c4..f5de7ee 100644 --- a/NUGET.md +++ b/NUGET.md @@ -45,24 +45,18 @@ var res = await sdk.Server.GetServerCapabilitiesAsync(); ## Error Handling -Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception. - -By default, an API error will raise a `LukeHagar.PlexAPI.SDK.Models.Errors.SDKException` exception, which has the following properties: +[`PlexAPIError`](./LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs) is the base exception class for all HTTP error responses. It has the following properties: | Property | Type | Description | |---------------|-----------------------|-----------------------| -| `Message` | *string* | The error message | -| `StatusCode` | *int* | The HTTP status code | -| `RawResponse` | *HttpResponseMessage* | The raw HTTP response | -| `Body` | *string* | The response content | +| `Message` | *string* | Error message | +| `StatusCode` | *int* | HTTP status code | +| `Headers` | *HttpResponseHeaders* | HTTP headers | +| `ContentType` | *string?* | HTTP content type | +| `RawResponse` | *HttpResponseMessage* | HTTP response object | +| `Body` | *string* | HTTP response body | -When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `GetServerCapabilitiesAsync` method throws the following exceptions: - -| Error Type | Status Code | Content Type | -| --------------------------------------------------------------------- | ----------- | ---------------- | -| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesBadRequest | 400 | application/json | -| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesUnauthorized | 401 | application/json | -| LukeHagar.PlexAPI.SDK.Models.Errors.SDKException | 4XX, 5XX | \*/\* | +Some exceptions in this SDK include an additional `Payload` field, which will contain deserialized custom error data when present. Possible exceptions are listed in the [Error Classes](#error-classes) section. ### Example @@ -70,6 +64,7 @@ When custom error responses are specified for an operation, the SDK may also thr using LukeHagar.PlexAPI.SDK; using LukeHagar.PlexAPI.SDK.Models.Components; using LukeHagar.PlexAPI.SDK.Models.Errors; +using System.Collections.Generic; var sdk = new PlexAPI(accessToken: ""); @@ -79,25 +74,208 @@ try // handle response } -catch (Exception ex) +catch (PlexAPIError ex) // all SDK exceptions inherit from PlexAPIError { - if (ex is GetServerCapabilitiesBadRequest) + // ex.ToString() provides a detailed error message + System.Console.WriteLine(ex); + + // Base exception fields + HttpResponseMessage rawResponse = ex.RawResponse; + HttpResponseHeaders headers = ex.Headers; + int statusCode = ex.StatusCode; + string? contentType = ex.ContentType; + var responseBody = ex.Body; + + if (ex is GetServerCapabilitiesBadRequest) // different exceptions may be thrown depending on the method { - // Handle exception data - throw; + // Check error data fields + GetServerCapabilitiesBadRequestPayload payload = ex.Payload; + List Errors = payload.Errors; + HttpResponseMessage RawResponse = payload.RawResponse; } - else if (ex is GetServerCapabilitiesUnauthorized) + + // An underlying cause may be provided + if (ex.InnerException != null) { - // Handle exception data - throw; - } - else if (ex is LukeHagar.PlexAPI.SDK.Models.Errors.SDKException) - { - // Handle default exception - throw; + Exception cause = ex.InnerException; } } +catch (System.Net.Http.HttpRequestException ex) +{ + // Check ex.InnerException for Network connectivity errors +} ``` + +### Error Classes + +**Primary exception:** +* [`PlexAPIError`](./LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs): The base class for HTTP error responses. + +
Less common exceptions (158) + +* [`System.Net.Http.HttpRequestException`](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httprequestexception): Network connectivity error. For more details about the underlying cause, inspect the `ex.InnerException`. + +* Inheriting from [`PlexAPIError`](./LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs): + * [`GetServerCapabilitiesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerPreferencesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetAvailableClientsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetDevicesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetMyPlexAccountBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetResizedPhotoBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetMediaProvidersBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerListBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`MarkPlayedBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`MarkUnplayedBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`UpdatePlayProgressBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetBannerImageBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetThumbImageBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTimelineBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StartUniversalTranscodeBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerActivitiesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`CancelServerActivitiesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetButlerTasksBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StartAllTasksBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StopAllTasksBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StartTaskBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StopTaskBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetCompanionsDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetUserFriendsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetGeoDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetHomeDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerResourcesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetPinBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPinBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTokenByPinIdBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetGlobalHubsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetLibraryHubsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`PerformSearchBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`PerformVoiceSearchBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSearchResultsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetFileHashBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetRecentlyAddedLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetAllLibrariesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetLibraryDetailsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`DeleteLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetLibraryItemsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetLibrarySectionsAllBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetRefreshLibraryMetadataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSearchLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetGenresLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetCountriesLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetActorsLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSearchAllLibrariesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetMediaMetaDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetMetadataChildrenBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTopWatchedContentBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetWatchListBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`LogLineBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/LogLineBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`LogMultiLineBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`EnablePaperTrailBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`CreatePlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetPlaylistsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetPlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`DeletePlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`UpdatePlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetPlaylistContentsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`ClearPlaylistContentsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`AddPlaylistContentsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`UploadPlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTransientTokenBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSourceConnectionInformationBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTokenDetailsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`PostUsersSignInDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetStatisticsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetResourcesStatisticsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetBandwidthStatisticsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSessionsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSessionHistoryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTranscodeSessionsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StopTranscodeSessionBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetUpdateStatusBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`CheckForUpdatesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`ApplyUpdatesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetUsersBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerCapabilitiesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetServerPreferencesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetAvailableClientsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetDevicesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetMyPlexAccountUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetResizedPhotoUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetMediaProvidersUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetServerListUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`MarkPlayedUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`MarkUnplayedUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`UpdatePlayProgressUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetBannerImageUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetThumbImageUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTimelineUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StartUniversalTranscodeUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetServerActivitiesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`CancelServerActivitiesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetButlerTasksUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StartAllTasksUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StopAllTasksUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StartTaskUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StopTaskUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetCompanionsDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetUserFriendsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetGeoDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetHomeDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetServerResourcesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetGlobalHubsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetLibraryHubsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`PerformSearchUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`PerformVoiceSearchUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSearchResultsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetFileHashUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetRecentlyAddedLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetAllLibrariesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetLibraryDetailsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`DeleteLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetLibraryItemsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetLibrarySectionsAllUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetRefreshLibraryMetadataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSearchLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetGenresLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetCountriesLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetActorsLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSearchAllLibrariesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetMediaMetaDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetMetadataChildrenUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTopWatchedContentUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetWatchListUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`LogLineUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/LogLineUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`LogMultiLineUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`EnablePaperTrailUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`CreatePlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetPlaylistsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetPlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`DeletePlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`UpdatePlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetPlaylistContentsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`ClearPlaylistContentsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`AddPlaylistContentsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`UploadPlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTransientTokenUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSourceConnectionInformationUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTokenDetailsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`PostUsersSignInDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetStatisticsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetResourcesStatisticsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetBandwidthStatisticsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSessionsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSessionHistoryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTranscodeSessionsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StopTranscodeSessionUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetUpdateStatusUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`CheckForUpdatesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`ApplyUpdatesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetUsersUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTokenByPinIdResponseBody`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdResponseBody.cs): Not Found or Expired. Status code `404`. Applicable to 1 of 84 methods.* + * [`GetServerIdentityRequestTimeout`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerIdentityRequestTimeout.cs): Request Timeout. Status code `408`. Applicable to 1 of 84 methods.* + * [`ResponseValidationError`](./LukeHagar/PlexAPI/SDK/Models/Errors/ResponseValidationError.cs): Thrown when the response data could not be deserialized into the expected type. +
+ +\* Refer to the [relevant documentation](#available-resources-and-operations) to determine whether an exception applies to a specific operation. diff --git a/README.md b/README.md index c24f692..d7e36e3 100644 --- a/README.md +++ b/README.md @@ -277,24 +277,18 @@ var res = await sdk.Server.GetServerCapabilitiesAsync(); ## Error Handling -Handling errors in this SDK should largely match your expectations. All operations return a response object or throw an exception. - -By default, an API error will raise a `LukeHagar.PlexAPI.SDK.Models.Errors.SDKException` exception, which has the following properties: +[`PlexAPIError`](./LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs) is the base exception class for all HTTP error responses. It has the following properties: | Property | Type | Description | |---------------|-----------------------|-----------------------| -| `Message` | *string* | The error message | -| `StatusCode` | *int* | The HTTP status code | -| `RawResponse` | *HttpResponseMessage* | The raw HTTP response | -| `Body` | *string* | The response content | +| `Message` | *string* | Error message | +| `StatusCode` | *int* | HTTP status code | +| `Headers` | *HttpResponseHeaders* | HTTP headers | +| `ContentType` | *string?* | HTTP content type | +| `RawResponse` | *HttpResponseMessage* | HTTP response object | +| `Body` | *string* | HTTP response body | -When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `GetServerCapabilitiesAsync` method throws the following exceptions: - -| Error Type | Status Code | Content Type | -| --------------------------------------------------------------------- | ----------- | ---------------- | -| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesBadRequest | 400 | application/json | -| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesUnauthorized | 401 | application/json | -| LukeHagar.PlexAPI.SDK.Models.Errors.SDKException | 4XX, 5XX | \*/\* | +Some exceptions in this SDK include an additional `Payload` field, which will contain deserialized custom error data when present. Possible exceptions are listed in the [Error Classes](#error-classes) section. ### Example @@ -302,6 +296,7 @@ When custom error responses are specified for an operation, the SDK may also thr using LukeHagar.PlexAPI.SDK; using LukeHagar.PlexAPI.SDK.Models.Components; using LukeHagar.PlexAPI.SDK.Models.Errors; +using System.Collections.Generic; var sdk = new PlexAPI(accessToken: ""); @@ -311,25 +306,208 @@ try // handle response } -catch (Exception ex) +catch (PlexAPIError ex) // all SDK exceptions inherit from PlexAPIError { - if (ex is GetServerCapabilitiesBadRequest) + // ex.ToString() provides a detailed error message + System.Console.WriteLine(ex); + + // Base exception fields + HttpResponseMessage rawResponse = ex.RawResponse; + HttpResponseHeaders headers = ex.Headers; + int statusCode = ex.StatusCode; + string? contentType = ex.ContentType; + var responseBody = ex.Body; + + if (ex is GetServerCapabilitiesBadRequest) // different exceptions may be thrown depending on the method { - // Handle exception data - throw; + // Check error data fields + GetServerCapabilitiesBadRequestPayload payload = ex.Payload; + List Errors = payload.Errors; + HttpResponseMessage RawResponse = payload.RawResponse; } - else if (ex is GetServerCapabilitiesUnauthorized) + + // An underlying cause may be provided + if (ex.InnerException != null) { - // Handle exception data - throw; - } - else if (ex is LukeHagar.PlexAPI.SDK.Models.Errors.SDKException) - { - // Handle default exception - throw; + Exception cause = ex.InnerException; } } +catch (System.Net.Http.HttpRequestException ex) +{ + // Check ex.InnerException for Network connectivity errors +} ``` + +### Error Classes + +**Primary exception:** +* [`PlexAPIError`](./LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs): The base class for HTTP error responses. + +
Less common exceptions (158) + +* [`System.Net.Http.HttpRequestException`](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httprequestexception): Network connectivity error. For more details about the underlying cause, inspect the `ex.InnerException`. + +* Inheriting from [`PlexAPIError`](./LukeHagar/PlexAPI/SDK/Models/Errors/PlexAPIError.cs): + * [`GetServerCapabilitiesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerPreferencesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetAvailableClientsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetDevicesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetMyPlexAccountBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetResizedPhotoBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetMediaProvidersBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerListBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`MarkPlayedBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`MarkUnplayedBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`UpdatePlayProgressBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetBannerImageBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetThumbImageBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTimelineBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StartUniversalTranscodeBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerActivitiesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`CancelServerActivitiesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetButlerTasksBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StartAllTasksBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StopAllTasksBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StartTaskBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StopTaskBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetCompanionsDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetUserFriendsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetGeoDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetHomeDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerResourcesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetPinBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPinBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTokenByPinIdBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetGlobalHubsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetLibraryHubsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`PerformSearchBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`PerformVoiceSearchBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSearchResultsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetFileHashBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetRecentlyAddedLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetAllLibrariesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetLibraryDetailsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`DeleteLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetLibraryItemsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetLibrarySectionsAllBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetRefreshLibraryMetadataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSearchLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetGenresLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetCountriesLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetActorsLibraryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSearchAllLibrariesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetMediaMetaDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetMetadataChildrenBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTopWatchedContentBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetWatchListBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`LogLineBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/LogLineBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`LogMultiLineBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`EnablePaperTrailBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`CreatePlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetPlaylistsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetPlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`DeletePlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`UpdatePlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetPlaylistContentsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`ClearPlaylistContentsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`AddPlaylistContentsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`UploadPlaylistBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTransientTokenBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSourceConnectionInformationBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTokenDetailsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`PostUsersSignInDataBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetStatisticsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetResourcesStatisticsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetBandwidthStatisticsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSessionsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetSessionHistoryBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetTranscodeSessionsBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`StopTranscodeSessionBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetUpdateStatusBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`CheckForUpdatesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`ApplyUpdatesBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetUsersBadRequest`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersBadRequest.cs): Bad Request - A parameter was not specified, or was specified incorrectly. Status code `400`. Applicable to 1 of 84 methods.* + * [`GetServerCapabilitiesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerCapabilitiesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetServerPreferencesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerPreferencesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetAvailableClientsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetAvailableClientsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetDevicesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetDevicesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetMyPlexAccountUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMyPlexAccountUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetResizedPhotoUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetResizedPhotoUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetMediaProvidersUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaProvidersUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetServerListUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerListUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`MarkPlayedUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/MarkPlayedUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`MarkUnplayedUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/MarkUnplayedUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`UpdatePlayProgressUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlayProgressUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetBannerImageUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetBannerImageUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetThumbImageUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetThumbImageUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTimelineUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTimelineUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StartUniversalTranscodeUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartUniversalTranscodeUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetServerActivitiesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerActivitiesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`CancelServerActivitiesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/CancelServerActivitiesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetButlerTasksUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetButlerTasksUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StartAllTasksUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartAllTasksUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StopAllTasksUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopAllTasksUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StartTaskUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StartTaskUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StopTaskUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopTaskUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetCompanionsDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetCompanionsDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetUserFriendsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUserFriendsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetGeoDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGeoDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetHomeDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetHomeDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetServerResourcesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerResourcesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetGlobalHubsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGlobalHubsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetLibraryHubsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryHubsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`PerformSearchUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/PerformSearchUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`PerformVoiceSearchUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/PerformVoiceSearchUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSearchResultsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchResultsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetFileHashUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetFileHashUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetRecentlyAddedLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetRecentlyAddedLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetAllLibrariesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetAllLibrariesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetLibraryDetailsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryDetailsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`DeleteLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/DeleteLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetLibraryItemsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibraryItemsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetLibrarySectionsAllUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetLibrarySectionsAllUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetRefreshLibraryMetadataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetRefreshLibraryMetadataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSearchLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetGenresLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetGenresLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetCountriesLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetCountriesLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetActorsLibraryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetActorsLibraryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSearchAllLibrariesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSearchAllLibrariesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetMediaMetaDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMediaMetaDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetMetadataChildrenUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetMetadataChildrenUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTopWatchedContentUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTopWatchedContentUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetWatchListUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetWatchListUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`LogLineUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/LogLineUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`LogMultiLineUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/LogMultiLineUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`EnablePaperTrailUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/EnablePaperTrailUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`CreatePlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/CreatePlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetPlaylistsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetPlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`DeletePlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/DeletePlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`UpdatePlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/UpdatePlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetPlaylistContentsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetPlaylistContentsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`ClearPlaylistContentsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/ClearPlaylistContentsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`AddPlaylistContentsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/AddPlaylistContentsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`UploadPlaylistUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/UploadPlaylistUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTransientTokenUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTransientTokenUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSourceConnectionInformationUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSourceConnectionInformationUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTokenDetailsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenDetailsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`PostUsersSignInDataUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/PostUsersSignInDataUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetStatisticsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetStatisticsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetResourcesStatisticsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetResourcesStatisticsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetBandwidthStatisticsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetBandwidthStatisticsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSessionsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetSessionHistoryUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetSessionHistoryUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTranscodeSessionsUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTranscodeSessionsUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`StopTranscodeSessionUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/StopTranscodeSessionUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetUpdateStatusUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUpdateStatusUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`CheckForUpdatesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/CheckForUpdatesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`ApplyUpdatesUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/ApplyUpdatesUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetUsersUnauthorized`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetUsersUnauthorized.cs): Unauthorized - Returned if the X-Plex-Token is missing from the header or query. Status code `401`. Applicable to 1 of 84 methods.* + * [`GetTokenByPinIdResponseBody`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetTokenByPinIdResponseBody.cs): Not Found or Expired. Status code `404`. Applicable to 1 of 84 methods.* + * [`GetServerIdentityRequestTimeout`](./LukeHagar/PlexAPI/SDK/Models/Errors/GetServerIdentityRequestTimeout.cs): Request Timeout. Status code `408`. Applicable to 1 of 84 methods.* + * [`ResponseValidationError`](./LukeHagar/PlexAPI/SDK/Models/Errors/ResponseValidationError.cs): Thrown when the response data could not be deserialized into the expected type. +
+ +\* Refer to the [relevant documentation](#available-resources-and-operations) to determine whether an exception applies to a specific operation. diff --git a/RELEASES.md b/RELEASES.md index da8d2b2..39cd7d3 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -624,4 +624,14 @@ Based on: ### Generated - [csharp v0.16.1] . ### Releases -- [NuGet v0.16.1] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.16.1 - . \ No newline at end of file +- [NuGet v0.16.1] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.16.1 - . + +## 2025-09-15 00:25:11 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.615.2 (2.698.4) https://github.com/speakeasy-api/speakeasy +### Generated +- [csharp v0.17.0] . +### Releases +- [NuGet v0.17.0] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.17.0 - . \ No newline at end of file diff --git a/docs/Models/Requests/Role.md b/docs/Models/Requests/Role.md index 504d146..45a4ede 100644 --- a/docs/Models/Requests/Role.md +++ b/docs/Models/Requests/Role.md @@ -9,5 +9,5 @@ | `Filter` | *string* | :heavy_check_mark: | The filter string used to query this actor. For example, it may indicate that this is an actor with a given key. | actor=126522 | | `Tag` | *string* | :heavy_check_mark: | The display tag for the actor (typically the actor's name). | Teller | | `TagKey` | *string* | :heavy_check_mark: | A 24-character hexadecimal unique key associated with the actor's tag, used for internal identification.
NOTE: This is globally unique across all Plex Servers.
| 5d77683d85719b001f3a535e | -| `Role` | *string* | :heavy_minus_sign: | The role played by the actor in the media item. | Self - Judge | +| `RoleValue` | *string* | :heavy_minus_sign: | The role played by the actor in the media item. | Self - Judge | | `Thumb` | *string* | :heavy_minus_sign: | The absolute URL of the thumbnail image for the actor. | https://metadata-static.plex.tv/7/people/708568fd018d7aa8b1032dcf867747e8.jpg | \ No newline at end of file