diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index cfc170f..175a7fa 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: f12b653820ae77ca3b2820bc9459d866 + docChecksum: 649b155561aeea4d804f8713e7b2dcac docVersion: 0.0.3 - speakeasyVersion: 1.405.4 - generationVersion: 2.428.1 - releaseVersion: 0.8.7 - configChecksum: 13422ad1c84a29dafd76ff43cb3e6315 + speakeasyVersion: 1.405.8 + generationVersion: 2.429.0 + releaseVersion: 0.9.0 + configChecksum: dc06201584fb7850142fe453a89a3e52 repoURL: https://github.com/LukeHagar/plexcsharp.git repoSubDirectory: . published: true @@ -29,6 +29,7 @@ features: nameOverrides: 2.81.2 nullables: 0.1.0 responseFormat: 0.0.4 + retries: 0.0.1 sdkHooks: 0.1.0 generatedFiles: - .gitattributes @@ -1689,6 +1690,8 @@ examples: parameters: query: X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + header: + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" responses: "401": application/json: {"errors": []} @@ -1748,6 +1751,8 @@ examples: minSize: 1 upscale: 1 X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + header: + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" responses: "401": application/json: {"errors": []} @@ -1766,6 +1771,8 @@ examples: minSize: 1 upscale: 1 X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + header: + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" responses: "401": application/json: {"errors": []} @@ -1930,6 +1937,21 @@ examples: application/json: [] "400": application/json: {"errors": []} + "": + parameters: + query: + includeHttps: 1 + includeRelay: 1 + includeIPv6: 1 + header: + X-Plex-Client-Identifier: "3381b62b-9ab7-4e37-827b-203e9809eb58" + responses: + "200": + application/json: [] + "400": + application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}, {"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]} + "401": + application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}]} getPin: "": parameters: @@ -1939,6 +1961,12 @@ examples: X-Plex-Version: "4.133.0" X-Plex-Platform: "Chrome" X-Plex-Client-Identifier: "gcgzw5rz2xovp84b4vha3a40" + header: + X-Plex-Client-Identifier: "3381b62b-9ab7-4e37-827b-203e9809eb58" + X-Plex-Product: "Plex for Roku" + X-Plex-Device: "Roku 3" + X-Plex-Version: "2.4.1" + X-Plex-Platform: "Roku" responses: "200": application/json: {"id": 308667304, "code": "7RQZ", "product": "0", "trusted": false, "qr": "https://plex.tv/api/v2/pins/qr/7RQZ", "clientIdentifier": "string", "location": {"code": "VI", "continent_code": "NA", "country": "United States Virgin Islands", "city": "Amsterdam", "european_union_member": true, "time_zone": "America/St_Thomas", "postal_code": 802, "in_privacy_restricted_country": true, "in_privacy_restricted_region": true, "subdivisions": "Saint Thomas", "coordinates": "18.3381, -64.8941"}, "expiresIn": 876, "createdAt": "2024-07-16T17:03:05Z", "expiresAt": "2024-07-16T17:18:05Z", "authToken": null, "newRegistration": null} @@ -1957,6 +1985,12 @@ examples: X-Plex-Device: "Linux" X-Plex-Version: "4.133.0" X-Plex-Platform: "Chrome" + header: + X-Plex-Client-Identifier: "3381b62b-9ab7-4e37-827b-203e9809eb58" + X-Plex-Product: "Plex for Roku" + X-Plex-Device: "Roku 3" + X-Plex-Version: "2.4.1" + X-Plex-Platform: "Roku" responses: "200": application/json: {"id": 308667304, "code": "7RQZ", "product": "0", "trusted": false, "qr": "https://plex.tv/api/v2/pins/qr/7RQZ", "clientIdentifier": "string", "location": {"code": "VI", "continent_code": "NA", "country": "United States Virgin Islands", "city": "Amsterdam", "european_union_member": true, "time_zone": "America/St_Thomas", "postal_code": 802, "in_privacy_restricted_country": true, "in_privacy_restricted_region": true, "subdivisions": "Saint Thomas", "coordinates": "18.3381, -64.8941"}, "expiresIn": 876, "createdAt": "2024-07-16T17:03:05Z", "expiresAt": "2024-07-16T17:18:05Z", "authToken": null, "newRegistration": null} @@ -2221,6 +2255,8 @@ examples: X-Plex-Container-Start: 0 X-Plex-Container-Size: 50 X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + header: + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" responses: "401": application/json: {"errors": []} @@ -2415,6 +2451,12 @@ examples: X-Plex-Device: "Linux" X-Plex-Version: "4.133.0" X-Plex-Platform: "Chrome" + header: + X-Plex-Client-Identifier: "3381b62b-9ab7-4e37-827b-203e9809eb58" + X-Plex-Product: "Plex for Roku" + X-Plex-Device: "Roku 3" + X-Plex-Version: "2.4.1" + X-Plex-Platform: "Roku" requestBody: application/x-www-form-urlencoded: {"login": "username@email.com", "password": "password123", "verificationCode": "123456"} responses: diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 412fcba..866783d 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -12,7 +12,7 @@ generation: auth: oAuth2ClientCredentialsEnabled: true csharp: - version: 0.8.7 + version: 0.9.0 additionalDependencies: [] author: LukeHagar clientServerStatusCodesAsErrors: true diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index 52e9336..27ceefd 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -1,4 +1,4 @@ -speakeasyVersion: 1.405.4 +speakeasyVersion: 1.405.8 sources: my-source: sourceNamespace: my-source @@ -16,8 +16,8 @@ sources: - main plexapi: sourceNamespace: plexapi - sourceRevisionDigest: sha256:c52cde0b8d51e160f7b9f1a3d3ea4dbb1aca6d5caad714e549201fb757fadd57 - sourceBlobDigest: sha256:f417b03ff71356808554313f24c3d06d670474bf51bc9a0631de1ad49c13a361 + sourceRevisionDigest: sha256:b1e231bd781f352738612b0158382ba51cfac32e97c23d9e4913aab5501e9529 + sourceBlobDigest: sha256:8ce05d5965182eb3fe9376715c269b9e1c7f3e2d90273c175a4181735f41daa0 tags: - latest - main @@ -25,10 +25,10 @@ targets: plexcsharp: source: plexapi sourceNamespace: plexapi - sourceRevisionDigest: sha256:c52cde0b8d51e160f7b9f1a3d3ea4dbb1aca6d5caad714e549201fb757fadd57 - sourceBlobDigest: sha256:f417b03ff71356808554313f24c3d06d670474bf51bc9a0631de1ad49c13a361 + sourceRevisionDigest: sha256:b1e231bd781f352738612b0158382ba51cfac32e97c23d9e4913aab5501e9529 + sourceBlobDigest: sha256:8ce05d5965182eb3fe9376715c269b9e1c7f3e2d90273c175a4181735f41daa0 codeSamplesNamespace: code-samples-csharp-plexcsharp - codeSamplesRevisionDigest: sha256:079471bc5703da7562a487278e4faa04f3b790ed98e2ad88494d994e665021c6 + codeSamplesRevisionDigest: sha256:58fe70fa1a5c905723a25f3e8c72551cc91f8227b052f13d826b5a6b25eb7049 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/LukeHagar/PlexAPI/SDK/Activities.cs b/LukeHagar/PlexAPI/SDK/Activities.cs index 3e77666..829468a 100644 --- a/LukeHagar/PlexAPI/SDK/Activities.cs +++ b/LukeHagar/PlexAPI/SDK/Activities.cs @@ -45,7 +45,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Server Activities /// /// - Task GetServerActivitiesAsync(); + Task GetServerActivitiesAsync(RetryConfig? retryConfig = null); /// /// Cancel Server Activities @@ -54,7 +54,7 @@ namespace LukeHagar.PlexAPI.SDK /// Cancel Server Activities /// /// - Task CancelServerActivitiesAsync(string activityUUID); + Task CancelServerActivitiesAsync(string activityUUID, RetryConfig? retryConfig = null); } /// @@ -74,10 +74,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -90,7 +90,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetServerActivitiesAsync() + public async Task GetServerActivitiesAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -107,11 +107,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getServerActivities", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -187,7 +220,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task CancelServerActivitiesAsync(string activityUUID) + public async Task CancelServerActivitiesAsync(string activityUUID, RetryConfig? retryConfig = null) { var request = new CancelServerActivitiesRequest() { @@ -207,11 +240,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("cancelServerActivities", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Authentication.cs b/LukeHagar/PlexAPI/SDK/Authentication.cs index 9e86fb4..59e54f4 100644 --- a/LukeHagar/PlexAPI/SDK/Authentication.cs +++ b/LukeHagar/PlexAPI/SDK/Authentication.cs @@ -40,7 +40,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope); + Task GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope, RetryConfig? retryConfig = null); /// /// Get Source Connection Information @@ -51,7 +51,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetSourceConnectionInformationAsync(string source); + Task GetSourceConnectionInformationAsync(string source, RetryConfig? retryConfig = null); /// /// Get Token Details @@ -60,7 +60,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get the User data from the provided X-Plex-Token /// /// - Task GetTokenDetailsAsync(string? serverUrl = null); + Task GetTokenDetailsAsync(string? serverUrl = null, RetryConfig? retryConfig = null); /// /// Get User Sign In Data @@ -69,7 +69,7 @@ namespace LukeHagar.PlexAPI.SDK /// Sign in user with username and password and return user data with Plex authentication token /// /// - Task PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null); + Task PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null, RetryConfig? retryConfig = null); } /// @@ -95,10 +95,10 @@ namespace LukeHagar.PlexAPI.SDK }; public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -111,7 +111,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope) + public async Task GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope, RetryConfig? retryConfig = null) { var request = new GetTransientTokenRequest() { @@ -132,11 +132,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getTransientToken", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -204,7 +237,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetSourceConnectionInformationAsync(string source) + public async Task GetSourceConnectionInformationAsync(string source, RetryConfig? retryConfig = null) { var request = new GetSourceConnectionInformationRequest() { @@ -224,11 +257,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getSourceConnectionInformation", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -296,7 +362,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetTokenDetailsAsync(string? serverUrl = null) + public async Task GetTokenDetailsAsync(string? serverUrl = null, RetryConfig? retryConfig = null) { string baseUrl = Utilities.TemplateUrl(GetTokenDetailsServerList[0], new Dictionary(){ }); @@ -318,11 +384,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getTokenDetails", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -398,13 +497,13 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null) + public async Task PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null, RetryConfig? retryConfig = null) { request.ClientID ??= SDKConfiguration.ClientID; request.ClientName ??= SDKConfiguration.ClientName; request.ClientVersion ??= SDKConfiguration.ClientVersion; - request.ClientPlatform ??= SDKConfiguration.ClientPlatform; - request.DeviceName ??= SDKConfiguration.DeviceName; + request.Platform ??= SDKConfiguration.Platform; + request.DeviceNickname ??= SDKConfiguration.DeviceNickname; string baseUrl = Utilities.TemplateUrl(PostUsersSignInDataServerList[0], new Dictionary(){ }); @@ -412,10 +511,12 @@ namespace LukeHagar.PlexAPI.SDK { baseUrl = serverUrl; } - var urlString = URLBuilder.Build(baseUrl, "/users/signin", request); + + var urlString = baseUrl + "/users/signin"; var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); httpRequest.Headers.Add("user-agent", _userAgent); + HeaderSerializer.PopulateHeaders(ref httpRequest, request); var serializedBody = RequestBodySerializer.Serialize(request, "RequestBody", "form", false, true); if (serializedBody != null) @@ -426,11 +527,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("post-users-sign-in-data", null, null); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Butler.cs b/LukeHagar/PlexAPI/SDK/Butler.cs index 8d69912..0a1dee2 100644 --- a/LukeHagar/PlexAPI/SDK/Butler.cs +++ b/LukeHagar/PlexAPI/SDK/Butler.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// Returns a list of butler tasks /// /// - Task GetButlerTasksAsync(); + Task GetButlerTasksAsync(RetryConfig? retryConfig = null); /// /// Start all Butler tasks @@ -53,7 +53,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task StartAllTasksAsync(); + Task StartAllTasksAsync(RetryConfig? retryConfig = null); /// /// Stop all Butler tasks @@ -63,7 +63,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task StopAllTasksAsync(); + Task StopAllTasksAsync(RetryConfig? retryConfig = null); /// /// Start a single Butler task @@ -77,7 +77,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task StartTaskAsync(TaskName taskName); + Task StartTaskAsync(TaskName taskName, RetryConfig? retryConfig = null); /// /// Stop a single Butler task @@ -87,7 +87,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task StopTaskAsync(PathParamTaskName taskName); + Task StopTaskAsync(PathParamTaskName taskName, RetryConfig? retryConfig = null); } /// @@ -101,10 +101,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -117,7 +117,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetButlerTasksAsync() + public async Task GetButlerTasksAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -134,11 +134,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getButlerTasks", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -214,7 +247,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task StartAllTasksAsync() + public async Task StartAllTasksAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -231,11 +264,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("startAllTasks", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -303,7 +369,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task StopAllTasksAsync() + public async Task StopAllTasksAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -320,11 +386,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("stopAllTasks", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -392,7 +491,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task StartTaskAsync(TaskName taskName) + public async Task StartTaskAsync(TaskName taskName, RetryConfig? retryConfig = null) { var request = new StartTaskRequest() { @@ -412,11 +511,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("startTask", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -484,7 +616,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task StopTaskAsync(PathParamTaskName taskName) + public async Task StopTaskAsync(PathParamTaskName taskName, RetryConfig? retryConfig = null) { var request = new StopTaskRequest() { @@ -504,11 +636,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("stopTask", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Hubs.cs b/LukeHagar/PlexAPI/SDK/Hubs.cs index 559f68d..95b0c90 100644 --- a/LukeHagar/PlexAPI/SDK/Hubs.cs +++ b/LukeHagar/PlexAPI/SDK/Hubs.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Global Hubs filtered by the parameters provided. /// /// - Task GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null); + Task GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null, RetryConfig? retryConfig = null); /// /// Get Recently Added @@ -49,7 +49,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetRecentlyAddedAsync(GetRecentlyAddedRequest request); + Task GetRecentlyAddedAsync(GetRecentlyAddedRequest request, RetryConfig? retryConfig = null); /// /// Get library specific hubs @@ -59,7 +59,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null); + Task GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null, RetryConfig? retryConfig = null); } /// @@ -73,10 +73,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -89,7 +89,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null) + public async Task GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null, RetryConfig? retryConfig = null) { var request = new GetGlobalHubsRequest() { @@ -110,11 +110,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getGlobalHubs", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -190,7 +223,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetRecentlyAddedAsync(GetRecentlyAddedRequest request) + public async Task GetRecentlyAddedAsync(GetRecentlyAddedRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/hubs/home/recentlyAdded", request); @@ -206,11 +239,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-recently-added", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -264,7 +330,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null) + public async Task GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null, RetryConfig? retryConfig = null) { var request = new GetLibraryHubsRequest() { @@ -286,11 +352,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getLibraryHubs", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Library.cs b/LukeHagar/PlexAPI/SDK/Library.cs index c64641d..4d107ec 100644 --- a/LukeHagar/PlexAPI/SDK/Library.cs +++ b/LukeHagar/PlexAPI/SDK/Library.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// This resource returns hash values for local files /// /// - Task GetFileHashAsync(string url, double? type = null); + Task GetFileHashAsync(string url, double? type = null, RetryConfig? retryConfig = null); /// /// Get Recently Added @@ -49,7 +49,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request); + Task GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request, RetryConfig? retryConfig = null); /// /// Get All Libraries @@ -64,7 +64,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetAllLibrariesAsync(); + Task GetAllLibrariesAsync(RetryConfig? retryConfig = null); /// /// Get Library Details @@ -112,7 +112,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = null); + Task GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = null, RetryConfig? retryConfig = null); /// /// Delete Library Section @@ -121,7 +121,7 @@ namespace LukeHagar.PlexAPI.SDK /// Delete a library using a specific section id /// /// - Task DeleteLibraryAsync(int sectionKey); + Task DeleteLibraryAsync(int sectionKey, RetryConfig? retryConfig = null); /// /// Get Library Items @@ -150,7 +150,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetLibraryItemsAsync(GetLibraryItemsRequest request); + Task GetLibraryItemsAsync(GetLibraryItemsRequest request, RetryConfig? retryConfig = null); /// /// Refresh Metadata Of The Library @@ -160,7 +160,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null); + Task GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null, RetryConfig? retryConfig = null); /// /// Search Library @@ -187,7 +187,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type); + Task GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type, RetryConfig? retryConfig = null); /// /// Get Metadata by RatingKey @@ -197,7 +197,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetMetaDataByRatingKeyAsync(long ratingKey); + Task GetMetaDataByRatingKeyAsync(long ratingKey, RetryConfig? retryConfig = null); /// /// Get Items Children @@ -207,7 +207,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetMetadataChildrenAsync(double ratingKey, string? includeElements = null); + Task GetMetadataChildrenAsync(double ratingKey, string? includeElements = null, RetryConfig? retryConfig = null); /// /// Get Top Watched Content @@ -217,7 +217,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, long? includeGuids = null); + Task GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, long? includeGuids = null, RetryConfig? retryConfig = null); /// /// Get On Deck @@ -227,7 +227,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetOnDeckAsync(); + Task GetOnDeckAsync(RetryConfig? retryConfig = null); } /// @@ -241,10 +241,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -257,7 +257,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetFileHashAsync(string url, double? type = null) + public async Task GetFileHashAsync(string url, double? type = null, RetryConfig? retryConfig = null) { var request = new GetFileHashRequest() { @@ -278,11 +278,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getFileHash", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -350,7 +383,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request) + public async Task GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/library/recentlyAdded", request); @@ -366,11 +399,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-recently-added-library", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -446,7 +512,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetAllLibrariesAsync() + public async Task GetAllLibrariesAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -463,11 +529,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-all-libraries", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -543,7 +642,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = null) + public async Task GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = null, RetryConfig? retryConfig = null) { var request = new GetLibraryDetailsRequest() { @@ -564,11 +663,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-library-details", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -644,7 +776,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task DeleteLibraryAsync(int sectionKey) + public async Task DeleteLibraryAsync(int sectionKey, RetryConfig? retryConfig = null) { var request = new DeleteLibraryRequest() { @@ -664,11 +796,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("deleteLibrary", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -736,7 +901,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetLibraryItemsAsync(GetLibraryItemsRequest request) + public async Task GetLibraryItemsAsync(GetLibraryItemsRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/library/sections/{sectionKey}/{tag}", request); @@ -752,11 +917,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-library-items", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -832,7 +1030,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null) + public async Task GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null, RetryConfig? retryConfig = null) { var request = new GetRefreshLibraryMetadataRequest() { @@ -853,11 +1051,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-refresh-library-metadata", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -925,7 +1156,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type) + public async Task GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type, RetryConfig? retryConfig = null) { var request = new GetSearchLibraryRequest() { @@ -946,11 +1177,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-search-library", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1026,7 +1290,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetMetaDataByRatingKeyAsync(long ratingKey) + public async Task GetMetaDataByRatingKeyAsync(long ratingKey, RetryConfig? retryConfig = null) { var request = new GetMetaDataByRatingKeyRequest() { @@ -1046,11 +1310,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-meta-data-by-rating-key", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1126,7 +1423,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetMetadataChildrenAsync(double ratingKey, string? includeElements = null) + public async Task GetMetadataChildrenAsync(double ratingKey, string? includeElements = null, RetryConfig? retryConfig = null) { var request = new GetMetadataChildrenRequest() { @@ -1147,11 +1444,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getMetadataChildren", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1227,7 +1557,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, long? includeGuids = null) + public async Task GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, long? includeGuids = null, RetryConfig? retryConfig = null) { var request = new GetTopWatchedContentRequest() { @@ -1248,11 +1578,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getTopWatchedContent", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -1328,7 +1691,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetOnDeckAsync() + public async Task GetOnDeckAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -1345,11 +1708,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getOnDeck", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Log.cs b/LukeHagar/PlexAPI/SDK/Log.cs index c85344d..230835f 100644 --- a/LukeHagar/PlexAPI/SDK/Log.cs +++ b/LukeHagar/PlexAPI/SDK/Log.cs @@ -40,7 +40,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task LogLineAsync(Level level, string message, string source); + Task LogLineAsync(Level level, string message, string source, RetryConfig? retryConfig = null); /// /// Logging a multi-line message @@ -70,7 +70,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task LogMultiLineAsync(string request); + Task LogMultiLineAsync(string request, RetryConfig? retryConfig = null); /// /// Enabling Papertrail @@ -80,7 +80,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task EnablePaperTrailAsync(); + Task EnablePaperTrailAsync(RetryConfig? retryConfig = null); } /// @@ -94,10 +94,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -110,7 +110,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task LogLineAsync(Level level, string message, string source) + public async Task LogLineAsync(Level level, string message, string source, RetryConfig? retryConfig = null) { var request = new LogLineRequest() { @@ -132,11 +132,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("logLine", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -204,7 +237,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task LogMultiLineAsync(string request) + public async Task LogMultiLineAsync(string request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -227,11 +260,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("logMultiLine", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -299,7 +365,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task EnablePaperTrailAsync() + public async Task EnablePaperTrailAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -316,11 +382,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("enablePaperTrail", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode == 403 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/LukeHagar.PlexAPI.SDK.csproj b/LukeHagar/PlexAPI/SDK/LukeHagar.PlexAPI.SDK.csproj index fa03660..71fa7c4 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.8.7 + 0.9.0 net8.0 LukeHagar Copyright (c) LukeHagar 2024 diff --git a/LukeHagar/PlexAPI/SDK/Media.cs b/LukeHagar/PlexAPI/SDK/Media.cs index 5b2af9b..2de7364 100644 --- a/LukeHagar/PlexAPI/SDK/Media.cs +++ b/LukeHagar/PlexAPI/SDK/Media.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// This will mark the provided media key as Played. /// /// - Task MarkPlayedAsync(double key); + Task MarkPlayedAsync(double key, RetryConfig? retryConfig = null); /// /// Mark Media Unplayed @@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK /// This will mark the provided media key as Unplayed. /// /// - Task MarkUnplayedAsync(double key); + Task MarkUnplayedAsync(double key, RetryConfig? retryConfig = null); /// /// Update Media Play Progress @@ -58,7 +58,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task UpdatePlayProgressAsync(string key, double time, string state); + Task UpdatePlayProgressAsync(string key, double time, string state, RetryConfig? retryConfig = null); /// /// Get Banner Image @@ -67,7 +67,7 @@ namespace LukeHagar.PlexAPI.SDK /// Gets the banner image of the media item /// /// - Task GetBannerImageAsync(GetBannerImageRequest request); + Task GetBannerImageAsync(GetBannerImageRequest request, RetryConfig? retryConfig = null); /// /// Get Thumb Image @@ -76,7 +76,7 @@ namespace LukeHagar.PlexAPI.SDK /// Gets the thumbnail image of the media item /// /// - Task GetThumbImageAsync(GetThumbImageRequest request); + Task GetThumbImageAsync(GetThumbImageRequest request, RetryConfig? retryConfig = null); } /// @@ -90,10 +90,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -106,7 +106,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task MarkPlayedAsync(double key) + public async Task MarkPlayedAsync(double key, RetryConfig? retryConfig = null) { var request = new MarkPlayedRequest() { @@ -126,11 +126,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("markPlayed", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -198,7 +231,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task MarkUnplayedAsync(double key) + public async Task MarkUnplayedAsync(double key, RetryConfig? retryConfig = null) { var request = new MarkUnplayedRequest() { @@ -218,11 +251,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("markUnplayed", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -290,7 +356,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task UpdatePlayProgressAsync(string key, double time, string state) + public async Task UpdatePlayProgressAsync(string key, double time, string state, RetryConfig? retryConfig = null) { var request = new UpdatePlayProgressRequest() { @@ -312,11 +378,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("updatePlayProgress", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -384,13 +483,14 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetBannerImageAsync(GetBannerImageRequest request) + public async Task GetBannerImageAsync(GetBannerImageRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/library/metadata/{ratingKey}/banner", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); httpRequest.Headers.Add("user-agent", _userAgent); + HeaderSerializer.PopulateHeaders(ref httpRequest, request); if (_securitySource != null) { @@ -400,11 +500,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-banner-image", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -479,13 +612,14 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetThumbImageAsync(GetThumbImageRequest request) + public async Task GetThumbImageAsync(GetThumbImageRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/library/metadata/{ratingKey}/thumb", request); var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); httpRequest.Headers.Add("user-agent", _userAgent); + HeaderSerializer.PopulateHeaders(ref httpRequest, request); if (_securitySource != null) { @@ -495,11 +629,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-thumb-image", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetBannerImageRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetBannerImageRequest.cs index 45259f5..a06c1a8 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetBannerImageRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetBannerImageRequest.cs @@ -33,9 +33,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public long Upscale { get; set; } = default!; /// - /// Plex Authentication Token + /// An authentication token, obtained from plex.tv /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Token")] + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Token")] public string XPlexToken { get; set; } = default!; } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsRequest.cs index fce1f57..bb0c2da 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetLibraryItemsRequest.cs @@ -15,6 +15,12 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public class GetLibraryItemsRequest { + /// + /// A key representing a specific tag within the section. + /// + [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=tag")] + public Tag Tag { get; set; } = default!; + /// /// The unique key of the Plex library.
/// @@ -26,12 +32,6 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=sectionKey")] public int SectionKey { get; set; } = default!; - /// - /// A key representing a specific tag within the section. - /// - [SpeakeasyMetadata("pathParam:style=simple,explode=false,name=tag")] - public Tag Tag { get; set; } = default!; - /// /// Adds the Guids object to the response
/// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaProvidersRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaProvidersRequest.cs index c41afeb..715e9a0 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaProvidersRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetMediaProvidersRequest.cs @@ -15,9 +15,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests { /// - /// Plex Authentication Token + /// An authentication token, obtained from plex.tv /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Token")] + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Token")] public string XPlexToken { get; set; } = default!; } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetPinRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetPinRequest.cs index a8a3732..e6713a8 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetPinRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetPinRequest.cs @@ -27,21 +27,33 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public bool? Strong { get; set; } = false; /// - /// The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) + /// An opaque identifier unique to the client (UUID, serial number, or other unique device ID) /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Client-Identifier")] + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier")] public string? ClientID { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Product")] + /// + /// The name of the client application. (Plex Web, Plex Media Server, etc.) + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Product")] public string? ClientName { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Device")] - public string? DeviceName { get; set; } + /// + /// A relatively friendly name for the client device + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Device")] + public string? DeviceNickname { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Version")] + /// + /// The version of the client application. + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Version")] public string? ClientVersion { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Platform")] - public string? ClientPlatform { get; set; } + /// + /// The platform of the client application. + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Platform")] + public string? Platform { get; set; } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetServerResourcesRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetServerResourcesRequest.cs index 6a2ef13..1d94282 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetServerResourcesRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetServerResourcesRequest.cs @@ -39,9 +39,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public IncludeIPv6? IncludeIPv6 { get; set; } = LukeHagar.PlexAPI.SDK.Models.Requests.IncludeIPv6.Disable; /// - /// The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) + /// An opaque identifier unique to the client (UUID, serial number, or other unique device ID) /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Client-Identifier")] + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier")] public string? ClientID { get; set; } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetThumbImageRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetThumbImageRequest.cs index 8d40515..9f76ab7 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetThumbImageRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetThumbImageRequest.cs @@ -33,9 +33,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public long Upscale { get; set; } = default!; /// - /// Plex Authentication Token + /// An authentication token, obtained from plex.tv /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Token")] + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Token")] public string XPlexToken { get; set; } = default!; } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenByPinIdRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenByPinIdRequest.cs index c16088b..38e4a7b 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenByPinIdRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetTokenByPinIdRequest.cs @@ -21,21 +21,33 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public long PinID { get; set; } = default!; /// - /// The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) + /// An opaque identifier unique to the client (UUID, serial number, or other unique device ID) /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Client-Identifier")] + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier")] public string? ClientID { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Product")] + /// + /// The name of the client application. (Plex Web, Plex Media Server, etc.) + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Product")] public string? ClientName { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Device")] - public string? DeviceName { get; set; } + /// + /// A relatively friendly name for the client device + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Device")] + public string? DeviceNickname { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Version")] + /// + /// The version of the client application. + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Version")] public string? ClientVersion { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Platform")] - public string? ClientPlatform { get; set; } + /// + /// The platform of the client application. + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Platform")] + public string? Platform { get; set; } } } \ No newline at end of file diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/GetWatchListRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/GetWatchListRequest.cs index 2a6fb01..fb90b42 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/GetWatchListRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/GetWatchListRequest.cs @@ -22,9 +22,9 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests public Filter Filter { get; set; } = default!; /// - /// Plex Authentication Token + /// An authentication token, obtained from plex.tv /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Token")] + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Token")] public string XPlexToken { get; set; } = default!; /// diff --git a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataRequest.cs b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataRequest.cs index 69e3462..43f64d4 100644 --- a/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataRequest.cs +++ b/LukeHagar/PlexAPI/SDK/Models/Requests/PostUsersSignInDataRequest.cs @@ -16,22 +16,34 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests { /// - /// The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) + /// An opaque identifier unique to the client (UUID, serial number, or other unique device ID) /// - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Client-Identifier")] + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier")] public string? ClientID { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Product")] + /// + /// The name of the client application. (Plex Web, Plex Media Server, etc.) + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Product")] public string? ClientName { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Device")] - public string? DeviceName { get; set; } + /// + /// A relatively friendly name for the client device + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Device")] + public string? DeviceNickname { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Version")] + /// + /// The version of the client application. + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Version")] public string? ClientVersion { get; set; } - [SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Platform")] - public string? ClientPlatform { get; set; } + /// + /// The platform of the client application. + /// + [SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Platform")] + public string? Platform { get; set; } /// /// Login credentials diff --git a/LukeHagar/PlexAPI/SDK/Playlists.cs b/LukeHagar/PlexAPI/SDK/Playlists.cs index 10d661a..7ed2b28 100644 --- a/LukeHagar/PlexAPI/SDK/Playlists.cs +++ b/LukeHagar/PlexAPI/SDK/Playlists.cs @@ -45,7 +45,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task CreatePlaylistAsync(CreatePlaylistRequest request); + Task CreatePlaylistAsync(CreatePlaylistRequest request, RetryConfig? retryConfig = null); /// /// Get All Playlists @@ -54,7 +54,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get All Playlists given the specified filters. /// /// - Task GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null); + Task GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null, RetryConfig? retryConfig = null); /// /// Retrieve Playlist @@ -65,7 +65,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetPlaylistAsync(double playlistID); + Task GetPlaylistAsync(double playlistID, RetryConfig? retryConfig = null); /// /// Deletes a Playlist @@ -75,7 +75,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task DeletePlaylistAsync(double playlistID); + Task DeletePlaylistAsync(double playlistID, RetryConfig? retryConfig = null); /// /// Update a Playlist @@ -85,7 +85,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null); + Task UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null, RetryConfig? retryConfig = null); /// /// Retrieve Playlist Contents @@ -98,7 +98,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type); + Task GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type, RetryConfig? retryConfig = null); /// /// Delete Playlist Contents @@ -108,7 +108,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task ClearPlaylistContentsAsync(double playlistID); + Task ClearPlaylistContentsAsync(double playlistID, RetryConfig? retryConfig = null); /// /// Adding to a Playlist @@ -119,7 +119,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null); + Task AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null, RetryConfig? retryConfig = null); /// /// Upload Playlist @@ -129,7 +129,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task UploadPlaylistAsync(string path, QueryParamForce force, long sectionID); + Task UploadPlaylistAsync(string path, QueryParamForce force, long sectionID, RetryConfig? retryConfig = null); } /// @@ -146,10 +146,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -162,7 +162,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task CreatePlaylistAsync(CreatePlaylistRequest request) + public async Task CreatePlaylistAsync(CreatePlaylistRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/playlists", request); @@ -178,11 +178,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("createPlaylist", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -258,7 +291,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null) + public async Task GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null, RetryConfig? retryConfig = null) { var request = new GetPlaylistsRequest() { @@ -279,11 +312,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getPlaylists", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -359,7 +425,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetPlaylistAsync(double playlistID) + public async Task GetPlaylistAsync(double playlistID, RetryConfig? retryConfig = null) { var request = new GetPlaylistRequest() { @@ -379,11 +445,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getPlaylist", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -459,7 +558,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task DeletePlaylistAsync(double playlistID) + public async Task DeletePlaylistAsync(double playlistID, RetryConfig? retryConfig = null) { var request = new DeletePlaylistRequest() { @@ -479,11 +578,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("deletePlaylist", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -551,7 +683,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null) + public async Task UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null, RetryConfig? retryConfig = null) { var request = new UpdatePlaylistRequest() { @@ -573,11 +705,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("updatePlaylist", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -645,7 +810,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type) + public async Task GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type, RetryConfig? retryConfig = null) { var request = new GetPlaylistContentsRequest() { @@ -666,11 +831,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getPlaylistContents", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -746,7 +944,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task ClearPlaylistContentsAsync(double playlistID) + public async Task ClearPlaylistContentsAsync(double playlistID, RetryConfig? retryConfig = null) { var request = new ClearPlaylistContentsRequest() { @@ -766,11 +964,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("clearPlaylistContents", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -838,7 +1069,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null) + public async Task AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null, RetryConfig? retryConfig = null) { var request = new AddPlaylistContentsRequest() { @@ -860,11 +1091,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("addPlaylistContents", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -940,7 +1204,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task UploadPlaylistAsync(string path, QueryParamForce force, long sectionID) + public async Task UploadPlaylistAsync(string path, QueryParamForce force, long sectionID, RetryConfig? retryConfig = null) { var request = new UploadPlaylistRequest() { @@ -962,11 +1226,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("uploadPlaylist", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Plex.cs b/LukeHagar/PlexAPI/SDK/Plex.cs index b7ac29e..92a61d9 100644 --- a/LukeHagar/PlexAPI/SDK/Plex.cs +++ b/LukeHagar/PlexAPI/SDK/Plex.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Companions Data /// /// - Task GetCompanionsDataAsync(string? serverUrl = null); + Task GetCompanionsDataAsync(string? serverUrl = null, RetryConfig? retryConfig = null); /// /// Get list of friends of the user logged in @@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get friends of provided auth token. /// /// - Task GetUserFriendsAsync(string? serverUrl = null); + Task GetUserFriendsAsync(string? serverUrl = null, RetryConfig? retryConfig = null); /// /// Get Geo Data @@ -57,7 +57,7 @@ namespace LukeHagar.PlexAPI.SDK /// Returns the geolocation and locale data of the caller /// /// - Task GetGeoDataAsync(string? serverUrl = null); + Task GetGeoDataAsync(string? serverUrl = null, RetryConfig? retryConfig = null); /// /// Get Plex Home Data @@ -66,7 +66,7 @@ namespace LukeHagar.PlexAPI.SDK /// Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status. /// /// - Task GetHomeDataAsync(); + Task GetHomeDataAsync(RetryConfig? retryConfig = null); /// /// Get Server Resources @@ -75,7 +75,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Plex server access tokens and server connections /// /// - Task GetServerResourcesAsync(IncludeHttps? includeHttps = null, IncludeRelay? includeRelay = null, IncludeIPv6? includeIPv6 = null, string? clientID = null, string? serverUrl = null); + Task GetServerResourcesAsync(IncludeHttps? includeHttps = null, IncludeRelay? includeRelay = null, IncludeIPv6? includeIPv6 = null, string? clientID = null, string? serverUrl = null, RetryConfig? retryConfig = null); /// /// Get a Pin @@ -84,7 +84,7 @@ namespace LukeHagar.PlexAPI.SDK /// Retrieve a Pin ID from Plex.tv to use for authentication flows /// /// - Task GetPinAsync(GetPinRequest? request = null, string? serverUrl = null); + Task GetPinAsync(GetPinRequest? request = null, string? serverUrl = null, RetryConfig? retryConfig = null); /// /// Get Access Token by PinId @@ -93,7 +93,7 @@ namespace LukeHagar.PlexAPI.SDK /// Retrieve an Access Token from Plex.tv after the Pin has been authenticated /// /// - Task GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null); + Task GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null, RetryConfig? retryConfig = null); } /// @@ -143,10 +143,10 @@ namespace LukeHagar.PlexAPI.SDK }; public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -159,7 +159,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetCompanionsDataAsync(string? serverUrl = null) + public async Task GetCompanionsDataAsync(string? serverUrl = null, RetryConfig? retryConfig = null) { string baseUrl = Utilities.TemplateUrl(GetCompanionsDataServerList[0], new Dictionary(){ }); @@ -181,11 +181,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getCompanionsData", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -261,7 +294,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetUserFriendsAsync(string? serverUrl = null) + public async Task GetUserFriendsAsync(string? serverUrl = null, RetryConfig? retryConfig = null) { string baseUrl = Utilities.TemplateUrl(GetUserFriendsServerList[0], new Dictionary(){ }); @@ -283,11 +316,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getUserFriends", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -363,7 +429,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetGeoDataAsync(string? serverUrl = null) + public async Task GetGeoDataAsync(string? serverUrl = null, RetryConfig? retryConfig = null) { string baseUrl = Utilities.TemplateUrl(GetGeoDataServerList[0], new Dictionary(){ }); @@ -380,11 +446,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getGeoData", null, null); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -460,7 +559,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetHomeDataAsync() + public async Task GetHomeDataAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -477,11 +576,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getHomeData", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -557,7 +689,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetServerResourcesAsync(IncludeHttps? includeHttps = null, IncludeRelay? includeRelay = null, IncludeIPv6? includeIPv6 = null, string? clientID = null, string? serverUrl = null) + public async Task GetServerResourcesAsync(IncludeHttps? includeHttps = null, IncludeRelay? includeRelay = null, IncludeIPv6? includeIPv6 = null, string? clientID = null, string? serverUrl = null, RetryConfig? retryConfig = null) { var request = new GetServerResourcesRequest() { @@ -578,6 +710,7 @@ namespace LukeHagar.PlexAPI.SDK var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); httpRequest.Headers.Add("user-agent", _userAgent); + HeaderSerializer.PopulateHeaders(ref httpRequest, request); if (_securitySource != null) { @@ -587,11 +720,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-server-resources", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -667,13 +833,13 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetPinAsync(GetPinRequest? request = null, string? serverUrl = null) + public async Task GetPinAsync(GetPinRequest? request = null, string? serverUrl = null, RetryConfig? retryConfig = null) { request.ClientID ??= SDKConfiguration.ClientID; request.ClientName ??= SDKConfiguration.ClientName; request.ClientVersion ??= SDKConfiguration.ClientVersion; - request.ClientPlatform ??= SDKConfiguration.ClientPlatform; - request.DeviceName ??= SDKConfiguration.DeviceName; + request.Platform ??= SDKConfiguration.Platform; + request.DeviceNickname ??= SDKConfiguration.DeviceNickname; string baseUrl = Utilities.TemplateUrl(GetPinServerList[0], new Dictionary(){ }); @@ -685,15 +851,49 @@ namespace LukeHagar.PlexAPI.SDK var httpRequest = new HttpRequestMessage(HttpMethod.Post, urlString); httpRequest.Headers.Add("user-agent", _userAgent); + HeaderSerializer.PopulateHeaders(ref httpRequest, request); var hookCtx = new HookContext("getPin", null, null); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -758,7 +958,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null) + public async Task GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null, RetryConfig? retryConfig = null) { if (request == null) { @@ -767,8 +967,8 @@ namespace LukeHagar.PlexAPI.SDK request.ClientID ??= SDKConfiguration.ClientID; request.ClientName ??= SDKConfiguration.ClientName; request.ClientVersion ??= SDKConfiguration.ClientVersion; - request.ClientPlatform ??= SDKConfiguration.ClientPlatform; - request.DeviceName ??= SDKConfiguration.DeviceName; + request.Platform ??= SDKConfiguration.Platform; + request.DeviceNickname ??= SDKConfiguration.DeviceNickname; string baseUrl = Utilities.TemplateUrl(GetTokenByPinIdServerList[0], new Dictionary(){ }); @@ -780,15 +980,49 @@ namespace LukeHagar.PlexAPI.SDK var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); httpRequest.Headers.Add("user-agent", _userAgent); + HeaderSerializer.PopulateHeaders(ref httpRequest, request); var hookCtx = new HookContext("getTokenByPinId", null, null); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/PlexAPI.cs b/LukeHagar/PlexAPI/SDK/PlexAPI.cs index 45c3df7..c96cad1 100644 --- a/LukeHagar/PlexAPI/SDK/PlexAPI.cs +++ b/LukeHagar/PlexAPI/SDK/PlexAPI.cs @@ -269,8 +269,8 @@ namespace LukeHagar.PlexAPI.SDK public string? ClientID; public string? ClientName; public string? ClientVersion; - public string? ClientPlatform; - public string? DeviceName; + public string? Platform; + public string? DeviceNickname; public SDKHooks Hooks = new SDKHooks(); public RetryConfig? RetryConfig = null; @@ -331,10 +331,10 @@ namespace LukeHagar.PlexAPI.SDK public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private int _serverIndex = 0; private ISpeakeasyHttpClient _client; @@ -356,7 +356,7 @@ namespace LukeHagar.PlexAPI.SDK public ISessions Sessions { get; private set; } public IUpdater Updater { get; private set; } - public PlexAPI(string? accessToken = null, Func? accessTokenSource = null, string? clientID = null, string? clientName = null, string? clientVersion = null, string? clientPlatform = null, string? deviceName = null, int? serverIndex = null, ServerProtocol? protocol = null, string? ip = null, string? port = null, string? serverUrl = null, Dictionary? urlParams = null, ISpeakeasyHttpClient? client = null, RetryConfig? retryConfig = null) + public PlexAPI(string? accessToken = null, Func? accessTokenSource = null, string? clientID = null, string? clientName = null, string? clientVersion = null, string? platform = null, string? deviceNickname = null, int? serverIndex = null, ServerProtocol? protocol = null, string? ip = null, string? port = null, string? serverUrl = null, Dictionary? urlParams = null, ISpeakeasyHttpClient? client = null, RetryConfig? retryConfig = null) { if (serverIndex != null) { @@ -401,8 +401,8 @@ namespace LukeHagar.PlexAPI.SDK ClientID = clientID, ClientName = clientName, ClientVersion = clientVersion, - ClientPlatform = clientPlatform, - DeviceName = deviceName, + Platform = platform, + DeviceNickname = deviceNickname, ServerDefaults = serverDefaults, ServerIndex = _serverIndex, ServerUrl = _serverUrl, diff --git a/LukeHagar/PlexAPI/SDK/Search.cs b/LukeHagar/PlexAPI/SDK/Search.cs index 5de5bb0..5e9075f 100644 --- a/LukeHagar/PlexAPI/SDK/Search.cs +++ b/LukeHagar/PlexAPI/SDK/Search.cs @@ -51,7 +51,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task PerformSearchAsync(string query, double? sectionId = null, double? limit = null); + Task PerformSearchAsync(string query, double? sectionId = null, double? limit = null, RetryConfig? retryConfig = null); /// /// Perform a voice search @@ -64,7 +64,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = null); + Task PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = null, RetryConfig? retryConfig = null); /// /// Get Search Results @@ -73,7 +73,7 @@ namespace LukeHagar.PlexAPI.SDK /// This will search the database for the string provided. /// /// - Task GetSearchResultsAsync(string query); + Task GetSearchResultsAsync(string query, RetryConfig? retryConfig = null); } /// @@ -87,10 +87,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -103,7 +103,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task PerformSearchAsync(string query, double? sectionId = null, double? limit = null) + public async Task PerformSearchAsync(string query, double? sectionId = null, double? limit = null, RetryConfig? retryConfig = null) { var request = new PerformSearchRequest() { @@ -125,11 +125,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("performSearch", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -197,7 +230,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = null) + public async Task PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = null, RetryConfig? retryConfig = null) { var request = new PerformVoiceSearchRequest() { @@ -219,11 +252,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("performVoiceSearch", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -291,7 +357,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetSearchResultsAsync(string query) + public async Task GetSearchResultsAsync(string query, RetryConfig? retryConfig = null) { var request = new GetSearchResultsRequest() { @@ -311,11 +377,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getSearchResults", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Server.cs b/LukeHagar/PlexAPI/SDK/Server.cs index d23653c..9b32a62 100644 --- a/LukeHagar/PlexAPI/SDK/Server.cs +++ b/LukeHagar/PlexAPI/SDK/Server.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Server Capabilities /// /// - Task GetServerCapabilitiesAsync(); + Task GetServerCapabilitiesAsync(RetryConfig? retryConfig = null); /// /// Get Server Preferences @@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Server Preferences /// /// - Task GetServerPreferencesAsync(); + Task GetServerPreferencesAsync(RetryConfig? retryConfig = null); /// /// Get Available Clients @@ -57,7 +57,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Available Clients /// /// - Task GetAvailableClientsAsync(); + Task GetAvailableClientsAsync(RetryConfig? retryConfig = null); /// /// Get Devices @@ -66,7 +66,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Devices /// /// - Task GetDevicesAsync(); + Task GetDevicesAsync(RetryConfig? retryConfig = null); /// /// Get Server Identity @@ -75,7 +75,7 @@ namespace LukeHagar.PlexAPI.SDK /// This request is useful to determine if the server is online or offline /// /// - Task GetServerIdentityAsync(); + Task GetServerIdentityAsync(RetryConfig? retryConfig = null); /// /// Get MyPlex Account @@ -84,7 +84,7 @@ namespace LukeHagar.PlexAPI.SDK /// Returns MyPlex Account Information /// /// - Task GetMyPlexAccountAsync(); + Task GetMyPlexAccountAsync(RetryConfig? retryConfig = null); /// /// Get a Resized Photo @@ -94,7 +94,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task GetResizedPhotoAsync(GetResizedPhotoRequest request); + Task GetResizedPhotoAsync(GetResizedPhotoRequest request, RetryConfig? retryConfig = null); /// /// Get Media Providers @@ -103,7 +103,7 @@ namespace LukeHagar.PlexAPI.SDK /// Retrieves media providers and their features from the Plex server. /// /// - Task GetMediaProvidersAsync(string xPlexToken); + Task GetMediaProvidersAsync(string xPlexToken, RetryConfig? retryConfig = null); /// /// Get Server List @@ -112,7 +112,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Server List /// /// - Task GetServerListAsync(); + Task GetServerListAsync(RetryConfig? retryConfig = null); } /// @@ -126,10 +126,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -142,7 +142,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetServerCapabilitiesAsync() + public async Task GetServerCapabilitiesAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -159,11 +159,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getServerCapabilities", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -239,7 +272,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetServerPreferencesAsync() + public async Task GetServerPreferencesAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -256,11 +289,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getServerPreferences", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -336,7 +402,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetAvailableClientsAsync() + public async Task GetAvailableClientsAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -353,11 +419,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getAvailableClients", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -433,7 +532,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetDevicesAsync() + public async Task GetDevicesAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -450,11 +549,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getDevices", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -530,7 +662,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetServerIdentityAsync() + public async Task GetServerIdentityAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -542,11 +674,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-server-identity", null, null); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 408 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -611,7 +776,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetMyPlexAccountAsync() + public async Task GetMyPlexAccountAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -628,11 +793,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getMyPlexAccount", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -708,7 +906,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetResizedPhotoAsync(GetResizedPhotoRequest request) + public async Task GetResizedPhotoAsync(GetResizedPhotoRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/photo/:/transcode", request); @@ -724,11 +922,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getResizedPhoto", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -796,17 +1027,19 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetMediaProvidersAsync(string xPlexToken) + public async Task GetMediaProvidersAsync(string xPlexToken, RetryConfig? retryConfig = null) { var request = new GetMediaProvidersRequest() { XPlexToken = xPlexToken, }; string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); - var urlString = URLBuilder.Build(baseUrl, "/media/providers", request); + + var urlString = baseUrl + "/media/providers"; var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); httpRequest.Headers.Add("user-agent", _userAgent); + HeaderSerializer.PopulateHeaders(ref httpRequest, request); if (_securitySource != null) { @@ -816,11 +1049,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-media-providers", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -896,7 +1162,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetServerListAsync() + public async Task GetServerListAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -913,11 +1179,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getServerList", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Sessions.cs b/LukeHagar/PlexAPI/SDK/Sessions.cs index 97914ed..e47461a 100644 --- a/LukeHagar/PlexAPI/SDK/Sessions.cs +++ b/LukeHagar/PlexAPI/SDK/Sessions.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// This will retrieve the "Now Playing" Information of the PMS. /// /// - Task GetSessionsAsync(); + Task GetSessionsAsync(RetryConfig? retryConfig = null); /// /// Get Session History @@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK /// This will Retrieve a listing of all history views. /// /// - Task GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null); + Task GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null, RetryConfig? retryConfig = null); /// /// Get Transcode Sessions @@ -57,7 +57,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get Transcode Sessions /// /// - Task GetTranscodeSessionsAsync(); + Task GetTranscodeSessionsAsync(RetryConfig? retryConfig = null); /// /// Stop a Transcode Session @@ -66,7 +66,7 @@ namespace LukeHagar.PlexAPI.SDK /// Stop a Transcode Session /// /// - Task StopTranscodeSessionAsync(string sessionKey); + Task StopTranscodeSessionAsync(string sessionKey, RetryConfig? retryConfig = null); } /// @@ -80,10 +80,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -96,7 +96,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetSessionsAsync() + public async Task GetSessionsAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -113,11 +113,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getSessions", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -193,7 +226,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null) + public async Task GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null, RetryConfig? retryConfig = null) { var request = new GetSessionHistoryRequest() { @@ -216,11 +249,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getSessionHistory", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -296,7 +362,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetTranscodeSessionsAsync() + public async Task GetTranscodeSessionsAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -313,11 +379,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getTranscodeSessions", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -393,7 +492,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task StopTranscodeSessionAsync(string sessionKey) + public async Task StopTranscodeSessionAsync(string sessionKey, RetryConfig? retryConfig = null) { var request = new StopTranscodeSessionRequest() { @@ -413,11 +512,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("stopTranscodeSession", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Statistics.cs b/LukeHagar/PlexAPI/SDK/Statistics.cs index 5185aa9..c032d28 100644 --- a/LukeHagar/PlexAPI/SDK/Statistics.cs +++ b/LukeHagar/PlexAPI/SDK/Statistics.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// This will return the media statistics for the server /// /// - Task GetStatisticsAsync(long? timespan = null); + Task GetStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null); /// /// Get Resources Statistics @@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK /// This will return the resources for the server /// /// - Task GetResourcesStatisticsAsync(long? timespan = null); + Task GetResourcesStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null); /// /// Get Bandwidth Statistics @@ -57,7 +57,7 @@ namespace LukeHagar.PlexAPI.SDK /// This will return the bandwidth statistics for the server /// /// - Task GetBandwidthStatisticsAsync(long? timespan = null); + Task GetBandwidthStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null); } /// @@ -71,10 +71,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -87,7 +87,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetStatisticsAsync(long? timespan = null) + public async Task GetStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null) { var request = new GetStatisticsRequest() { @@ -107,11 +107,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getStatistics", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -187,7 +220,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetResourcesStatisticsAsync(long? timespan = null) + public async Task GetResourcesStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null) { var request = new GetResourcesStatisticsRequest() { @@ -207,11 +240,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getResourcesStatistics", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -287,7 +353,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task GetBandwidthStatisticsAsync(long? timespan = null) + public async Task GetBandwidthStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null) { var request = new GetBandwidthStatisticsRequest() { @@ -307,11 +373,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getBandwidthStatistics", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Updater.cs b/LukeHagar/PlexAPI/SDK/Updater.cs index 45cbe0b..f44cc6c 100644 --- a/LukeHagar/PlexAPI/SDK/Updater.cs +++ b/LukeHagar/PlexAPI/SDK/Updater.cs @@ -40,7 +40,7 @@ namespace LukeHagar.PlexAPI.SDK /// Querying status of updates /// /// - Task GetUpdateStatusAsync(); + Task GetUpdateStatusAsync(RetryConfig? retryConfig = null); /// /// Checking for updates @@ -49,7 +49,7 @@ namespace LukeHagar.PlexAPI.SDK /// Checking for updates /// /// - Task CheckForUpdatesAsync(Download? download = null); + Task CheckForUpdatesAsync(Download? download = null, RetryConfig? retryConfig = null); /// /// Apply Updates @@ -59,7 +59,7 @@ namespace LukeHagar.PlexAPI.SDK /// /// /// - Task ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null); + Task ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null, RetryConfig? retryConfig = null); } /// @@ -74,10 +74,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -90,7 +90,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetUpdateStatusAsync() + public async Task GetUpdateStatusAsync(RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); @@ -107,11 +107,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getUpdateStatus", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -187,7 +220,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task CheckForUpdatesAsync(Download? download = null) + public async Task CheckForUpdatesAsync(Download? download = null, RetryConfig? retryConfig = null) { var request = new CheckForUpdatesRequest() { @@ -207,11 +240,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("checkForUpdates", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -279,7 +345,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null) + public async Task ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null, RetryConfig? retryConfig = null) { var request = new ApplyUpdatesRequest() { @@ -300,11 +366,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("applyUpdates", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode == 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Video.cs b/LukeHagar/PlexAPI/SDK/Video.cs index 0c7fbbc..6996442 100644 --- a/LukeHagar/PlexAPI/SDK/Video.cs +++ b/LukeHagar/PlexAPI/SDK/Video.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get the timeline for a media item /// /// - Task GetTimelineAsync(GetTimelineRequest request); + Task GetTimelineAsync(GetTimelineRequest request, RetryConfig? retryConfig = null); /// /// Start Universal Transcode @@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK /// Begin a Universal Transcode Session /// /// - Task StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request); + Task StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request, RetryConfig? retryConfig = null); } /// @@ -62,10 +62,10 @@ namespace LukeHagar.PlexAPI.SDK { public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -78,7 +78,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetTimelineAsync(GetTimelineRequest request) + public async Task GetTimelineAsync(GetTimelineRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/:/timeline", request); @@ -94,11 +94,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("getTimeline", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) @@ -166,7 +199,7 @@ namespace LukeHagar.PlexAPI.SDK throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse); } - public async Task StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request) + public async Task StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request, RetryConfig? retryConfig = null) { string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl(); var urlString = URLBuilder.Build(baseUrl, "/video/:/transcode/universal/start.mpd", request); @@ -182,11 +215,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("startUniversalTranscode", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/LukeHagar/PlexAPI/SDK/Watchlist.cs b/LukeHagar/PlexAPI/SDK/Watchlist.cs index 3cdf18a..645a8e4 100644 --- a/LukeHagar/PlexAPI/SDK/Watchlist.cs +++ b/LukeHagar/PlexAPI/SDK/Watchlist.cs @@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK /// Get User Watchlist /// /// - Task GetWatchListAsync(GetWatchListRequest request, string? serverUrl = null); + Task GetWatchListAsync(GetWatchListRequest request, string? serverUrl = null, RetryConfig? retryConfig = null); } /// @@ -59,10 +59,10 @@ namespace LukeHagar.PlexAPI.SDK }; public SDKConfig SDKConfiguration { get; private set; } private const string _language = "csharp"; - private const string _sdkVersion = "0.8.7"; - private const string _sdkGenVersion = "2.428.1"; + private const string _sdkVersion = "0.9.0"; + private const string _sdkGenVersion = "2.429.0"; private const string _openapiDocVersion = "0.0.3"; - private const string _userAgent = "speakeasy-sdk/csharp 0.8.7 2.428.1 0.0.3 LukeHagar.PlexAPI.SDK"; + private const string _userAgent = "speakeasy-sdk/csharp 0.9.0 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK"; private string _serverUrl = ""; private ISpeakeasyHttpClient _client; private Func? _securitySource; @@ -75,7 +75,7 @@ namespace LukeHagar.PlexAPI.SDK SDKConfiguration = config; } - public async Task GetWatchListAsync(GetWatchListRequest request, string? serverUrl = null) + public async Task GetWatchListAsync(GetWatchListRequest request, string? serverUrl = null, RetryConfig? retryConfig = null) { string baseUrl = Utilities.TemplateUrl(GetWatchListServerList[0], new Dictionary(){ }); @@ -87,6 +87,7 @@ namespace LukeHagar.PlexAPI.SDK var httpRequest = new HttpRequestMessage(HttpMethod.Get, urlString); httpRequest.Headers.Add("user-agent", _userAgent); + HeaderSerializer.PopulateHeaders(ref httpRequest, request); if (_securitySource != null) { @@ -96,11 +97,44 @@ namespace LukeHagar.PlexAPI.SDK var hookCtx = new HookContext("get-watch-list", null, _securitySource); httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest); + if (retryConfig == null) + { + if (this.SDKConfiguration.RetryConfig != null) + { + retryConfig = this.SDKConfiguration.RetryConfig; + } + else + { + var backoff = new BackoffStrategy( + initialIntervalMs: 500L, + maxIntervalMs: 60000L, + maxElapsedTimeMs: 3600000L, + exponent: 1.5 + ); + retryConfig = new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: backoff, + retryConnectionErrors: true + ); + } + } + + List statusCodes = new List + { + "5XX", + }; + + Func> retrySend = async () => + { + var _httpRequest = await _client.CloneAsync(httpRequest); + return await _client.SendAsync(_httpRequest); + }; + var retries = new LukeHagar.PlexAPI.SDK.Utils.Retries.Retries(retrySend, retryConfig, statusCodes); HttpResponseMessage httpResponse; try { - httpResponse = await _client.SendAsync(httpRequest); + httpResponse = await retries.Run(); int _statusCode = (int)httpResponse.StatusCode; if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600) diff --git a/NUGET.md b/NUGET.md index e9ff3ad..0aa2623 100644 --- a/NUGET.md +++ b/NUGET.md @@ -12,11 +12,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerCapabilitiesAsync(); @@ -25,55 +25,68 @@ var res = await sdk.Server.GetServerCapabilitiesAsync(); ``` - -## Global Parameters + +## Retries -## Global Parameters - -Certain parameters are configured globally. These parameters may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, These global values will be used as defaults on the operations that use them. When such operations are called, there is a place in each to override the global value, if needed. - -For example, you can set `ClientID` to `"gcgzw5rz2xovp84b4vha3a40"` at SDK initialization and then you do not have to pass the same value on calls to operations like `GetServerResources`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration. - - -### Available Globals - -The following global parameters are available. - -| Name | Type | Required | Description | -| ---- | ---- |:--------:| ----------- | -| clientID | string | | The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) | -| clientName | string | | The ClientName parameter. | -| clientVersion | string | | The ClientVersion parameter. | -| clientPlatform | string | | The ClientPlatform parameter. | -| deviceName | string | | The DeviceName parameter. | - - -### Example +Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. +To change the default retry strategy for a single API call, simply pass a `RetryConfig` to the call: ```csharp using LukeHagar.PlexAPI.SDK; -using LukeHagar.PlexAPI.SDK.Models.Requests; using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); -var res = await sdk.Plex.GetServerResourcesAsync( - includeHttps: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeHttps.Enable, - includeRelay: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeRelay.Enable, - includeIPv6: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeIPv6.Enable, - clientID: "gcgzw5rz2xovp84b4vha3a40" -); +var res = await sdk.Server.GetServerCapabilitiesAsync(retryConfig: new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: new BackoffStrategy( + initialIntervalMs: 1L, + maxIntervalMs: 50L, + maxElapsedTimeMs: 100L, + exponent: 1.1 + ), + retryConnectionErrors: false +)); // handle response ``` - + +If you'd like to override the default retry strategy for all operations that support retries, you can use the `RetryConfig` optional parameter when intitializing the SDK: +```csharp +using LukeHagar.PlexAPI.SDK; +using LukeHagar.PlexAPI.SDK.Models.Components; + +var sdk = new PlexAPI( + retryConfig: new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: new BackoffStrategy( + initialIntervalMs: 1L, + maxIntervalMs: 50L, + maxElapsedTimeMs: 100L, + exponent: 1.1 + ), + retryConnectionErrors: false + ), + accessToken: "", + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" +); + +var res = await sdk.Server.GetServerCapabilitiesAsync(); + +// handle response +``` + ## Error Handling @@ -107,11 +120,11 @@ using LukeHagar.PlexAPI.SDK.Models.Errors; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); try @@ -175,11 +188,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetCompanionsDataAsync(serverUrl: "https://plex.tv/api/v2"); @@ -206,11 +219,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerCapabilitiesAsync(); diff --git a/README.md b/README.md index 387c25f..aa0d24f 100644 --- a/README.md +++ b/README.md @@ -36,11 +36,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerCapabilitiesAsync(); @@ -216,11 +216,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetCompanionsDataAsync(serverUrl: "https://plex.tv/api/v2"); @@ -247,11 +247,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerCapabilitiesAsync(); @@ -260,55 +260,68 @@ var res = await sdk.Server.GetServerCapabilitiesAsync(); ``` - -## Global Parameters + +## Retries -## Global Parameters - -Certain parameters are configured globally. These parameters may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, These global values will be used as defaults on the operations that use them. When such operations are called, there is a place in each to override the global value, if needed. - -For example, you can set `ClientID` to `"gcgzw5rz2xovp84b4vha3a40"` at SDK initialization and then you do not have to pass the same value on calls to operations like `GetServerResources`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration. - - -### Available Globals - -The following global parameters are available. - -| Name | Type | Required | Description | -| ---- | ---- |:--------:| ----------- | -| clientID | string | | The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) | -| clientName | string | | The ClientName parameter. | -| clientVersion | string | | The ClientVersion parameter. | -| clientPlatform | string | | The ClientPlatform parameter. | -| deviceName | string | | The DeviceName parameter. | - - -### Example +Some of the endpoints in this SDK support retries. If you use the SDK without any configuration, it will fall back to the default retry strategy provided by the API. However, the default retry strategy can be overridden on a per-operation basis, or across the entire SDK. +To change the default retry strategy for a single API call, simply pass a `RetryConfig` to the call: ```csharp using LukeHagar.PlexAPI.SDK; -using LukeHagar.PlexAPI.SDK.Models.Requests; using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); -var res = await sdk.Plex.GetServerResourcesAsync( - includeHttps: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeHttps.Enable, - includeRelay: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeRelay.Enable, - includeIPv6: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeIPv6.Enable, - clientID: "gcgzw5rz2xovp84b4vha3a40" -); +var res = await sdk.Server.GetServerCapabilitiesAsync(retryConfig: new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: new BackoffStrategy( + initialIntervalMs: 1L, + maxIntervalMs: 50L, + maxElapsedTimeMs: 100L, + exponent: 1.1 + ), + retryConnectionErrors: false +)); // handle response ``` - + +If you'd like to override the default retry strategy for all operations that support retries, you can use the `RetryConfig` optional parameter when intitializing the SDK: +```csharp +using LukeHagar.PlexAPI.SDK; +using LukeHagar.PlexAPI.SDK.Models.Components; + +var sdk = new PlexAPI( + retryConfig: new RetryConfig( + strategy: RetryConfig.RetryStrategy.BACKOFF, + backoff: new BackoffStrategy( + initialIntervalMs: 1L, + maxIntervalMs: 50L, + maxElapsedTimeMs: 100L, + exponent: 1.1 + ), + retryConnectionErrors: false + ), + accessToken: "", + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" +); + +var res = await sdk.Server.GetServerCapabilitiesAsync(); + +// handle response +``` + ## Error Handling @@ -342,11 +355,11 @@ using LukeHagar.PlexAPI.SDK.Models.Errors; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); try @@ -413,7 +426,7 @@ The following SDKs are generated from the OpenAPI Specification. They are automa * [SDK Installation](#sdk-installation) * [SDK Example Usage](#sdk-example-usage) * [Available Resources and Operations](#available-resources-and-operations) -* [Global Parameters](#global-parameters) +* [Retries](#retries) * [Error Handling](#error-handling) * [Server Selection](#server-selection) * [Authentication](#authentication) diff --git a/RELEASES.md b/RELEASES.md index 3d2af52..fc659b7 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -334,4 +334,14 @@ Based on: ### Generated - [csharp v0.8.7] . ### Releases -- [NuGet v0.8.7] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.8.7 - . \ No newline at end of file +- [NuGet v0.8.7] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.8.7 - . + +## 2024-10-02 09:48:21 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.405.8 (2.429.0) https://github.com/speakeasy-api/speakeasy +### Generated +- [csharp v0.9.0] . +### Releases +- [NuGet v0.9.0] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.9.0 - . \ No newline at end of file diff --git a/USAGE.md b/USAGE.md index 02ad74c..cb75937 100644 --- a/USAGE.md +++ b/USAGE.md @@ -5,11 +5,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerCapabilitiesAsync(); diff --git a/codeSamples.yaml b/codeSamples.yaml index 1d2ba39..b4e66c9 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -14,11 +14,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerCapabilitiesAsync(); @@ -35,11 +35,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerPreferencesAsync(); @@ -57,11 +57,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Media.UpdatePlayProgressAsync( @@ -83,11 +83,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Media.MarkPlayedAsync(key: 59398D); @@ -105,11 +105,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetTimelineRequest req = new GetTimelineRequest() { @@ -140,11 +140,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Media.MarkUnplayedAsync(key: 59398D); @@ -161,11 +161,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Activities.GetServerActivitiesAsync(); @@ -183,11 +183,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Activities.CancelServerActivitiesAsync(activityUUID: "25b71ed5-0f9d-461c-baa7-d404e9e10d3e"); @@ -204,11 +204,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.StopAllTasksAsync(); @@ -225,11 +225,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.GetButlerTasksAsync(); @@ -246,11 +246,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.StartAllTasksAsync(); @@ -268,11 +268,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.StopTaskAsync(taskName: LukeHagar.PlexAPI.SDK.Models.Requests.PathParamTaskName.BackupDatabase); @@ -290,11 +290,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.StartTaskAsync(taskName: LukeHagar.PlexAPI.SDK.Models.Requests.TaskName.CleanOldBundles); @@ -311,11 +311,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetAvailableClientsAsync(); @@ -332,11 +332,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetCompanionsDataAsync(); @@ -353,11 +353,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetDevicesAsync(); @@ -374,11 +374,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetUserFriendsAsync(); @@ -394,11 +394,11 @@ actions: using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetGeoDataAsync(); @@ -415,11 +415,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetHomeDataAsync(); @@ -437,11 +437,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Hubs.GetGlobalHubsAsync( @@ -462,11 +462,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetRecentlyAddedRequest req = new GetRecentlyAddedRequest() { @@ -493,11 +493,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Search.PerformSearchAsync( @@ -519,11 +519,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Search.PerformVoiceSearchAsync( @@ -545,11 +545,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Hubs.GetLibraryHubsAsync( @@ -569,11 +569,11 @@ actions: using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerIdentityAsync(); @@ -591,11 +591,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetTopWatchedContentAsync( @@ -616,11 +616,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetFileHashAsync( @@ -641,11 +641,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetMetaDataByRatingKeyAsync(ratingKey: 9518); @@ -663,11 +663,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetBannerImageRequest req = new GetBannerImageRequest() { @@ -694,11 +694,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetMetadataChildrenAsync( @@ -719,11 +719,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetThumbImageRequest req = new GetThumbImageRequest() { @@ -749,11 +749,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetOnDeckAsync(); @@ -772,11 +772,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetRecentlyAddedLibraryRequest req = new GetRecentlyAddedLibraryRequest() { @@ -816,11 +816,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetAllLibrariesAsync(); @@ -838,11 +838,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetWatchListRequest req = new GetWatchListRequest() { @@ -867,11 +867,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.DeleteLibraryAsync(sectionKey: 9518); @@ -889,11 +889,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetLibraryDetailsAsync( @@ -914,11 +914,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetRefreshLibraryMetadataAsync( @@ -939,11 +939,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetSearchLibraryAsync( @@ -964,18 +964,18 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetLibraryItemsRequest req = new GetLibraryItemsRequest() { - SectionKey = 9518, Tag = LukeHagar.PlexAPI.SDK.Models.Requests.Tag.Edition, IncludeGuids = LukeHagar.PlexAPI.SDK.Models.Requests.IncludeGuids.Enable, Type = LukeHagar.PlexAPI.SDK.Models.Requests.GetLibraryItemsQueryParamType.TvShow, + SectionKey = 9518, IncludeMeta = LukeHagar.PlexAPI.SDK.Models.Requests.GetLibraryItemsQueryParamIncludeMeta.Enable, XPlexContainerStart = 0, XPlexContainerSize = 50, @@ -996,11 +996,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Log.LogLineAsync( @@ -1021,11 +1021,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); string req = "level=4&message=Test%20message%201&source=postman @@ -1046,11 +1046,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Log.EnablePaperTrailAsync(); @@ -1068,11 +1068,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetMediaProvidersAsync(xPlexToken: "CV5xoxjTpFKUzBTShsaf"); @@ -1089,11 +1089,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetMyPlexAccountAsync(); @@ -1111,11 +1111,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetResizedPhotoRequest req = new GetResizedPhotoRequest() { @@ -1142,11 +1142,11 @@ actions: using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetPinRequest req = new GetPinRequest() {}; @@ -1165,11 +1165,11 @@ actions: using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetTokenByPinIdRequest req = new GetTokenByPinIdRequest() { @@ -1191,11 +1191,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.GetPlaylistsAsync( @@ -1216,11 +1216,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); CreatePlaylistRequest req = new CreatePlaylistRequest() { @@ -1245,11 +1245,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.UploadPlaylistAsync( @@ -1271,11 +1271,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.DeletePlaylistAsync(playlistID: 216.22D); @@ -1293,11 +1293,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.GetPlaylistAsync(playlistID: 4109.48D); @@ -1315,11 +1315,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.UpdatePlaylistAsync( @@ -1341,11 +1341,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.ClearPlaylistContentsAsync(playlistID: 1893.18D); @@ -1363,11 +1363,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.GetPlaylistContentsAsync( @@ -1388,11 +1388,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.AddPlaylistContentsAsync( @@ -1414,18 +1414,18 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetServerResourcesAsync( includeHttps: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeHttps.Enable, includeRelay: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeRelay.Enable, includeIPv6: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeIPv6.Enable, - clientID: "gcgzw5rz2xovp84b4vha3a40" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58" ); // handle response @@ -1441,11 +1441,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Search.GetSearchResultsAsync(query: "110"); @@ -1463,11 +1463,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Authentication.GetSourceConnectionInformationAsync(source: "server://client-identifier"); @@ -1485,11 +1485,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Authentication.GetTransientTokenAsync( @@ -1509,11 +1509,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerListAsync(); @@ -1531,11 +1531,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Statistics.GetBandwidthStatisticsAsync(timespan: 4); @@ -1553,11 +1553,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Statistics.GetStatisticsAsync(timespan: 4); @@ -1575,11 +1575,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Statistics.GetResourcesStatisticsAsync(timespan: 4); @@ -1596,11 +1596,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Sessions.GetSessionsAsync(); @@ -1618,11 +1618,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Sessions.GetSessionHistoryAsync( @@ -1644,11 +1644,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Sessions.GetTranscodeSessionsAsync(); @@ -1666,11 +1666,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Sessions.StopTranscodeSessionAsync(sessionKey: "zz7llzqlx8w9vnrsbnwhbmep"); @@ -1688,11 +1688,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Updater.ApplyUpdatesAsync( @@ -1713,11 +1713,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Updater.CheckForUpdatesAsync(download: LukeHagar.PlexAPI.SDK.Models.Requests.Download.One); @@ -1734,11 +1734,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Updater.GetUpdateStatusAsync(); @@ -1755,11 +1755,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Authentication.GetTokenDetailsAsync(); @@ -1776,11 +1776,11 @@ actions: using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); PostUsersSignInDataRequest req = new PostUsersSignInDataRequest() { @@ -1806,11 +1806,11 @@ actions: var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); StartUniversalTranscodeRequest req = new StartUniversalTranscodeRequest() { diff --git a/docs/Models/Requests/GetBannerImageRequest.md b/docs/Models/Requests/GetBannerImageRequest.md index d0936fa..5a5636f 100644 --- a/docs/Models/Requests/GetBannerImageRequest.md +++ b/docs/Models/Requests/GetBannerImageRequest.md @@ -10,4 +10,4 @@ | `Height` | *long* | :heavy_check_mark: | N/A | 396 | | `MinSize` | *long* | :heavy_check_mark: | N/A | 1 | | `Upscale` | *long* | :heavy_check_mark: | N/A | 1 | -| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file +| `XPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/Models/Requests/GetLibraryItemsRequest.md b/docs/Models/Requests/GetLibraryItemsRequest.md index c346827..ffcb1fb 100644 --- a/docs/Models/Requests/GetLibraryItemsRequest.md +++ b/docs/Models/Requests/GetLibraryItemsRequest.md @@ -5,8 +5,8 @@ | Field | Type | Required | Description | Example | | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | | `Tag` | [Tag](../../Models/Requests/Tag.md) | :heavy_check_mark: | A key representing a specific tag within the section. | | +| `SectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 | | `IncludeGuids` | [IncludeGuids](../../Models/Requests/IncludeGuids.md) | :heavy_minus_sign: | Adds the Guids object to the response
| 1 | | `Type` | [GetLibraryItemsQueryParamType](../../Models/Requests/GetLibraryItemsQueryParamType.md) | :heavy_minus_sign: | The type of media to retrieve.
1 = movie
2 = show
3 = season
4 = episode
E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
| 2 | | `IncludeMeta` | [GetLibraryItemsQueryParamIncludeMeta](../../Models/Requests/GetLibraryItemsQueryParamIncludeMeta.md) | :heavy_minus_sign: | Adds the Meta object to the response
| 1 | diff --git a/docs/Models/Requests/GetMediaProvidersRequest.md b/docs/Models/Requests/GetMediaProvidersRequest.md index 2466085..9dea2da 100644 --- a/docs/Models/Requests/GetMediaProvidersRequest.md +++ b/docs/Models/Requests/GetMediaProvidersRequest.md @@ -3,6 +3,6 @@ ## Fields -| Field | Type | Required | Description | Example | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| `XPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/Models/Requests/GetMetadataChildrenMetadata.md b/docs/Models/Requests/GetMetadataChildrenMetadata.md index 12758aa..2cd0ef3 100644 --- a/docs/Models/Requests/GetMetadataChildrenMetadata.md +++ b/docs/Models/Requests/GetMetadataChildrenMetadata.md @@ -15,7 +15,7 @@ | `Title` | *string* | :heavy_minus_sign: | N/A | Season 2 | | `ParentKey` | *string* | :heavy_minus_sign: | N/A | /library/metadata/30072 | | `ParentTitle` | *string* | :heavy_minus_sign: | N/A | Reacher | -| `Summary` | *string* | :heavy_minus_sign: | N/A | Based on"Bad Luck and Trouble," when members of Reacher's old military unit start turning up dead, Reacher has just one thing on his mind—revenge. | +| `Summary` | *string* | :heavy_minus_sign: | N/A | Based on"Bad Luck and Trouble," when members of Reacher's old military unit start turning up dead, Reacher has just one thing on his mind-revenge. | | `Index` | *int* | :heavy_minus_sign: | N/A | 2 | | `ParentIndex` | *int* | :heavy_minus_sign: | N/A | 1 | | `ViewCount` | *int* | :heavy_minus_sign: | N/A | 11 | diff --git a/docs/Models/Requests/GetPinRequest.md b/docs/Models/Requests/GetPinRequest.md index cc63dd6..29d0b5a 100644 --- a/docs/Models/Requests/GetPinRequest.md +++ b/docs/Models/Requests/GetPinRequest.md @@ -3,11 +3,11 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `Strong` | *bool* | :heavy_minus_sign: | Determines the kind of code returned by the API call
Strong codes are used for Pin authentication flows
Non-Strong codes are used for `Plex.tv/link`
| | -| `ClientID` | *string* | :heavy_minus_sign: | The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) | gcgzw5rz2xovp84b4vha3a40 | -| `ClientName` | *string* | :heavy_minus_sign: | N/A | Plex Web | -| `DeviceName` | *string* | :heavy_minus_sign: | N/A | Linux | -| `ClientVersion` | *string* | :heavy_minus_sign: | N/A | 4.133.0 | -| `ClientPlatform` | *string* | :heavy_minus_sign: | N/A | Chrome | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | +| `Strong` | *bool* | :heavy_minus_sign: | Determines the kind of code returned by the API call
Strong codes are used for Pin authentication flows
Non-Strong codes are used for `Plex.tv/link`
| | +| `ClientID` | *string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `ClientName` | *string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | +| `DeviceNickname` | *string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | +| `ClientVersion` | *string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | +| `Platform` | *string* | :heavy_minus_sign: | The platform of the client application. | Roku | \ No newline at end of file diff --git a/docs/Models/Requests/GetServerResourcesRequest.md b/docs/Models/Requests/GetServerResourcesRequest.md index 6e0c6c3..1058fa7 100644 --- a/docs/Models/Requests/GetServerResourcesRequest.md +++ b/docs/Models/Requests/GetServerResourcesRequest.md @@ -3,9 +3,9 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `IncludeHttps` | [IncludeHttps](../../Models/Requests/IncludeHttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 | -| `IncludeRelay` | [IncludeRelay](../../Models/Requests/IncludeRelay.md) | :heavy_minus_sign: | Include Relay addresses in the results
E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
| 1 | -| `IncludeIPv6` | [IncludeIPv6](../../Models/Requests/IncludeIPv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 | -| `ClientID` | *string* | :heavy_minus_sign: | The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) | gcgzw5rz2xovp84b4vha3a40 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `IncludeHttps` | [IncludeHttps](../../Models/Requests/IncludeHttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 | +| `IncludeRelay` | [IncludeRelay](../../Models/Requests/IncludeRelay.md) | :heavy_minus_sign: | Include Relay addresses in the results
E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
| 1 | +| `IncludeIPv6` | [IncludeIPv6](../../Models/Requests/IncludeIPv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 | +| `ClientID` | *string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | \ No newline at end of file diff --git a/docs/Models/Requests/GetThumbImageRequest.md b/docs/Models/Requests/GetThumbImageRequest.md index 4347572..fddedbd 100644 --- a/docs/Models/Requests/GetThumbImageRequest.md +++ b/docs/Models/Requests/GetThumbImageRequest.md @@ -10,4 +10,4 @@ | `Height` | *long* | :heavy_check_mark: | N/A | 396 | | `MinSize` | *long* | :heavy_check_mark: | N/A | 1 | | `Upscale` | *long* | :heavy_check_mark: | N/A | 1 | -| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file +| `XPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/Models/Requests/GetTokenByPinIdRequest.md b/docs/Models/Requests/GetTokenByPinIdRequest.md index 19a397c..01ccd05 100644 --- a/docs/Models/Requests/GetTokenByPinIdRequest.md +++ b/docs/Models/Requests/GetTokenByPinIdRequest.md @@ -3,11 +3,11 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `PinID` | *long* | :heavy_check_mark: | The PinID to retrieve an access token for | | -| `ClientID` | *string* | :heavy_minus_sign: | The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) | gcgzw5rz2xovp84b4vha3a40 | -| `ClientName` | *string* | :heavy_minus_sign: | N/A | Plex Web | -| `DeviceName` | *string* | :heavy_minus_sign: | N/A | Linux | -| `ClientVersion` | *string* | :heavy_minus_sign: | N/A | 4.133.0 | -| `ClientPlatform` | *string* | :heavy_minus_sign: | N/A | Chrome | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `PinID` | *long* | :heavy_check_mark: | The PinID to retrieve an access token for | | +| `ClientID` | *string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `ClientName` | *string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | +| `DeviceNickname` | *string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | +| `ClientVersion` | *string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | +| `Platform` | *string* | :heavy_minus_sign: | The platform of the client application. | Roku | \ No newline at end of file diff --git a/docs/Models/Requests/GetWatchListRequest.md b/docs/Models/Requests/GetWatchListRequest.md index a5a5e89..6ccec03 100644 --- a/docs/Models/Requests/GetWatchListRequest.md +++ b/docs/Models/Requests/GetWatchListRequest.md @@ -6,7 +6,7 @@ | Field | Type | Required | Description | Example | | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `Filter` | [Filter](../../Models/Requests/Filter.md) | :heavy_check_mark: | Filter | | -| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | +| `XPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf | | `Sort` | *string* | :heavy_minus_sign: | In the format "field:dir". Available fields are "watchlistedAt" (Added At),
"titleSort" (Title), "originallyAvailableAt" (Release Date), or "rating" (Critic Rating).
"dir" can be "asc" or "desc"
| | | `Libtype` | [Libtype](../../Models/Requests/Libtype.md) | :heavy_minus_sign: | The type of library to filter. Can be "movie" or "show", or all if not present.
| | | `Maxresults` | *int* | :heavy_minus_sign: | The number of items to return. If not specified, all items will be returned.
If the number of items exceeds the limit, the response will be paginated.
| | diff --git a/docs/Models/Requests/PostUsersSignInDataRequest.md b/docs/Models/Requests/PostUsersSignInDataRequest.md index 3b9fdad..c227bd2 100644 --- a/docs/Models/Requests/PostUsersSignInDataRequest.md +++ b/docs/Models/Requests/PostUsersSignInDataRequest.md @@ -3,11 +3,11 @@ ## Fields -| Field | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `ClientID` | *string* | :heavy_minus_sign: | The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) | gcgzw5rz2xovp84b4vha3a40 | -| `ClientName` | *string* | :heavy_minus_sign: | N/A | Plex Web | -| `DeviceName` | *string* | :heavy_minus_sign: | N/A | Linux | -| `ClientVersion` | *string* | :heavy_minus_sign: | N/A | 4.133.0 | -| `ClientPlatform` | *string* | :heavy_minus_sign: | N/A | Chrome | -| `RequestBody` | [PostUsersSignInDataRequestBody](../../Models/Requests/PostUsersSignInDataRequestBody.md) | :heavy_minus_sign: | Login credentials | | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| `ClientID` | *string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `ClientName` | *string* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | +| `DeviceNickname` | *string* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | +| `ClientVersion` | *string* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | +| `Platform` | *string* | :heavy_minus_sign: | The platform of the client application. | Roku | +| `RequestBody` | [PostUsersSignInDataRequestBody](../../Models/Requests/PostUsersSignInDataRequestBody.md) | :heavy_minus_sign: | Login credentials | | \ No newline at end of file diff --git a/docs/sdks/activities/README.md b/docs/sdks/activities/README.md index 12d29d4..a25f040 100644 --- a/docs/sdks/activities/README.md +++ b/docs/sdks/activities/README.md @@ -29,11 +29,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Activities.GetServerActivitiesAsync(); @@ -66,11 +66,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Activities.CancelServerActivitiesAsync(activityUUID: "25b71ed5-0f9d-461c-baa7-d404e9e10d3e"); diff --git a/docs/sdks/authentication/README.md b/docs/sdks/authentication/README.md index ee09a5a..846cd40 100644 --- a/docs/sdks/authentication/README.md +++ b/docs/sdks/authentication/README.md @@ -27,11 +27,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Authentication.GetTransientTokenAsync( @@ -76,11 +76,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Authentication.GetSourceConnectionInformationAsync(source: "server://client-identifier"); @@ -118,11 +118,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Authentication.GetTokenDetailsAsync(); @@ -160,11 +160,11 @@ using LukeHagar.PlexAPI.SDK.Models.Requests; using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); PostUsersSignInDataRequest req = new PostUsersSignInDataRequest() { diff --git a/docs/sdks/butler/README.md b/docs/sdks/butler/README.md index 18c5ba7..c40a475 100644 --- a/docs/sdks/butler/README.md +++ b/docs/sdks/butler/README.md @@ -26,11 +26,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.GetButlerTasksAsync(); @@ -67,11 +67,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.StartAllTasksAsync(); @@ -104,11 +104,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.StopAllTasksAsync(); @@ -146,11 +146,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.StartTaskAsync(taskName: LukeHagar.PlexAPI.SDK.Models.Requests.TaskName.CleanOldBundles); @@ -190,11 +190,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Butler.StopTaskAsync(taskName: LukeHagar.PlexAPI.SDK.Models.Requests.PathParamTaskName.BackupDatabase); diff --git a/docs/sdks/hubs/README.md b/docs/sdks/hubs/README.md index ac08a9b..fb3d6ca 100644 --- a/docs/sdks/hubs/README.md +++ b/docs/sdks/hubs/README.md @@ -25,11 +25,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Hubs.GetGlobalHubsAsync( @@ -73,11 +73,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetRecentlyAddedRequest req = new GetRecentlyAddedRequest() { @@ -124,11 +124,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Hubs.GetLibraryHubsAsync( diff --git a/docs/sdks/library/README.md b/docs/sdks/library/README.md index f746298..75ada7a 100644 --- a/docs/sdks/library/README.md +++ b/docs/sdks/library/README.md @@ -34,11 +34,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetFileHashAsync( @@ -83,11 +83,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetRecentlyAddedLibraryRequest req = new GetRecentlyAddedLibraryRequest() { @@ -154,11 +154,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetAllLibrariesAsync(); @@ -230,11 +230,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetLibraryDetailsAsync( @@ -277,11 +277,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.DeleteLibraryAsync(sectionKey: 9518); @@ -340,16 +340,16 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetLibraryItemsRequest req = new GetLibraryItemsRequest() { - SectionKey = 9518, Tag = LukeHagar.PlexAPI.SDK.Models.Requests.Tag.Edition, + SectionKey = 9518, IncludeGuids = LukeHagar.PlexAPI.SDK.Models.Requests.IncludeGuids.Enable, Type = LukeHagar.PlexAPI.SDK.Models.Requests.GetLibraryItemsQueryParamType.TvShow, IncludeMeta = LukeHagar.PlexAPI.SDK.Models.Requests.GetLibraryItemsQueryParamIncludeMeta.Enable, @@ -394,11 +394,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetRefreshLibraryMetadataAsync( @@ -459,11 +459,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetSearchLibraryAsync( @@ -507,11 +507,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetMetaDataByRatingKeyAsync(ratingKey: 9518); @@ -551,11 +551,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetMetadataChildrenAsync( @@ -599,11 +599,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetTopWatchedContentAsync( @@ -646,11 +646,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Library.GetOnDeckAsync(); diff --git a/docs/sdks/log/README.md b/docs/sdks/log/README.md index dba281c..40b3a30 100644 --- a/docs/sdks/log/README.md +++ b/docs/sdks/log/README.md @@ -26,11 +26,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Log.LogLineAsync( @@ -95,11 +95,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); string req = "level=4&message=Test%20message%201&source=postman @@ -142,11 +142,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Log.EnablePaperTrailAsync(); diff --git a/docs/sdks/media/README.md b/docs/sdks/media/README.md index 468fca4..0dd4649 100644 --- a/docs/sdks/media/README.md +++ b/docs/sdks/media/README.md @@ -27,11 +27,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Media.MarkPlayedAsync(key: 59398D); @@ -70,11 +70,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Media.MarkUnplayedAsync(key: 59398D); @@ -114,11 +114,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Media.UpdatePlayProgressAsync( @@ -163,11 +163,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetBannerImageRequest req = new GetBannerImageRequest() { @@ -215,11 +215,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetThumbImageRequest req = new GetThumbImageRequest() { diff --git a/docs/sdks/playlists/README.md b/docs/sdks/playlists/README.md index 34b1c43..b9e87fc 100644 --- a/docs/sdks/playlists/README.md +++ b/docs/sdks/playlists/README.md @@ -37,11 +37,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); CreatePlaylistRequest req = new CreatePlaylistRequest() { @@ -87,11 +87,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.GetPlaylistsAsync( @@ -136,11 +136,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.GetPlaylistAsync(playlistID: 4109.48D); @@ -180,11 +180,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.DeletePlaylistAsync(playlistID: 216.22D); @@ -224,11 +224,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.UpdatePlaylistAsync( @@ -277,11 +277,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.GetPlaylistContentsAsync( @@ -325,11 +325,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.ClearPlaylistContentsAsync(playlistID: 1893.18D); @@ -370,11 +370,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.AddPlaylistContentsAsync( @@ -420,11 +420,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Playlists.UploadPlaylistAsync( diff --git a/docs/sdks/plex/README.md b/docs/sdks/plex/README.md index 19c09cf..7db497e 100644 --- a/docs/sdks/plex/README.md +++ b/docs/sdks/plex/README.md @@ -28,11 +28,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetCompanionsDataAsync(); @@ -70,11 +70,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetUserFriendsAsync(); @@ -111,11 +111,11 @@ using LukeHagar.PlexAPI.SDK; using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetGeoDataAsync(); @@ -153,11 +153,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetHomeDataAsync(); @@ -190,18 +190,18 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Plex.GetServerResourcesAsync( includeHttps: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeHttps.Enable, includeRelay: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeRelay.Enable, includeIPv6: LukeHagar.PlexAPI.SDK.Models.Requests.IncludeIPv6.Enable, - clientID: "gcgzw5rz2xovp84b4vha3a40" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58" ); // handle response @@ -209,13 +209,13 @@ var res = await sdk.Plex.GetServerResourcesAsync( ### Parameters -| Parameter | Type | Required | Description | Example | -| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `IncludeHttps` | [IncludeHttps](../../Models/Requests/IncludeHttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 | -| `IncludeRelay` | [IncludeRelay](../../Models/Requests/IncludeRelay.md) | :heavy_minus_sign: | Include Relay addresses in the results
E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
| 1 | -| `IncludeIPv6` | [IncludeIPv6](../../Models/Requests/IncludeIPv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 | -| `ClientID` | *string* | :heavy_minus_sign: | The unique identifier for the client application. This is used to track the client application and its usage. (UUID, serial number, or other number unique per device) | gcgzw5rz2xovp84b4vha3a40 | -| `serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 | +| Parameter | Type | Required | Description | Example | +| ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | +| `IncludeHttps` | [IncludeHttps](../../Models/Requests/IncludeHttps.md) | :heavy_minus_sign: | Include Https entries in the results | 1 | +| `IncludeRelay` | [IncludeRelay](../../Models/Requests/IncludeRelay.md) | :heavy_minus_sign: | Include Relay addresses in the results
E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
| 1 | +| `IncludeIPv6` | [IncludeIPv6](../../Models/Requests/IncludeIPv6.md) | :heavy_minus_sign: | Include IPv6 entries in the results | 1 | +| `ClientID` | *string* | :heavy_minus_sign: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. | http://localhost:8080 | ### Response @@ -241,11 +241,11 @@ using LukeHagar.PlexAPI.SDK.Models.Requests; using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetPinRequest req = new GetPinRequest() {}; @@ -285,11 +285,11 @@ using LukeHagar.PlexAPI.SDK.Models.Requests; using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetTokenByPinIdRequest req = new GetTokenByPinIdRequest() { diff --git a/docs/sdks/search/README.md b/docs/sdks/search/README.md index 5a3ab07..0ed5d27 100644 --- a/docs/sdks/search/README.md +++ b/docs/sdks/search/README.md @@ -37,11 +37,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Search.PerformSearchAsync( @@ -90,11 +90,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Search.PerformVoiceSearchAsync( @@ -139,11 +139,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Search.GetSearchResultsAsync(query: "110"); diff --git a/docs/sdks/server/README.md b/docs/sdks/server/README.md index 4ff6169..2a02576 100644 --- a/docs/sdks/server/README.md +++ b/docs/sdks/server/README.md @@ -30,11 +30,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerCapabilitiesAsync(); @@ -66,11 +66,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerPreferencesAsync(); @@ -102,11 +102,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetAvailableClientsAsync(); @@ -138,11 +138,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetDevicesAsync(); @@ -173,11 +173,11 @@ using LukeHagar.PlexAPI.SDK; using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerIdentityAsync(); @@ -208,11 +208,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetMyPlexAccountAsync(); @@ -246,11 +246,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetResizedPhotoRequest req = new GetResizedPhotoRequest() { @@ -299,11 +299,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetMediaProvidersAsync(xPlexToken: "CV5xoxjTpFKUzBTShsaf"); @@ -313,9 +313,9 @@ var res = await sdk.Server.GetMediaProvidersAsync(xPlexToken: "CV5xoxjTpFKUzBTSh ### Parameters -| Parameter | Type | Required | Description | Example | -| ------------------------- | ------------------------- | ------------------------- | ------------------------- | ------------------------- | -| `XPlexToken` | *string* | :heavy_check_mark: | Plex Authentication Token | CV5xoxjTpFKUzBTShsaf | +| Parameter | Type | Required | Description | Example | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| `XPlexToken` | *string* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf | ### Response @@ -341,11 +341,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Server.GetServerListAsync(); diff --git a/docs/sdks/sessions/README.md b/docs/sdks/sessions/README.md index 41679f3..beaa7e2 100644 --- a/docs/sdks/sessions/README.md +++ b/docs/sdks/sessions/README.md @@ -25,11 +25,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Sessions.GetSessionsAsync(); @@ -62,11 +62,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Sessions.GetSessionHistoryAsync( @@ -112,11 +112,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Sessions.GetTranscodeSessionsAsync(); @@ -149,11 +149,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Sessions.StopTranscodeSessionAsync(sessionKey: "zz7llzqlx8w9vnrsbnwhbmep"); diff --git a/docs/sdks/statistics/README.md b/docs/sdks/statistics/README.md index 79d31a4..7eed76c 100644 --- a/docs/sdks/statistics/README.md +++ b/docs/sdks/statistics/README.md @@ -25,11 +25,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Statistics.GetStatisticsAsync(timespan: 4); @@ -68,11 +68,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Statistics.GetResourcesStatisticsAsync(timespan: 4); @@ -111,11 +111,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Statistics.GetBandwidthStatisticsAsync(timespan: 4); diff --git a/docs/sdks/updater/README.md b/docs/sdks/updater/README.md index baacfb9..c2ec5c1 100644 --- a/docs/sdks/updater/README.md +++ b/docs/sdks/updater/README.md @@ -25,11 +25,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Updater.GetUpdateStatusAsync(); @@ -62,11 +62,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Updater.CheckForUpdatesAsync(download: LukeHagar.PlexAPI.SDK.Models.Requests.Download.One); @@ -106,11 +106,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); var res = await sdk.Updater.ApplyUpdatesAsync( diff --git a/docs/sdks/video/README.md b/docs/sdks/video/README.md index 2c34820..868eb71 100644 --- a/docs/sdks/video/README.md +++ b/docs/sdks/video/README.md @@ -24,11 +24,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetTimelineRequest req = new GetTimelineRequest() { @@ -80,11 +80,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); StartUniversalTranscodeRequest req = new StartUniversalTranscodeRequest() { diff --git a/docs/sdks/watchlist/README.md b/docs/sdks/watchlist/README.md index 28d5744..6c1386e 100644 --- a/docs/sdks/watchlist/README.md +++ b/docs/sdks/watchlist/README.md @@ -23,11 +23,11 @@ using LukeHagar.PlexAPI.SDK.Models.Components; var sdk = new PlexAPI( accessToken: "", - clientID: "gcgzw5rz2xovp84b4vha3a40", - clientName: "Plex Web", - clientVersion: "4.133.0", - clientPlatform: "Chrome", - deviceName: "Linux" + clientID: "3381b62b-9ab7-4e37-827b-203e9809eb58", + clientName: "Plex for Roku", + clientVersion: "2.4.1", + platform: "Roku", + deviceNickname: "Roku 3" ); GetWatchListRequest req = new GetWatchListRequest() {