mirror of
https://github.com/LukeHagar/plexcsharp.git
synced 2025-12-06 12:37:46 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61492e5dad | ||
|
|
f099c01940 |
@@ -1,12 +1,12 @@
|
|||||||
lockVersion: 2.0.0
|
lockVersion: 2.0.0
|
||||||
id: 5a8dbcbc-e0ee-41f0-9d84-b8b50567d1e9
|
id: 5a8dbcbc-e0ee-41f0-9d84-b8b50567d1e9
|
||||||
management:
|
management:
|
||||||
docChecksum: 1ee2e5413af07e886e33659b9b269dd5
|
docChecksum: af45c1ae70f7fc6589adb3f8075cb275
|
||||||
docVersion: 0.0.3
|
docVersion: 0.0.3
|
||||||
speakeasyVersion: 1.405.8
|
speakeasyVersion: 1.438.1
|
||||||
generationVersion: 2.429.0
|
generationVersion: 2.457.2
|
||||||
releaseVersion: 0.9.2
|
releaseVersion: 0.11.0
|
||||||
configChecksum: 81c2971806adecbcf35170ac11c4c585
|
configChecksum: c5bc92dea8d2540f87820eddd9e36dfd
|
||||||
repoURL: https://github.com/LukeHagar/plexcsharp.git
|
repoURL: https://github.com/LukeHagar/plexcsharp.git
|
||||||
repoSubDirectory: .
|
repoSubDirectory: .
|
||||||
published: true
|
published: true
|
||||||
@@ -14,10 +14,10 @@ features:
|
|||||||
csharp:
|
csharp:
|
||||||
additionalDependencies: 0.1.0
|
additionalDependencies: 0.1.0
|
||||||
constsAndDefaults: 0.0.1
|
constsAndDefaults: 0.0.1
|
||||||
core: 3.10.3
|
core: 3.10.4
|
||||||
deprecations: 2.81.2
|
deprecations: 2.81.2
|
||||||
enums: 2.82.0
|
enums: 2.82.0
|
||||||
errors: 0.0.3
|
errors: 0.2.0
|
||||||
flattening: 2.81.3
|
flattening: 2.81.3
|
||||||
globalSecurity: 2.83.6
|
globalSecurity: 2.83.6
|
||||||
globalSecurityCallbacks: 0.1.0
|
globalSecurityCallbacks: 0.1.0
|
||||||
@@ -25,11 +25,11 @@ features:
|
|||||||
globalServerURLs: 2.82.3
|
globalServerURLs: 2.82.3
|
||||||
globals: 2.82.1
|
globals: 2.82.1
|
||||||
intellisenseMarkdownSupport: 0.1.0
|
intellisenseMarkdownSupport: 0.1.0
|
||||||
|
methodArguments: 0.1.0
|
||||||
methodServerURLs: 2.82.1
|
methodServerURLs: 2.82.1
|
||||||
nameOverrides: 2.81.2
|
nameOverrides: 2.81.2
|
||||||
nullables: 0.1.0
|
nullables: 0.1.0
|
||||||
responseFormat: 0.0.4
|
responseFormat: 0.0.4
|
||||||
retries: 0.0.1
|
|
||||||
sdkHooks: 0.1.0
|
sdkHooks: 0.1.0
|
||||||
generatedFiles:
|
generatedFiles:
|
||||||
- .gitattributes
|
- .gitattributes
|
||||||
@@ -2704,7 +2704,7 @@ examples:
|
|||||||
speakeasy-default-get-token-details:
|
speakeasy-default-get-token-details:
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
application/json: {"adsConsent": true, "adsConsentReminderAt": "2019-08-24T14:15:22Z", "adsConsentSetAt": "2019-08-24T14:15:22Z", "anonymous": false, "authToken": "CxoUzBTSV5hsxjTpFKaf", "backupCodesCreated": false, "confirmed": false, "country": "US", "email": "username@email.com", "emailOnlyAuth": false, "experimentalFeatures": false, "friendlyName": "friendlyUsername", "entitlements": ["[]"], "guest": false, "hasPassword": true, "home": false, "homeAdmin": false, "homeSize": 1, "id": 13692262, "joinedAt": 1556281940, "locale": null, "mailingListActive": false, "mailingListStatus": "active", "maxHomeSize": 15, "pin": "string", "profile": {"autoSelectAudio": true, "defaultAudioLanguage": "ja", "defaultSubtitleLanguage": "en", "autoSelectSubtitle": 1, "defaultSubtitleAccessibility": 1, "defaultSubtitleForced": 1, "watchedIndicator": 1, "mediaReviewsVisibility": 1}, "protected": false, "rememberExpiresAt": 1556281940, "restricted": false, "roles": ["string"], "scrobbleTypes": "", "services": [{"identifier": "metadata-dev", "endpoint": "https://epg.provider.plex.tv", "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", "secret": "string", "status": "online"}], "subscription": {"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}, "subscriptionDescription": "string", "subscriptions": [{"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}], "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", "title": "UsernameTitle", "twoFactorEnabled": false, "username": "Username", "uuid": "dae343c1f45beb4f", "attributionPartner": null}
|
application/json: {"adsConsent": true, "adsConsentReminderAt": 1556281940, "adsConsentSetAt": 1556281940, "anonymous": false, "authToken": "CxoUzBTSV5hsxjTpFKaf", "backupCodesCreated": false, "confirmed": false, "country": "US", "email": "username@email.com", "emailOnlyAuth": false, "experimentalFeatures": false, "friendlyName": "friendlyUsername", "entitlements": ["[]"], "guest": false, "hasPassword": true, "home": false, "homeAdmin": false, "homeSize": 1, "id": 13692262, "joinedAt": 1556281940, "locale": null, "mailingListActive": false, "mailingListStatus": "active", "maxHomeSize": 15, "pin": "string", "profile": {"autoSelectAudio": true, "defaultAudioLanguage": "ja", "defaultSubtitleLanguage": "en", "autoSelectSubtitle": 1, "defaultSubtitleAccessibility": 1, "defaultSubtitleForced": 1, "watchedIndicator": 1, "mediaReviewsVisibility": 1}, "protected": false, "rememberExpiresAt": 1556281940, "restricted": false, "roles": ["string"], "scrobbleTypes": "", "services": [{"identifier": "metadata-dev", "endpoint": "https://epg.provider.plex.tv", "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", "secret": "string", "status": "online"}], "subscription": {"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}, "subscriptionDescription": "string", "subscriptions": [{"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}], "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", "title": "UsernameTitle", "twoFactorEnabled": false, "username": "Username", "uuid": "dae343c1f45beb4f", "attributionPartner": null}
|
||||||
"400":
|
"400":
|
||||||
application/json: {"errors": []}
|
application/json: {"errors": []}
|
||||||
"401":
|
"401":
|
||||||
|
|||||||
@@ -11,15 +11,18 @@ generation:
|
|||||||
requestResponseComponentNamesFeb2024: true
|
requestResponseComponentNamesFeb2024: true
|
||||||
auth:
|
auth:
|
||||||
oAuth2ClientCredentialsEnabled: true
|
oAuth2ClientCredentialsEnabled: true
|
||||||
|
oAuth2PasswordEnabled: false
|
||||||
csharp:
|
csharp:
|
||||||
version: 0.9.2
|
version: 0.11.0
|
||||||
additionalDependencies: []
|
additionalDependencies: []
|
||||||
author: LukeHagar
|
author: LukeHagar
|
||||||
clientServerStatusCodesAsErrors: true
|
clientServerStatusCodesAsErrors: true
|
||||||
|
defaultErrorName: SDKException
|
||||||
disableNamespacePascalCasingApr2024: true
|
disableNamespacePascalCasingApr2024: true
|
||||||
dotnetVersion: net8.0
|
dotnetVersion: net8.0
|
||||||
enableSourceLink: true
|
enableSourceLink: true
|
||||||
flattenGlobalSecurity: true
|
flattenGlobalSecurity: true
|
||||||
|
flatteningOrder: ""
|
||||||
imports:
|
imports:
|
||||||
option: openapi
|
option: openapi
|
||||||
paths:
|
paths:
|
||||||
@@ -31,6 +34,7 @@ csharp:
|
|||||||
includeDebugSymbols: true
|
includeDebugSymbols: true
|
||||||
inputModelSuffix: input
|
inputModelSuffix: input
|
||||||
maxMethodParams: 4
|
maxMethodParams: 4
|
||||||
|
methodArguments: infer-optional-args
|
||||||
outputModelSuffix: output
|
outputModelSuffix: output
|
||||||
packageName: LukeHagar.PlexAPI.SDK
|
packageName: LukeHagar.PlexAPI.SDK
|
||||||
packageTags: Plex Media Server SDK
|
packageTags: Plex Media Server SDK
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
speakeasyVersion: 1.405.8
|
speakeasyVersion: 1.438.1
|
||||||
sources:
|
sources:
|
||||||
my-source:
|
my-source:
|
||||||
sourceNamespace: my-source
|
sourceNamespace: my-source
|
||||||
@@ -16,8 +16,8 @@ sources:
|
|||||||
- main
|
- main
|
||||||
plexapi:
|
plexapi:
|
||||||
sourceNamespace: plexapi
|
sourceNamespace: plexapi
|
||||||
sourceRevisionDigest: sha256:c6ab8f13847c7cdc4ab3752f517164d7da08266726255aa0d614b1eaea66fb0e
|
sourceRevisionDigest: sha256:15e040d800921ded49cf84650ef2bc8fb1acf32c885ee193c42e838d754bf345
|
||||||
sourceBlobDigest: sha256:64c7694915a0828aeb256d10d2fa0ea477681785b818916b6681be8cc5ffb93b
|
sourceBlobDigest: sha256:c178be2b4bfefb37d76c0fdaef37c51f9b6ab1410422d3698a41bb6a8d79a79f
|
||||||
tags:
|
tags:
|
||||||
- latest
|
- latest
|
||||||
- main
|
- main
|
||||||
@@ -25,10 +25,10 @@ targets:
|
|||||||
plexcsharp:
|
plexcsharp:
|
||||||
source: plexapi
|
source: plexapi
|
||||||
sourceNamespace: plexapi
|
sourceNamespace: plexapi
|
||||||
sourceRevisionDigest: sha256:c6ab8f13847c7cdc4ab3752f517164d7da08266726255aa0d614b1eaea66fb0e
|
sourceRevisionDigest: sha256:15e040d800921ded49cf84650ef2bc8fb1acf32c885ee193c42e838d754bf345
|
||||||
sourceBlobDigest: sha256:64c7694915a0828aeb256d10d2fa0ea477681785b818916b6681be8cc5ffb93b
|
sourceBlobDigest: sha256:c178be2b4bfefb37d76c0fdaef37c51f9b6ab1410422d3698a41bb6a8d79a79f
|
||||||
codeSamplesNamespace: code-samples-csharp-plexcsharp
|
codeSamplesNamespace: code-samples-csharp-plexcsharp
|
||||||
codeSamplesRevisionDigest: sha256:92500227f7e52cdceac29cb2915dfe637ad1432c312c69dd3acb197b357a3577
|
codeSamplesRevisionDigest: sha256:4e9986991eb14e3738ca129200e36609e1228243d3caeb8441707e07006f50e2
|
||||||
workflow:
|
workflow:
|
||||||
workflowVersion: 1.0.0
|
workflowVersion: 1.0.0
|
||||||
speakeasyVersion: latest
|
speakeasyVersion: latest
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Server Activities
|
/// Get Server Activities
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetServerActivitiesResponse> GetServerActivitiesAsync(RetryConfig? retryConfig = null);
|
Task<GetServerActivitiesResponse> GetServerActivitiesAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Cancel Server Activities
|
/// Cancel Server Activities
|
||||||
@@ -54,7 +54,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Cancel Server Activities
|
/// Cancel Server Activities
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<CancelServerActivitiesResponse> CancelServerActivitiesAsync(string activityUUID, RetryConfig? retryConfig = null);
|
Task<CancelServerActivitiesResponse> CancelServerActivitiesAsync(string activityUUID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -74,10 +74,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -90,7 +90,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetServerActivitiesResponse> GetServerActivitiesAsync(RetryConfig? retryConfig = null)
|
public async Task<GetServerActivitiesResponse> GetServerActivitiesAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -107,44 +107,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getServerActivities", null, _securitySource);
|
var hookCtx = new HookContext("getServerActivities", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -220,7 +187,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CancelServerActivitiesResponse> CancelServerActivitiesAsync(string activityUUID, RetryConfig? retryConfig = null)
|
public async Task<CancelServerActivitiesResponse> CancelServerActivitiesAsync(string activityUUID)
|
||||||
{
|
{
|
||||||
var request = new CancelServerActivitiesRequest()
|
var request = new CancelServerActivitiesRequest()
|
||||||
{
|
{
|
||||||
@@ -240,44 +207,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("cancelServerActivities", null, _securitySource);
|
var hookCtx = new HookContext("cancelServerActivities", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope, RetryConfig? retryConfig = null);
|
Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Source Connection Information
|
/// Get Source Connection Information
|
||||||
@@ -51,7 +51,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(string source, RetryConfig? retryConfig = null);
|
Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(string source);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Token Details
|
/// Get Token Details
|
||||||
@@ -60,7 +60,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get the User data from the provided X-Plex-Token
|
/// Get the User data from the provided X-Plex-Token
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetTokenDetailsResponse> GetTokenDetailsAsync(string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<GetTokenDetailsResponse> GetTokenDetailsAsync(string? serverUrl = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get User Sign In Data
|
/// 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
|
/// Sign in user with username and password and return user data with Plex authentication token
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<PostUsersSignInDataResponse> PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<PostUsersSignInDataResponse> PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -95,10 +95,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
};
|
};
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -111,7 +111,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope, RetryConfig? retryConfig = null)
|
public async Task<GetTransientTokenResponse> GetTransientTokenAsync(GetTransientTokenQueryParamType type, Scope scope)
|
||||||
{
|
{
|
||||||
var request = new GetTransientTokenRequest()
|
var request = new GetTransientTokenRequest()
|
||||||
{
|
{
|
||||||
@@ -132,44 +132,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getTransientToken", null, _securitySource);
|
var hookCtx = new HookContext("getTransientToken", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -237,7 +204,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(string source, RetryConfig? retryConfig = null)
|
public async Task<GetSourceConnectionInformationResponse> GetSourceConnectionInformationAsync(string source)
|
||||||
{
|
{
|
||||||
var request = new GetSourceConnectionInformationRequest()
|
var request = new GetSourceConnectionInformationRequest()
|
||||||
{
|
{
|
||||||
@@ -257,44 +224,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getSourceConnectionInformation", null, _securitySource);
|
var hookCtx = new HookContext("getSourceConnectionInformation", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -362,7 +296,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetTokenDetailsResponse> GetTokenDetailsAsync(string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<GetTokenDetailsResponse> GetTokenDetailsAsync(string? serverUrl = null)
|
||||||
{
|
{
|
||||||
string baseUrl = Utilities.TemplateUrl(GetTokenDetailsServerList[0], new Dictionary<string, string>(){
|
string baseUrl = Utilities.TemplateUrl(GetTokenDetailsServerList[0], new Dictionary<string, string>(){
|
||||||
});
|
});
|
||||||
@@ -384,44 +318,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getTokenDetails", null, _securitySource);
|
var hookCtx = new HookContext("getTokenDetails", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -497,7 +398,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PostUsersSignInDataResponse> PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<PostUsersSignInDataResponse> PostUsersSignInDataAsync(PostUsersSignInDataRequest? request = null, string? serverUrl = null)
|
||||||
{
|
{
|
||||||
request.ClientID ??= SDKConfiguration.ClientID;
|
request.ClientID ??= SDKConfiguration.ClientID;
|
||||||
request.ClientName ??= SDKConfiguration.ClientName;
|
request.ClientName ??= SDKConfiguration.ClientName;
|
||||||
@@ -527,44 +428,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("post-users-sign-in-data", null, null);
|
var hookCtx = new HookContext("post-users-sign-in-data", null, null);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Returns a list of butler tasks
|
/// Returns a list of butler tasks
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetButlerTasksResponse> GetButlerTasksAsync(RetryConfig? retryConfig = null);
|
Task<GetButlerTasksResponse> GetButlerTasksAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start all Butler tasks
|
/// Start all Butler tasks
|
||||||
@@ -53,7 +53,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<StartAllTasksResponse> StartAllTasksAsync(RetryConfig? retryConfig = null);
|
Task<StartAllTasksResponse> StartAllTasksAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop all Butler tasks
|
/// Stop all Butler tasks
|
||||||
@@ -63,7 +63,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<StopAllTasksResponse> StopAllTasksAsync(RetryConfig? retryConfig = null);
|
Task<StopAllTasksResponse> StopAllTasksAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start a single Butler task
|
/// Start a single Butler task
|
||||||
@@ -77,7 +77,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<StartTaskResponse> StartTaskAsync(TaskName taskName, RetryConfig? retryConfig = null);
|
Task<StartTaskResponse> StartTaskAsync(TaskName taskName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop a single Butler task
|
/// Stop a single Butler task
|
||||||
@@ -87,7 +87,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<StopTaskResponse> StopTaskAsync(PathParamTaskName taskName, RetryConfig? retryConfig = null);
|
Task<StopTaskResponse> StopTaskAsync(PathParamTaskName taskName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -101,10 +101,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -117,7 +117,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetButlerTasksResponse> GetButlerTasksAsync(RetryConfig? retryConfig = null)
|
public async Task<GetButlerTasksResponse> GetButlerTasksAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -134,44 +134,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getButlerTasks", null, _securitySource);
|
var hookCtx = new HookContext("getButlerTasks", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -247,7 +214,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<StartAllTasksResponse> StartAllTasksAsync(RetryConfig? retryConfig = null)
|
public async Task<StartAllTasksResponse> StartAllTasksAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -264,44 +231,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("startAllTasks", null, _securitySource);
|
var hookCtx = new HookContext("startAllTasks", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -369,7 +303,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<StopAllTasksResponse> StopAllTasksAsync(RetryConfig? retryConfig = null)
|
public async Task<StopAllTasksResponse> StopAllTasksAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -386,44 +320,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("stopAllTasks", null, _securitySource);
|
var hookCtx = new HookContext("stopAllTasks", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -491,7 +392,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<StartTaskResponse> StartTaskAsync(TaskName taskName, RetryConfig? retryConfig = null)
|
public async Task<StartTaskResponse> StartTaskAsync(TaskName taskName)
|
||||||
{
|
{
|
||||||
var request = new StartTaskRequest()
|
var request = new StartTaskRequest()
|
||||||
{
|
{
|
||||||
@@ -511,44 +412,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("startTask", null, _securitySource);
|
var hookCtx = new HookContext("startTask", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -616,7 +484,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<StopTaskResponse> StopTaskAsync(PathParamTaskName taskName, RetryConfig? retryConfig = null)
|
public async Task<StopTaskResponse> StopTaskAsync(PathParamTaskName taskName)
|
||||||
{
|
{
|
||||||
var request = new StopTaskRequest()
|
var request = new StopTaskRequest()
|
||||||
{
|
{
|
||||||
@@ -636,44 +504,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("stopTask", null, _securitySource);
|
var hookCtx = new HookContext("stopTask", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Global Hubs filtered by the parameters provided.
|
/// Get Global Hubs filtered by the parameters provided.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetGlobalHubsResponse> GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null, RetryConfig? retryConfig = null);
|
Task<GetGlobalHubsResponse> GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Recently Added
|
/// Get Recently Added
|
||||||
@@ -49,7 +49,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetRecentlyAddedResponse> GetRecentlyAddedAsync(GetRecentlyAddedRequest request, RetryConfig? retryConfig = null);
|
Task<GetRecentlyAddedResponse> GetRecentlyAddedAsync(GetRecentlyAddedRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get library specific hubs
|
/// Get library specific hubs
|
||||||
@@ -59,7 +59,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetLibraryHubsResponse> GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null, RetryConfig? retryConfig = null);
|
Task<GetLibraryHubsResponse> GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -73,10 +73,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -89,7 +89,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetGlobalHubsResponse> GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null, RetryConfig? retryConfig = null)
|
public async Task<GetGlobalHubsResponse> GetGlobalHubsAsync(double? count = null, OnlyTransient? onlyTransient = null)
|
||||||
{
|
{
|
||||||
var request = new GetGlobalHubsRequest()
|
var request = new GetGlobalHubsRequest()
|
||||||
{
|
{
|
||||||
@@ -110,44 +110,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getGlobalHubs", null, _securitySource);
|
var hookCtx = new HookContext("getGlobalHubs", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -223,7 +190,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetRecentlyAddedResponse> GetRecentlyAddedAsync(GetRecentlyAddedRequest request, RetryConfig? retryConfig = null)
|
public async Task<GetRecentlyAddedResponse> GetRecentlyAddedAsync(GetRecentlyAddedRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/hubs/home/recentlyAdded", request);
|
var urlString = URLBuilder.Build(baseUrl, "/hubs/home/recentlyAdded", request);
|
||||||
@@ -239,44 +206,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-recently-added", null, _securitySource);
|
var hookCtx = new HookContext("get-recently-added", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -330,7 +264,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetLibraryHubsResponse> GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null, RetryConfig? retryConfig = null)
|
public async Task<GetLibraryHubsResponse> GetLibraryHubsAsync(double sectionId, double? count = null, QueryParamOnlyTransient? onlyTransient = null)
|
||||||
{
|
{
|
||||||
var request = new GetLibraryHubsRequest()
|
var request = new GetLibraryHubsRequest()
|
||||||
{
|
{
|
||||||
@@ -352,44 +286,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getLibraryHubs", null, _securitySource);
|
var hookCtx = new HookContext("getLibraryHubs", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This resource returns hash values for local files
|
/// This resource returns hash values for local files
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetFileHashResponse> GetFileHashAsync(string url, double? type = null, RetryConfig? retryConfig = null);
|
Task<GetFileHashResponse> GetFileHashAsync(string url, double? type = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Recently Added
|
/// Get Recently Added
|
||||||
@@ -49,7 +49,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetRecentlyAddedLibraryResponse> GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request, RetryConfig? retryConfig = null);
|
Task<GetRecentlyAddedLibraryResponse> GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get All Libraries
|
/// Get All Libraries
|
||||||
@@ -64,7 +64,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetAllLibrariesResponse> GetAllLibrariesAsync(RetryConfig? retryConfig = null);
|
Task<GetAllLibrariesResponse> GetAllLibrariesAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Library Details
|
/// Get Library Details
|
||||||
@@ -112,7 +112,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetLibraryDetailsResponse> GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = null, RetryConfig? retryConfig = null);
|
Task<GetLibraryDetailsResponse> GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete Library Section
|
/// Delete Library Section
|
||||||
@@ -121,7 +121,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Delete a library using a specific section id
|
/// Delete a library using a specific section id
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<DeleteLibraryResponse> DeleteLibraryAsync(int sectionKey, RetryConfig? retryConfig = null);
|
Task<DeleteLibraryResponse> DeleteLibraryAsync(int sectionKey);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Library Items
|
/// Get Library Items
|
||||||
@@ -150,7 +150,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetLibraryItemsResponse> GetLibraryItemsAsync(GetLibraryItemsRequest request, RetryConfig? retryConfig = null);
|
Task<GetLibraryItemsResponse> GetLibraryItemsAsync(GetLibraryItemsRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Refresh Metadata Of The Library
|
/// Refresh Metadata Of The Library
|
||||||
@@ -160,7 +160,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetRefreshLibraryMetadataResponse> GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null, RetryConfig? retryConfig = null);
|
Task<GetRefreshLibraryMetadataResponse> GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Search Library
|
/// Search Library
|
||||||
@@ -187,7 +187,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetSearchLibraryResponse> GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type, RetryConfig? retryConfig = null);
|
Task<GetSearchLibraryResponse> GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Search All Libraries
|
/// Search All Libraries
|
||||||
@@ -197,7 +197,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetSearchAllLibrariesResponse> GetSearchAllLibrariesAsync(GetSearchAllLibrariesRequest request, RetryConfig? retryConfig = null);
|
Task<GetSearchAllLibrariesResponse> GetSearchAllLibrariesAsync(GetSearchAllLibrariesRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Metadata by RatingKey
|
/// Get Metadata by RatingKey
|
||||||
@@ -207,7 +207,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetMetaDataByRatingKeyResponse> GetMetaDataByRatingKeyAsync(long ratingKey, RetryConfig? retryConfig = null);
|
Task<GetMetaDataByRatingKeyResponse> GetMetaDataByRatingKeyAsync(long ratingKey);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Items Children
|
/// Get Items Children
|
||||||
@@ -217,7 +217,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetMetadataChildrenResponse> GetMetadataChildrenAsync(double ratingKey, string? includeElements = null, RetryConfig? retryConfig = null);
|
Task<GetMetadataChildrenResponse> GetMetadataChildrenAsync(double ratingKey, string? includeElements = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Top Watched Content
|
/// Get Top Watched Content
|
||||||
@@ -227,7 +227,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetTopWatchedContentResponse> GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, long? includeGuids = null, RetryConfig? retryConfig = null);
|
Task<GetTopWatchedContentResponse> GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, long? includeGuids = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get On Deck
|
/// Get On Deck
|
||||||
@@ -237,7 +237,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetOnDeckResponse> GetOnDeckAsync(RetryConfig? retryConfig = null);
|
Task<GetOnDeckResponse> GetOnDeckAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -251,10 +251,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -267,7 +267,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetFileHashResponse> GetFileHashAsync(string url, double? type = null, RetryConfig? retryConfig = null)
|
public async Task<GetFileHashResponse> GetFileHashAsync(string url, double? type = null)
|
||||||
{
|
{
|
||||||
var request = new GetFileHashRequest()
|
var request = new GetFileHashRequest()
|
||||||
{
|
{
|
||||||
@@ -288,44 +288,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getFileHash", null, _securitySource);
|
var hookCtx = new HookContext("getFileHash", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -393,7 +360,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetRecentlyAddedLibraryResponse> GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request, RetryConfig? retryConfig = null)
|
public async Task<GetRecentlyAddedLibraryResponse> GetRecentlyAddedLibraryAsync(GetRecentlyAddedLibraryRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/library/recentlyAdded", request);
|
var urlString = URLBuilder.Build(baseUrl, "/library/recentlyAdded", request);
|
||||||
@@ -409,44 +376,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-recently-added-library", null, _securitySource);
|
var hookCtx = new HookContext("get-recently-added-library", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -522,7 +456,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetAllLibrariesResponse> GetAllLibrariesAsync(RetryConfig? retryConfig = null)
|
public async Task<GetAllLibrariesResponse> GetAllLibrariesAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -539,44 +473,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-all-libraries", null, _securitySource);
|
var hookCtx = new HookContext("get-all-libraries", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -652,7 +553,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetLibraryDetailsResponse> GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = null, RetryConfig? retryConfig = null)
|
public async Task<GetLibraryDetailsResponse> GetLibraryDetailsAsync(int sectionKey, IncludeDetails? includeDetails = null)
|
||||||
{
|
{
|
||||||
var request = new GetLibraryDetailsRequest()
|
var request = new GetLibraryDetailsRequest()
|
||||||
{
|
{
|
||||||
@@ -673,44 +574,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-library-details", null, _securitySource);
|
var hookCtx = new HookContext("get-library-details", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -786,7 +654,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DeleteLibraryResponse> DeleteLibraryAsync(int sectionKey, RetryConfig? retryConfig = null)
|
public async Task<DeleteLibraryResponse> DeleteLibraryAsync(int sectionKey)
|
||||||
{
|
{
|
||||||
var request = new DeleteLibraryRequest()
|
var request = new DeleteLibraryRequest()
|
||||||
{
|
{
|
||||||
@@ -806,44 +674,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("deleteLibrary", null, _securitySource);
|
var hookCtx = new HookContext("deleteLibrary", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -911,7 +746,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetLibraryItemsResponse> GetLibraryItemsAsync(GetLibraryItemsRequest request, RetryConfig? retryConfig = null)
|
public async Task<GetLibraryItemsResponse> GetLibraryItemsAsync(GetLibraryItemsRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/library/sections/{sectionKey}/{tag}", request);
|
var urlString = URLBuilder.Build(baseUrl, "/library/sections/{sectionKey}/{tag}", request);
|
||||||
@@ -927,44 +762,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-library-items", null, _securitySource);
|
var hookCtx = new HookContext("get-library-items", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1040,7 +842,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetRefreshLibraryMetadataResponse> GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null, RetryConfig? retryConfig = null)
|
public async Task<GetRefreshLibraryMetadataResponse> GetRefreshLibraryMetadataAsync(int sectionKey, Force? force = null)
|
||||||
{
|
{
|
||||||
var request = new GetRefreshLibraryMetadataRequest()
|
var request = new GetRefreshLibraryMetadataRequest()
|
||||||
{
|
{
|
||||||
@@ -1061,44 +863,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-refresh-library-metadata", null, _securitySource);
|
var hookCtx = new HookContext("get-refresh-library-metadata", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1166,7 +935,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetSearchLibraryResponse> GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type, RetryConfig? retryConfig = null)
|
public async Task<GetSearchLibraryResponse> GetSearchLibraryAsync(int sectionKey, GetSearchLibraryQueryParamType type)
|
||||||
{
|
{
|
||||||
var request = new GetSearchLibraryRequest()
|
var request = new GetSearchLibraryRequest()
|
||||||
{
|
{
|
||||||
@@ -1187,44 +956,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-search-library", null, _securitySource);
|
var hookCtx = new HookContext("get-search-library", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1300,7 +1036,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetSearchAllLibrariesResponse> GetSearchAllLibrariesAsync(GetSearchAllLibrariesRequest request, RetryConfig? retryConfig = null)
|
public async Task<GetSearchAllLibrariesResponse> GetSearchAllLibrariesAsync(GetSearchAllLibrariesRequest request)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
{
|
{
|
||||||
@@ -1323,44 +1059,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-search-all-libraries", null, _securitySource);
|
var hookCtx = new HookContext("get-search-all-libraries", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1436,7 +1139,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetMetaDataByRatingKeyResponse> GetMetaDataByRatingKeyAsync(long ratingKey, RetryConfig? retryConfig = null)
|
public async Task<GetMetaDataByRatingKeyResponse> GetMetaDataByRatingKeyAsync(long ratingKey)
|
||||||
{
|
{
|
||||||
var request = new GetMetaDataByRatingKeyRequest()
|
var request = new GetMetaDataByRatingKeyRequest()
|
||||||
{
|
{
|
||||||
@@ -1456,44 +1159,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-meta-data-by-rating-key", null, _securitySource);
|
var hookCtx = new HookContext("get-meta-data-by-rating-key", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1569,7 +1239,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetMetadataChildrenResponse> GetMetadataChildrenAsync(double ratingKey, string? includeElements = null, RetryConfig? retryConfig = null)
|
public async Task<GetMetadataChildrenResponse> GetMetadataChildrenAsync(double ratingKey, string? includeElements = null)
|
||||||
{
|
{
|
||||||
var request = new GetMetadataChildrenRequest()
|
var request = new GetMetadataChildrenRequest()
|
||||||
{
|
{
|
||||||
@@ -1590,44 +1260,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getMetadataChildren", null, _securitySource);
|
var hookCtx = new HookContext("getMetadataChildren", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1703,7 +1340,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetTopWatchedContentResponse> GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, long? includeGuids = null, RetryConfig? retryConfig = null)
|
public async Task<GetTopWatchedContentResponse> GetTopWatchedContentAsync(GetTopWatchedContentQueryParamType type, long? includeGuids = null)
|
||||||
{
|
{
|
||||||
var request = new GetTopWatchedContentRequest()
|
var request = new GetTopWatchedContentRequest()
|
||||||
{
|
{
|
||||||
@@ -1724,44 +1361,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getTopWatchedContent", null, _securitySource);
|
var hookCtx = new HookContext("getTopWatchedContent", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1837,7 +1441,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetOnDeckResponse> GetOnDeckAsync(RetryConfig? retryConfig = null)
|
public async Task<GetOnDeckResponse> GetOnDeckAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -1854,44 +1458,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getOnDeck", null, _securitySource);
|
var hookCtx = new HookContext("getOnDeck", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<LogLineResponse> LogLineAsync(Level level, string message, string source, RetryConfig? retryConfig = null);
|
Task<LogLineResponse> LogLineAsync(Level level, string message, string source);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging a multi-line message
|
/// Logging a multi-line message
|
||||||
@@ -70,7 +70,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<LogMultiLineResponse> LogMultiLineAsync(string request, RetryConfig? retryConfig = null);
|
Task<LogMultiLineResponse> LogMultiLineAsync(string request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Enabling Papertrail
|
/// Enabling Papertrail
|
||||||
@@ -80,7 +80,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<EnablePaperTrailResponse> EnablePaperTrailAsync(RetryConfig? retryConfig = null);
|
Task<EnablePaperTrailResponse> EnablePaperTrailAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -94,10 +94,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -110,7 +110,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<LogLineResponse> LogLineAsync(Level level, string message, string source, RetryConfig? retryConfig = null)
|
public async Task<LogLineResponse> LogLineAsync(Level level, string message, string source)
|
||||||
{
|
{
|
||||||
var request = new LogLineRequest()
|
var request = new LogLineRequest()
|
||||||
{
|
{
|
||||||
@@ -132,44 +132,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("logLine", null, _securitySource);
|
var hookCtx = new HookContext("logLine", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -237,7 +204,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<LogMultiLineResponse> LogMultiLineAsync(string request, RetryConfig? retryConfig = null)
|
public async Task<LogMultiLineResponse> LogMultiLineAsync(string request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -260,44 +227,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("logMultiLine", null, _securitySource);
|
var hookCtx = new HookContext("logMultiLine", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -365,7 +299,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<EnablePaperTrailResponse> EnablePaperTrailAsync(RetryConfig? retryConfig = null)
|
public async Task<EnablePaperTrailResponse> EnablePaperTrailAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -382,44 +316,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("enablePaperTrail", null, _securitySource);
|
var hookCtx = new HookContext("enablePaperTrail", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 403 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode == 403 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -3,37 +3,37 @@
|
|||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<IsPackable>true</IsPackable>
|
<IsPackable>true</IsPackable>
|
||||||
<PackageId>LukeHagar.PlexAPI.SDK</PackageId>
|
<PackageId>LukeHagar.PlexAPI.SDK</PackageId>
|
||||||
<Version>0.9.2</Version>
|
<Version>0.11.0</Version>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Authors>LukeHagar</Authors>
|
<Authors>LukeHagar</Authors>
|
||||||
<Copyright>Copyright (c) LukeHagar 2024</Copyright>
|
<Copyright>Copyright (c) LukeHagar 2024</Copyright>
|
||||||
<RepositoryUrl>https://github.com/LukeHagar/plexcsharp.git</RepositoryUrl>
|
<RepositoryUrl>https://github.com/LukeHagar/plexcsharp.git</RepositoryUrl>
|
||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<PackageTags>Plex Media Server SDK</PackageTags>
|
<PackageTags>Plex Media Server SDK</PackageTags>
|
||||||
<Description># Plex Media Server OpenAPI Specification
|
<Description># Plex Media Server OpenAPI Specification<br/>
|
||||||
|
<br/>
|
||||||
An Open Source OpenAPI Specification for Plex Media Server
|
An Open Source OpenAPI Specification for Plex Media Server<br/>
|
||||||
|
<br/>
|
||||||
Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)
|
Automation and SDKs provided by <a href="https://speakeasyapi.dev/">Speakeasy</a><br/>
|
||||||
|
<br/>
|
||||||
## Documentation
|
## Documentation<br/>
|
||||||
|
<br/>
|
||||||
[API Documentation](https://plexapi.dev)
|
<a href="https://plexapi.dev">API Documentation</a><br/>
|
||||||
|
<br/>
|
||||||
## SDKs
|
## SDKs<br/>
|
||||||
|
<br/>
|
||||||
The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the [main specification Repository](https://github.com/LukeHagar/plex-api-spec).
|
The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the <a href="https://github.com/LukeHagar/plex-api-spec">main specification Repository</a>.<br/>
|
||||||
|
<br/>
|
||||||
| Language | Repository | Releases | Other |
|
| Language | Repository | Releases | Other |<br/>
|
||||||
| --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
|
| --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |<br/>
|
||||||
| Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - |
|
| Python | <a href="https://github.com/LukeHagar/plexpy">GitHub</a> | <a href="https://pypi.org/project/plex-api-client/">PyPI</a> | - |<br/>
|
||||||
| JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - |
|
| JavaScript/TypeScript | <a href="https://github.com/LukeHagar/plexjs">GitHub</a> | <a href="https://www.npmjs.com/package/@lukehagar/plexjs">NPM</a> \ <a href="https://jsr.io/@lukehagar/plexjs">JSR</a> | - |<br/>
|
||||||
| Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |
|
| Go | <a href="https://github.com/LukeHagar/plexgo">GitHub</a> | <a href="https://github.com/LukeHagar/plexgo/releases">Releases</a> | <a href="https://pkg.go.dev/github.com/LukeHagar/plexgo">GoDoc</a> |<br/>
|
||||||
| Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - |
|
| Ruby | <a href="https://github.com/LukeHagar/plexruby">GitHub</a> | <a href="https://github.com/LukeHagar/plexruby/releases">Releases</a> | - |<br/>
|
||||||
| Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - |
|
| Swift | <a href="https://github.com/LukeHagar/plexswift">GitHub</a> | <a href="https://github.com/LukeHagar/plexswift/releases">Releases</a> | - |<br/>
|
||||||
| PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - |
|
| PHP | <a href="https://github.com/LukeHagar/plexphp">GitHub</a> | <a href="https://github.com/LukeHagar/plexphp/releases">Releases</a> | - |<br/>
|
||||||
| Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - |
|
| Java | <a href="https://github.com/LukeHagar/plexjava">GitHub</a> | <a href="https://github.com/LukeHagar/plexjava/releases">Releases</a> | - |<br/>
|
||||||
| C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | -
|
| C# | <a href="https://github.com/LukeHagar/plexcsharp">GitHub</a> | <a href="https://github.com/LukeHagar/plexcsharp/releases">Releases</a> | -<br/>
|
||||||
</Description>
|
</Description>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This will mark the provided media key as Played.
|
/// This will mark the provided media key as Played.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<MarkPlayedResponse> MarkPlayedAsync(double key, RetryConfig? retryConfig = null);
|
Task<MarkPlayedResponse> MarkPlayedAsync(double key);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mark Media Unplayed
|
/// Mark Media Unplayed
|
||||||
@@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This will mark the provided media key as Unplayed.
|
/// This will mark the provided media key as Unplayed.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<MarkUnplayedResponse> MarkUnplayedAsync(double key, RetryConfig? retryConfig = null);
|
Task<MarkUnplayedResponse> MarkUnplayedAsync(double key);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update Media Play Progress
|
/// Update Media Play Progress
|
||||||
@@ -58,7 +58,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state, RetryConfig? retryConfig = null);
|
Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Banner Image
|
/// Get Banner Image
|
||||||
@@ -67,7 +67,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Gets the banner image of the media item
|
/// Gets the banner image of the media item
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetBannerImageResponse> GetBannerImageAsync(GetBannerImageRequest request, RetryConfig? retryConfig = null);
|
Task<GetBannerImageResponse> GetBannerImageAsync(GetBannerImageRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Thumb Image
|
/// Get Thumb Image
|
||||||
@@ -76,7 +76,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Gets the thumbnail image of the media item
|
/// Gets the thumbnail image of the media item
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetThumbImageResponse> GetThumbImageAsync(GetThumbImageRequest request, RetryConfig? retryConfig = null);
|
Task<GetThumbImageResponse> GetThumbImageAsync(GetThumbImageRequest request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -90,10 +90,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -106,7 +106,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<MarkPlayedResponse> MarkPlayedAsync(double key, RetryConfig? retryConfig = null)
|
public async Task<MarkPlayedResponse> MarkPlayedAsync(double key)
|
||||||
{
|
{
|
||||||
var request = new MarkPlayedRequest()
|
var request = new MarkPlayedRequest()
|
||||||
{
|
{
|
||||||
@@ -126,44 +126,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("markPlayed", null, _securitySource);
|
var hookCtx = new HookContext("markPlayed", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -231,7 +198,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<MarkUnplayedResponse> MarkUnplayedAsync(double key, RetryConfig? retryConfig = null)
|
public async Task<MarkUnplayedResponse> MarkUnplayedAsync(double key)
|
||||||
{
|
{
|
||||||
var request = new MarkUnplayedRequest()
|
var request = new MarkUnplayedRequest()
|
||||||
{
|
{
|
||||||
@@ -251,44 +218,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("markUnplayed", null, _securitySource);
|
var hookCtx = new HookContext("markUnplayed", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -356,7 +290,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state, RetryConfig? retryConfig = null)
|
public async Task<UpdatePlayProgressResponse> UpdatePlayProgressAsync(string key, double time, string state)
|
||||||
{
|
{
|
||||||
var request = new UpdatePlayProgressRequest()
|
var request = new UpdatePlayProgressRequest()
|
||||||
{
|
{
|
||||||
@@ -378,44 +312,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("updatePlayProgress", null, _securitySource);
|
var hookCtx = new HookContext("updatePlayProgress", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -483,7 +384,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetBannerImageResponse> GetBannerImageAsync(GetBannerImageRequest request, RetryConfig? retryConfig = null)
|
public async Task<GetBannerImageResponse> GetBannerImageAsync(GetBannerImageRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/library/metadata/{ratingKey}/banner", request);
|
var urlString = URLBuilder.Build(baseUrl, "/library/metadata/{ratingKey}/banner", request);
|
||||||
@@ -500,44 +401,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-banner-image", null, _securitySource);
|
var hookCtx = new HookContext("get-banner-image", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -612,7 +480,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetThumbImageResponse> GetThumbImageAsync(GetThumbImageRequest request, RetryConfig? retryConfig = null)
|
public async Task<GetThumbImageResponse> GetThumbImageAsync(GetThumbImageRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/library/metadata/{ratingKey}/thumb", request);
|
var urlString = URLBuilder.Build(baseUrl, "/library/metadata/{ratingKey}/thumb", request);
|
||||||
@@ -629,44 +497,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-thumb-image", null, _securitySource);
|
var hookCtx = new HookContext("get-thumb-image", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
public bool? MixedParents { get; set; }
|
public bool? MixedParents { get; set; }
|
||||||
|
|
||||||
[JsonProperty("Metadata")]
|
[JsonProperty("Metadata")]
|
||||||
public List<GetLibraryItemsMetadata> Metadata { get; set; } = default!;
|
public List<GetLibraryItemsMetadata>? Metadata { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.<br/>
|
/// The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.<br/>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
TvShow = 2,
|
TvShow = 2,
|
||||||
Season = 3,
|
Season = 3,
|
||||||
Episode = 4,
|
Episode = 4,
|
||||||
|
Audio = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -29,6 +29,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
TvShow = 2,
|
TvShow = 2,
|
||||||
Season = 3,
|
Season = 3,
|
||||||
Episode = 4,
|
Episode = 4,
|
||||||
|
Audio = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -29,6 +29,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
TvShow = 2,
|
TvShow = 2,
|
||||||
Season = 3,
|
Season = 3,
|
||||||
Episode = 4,
|
Episode = 4,
|
||||||
|
Audio = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -27,17 +27,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
[JsonProperty("adsConsent", NullValueHandling = NullValueHandling.Include)]
|
[JsonProperty("adsConsent", NullValueHandling = NullValueHandling.Include)]
|
||||||
public bool? AdsConsent { get; set; }
|
public bool? AdsConsent { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Unknown
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("adsConsentReminderAt", NullValueHandling = NullValueHandling.Include)]
|
[JsonProperty("adsConsentReminderAt", NullValueHandling = NullValueHandling.Include)]
|
||||||
public DateTime? AdsConsentReminderAt { get; set; }
|
public long? AdsConsentReminderAt { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Unknown
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("adsConsentSetAt", NullValueHandling = NullValueHandling.Include)]
|
[JsonProperty("adsConsentSetAt", NullValueHandling = NullValueHandling.Include)]
|
||||||
public DateTime? AdsConsentSetAt { get; set; }
|
public long? AdsConsentSetAt { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unknown
|
/// Unknown
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
TvShow = 2,
|
TvShow = 2,
|
||||||
Season = 3,
|
Season = 3,
|
||||||
Episode = 4,
|
Episode = 4,
|
||||||
|
Audio = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -27,17 +27,11 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
[JsonProperty("adsConsent", NullValueHandling = NullValueHandling.Include)]
|
[JsonProperty("adsConsent", NullValueHandling = NullValueHandling.Include)]
|
||||||
public bool? AdsConsent { get; set; }
|
public bool? AdsConsent { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Unknown
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("adsConsentReminderAt", NullValueHandling = NullValueHandling.Include)]
|
[JsonProperty("adsConsentReminderAt", NullValueHandling = NullValueHandling.Include)]
|
||||||
public DateTime? AdsConsentReminderAt { get; set; }
|
public long? AdsConsentReminderAt { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Unknown
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("adsConsentSetAt", NullValueHandling = NullValueHandling.Include)]
|
[JsonProperty("adsConsentSetAt", NullValueHandling = NullValueHandling.Include)]
|
||||||
public DateTime? AdsConsentSetAt { get; set; }
|
public long? AdsConsentSetAt { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Unknown
|
/// Unknown
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
TvShow = 2,
|
TvShow = 2,
|
||||||
Season = 3,
|
Season = 3,
|
||||||
Episode = 4,
|
Episode = 4,
|
||||||
|
Audio = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -29,6 +29,7 @@ namespace LukeHagar.PlexAPI.SDK.Models.Requests
|
|||||||
TvShow = 2,
|
TvShow = 2,
|
||||||
Season = 3,
|
Season = 3,
|
||||||
Episode = 4,
|
Episode = 4,
|
||||||
|
Audio = 8,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -45,7 +45,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<CreatePlaylistResponse> CreatePlaylistAsync(CreatePlaylistRequest request, RetryConfig? retryConfig = null);
|
Task<CreatePlaylistResponse> CreatePlaylistAsync(CreatePlaylistRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get All Playlists
|
/// Get All Playlists
|
||||||
@@ -54,7 +54,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get All Playlists given the specified filters.
|
/// Get All Playlists given the specified filters.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetPlaylistsResponse> GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null, RetryConfig? retryConfig = null);
|
Task<GetPlaylistsResponse> GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve Playlist
|
/// Retrieve Playlist
|
||||||
@@ -65,7 +65,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetPlaylistResponse> GetPlaylistAsync(double playlistID, RetryConfig? retryConfig = null);
|
Task<GetPlaylistResponse> GetPlaylistAsync(double playlistID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Deletes a Playlist
|
/// Deletes a Playlist
|
||||||
@@ -75,7 +75,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<DeletePlaylistResponse> DeletePlaylistAsync(double playlistID, RetryConfig? retryConfig = null);
|
Task<DeletePlaylistResponse> DeletePlaylistAsync(double playlistID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Update a Playlist
|
/// Update a Playlist
|
||||||
@@ -85,7 +85,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<UpdatePlaylistResponse> UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null, RetryConfig? retryConfig = null);
|
Task<UpdatePlaylistResponse> UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieve Playlist Contents
|
/// Retrieve Playlist Contents
|
||||||
@@ -98,7 +98,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetPlaylistContentsResponse> GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type, RetryConfig? retryConfig = null);
|
Task<GetPlaylistContentsResponse> GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Delete Playlist Contents
|
/// Delete Playlist Contents
|
||||||
@@ -108,7 +108,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<ClearPlaylistContentsResponse> ClearPlaylistContentsAsync(double playlistID, RetryConfig? retryConfig = null);
|
Task<ClearPlaylistContentsResponse> ClearPlaylistContentsAsync(double playlistID);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Adding to a Playlist
|
/// Adding to a Playlist
|
||||||
@@ -119,7 +119,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<AddPlaylistContentsResponse> AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null, RetryConfig? retryConfig = null);
|
Task<AddPlaylistContentsResponse> AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Upload Playlist
|
/// Upload Playlist
|
||||||
@@ -129,7 +129,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<UploadPlaylistResponse> UploadPlaylistAsync(string path, QueryParamForce force, long sectionID, RetryConfig? retryConfig = null);
|
Task<UploadPlaylistResponse> UploadPlaylistAsync(string path, QueryParamForce force, long sectionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -146,10 +146,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -162,7 +162,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CreatePlaylistResponse> CreatePlaylistAsync(CreatePlaylistRequest request, RetryConfig? retryConfig = null)
|
public async Task<CreatePlaylistResponse> CreatePlaylistAsync(CreatePlaylistRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/playlists", request);
|
var urlString = URLBuilder.Build(baseUrl, "/playlists", request);
|
||||||
@@ -178,44 +178,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("createPlaylist", null, _securitySource);
|
var hookCtx = new HookContext("createPlaylist", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -291,7 +258,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetPlaylistsResponse> GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null, RetryConfig? retryConfig = null)
|
public async Task<GetPlaylistsResponse> GetPlaylistsAsync(PlaylistType? playlistType = null, QueryParamSmart? smart = null)
|
||||||
{
|
{
|
||||||
var request = new GetPlaylistsRequest()
|
var request = new GetPlaylistsRequest()
|
||||||
{
|
{
|
||||||
@@ -312,44 +279,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getPlaylists", null, _securitySource);
|
var hookCtx = new HookContext("getPlaylists", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -425,7 +359,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetPlaylistResponse> GetPlaylistAsync(double playlistID, RetryConfig? retryConfig = null)
|
public async Task<GetPlaylistResponse> GetPlaylistAsync(double playlistID)
|
||||||
{
|
{
|
||||||
var request = new GetPlaylistRequest()
|
var request = new GetPlaylistRequest()
|
||||||
{
|
{
|
||||||
@@ -445,44 +379,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getPlaylist", null, _securitySource);
|
var hookCtx = new HookContext("getPlaylist", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -558,7 +459,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<DeletePlaylistResponse> DeletePlaylistAsync(double playlistID, RetryConfig? retryConfig = null)
|
public async Task<DeletePlaylistResponse> DeletePlaylistAsync(double playlistID)
|
||||||
{
|
{
|
||||||
var request = new DeletePlaylistRequest()
|
var request = new DeletePlaylistRequest()
|
||||||
{
|
{
|
||||||
@@ -578,44 +479,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("deletePlaylist", null, _securitySource);
|
var hookCtx = new HookContext("deletePlaylist", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -683,7 +551,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UpdatePlaylistResponse> UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null, RetryConfig? retryConfig = null)
|
public async Task<UpdatePlaylistResponse> UpdatePlaylistAsync(double playlistID, string? title = null, string? summary = null)
|
||||||
{
|
{
|
||||||
var request = new UpdatePlaylistRequest()
|
var request = new UpdatePlaylistRequest()
|
||||||
{
|
{
|
||||||
@@ -705,44 +573,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("updatePlaylist", null, _securitySource);
|
var hookCtx = new HookContext("updatePlaylist", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -810,7 +645,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetPlaylistContentsResponse> GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type, RetryConfig? retryConfig = null)
|
public async Task<GetPlaylistContentsResponse> GetPlaylistContentsAsync(double playlistID, GetPlaylistContentsQueryParamType type)
|
||||||
{
|
{
|
||||||
var request = new GetPlaylistContentsRequest()
|
var request = new GetPlaylistContentsRequest()
|
||||||
{
|
{
|
||||||
@@ -831,44 +666,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getPlaylistContents", null, _securitySource);
|
var hookCtx = new HookContext("getPlaylistContents", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -944,7 +746,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ClearPlaylistContentsResponse> ClearPlaylistContentsAsync(double playlistID, RetryConfig? retryConfig = null)
|
public async Task<ClearPlaylistContentsResponse> ClearPlaylistContentsAsync(double playlistID)
|
||||||
{
|
{
|
||||||
var request = new ClearPlaylistContentsRequest()
|
var request = new ClearPlaylistContentsRequest()
|
||||||
{
|
{
|
||||||
@@ -964,44 +766,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("clearPlaylistContents", null, _securitySource);
|
var hookCtx = new HookContext("clearPlaylistContents", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1069,7 +838,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<AddPlaylistContentsResponse> AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null, RetryConfig? retryConfig = null)
|
public async Task<AddPlaylistContentsResponse> AddPlaylistContentsAsync(double playlistID, string uri, double? playQueueID = null)
|
||||||
{
|
{
|
||||||
var request = new AddPlaylistContentsRequest()
|
var request = new AddPlaylistContentsRequest()
|
||||||
{
|
{
|
||||||
@@ -1091,44 +860,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("addPlaylistContents", null, _securitySource);
|
var hookCtx = new HookContext("addPlaylistContents", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1204,7 +940,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<UploadPlaylistResponse> UploadPlaylistAsync(string path, QueryParamForce force, long sectionID, RetryConfig? retryConfig = null)
|
public async Task<UploadPlaylistResponse> UploadPlaylistAsync(string path, QueryParamForce force, long sectionID)
|
||||||
{
|
{
|
||||||
var request = new UploadPlaylistRequest()
|
var request = new UploadPlaylistRequest()
|
||||||
{
|
{
|
||||||
@@ -1226,44 +962,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("uploadPlaylist", null, _securitySource);
|
var hookCtx = new HookContext("uploadPlaylist", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Companions Data
|
/// Get Companions Data
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetCompanionsDataResponse> GetCompanionsDataAsync(string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<GetCompanionsDataResponse> GetCompanionsDataAsync(string? serverUrl = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get list of friends of the user logged in
|
/// Get list of friends of the user logged in
|
||||||
@@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get friends of provided auth token.
|
/// Get friends of provided auth token.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetUserFriendsResponse> GetUserFriendsAsync(string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<GetUserFriendsResponse> GetUserFriendsAsync(string? serverUrl = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Geo Data
|
/// Get Geo Data
|
||||||
@@ -57,7 +57,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Returns the geolocation and locale data of the caller
|
/// Returns the geolocation and locale data of the caller
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetGeoDataResponse> GetGeoDataAsync(string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<GetGeoDataResponse> GetGeoDataAsync(string? serverUrl = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Plex Home Data
|
/// 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.
|
/// Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetHomeDataResponse> GetHomeDataAsync(RetryConfig? retryConfig = null);
|
Task<GetHomeDataResponse> GetHomeDataAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Server Resources
|
/// Get Server Resources
|
||||||
@@ -75,7 +75,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Plex server access tokens and server connections
|
/// Get Plex server access tokens and server connections
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetServerResourcesResponse> GetServerResourcesAsync(IncludeHttps? includeHttps = null, IncludeRelay? includeRelay = null, IncludeIPv6? includeIPv6 = null, string? clientID = null, string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<GetServerResourcesResponse> GetServerResourcesAsync(IncludeHttps? includeHttps = null, IncludeRelay? includeRelay = null, IncludeIPv6? includeIPv6 = null, string? clientID = null, string? serverUrl = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a Pin
|
/// Get a Pin
|
||||||
@@ -84,7 +84,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Retrieve a Pin ID from Plex.tv to use for authentication flows
|
/// Retrieve a Pin ID from Plex.tv to use for authentication flows
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetPinResponse> GetPinAsync(GetPinRequest? request = null, string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<GetPinResponse> GetPinAsync(GetPinRequest? request = null, string? serverUrl = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Access Token by PinId
|
/// 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
|
/// Retrieve an Access Token from Plex.tv after the Pin has been authenticated
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetTokenByPinIdResponse> GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<GetTokenByPinIdResponse> GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -143,10 +143,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
};
|
};
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -159,7 +159,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetCompanionsDataResponse> GetCompanionsDataAsync(string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<GetCompanionsDataResponse> GetCompanionsDataAsync(string? serverUrl = null)
|
||||||
{
|
{
|
||||||
string baseUrl = Utilities.TemplateUrl(GetCompanionsDataServerList[0], new Dictionary<string, string>(){
|
string baseUrl = Utilities.TemplateUrl(GetCompanionsDataServerList[0], new Dictionary<string, string>(){
|
||||||
});
|
});
|
||||||
@@ -181,44 +181,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getCompanionsData", null, _securitySource);
|
var hookCtx = new HookContext("getCompanionsData", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -294,7 +261,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetUserFriendsResponse> GetUserFriendsAsync(string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<GetUserFriendsResponse> GetUserFriendsAsync(string? serverUrl = null)
|
||||||
{
|
{
|
||||||
string baseUrl = Utilities.TemplateUrl(GetUserFriendsServerList[0], new Dictionary<string, string>(){
|
string baseUrl = Utilities.TemplateUrl(GetUserFriendsServerList[0], new Dictionary<string, string>(){
|
||||||
});
|
});
|
||||||
@@ -316,44 +283,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getUserFriends", null, _securitySource);
|
var hookCtx = new HookContext("getUserFriends", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -429,7 +363,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetGeoDataResponse> GetGeoDataAsync(string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<GetGeoDataResponse> GetGeoDataAsync(string? serverUrl = null)
|
||||||
{
|
{
|
||||||
string baseUrl = Utilities.TemplateUrl(GetGeoDataServerList[0], new Dictionary<string, string>(){
|
string baseUrl = Utilities.TemplateUrl(GetGeoDataServerList[0], new Dictionary<string, string>(){
|
||||||
});
|
});
|
||||||
@@ -446,44 +380,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getGeoData", null, null);
|
var hookCtx = new HookContext("getGeoData", null, null);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -559,7 +460,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetHomeDataResponse> GetHomeDataAsync(RetryConfig? retryConfig = null)
|
public async Task<GetHomeDataResponse> GetHomeDataAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -576,44 +477,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getHomeData", null, _securitySource);
|
var hookCtx = new HookContext("getHomeData", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -689,7 +557,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetServerResourcesResponse> GetServerResourcesAsync(IncludeHttps? includeHttps = null, IncludeRelay? includeRelay = null, IncludeIPv6? includeIPv6 = null, string? clientID = null, string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<GetServerResourcesResponse> GetServerResourcesAsync(IncludeHttps? includeHttps = null, IncludeRelay? includeRelay = null, IncludeIPv6? includeIPv6 = null, string? clientID = null, string? serverUrl = null)
|
||||||
{
|
{
|
||||||
var request = new GetServerResourcesRequest()
|
var request = new GetServerResourcesRequest()
|
||||||
{
|
{
|
||||||
@@ -720,44 +588,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-server-resources", null, _securitySource);
|
var hookCtx = new HookContext("get-server-resources", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -833,7 +668,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetPinResponse> GetPinAsync(GetPinRequest? request = null, string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<GetPinResponse> GetPinAsync(GetPinRequest? request = null, string? serverUrl = null)
|
||||||
{
|
{
|
||||||
request.ClientID ??= SDKConfiguration.ClientID;
|
request.ClientID ??= SDKConfiguration.ClientID;
|
||||||
request.ClientName ??= SDKConfiguration.ClientName;
|
request.ClientName ??= SDKConfiguration.ClientName;
|
||||||
@@ -856,44 +691,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getPin", null, null);
|
var hookCtx = new HookContext("getPin", null, null);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -958,7 +760,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetTokenByPinIdResponse> GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<GetTokenByPinIdResponse> GetTokenByPinIdAsync(GetTokenByPinIdRequest request, string? serverUrl = null)
|
||||||
{
|
{
|
||||||
if (request == null)
|
if (request == null)
|
||||||
{
|
{
|
||||||
@@ -985,44 +787,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getTokenByPinId", null, null);
|
var hookCtx = new HookContext("getTokenByPinId", null, null);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 404 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -331,10 +331,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
|
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private int _serverIndex = 0;
|
private int _serverIndex = 0;
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<PerformSearchResponse> PerformSearchAsync(string query, double? sectionId = null, double? limit = null, RetryConfig? retryConfig = null);
|
Task<PerformSearchResponse> PerformSearchAsync(string query, double? sectionId = null, double? limit = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Perform a voice search
|
/// Perform a voice search
|
||||||
@@ -64,7 +64,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<PerformVoiceSearchResponse> PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = null, RetryConfig? retryConfig = null);
|
Task<PerformVoiceSearchResponse> PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Search Results
|
/// Get Search Results
|
||||||
@@ -73,7 +73,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This will search the database for the string provided.
|
/// This will search the database for the string provided.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetSearchResultsResponse> GetSearchResultsAsync(string query, RetryConfig? retryConfig = null);
|
Task<GetSearchResultsResponse> GetSearchResultsAsync(string query);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -87,10 +87,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -103,7 +103,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PerformSearchResponse> PerformSearchAsync(string query, double? sectionId = null, double? limit = null, RetryConfig? retryConfig = null)
|
public async Task<PerformSearchResponse> PerformSearchAsync(string query, double? sectionId = null, double? limit = null)
|
||||||
{
|
{
|
||||||
var request = new PerformSearchRequest()
|
var request = new PerformSearchRequest()
|
||||||
{
|
{
|
||||||
@@ -125,44 +125,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("performSearch", null, _securitySource);
|
var hookCtx = new HookContext("performSearch", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -230,7 +197,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<PerformVoiceSearchResponse> PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = null, RetryConfig? retryConfig = null)
|
public async Task<PerformVoiceSearchResponse> PerformVoiceSearchAsync(string query, double? sectionId = null, double? limit = null)
|
||||||
{
|
{
|
||||||
var request = new PerformVoiceSearchRequest()
|
var request = new PerformVoiceSearchRequest()
|
||||||
{
|
{
|
||||||
@@ -252,44 +219,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("performVoiceSearch", null, _securitySource);
|
var hookCtx = new HookContext("performVoiceSearch", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -357,7 +291,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetSearchResultsResponse> GetSearchResultsAsync(string query, RetryConfig? retryConfig = null)
|
public async Task<GetSearchResultsResponse> GetSearchResultsAsync(string query)
|
||||||
{
|
{
|
||||||
var request = new GetSearchResultsRequest()
|
var request = new GetSearchResultsRequest()
|
||||||
{
|
{
|
||||||
@@ -377,44 +311,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getSearchResults", null, _securitySource);
|
var hookCtx = new HookContext("getSearchResults", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Server Capabilities
|
/// Get Server Capabilities
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetServerCapabilitiesResponse> GetServerCapabilitiesAsync(RetryConfig? retryConfig = null);
|
Task<GetServerCapabilitiesResponse> GetServerCapabilitiesAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Server Preferences
|
/// Get Server Preferences
|
||||||
@@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Server Preferences
|
/// Get Server Preferences
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetServerPreferencesResponse> GetServerPreferencesAsync(RetryConfig? retryConfig = null);
|
Task<GetServerPreferencesResponse> GetServerPreferencesAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Available Clients
|
/// Get Available Clients
|
||||||
@@ -57,7 +57,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Available Clients
|
/// Get Available Clients
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetAvailableClientsResponse> GetAvailableClientsAsync(RetryConfig? retryConfig = null);
|
Task<GetAvailableClientsResponse> GetAvailableClientsAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Devices
|
/// Get Devices
|
||||||
@@ -66,7 +66,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Devices
|
/// Get Devices
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetDevicesResponse> GetDevicesAsync(RetryConfig? retryConfig = null);
|
Task<GetDevicesResponse> GetDevicesAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Server Identity
|
/// Get Server Identity
|
||||||
@@ -75,7 +75,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This request is useful to determine if the server is online or offline
|
/// This request is useful to determine if the server is online or offline
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetServerIdentityResponse> GetServerIdentityAsync(RetryConfig? retryConfig = null);
|
Task<GetServerIdentityResponse> GetServerIdentityAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get MyPlex Account
|
/// Get MyPlex Account
|
||||||
@@ -84,7 +84,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Returns MyPlex Account Information
|
/// Returns MyPlex Account Information
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetMyPlexAccountResponse> GetMyPlexAccountAsync(RetryConfig? retryConfig = null);
|
Task<GetMyPlexAccountResponse> GetMyPlexAccountAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get a Resized Photo
|
/// Get a Resized Photo
|
||||||
@@ -94,7 +94,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetResizedPhotoResponse> GetResizedPhotoAsync(GetResizedPhotoRequest request, RetryConfig? retryConfig = null);
|
Task<GetResizedPhotoResponse> GetResizedPhotoAsync(GetResizedPhotoRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Media Providers
|
/// Get Media Providers
|
||||||
@@ -103,7 +103,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Retrieves media providers and their features from the Plex server.
|
/// Retrieves media providers and their features from the Plex server.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetMediaProvidersResponse> GetMediaProvidersAsync(string xPlexToken, RetryConfig? retryConfig = null);
|
Task<GetMediaProvidersResponse> GetMediaProvidersAsync(string xPlexToken);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Server List
|
/// Get Server List
|
||||||
@@ -112,7 +112,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Server List
|
/// Get Server List
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetServerListResponse> GetServerListAsync(RetryConfig? retryConfig = null);
|
Task<GetServerListResponse> GetServerListAsync();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -126,10 +126,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -142,7 +142,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetServerCapabilitiesResponse> GetServerCapabilitiesAsync(RetryConfig? retryConfig = null)
|
public async Task<GetServerCapabilitiesResponse> GetServerCapabilitiesAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -159,44 +159,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getServerCapabilities", null, _securitySource);
|
var hookCtx = new HookContext("getServerCapabilities", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -272,7 +239,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetServerPreferencesResponse> GetServerPreferencesAsync(RetryConfig? retryConfig = null)
|
public async Task<GetServerPreferencesResponse> GetServerPreferencesAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -289,44 +256,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getServerPreferences", null, _securitySource);
|
var hookCtx = new HookContext("getServerPreferences", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -402,7 +336,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetAvailableClientsResponse> GetAvailableClientsAsync(RetryConfig? retryConfig = null)
|
public async Task<GetAvailableClientsResponse> GetAvailableClientsAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -419,44 +353,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getAvailableClients", null, _securitySource);
|
var hookCtx = new HookContext("getAvailableClients", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -532,7 +433,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetDevicesResponse> GetDevicesAsync(RetryConfig? retryConfig = null)
|
public async Task<GetDevicesResponse> GetDevicesAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -549,44 +450,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getDevices", null, _securitySource);
|
var hookCtx = new HookContext("getDevices", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -662,7 +530,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetServerIdentityResponse> GetServerIdentityAsync(RetryConfig? retryConfig = null)
|
public async Task<GetServerIdentityResponse> GetServerIdentityAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -674,44 +542,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-server-identity", null, null);
|
var hookCtx = new HookContext("get-server-identity", null, null);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 408 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 408 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -776,7 +611,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetMyPlexAccountResponse> GetMyPlexAccountAsync(RetryConfig? retryConfig = null)
|
public async Task<GetMyPlexAccountResponse> GetMyPlexAccountAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -793,44 +628,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getMyPlexAccount", null, _securitySource);
|
var hookCtx = new HookContext("getMyPlexAccount", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -906,7 +708,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetResizedPhotoResponse> GetResizedPhotoAsync(GetResizedPhotoRequest request, RetryConfig? retryConfig = null)
|
public async Task<GetResizedPhotoResponse> GetResizedPhotoAsync(GetResizedPhotoRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/photo/:/transcode", request);
|
var urlString = URLBuilder.Build(baseUrl, "/photo/:/transcode", request);
|
||||||
@@ -922,44 +724,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getResizedPhoto", null, _securitySource);
|
var hookCtx = new HookContext("getResizedPhoto", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1027,7 +796,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetMediaProvidersResponse> GetMediaProvidersAsync(string xPlexToken, RetryConfig? retryConfig = null)
|
public async Task<GetMediaProvidersResponse> GetMediaProvidersAsync(string xPlexToken)
|
||||||
{
|
{
|
||||||
var request = new GetMediaProvidersRequest()
|
var request = new GetMediaProvidersRequest()
|
||||||
{
|
{
|
||||||
@@ -1049,44 +818,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-media-providers", null, _securitySource);
|
var hookCtx = new HookContext("get-media-providers", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -1162,7 +898,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetServerListResponse> GetServerListAsync(RetryConfig? retryConfig = null)
|
public async Task<GetServerListResponse> GetServerListAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -1179,44 +915,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getServerList", null, _securitySource);
|
var hookCtx = new HookContext("getServerList", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This will retrieve the "Now Playing" Information of the PMS.
|
/// This will retrieve the "Now Playing" Information of the PMS.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetSessionsResponse> GetSessionsAsync(RetryConfig? retryConfig = null);
|
Task<GetSessionsResponse> GetSessionsAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Session History
|
/// Get Session History
|
||||||
@@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This will Retrieve a listing of all history views.
|
/// This will Retrieve a listing of all history views.
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetSessionHistoryResponse> GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null, RetryConfig? retryConfig = null);
|
Task<GetSessionHistoryResponse> GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Transcode Sessions
|
/// Get Transcode Sessions
|
||||||
@@ -57,7 +57,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get Transcode Sessions
|
/// Get Transcode Sessions
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetTranscodeSessionsResponse> GetTranscodeSessionsAsync(RetryConfig? retryConfig = null);
|
Task<GetTranscodeSessionsResponse> GetTranscodeSessionsAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stop a Transcode Session
|
/// Stop a Transcode Session
|
||||||
@@ -66,7 +66,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Stop a Transcode Session
|
/// Stop a Transcode Session
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<StopTranscodeSessionResponse> StopTranscodeSessionAsync(string sessionKey, RetryConfig? retryConfig = null);
|
Task<StopTranscodeSessionResponse> StopTranscodeSessionAsync(string sessionKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -80,10 +80,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -96,7 +96,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetSessionsResponse> GetSessionsAsync(RetryConfig? retryConfig = null)
|
public async Task<GetSessionsResponse> GetSessionsAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -113,44 +113,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getSessions", null, _securitySource);
|
var hookCtx = new HookContext("getSessions", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -226,7 +193,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetSessionHistoryResponse> GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null, RetryConfig? retryConfig = null)
|
public async Task<GetSessionHistoryResponse> GetSessionHistoryAsync(string? sort = null, long? accountId = null, QueryParamFilter? filter = null, long? librarySectionID = null)
|
||||||
{
|
{
|
||||||
var request = new GetSessionHistoryRequest()
|
var request = new GetSessionHistoryRequest()
|
||||||
{
|
{
|
||||||
@@ -249,44 +216,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getSessionHistory", null, _securitySource);
|
var hookCtx = new HookContext("getSessionHistory", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -362,7 +296,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetTranscodeSessionsResponse> GetTranscodeSessionsAsync(RetryConfig? retryConfig = null)
|
public async Task<GetTranscodeSessionsResponse> GetTranscodeSessionsAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -379,44 +313,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getTranscodeSessions", null, _securitySource);
|
var hookCtx = new HookContext("getTranscodeSessions", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -492,7 +393,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<StopTranscodeSessionResponse> StopTranscodeSessionAsync(string sessionKey, RetryConfig? retryConfig = null)
|
public async Task<StopTranscodeSessionResponse> StopTranscodeSessionAsync(string sessionKey)
|
||||||
{
|
{
|
||||||
var request = new StopTranscodeSessionRequest()
|
var request = new StopTranscodeSessionRequest()
|
||||||
{
|
{
|
||||||
@@ -512,44 +413,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("stopTranscodeSession", null, _securitySource);
|
var hookCtx = new HookContext("stopTranscodeSession", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This will return the media statistics for the server
|
/// This will return the media statistics for the server
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetStatisticsResponse> GetStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null);
|
Task<GetStatisticsResponse> GetStatisticsAsync(long? timespan = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Resources Statistics
|
/// Get Resources Statistics
|
||||||
@@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This will return the resources for the server
|
/// This will return the resources for the server
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetResourcesStatisticsResponse> GetResourcesStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null);
|
Task<GetResourcesStatisticsResponse> GetResourcesStatisticsAsync(long? timespan = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get Bandwidth Statistics
|
/// Get Bandwidth Statistics
|
||||||
@@ -57,7 +57,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// This will return the bandwidth statistics for the server
|
/// This will return the bandwidth statistics for the server
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetBandwidthStatisticsResponse> GetBandwidthStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null);
|
Task<GetBandwidthStatisticsResponse> GetBandwidthStatisticsAsync(long? timespan = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -71,10 +71,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -87,7 +87,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetStatisticsResponse> GetStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null)
|
public async Task<GetStatisticsResponse> GetStatisticsAsync(long? timespan = null)
|
||||||
{
|
{
|
||||||
var request = new GetStatisticsRequest()
|
var request = new GetStatisticsRequest()
|
||||||
{
|
{
|
||||||
@@ -107,44 +107,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getStatistics", null, _securitySource);
|
var hookCtx = new HookContext("getStatistics", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -220,7 +187,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetResourcesStatisticsResponse> GetResourcesStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null)
|
public async Task<GetResourcesStatisticsResponse> GetResourcesStatisticsAsync(long? timespan = null)
|
||||||
{
|
{
|
||||||
var request = new GetResourcesStatisticsRequest()
|
var request = new GetResourcesStatisticsRequest()
|
||||||
{
|
{
|
||||||
@@ -240,44 +207,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getResourcesStatistics", null, _securitySource);
|
var hookCtx = new HookContext("getResourcesStatistics", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -353,7 +287,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetBandwidthStatisticsResponse> GetBandwidthStatisticsAsync(long? timespan = null, RetryConfig? retryConfig = null)
|
public async Task<GetBandwidthStatisticsResponse> GetBandwidthStatisticsAsync(long? timespan = null)
|
||||||
{
|
{
|
||||||
var request = new GetBandwidthStatisticsRequest()
|
var request = new GetBandwidthStatisticsRequest()
|
||||||
{
|
{
|
||||||
@@ -373,44 +307,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getBandwidthStatistics", null, _securitySource);
|
var hookCtx = new HookContext("getBandwidthStatistics", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Querying status of updates
|
/// Querying status of updates
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetUpdateStatusResponse> GetUpdateStatusAsync(RetryConfig? retryConfig = null);
|
Task<GetUpdateStatusResponse> GetUpdateStatusAsync();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checking for updates
|
/// Checking for updates
|
||||||
@@ -49,7 +49,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Checking for updates
|
/// Checking for updates
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<CheckForUpdatesResponse> CheckForUpdatesAsync(Download? download = null, RetryConfig? retryConfig = null);
|
Task<CheckForUpdatesResponse> CheckForUpdatesAsync(Download? download = null);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply Updates
|
/// Apply Updates
|
||||||
@@ -59,7 +59,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
///
|
///
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<ApplyUpdatesResponse> ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null, RetryConfig? retryConfig = null);
|
Task<ApplyUpdatesResponse> ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -74,10 +74,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -90,7 +90,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetUpdateStatusResponse> GetUpdateStatusAsync(RetryConfig? retryConfig = null)
|
public async Task<GetUpdateStatusResponse> GetUpdateStatusAsync()
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
|
|
||||||
@@ -107,44 +107,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getUpdateStatus", null, _securitySource);
|
var hookCtx = new HookContext("getUpdateStatus", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -220,7 +187,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<CheckForUpdatesResponse> CheckForUpdatesAsync(Download? download = null, RetryConfig? retryConfig = null)
|
public async Task<CheckForUpdatesResponse> CheckForUpdatesAsync(Download? download = null)
|
||||||
{
|
{
|
||||||
var request = new CheckForUpdatesRequest()
|
var request = new CheckForUpdatesRequest()
|
||||||
{
|
{
|
||||||
@@ -240,44 +207,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("checkForUpdates", null, _securitySource);
|
var hookCtx = new HookContext("checkForUpdates", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -345,7 +279,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<ApplyUpdatesResponse> ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null, RetryConfig? retryConfig = null)
|
public async Task<ApplyUpdatesResponse> ApplyUpdatesAsync(Tonight? tonight = null, Skip? skip = null)
|
||||||
{
|
{
|
||||||
var request = new ApplyUpdatesRequest()
|
var request = new ApplyUpdatesRequest()
|
||||||
{
|
{
|
||||||
@@ -366,44 +300,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("applyUpdates", null, _securitySource);
|
var hookCtx = new HookContext("applyUpdates", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode == 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode == 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get the timeline for a media item
|
/// Get the timeline for a media item
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetTimelineResponse> GetTimelineAsync(GetTimelineRequest request, RetryConfig? retryConfig = null);
|
Task<GetTimelineResponse> GetTimelineAsync(GetTimelineRequest request);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Start Universal Transcode
|
/// Start Universal Transcode
|
||||||
@@ -48,7 +48,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Begin a Universal Transcode Session
|
/// Begin a Universal Transcode Session
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<StartUniversalTranscodeResponse> StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request, RetryConfig? retryConfig = null);
|
Task<StartUniversalTranscodeResponse> StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -62,10 +62,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
{
|
{
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -78,7 +78,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetTimelineResponse> GetTimelineAsync(GetTimelineRequest request, RetryConfig? retryConfig = null)
|
public async Task<GetTimelineResponse> GetTimelineAsync(GetTimelineRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/:/timeline", request);
|
var urlString = URLBuilder.Build(baseUrl, "/:/timeline", request);
|
||||||
@@ -94,44 +94,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("getTimeline", null, _securitySource);
|
var hookCtx = new HookContext("getTimeline", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
@@ -199,7 +166,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
throw new Models.Errors.SDKException("Unknown status code received", responseStatusCode, await httpResponse.Content.ReadAsStringAsync(), httpResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<StartUniversalTranscodeResponse> StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request, RetryConfig? retryConfig = null)
|
public async Task<StartUniversalTranscodeResponse> StartUniversalTranscodeAsync(StartUniversalTranscodeRequest request)
|
||||||
{
|
{
|
||||||
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
string baseUrl = this.SDKConfiguration.GetTemplatedServerUrl();
|
||||||
var urlString = URLBuilder.Build(baseUrl, "/video/:/transcode/universal/start.mpd", request);
|
var urlString = URLBuilder.Build(baseUrl, "/video/:/transcode/universal/start.mpd", request);
|
||||||
@@ -215,44 +182,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("startUniversalTranscode", null, _securitySource);
|
var hookCtx = new HookContext("startUniversalTranscode", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
/// Get User Watchlist
|
/// Get User Watchlist
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
Task<GetWatchListResponse> GetWatchListAsync(GetWatchListRequest request, string? serverUrl = null, RetryConfig? retryConfig = null);
|
Task<GetWatchListResponse> GetWatchListAsync(GetWatchListRequest request, string? serverUrl = null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -59,10 +59,10 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
};
|
};
|
||||||
public SDKConfig SDKConfiguration { get; private set; }
|
public SDKConfig SDKConfiguration { get; private set; }
|
||||||
private const string _language = "csharp";
|
private const string _language = "csharp";
|
||||||
private const string _sdkVersion = "0.9.2";
|
private const string _sdkVersion = "0.11.0";
|
||||||
private const string _sdkGenVersion = "2.429.0";
|
private const string _sdkGenVersion = "2.457.2";
|
||||||
private const string _openapiDocVersion = "0.0.3";
|
private const string _openapiDocVersion = "0.0.3";
|
||||||
private const string _userAgent = "speakeasy-sdk/csharp 0.9.2 2.429.0 0.0.3 LukeHagar.PlexAPI.SDK";
|
private const string _userAgent = "speakeasy-sdk/csharp 0.11.0 2.457.2 0.0.3 LukeHagar.PlexAPI.SDK";
|
||||||
private string _serverUrl = "";
|
private string _serverUrl = "";
|
||||||
private ISpeakeasyHttpClient _client;
|
private ISpeakeasyHttpClient _client;
|
||||||
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
private Func<LukeHagar.PlexAPI.SDK.Models.Components.Security>? _securitySource;
|
||||||
@@ -75,7 +75,7 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
SDKConfiguration = config;
|
SDKConfiguration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<GetWatchListResponse> GetWatchListAsync(GetWatchListRequest request, string? serverUrl = null, RetryConfig? retryConfig = null)
|
public async Task<GetWatchListResponse> GetWatchListAsync(GetWatchListRequest request, string? serverUrl = null)
|
||||||
{
|
{
|
||||||
string baseUrl = Utilities.TemplateUrl(GetWatchListServerList[0], new Dictionary<string, string>(){
|
string baseUrl = Utilities.TemplateUrl(GetWatchListServerList[0], new Dictionary<string, string>(){
|
||||||
});
|
});
|
||||||
@@ -97,44 +97,11 @@ namespace LukeHagar.PlexAPI.SDK
|
|||||||
var hookCtx = new HookContext("get-watch-list", null, _securitySource);
|
var hookCtx = new HookContext("get-watch-list", null, _securitySource);
|
||||||
|
|
||||||
httpRequest = await this.SDKConfiguration.Hooks.BeforeRequestAsync(new BeforeRequestContext(hookCtx), httpRequest);
|
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<string> statusCodes = new List<string>
|
|
||||||
{
|
|
||||||
"5XX",
|
|
||||||
};
|
|
||||||
|
|
||||||
Func<Task<HttpResponseMessage>> 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;
|
HttpResponseMessage httpResponse;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
httpResponse = await retries.Run();
|
httpResponse = await _client.SendAsync(httpRequest);
|
||||||
int _statusCode = (int)httpResponse.StatusCode;
|
int _statusCode = (int)httpResponse.StatusCode;
|
||||||
|
|
||||||
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
if (_statusCode == 400 || _statusCode == 401 || _statusCode >= 400 && _statusCode < 500 || _statusCode >= 500 && _statusCode < 600)
|
||||||
|
|||||||
112
NUGET.md
112
NUGET.md
@@ -25,69 +25,6 @@ var res = await sdk.Server.GetServerCapabilitiesAsync();
|
|||||||
```
|
```
|
||||||
<!-- End SDK Example Usage [usage] -->
|
<!-- End SDK Example Usage [usage] -->
|
||||||
|
|
||||||
<!-- Start Retries [retries] -->
|
|
||||||
## Retries
|
|
||||||
|
|
||||||
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.Components;
|
|
||||||
|
|
||||||
var sdk = new PlexAPI(
|
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
|
||||||
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(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: "<YOUR_API_KEY_HERE>",
|
|
||||||
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
|
|
||||||
```
|
|
||||||
<!-- End Retries [retries] -->
|
|
||||||
|
|
||||||
<!-- Start Error Handling [errors] -->
|
<!-- Start Error Handling [errors] -->
|
||||||
## Error Handling
|
## Error Handling
|
||||||
|
|
||||||
@@ -104,11 +41,11 @@ By default, an API error will raise a `LukeHagar.PlexAPI.SDK.Models.Errors.SDKEx
|
|||||||
|
|
||||||
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `GetServerCapabilitiesAsync` method throws the following exceptions:
|
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `GetServerCapabilitiesAsync` method throws the following exceptions:
|
||||||
|
|
||||||
| Error Type | Status Code | Content Type |
|
| Error Type | Status Code | Content Type |
|
||||||
| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
| --------------------------------------------------------------------- | ----------- | ---------------- |
|
||||||
| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesBadRequest | 400 | application/json |
|
| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesBadRequest | 400 | application/json |
|
||||||
| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesUnauthorized | 401 | application/json |
|
| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesUnauthorized | 401 | application/json |
|
||||||
| LukeHagar.PlexAPI.SDK.Models.Errors.SDKException | 4XX, 5XX | \*/\* |
|
| LukeHagar.PlexAPI.SDK.Models.Errors.SDKException | 4XX, 5XX | \*/\* |
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@@ -157,27 +94,34 @@ catch (Exception ex)
|
|||||||
<!-- Start Server Selection [server] -->
|
<!-- Start Server Selection [server] -->
|
||||||
## Server Selection
|
## Server Selection
|
||||||
|
|
||||||
### Select Server by Index
|
### Server Variables
|
||||||
|
|
||||||
You can override the default server globally by passing a server index to the `serverIndex: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
|
The default server `https://10.10.10.47:32400` contains variables and is set to `https://10.10.10.47:32400` by default. To override default values, the following parameters are available when initializing the SDK client instance:
|
||||||
|
|
||||||
| # | Server | Variables |
|
|
||||||
| - | ------ | --------- |
|
|
||||||
| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `https`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Variables
|
|
||||||
|
|
||||||
Some of the server options above contain variables. If you want to set the values of those variables, the following options are provided for doing so:
|
|
||||||
* `protocol: ServerProtocol`
|
* `protocol: ServerProtocol`
|
||||||
* `ip: string`
|
* `ip: string`
|
||||||
* `port: string`
|
* `port: string`
|
||||||
|
|
||||||
### Override Server URL Per-Client
|
### Override Server URL Per-Client
|
||||||
|
|
||||||
The default server can also be overridden globally by passing a URL to the `serverUrl: str` optional parameter when initializing the SDK client instance. For example:
|
The default server can also be overridden globally by passing a URL to the `serverUrl: string` optional parameter when initializing the SDK client instance. For example:
|
||||||
|
```csharp
|
||||||
|
using LukeHagar.PlexAPI.SDK;
|
||||||
|
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||||
|
|
||||||
|
var sdk = new PlexAPI(
|
||||||
|
serverUrl: "https://10.10.10.47:32400",
|
||||||
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
### Override Server URL Per-Operation
|
### Override Server URL Per-Operation
|
||||||
|
|
||||||
@@ -208,9 +152,9 @@ var res = await sdk.Plex.GetCompanionsDataAsync(serverUrl: "https://plex.tv/api/
|
|||||||
|
|
||||||
This SDK supports the following security scheme globally:
|
This SDK supports the following security scheme globally:
|
||||||
|
|
||||||
| Name | Type | Scheme |
|
| Name | Type | Scheme |
|
||||||
| ------------- | ------------- | ------------- |
|
| ------------- | ------ | ------- |
|
||||||
| `AccessToken` | apiKey | API key |
|
| `AccessToken` | apiKey | API key |
|
||||||
|
|
||||||
To authenticate with the API the `AccessToken` parameter must be set when initializing the SDK client instance. For example:
|
To authenticate with the API the `AccessToken` parameter must be set when initializing the SDK client instance. For example:
|
||||||
```csharp
|
```csharp
|
||||||
|
|||||||
113
README.md
113
README.md
@@ -186,27 +186,34 @@ var res = await sdk.Server.GetServerCapabilitiesAsync();
|
|||||||
<!-- Start Server Selection [server] -->
|
<!-- Start Server Selection [server] -->
|
||||||
## Server Selection
|
## Server Selection
|
||||||
|
|
||||||
### Select Server by Index
|
### Server Variables
|
||||||
|
|
||||||
You can override the default server globally by passing a server index to the `serverIndex: number` optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
|
The default server `{protocol}://{ip}:{port}` contains variables and is set to `https://10.10.10.47:32400` by default. To override default values, the following parameters are available when initializing the SDK client instance:
|
||||||
|
|
||||||
| # | Server | Variables |
|
|
||||||
| - | ------ | --------- |
|
|
||||||
| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `https`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) |
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### Variables
|
|
||||||
|
|
||||||
Some of the server options above contain variables. If you want to set the values of those variables, the following options are provided for doing so:
|
|
||||||
* `protocol: ServerProtocol`
|
* `protocol: ServerProtocol`
|
||||||
* `ip: string`
|
* `ip: string`
|
||||||
* `port: string`
|
* `port: string`
|
||||||
|
|
||||||
### Override Server URL Per-Client
|
### Override Server URL Per-Client
|
||||||
|
|
||||||
The default server can also be overridden globally by passing a URL to the `serverUrl: str` optional parameter when initializing the SDK client instance. For example:
|
The default server can also be overridden globally by passing a URL to the `serverUrl: string` optional parameter when initializing the SDK client instance. For example:
|
||||||
|
```csharp
|
||||||
|
using LukeHagar.PlexAPI.SDK;
|
||||||
|
using LukeHagar.PlexAPI.SDK.Models.Components;
|
||||||
|
|
||||||
|
var sdk = new PlexAPI(
|
||||||
|
serverUrl: "https://10.10.10.47:32400",
|
||||||
|
accessToken: "<YOUR_API_KEY_HERE>",
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
### Override Server URL Per-Operation
|
### Override Server URL Per-Operation
|
||||||
|
|
||||||
@@ -237,9 +244,9 @@ var res = await sdk.Plex.GetCompanionsDataAsync(serverUrl: "https://plex.tv/api/
|
|||||||
|
|
||||||
This SDK supports the following security scheme globally:
|
This SDK supports the following security scheme globally:
|
||||||
|
|
||||||
| Name | Type | Scheme |
|
| Name | Type | Scheme |
|
||||||
| ------------- | ------------- | ------------- |
|
| ------------- | ------ | ------- |
|
||||||
| `AccessToken` | apiKey | API key |
|
| `AccessToken` | apiKey | API key |
|
||||||
|
|
||||||
To authenticate with the API the `AccessToken` parameter must be set when initializing the SDK client instance. For example:
|
To authenticate with the API the `AccessToken` parameter must be set when initializing the SDK client instance. For example:
|
||||||
```csharp
|
```csharp
|
||||||
@@ -261,69 +268,6 @@ var res = await sdk.Server.GetServerCapabilitiesAsync();
|
|||||||
```
|
```
|
||||||
<!-- End Authentication [security] -->
|
<!-- End Authentication [security] -->
|
||||||
|
|
||||||
<!-- Start Retries [retries] -->
|
|
||||||
## Retries
|
|
||||||
|
|
||||||
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.Components;
|
|
||||||
|
|
||||||
var sdk = new PlexAPI(
|
|
||||||
accessToken: "<YOUR_API_KEY_HERE>",
|
|
||||||
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(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: "<YOUR_API_KEY_HERE>",
|
|
||||||
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
|
|
||||||
```
|
|
||||||
<!-- End Retries [retries] -->
|
|
||||||
|
|
||||||
<!-- Start Error Handling [errors] -->
|
<!-- Start Error Handling [errors] -->
|
||||||
## Error Handling
|
## Error Handling
|
||||||
|
|
||||||
@@ -340,11 +284,11 @@ By default, an API error will raise a `LukeHagar.PlexAPI.SDK.Models.Errors.SDKEx
|
|||||||
|
|
||||||
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `GetServerCapabilitiesAsync` method throws the following exceptions:
|
When custom error responses are specified for an operation, the SDK may also throw their associated exceptions. You can refer to respective *Errors* tables in SDK docs for more details on possible exception types for each operation. For example, the `GetServerCapabilitiesAsync` method throws the following exceptions:
|
||||||
|
|
||||||
| Error Type | Status Code | Content Type |
|
| Error Type | Status Code | Content Type |
|
||||||
| --------------------------------------------------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------- |
|
| --------------------------------------------------------------------- | ----------- | ---------------- |
|
||||||
| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesBadRequest | 400 | application/json |
|
| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesBadRequest | 400 | application/json |
|
||||||
| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesUnauthorized | 401 | application/json |
|
| LukeHagar.PlexAPI.SDK.Models.Errors.GetServerCapabilitiesUnauthorized | 401 | application/json |
|
||||||
| LukeHagar.PlexAPI.SDK.Models.Errors.SDKException | 4XX, 5XX | \*/\* |
|
| LukeHagar.PlexAPI.SDK.Models.Errors.SDKException | 4XX, 5XX | \*/\* |
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
|
|
||||||
@@ -427,7 +371,6 @@ The following SDKs are generated from the OpenAPI Specification. They are automa
|
|||||||
* [SDK Installation](#sdk-installation)
|
* [SDK Installation](#sdk-installation)
|
||||||
* [SDK Example Usage](#sdk-example-usage)
|
* [SDK Example Usage](#sdk-example-usage)
|
||||||
* [Available Resources and Operations](#available-resources-and-operations)
|
* [Available Resources and Operations](#available-resources-and-operations)
|
||||||
* [Retries](#retries)
|
|
||||||
* [Error Handling](#error-handling)
|
* [Error Handling](#error-handling)
|
||||||
* [Server Selection](#server-selection)
|
* [Server Selection](#server-selection)
|
||||||
* [Authentication](#authentication)
|
* [Authentication](#authentication)
|
||||||
|
|||||||
22
RELEASES.md
22
RELEASES.md
@@ -364,4 +364,24 @@ Based on:
|
|||||||
### Generated
|
### Generated
|
||||||
- [csharp v0.9.2] .
|
- [csharp v0.9.2] .
|
||||||
### Releases
|
### Releases
|
||||||
- [NuGet v0.9.2] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.9.2 - .
|
- [NuGet v0.9.2] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.9.2 - .
|
||||||
|
|
||||||
|
## 2024-10-03 12:24:46
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.406.0 (2.429.0) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [csharp v0.10.0] .
|
||||||
|
### Releases
|
||||||
|
- [NuGet v0.10.0] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.10.0 - .
|
||||||
|
|
||||||
|
## 2024-11-12 00:20:30
|
||||||
|
### Changes
|
||||||
|
Based on:
|
||||||
|
- OpenAPI Doc
|
||||||
|
- Speakeasy CLI 1.438.1 (2.457.2) https://github.com/speakeasy-api/speakeasy
|
||||||
|
### Generated
|
||||||
|
- [csharp v0.11.0] .
|
||||||
|
### Releases
|
||||||
|
- [NuGet v0.11.0] https://www.nuget.org/packages/LukeHagar.PlexAPI.SDK/0.11.0 - .
|
||||||
@@ -29,5 +29,5 @@ The Meta object is only included in the response if the `includeMeta` parameter
|
|||||||
| `ViewGroup` | *string* | :heavy_check_mark: | N/A | movie |
|
| `ViewGroup` | *string* | :heavy_check_mark: | N/A | movie |
|
||||||
| `ViewMode` | *int* | :heavy_minus_sign: | N/A | 65592 |
|
| `ViewMode` | *int* | :heavy_minus_sign: | N/A | 65592 |
|
||||||
| `MixedParents` | *bool* | :heavy_minus_sign: | N/A | true |
|
| `MixedParents` | *bool* | :heavy_minus_sign: | N/A | true |
|
||||||
| `Metadata` | List<[GetLibraryItemsMetadata](../../Models/Requests/GetLibraryItemsMetadata.md)> | :heavy_check_mark: | N/A | |
|
| `Metadata` | List<[GetLibraryItemsMetadata](../../Models/Requests/GetLibraryItemsMetadata.md)> | :heavy_minus_sign: | N/A | |
|
||||||
| `Meta` | [GetLibraryItemsMeta](../../Models/Requests/GetLibraryItemsMeta.md) | :heavy_minus_sign: | The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.<br/> | |
|
| `Meta` | [GetLibraryItemsMeta](../../Models/Requests/GetLibraryItemsMeta.md) | :heavy_minus_sign: | The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.<br/> | |
|
||||||
@@ -16,4 +16,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
|
|||||||
| `Movie` | 1 |
|
| `Movie` | 1 |
|
||||||
| `TvShow` | 2 |
|
| `TvShow` | 2 |
|
||||||
| `Season` | 3 |
|
| `Season` | 3 |
|
||||||
| `Episode` | 4 |
|
| `Episode` | 4 |
|
||||||
|
| `Audio` | 8 |
|
||||||
@@ -16,4 +16,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
|
|||||||
| `Movie` | 1 |
|
| `Movie` | 1 |
|
||||||
| `TvShow` | 2 |
|
| `TvShow` | 2 |
|
||||||
| `Season` | 3 |
|
| `Season` | 3 |
|
||||||
| `Episode` | 4 |
|
| `Episode` | 4 |
|
||||||
|
| `Audio` | 8 |
|
||||||
@@ -16,4 +16,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
|
|||||||
| `Movie` | 1 |
|
| `Movie` | 1 |
|
||||||
| `TvShow` | 2 |
|
| `TvShow` | 2 |
|
||||||
| `Season` | 3 |
|
| `Season` | 3 |
|
||||||
| `Episode` | 4 |
|
| `Episode` | 4 |
|
||||||
|
| `Audio` | 8 |
|
||||||
File diff suppressed because one or more lines are too long
@@ -8,8 +8,8 @@ Logged in user details
|
|||||||
| Field | Type | Required | Description | Example |
|
| Field | Type | Required | Description | Example |
|
||||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `AdsConsent` | *bool* | :heavy_check_mark: | Unknown | |
|
| `AdsConsent` | *bool* | :heavy_check_mark: | Unknown | |
|
||||||
| `AdsConsentReminderAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | Unknown | |
|
| `AdsConsentReminderAt` | *long* | :heavy_check_mark: | N/A | 1556281940 |
|
||||||
| `AdsConsentSetAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | Unknown | |
|
| `AdsConsentSetAt` | *long* | :heavy_check_mark: | N/A | 1556281940 |
|
||||||
| `Anonymous` | *bool* | :heavy_minus_sign: | Unknown | |
|
| `Anonymous` | *bool* | :heavy_minus_sign: | Unknown | |
|
||||||
| `AuthToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf |
|
| `AuthToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf |
|
||||||
| `BackupCodesCreated` | *bool* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | |
|
| `BackupCodesCreated` | *bool* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | |
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
|
|||||||
| `Movie` | 1 |
|
| `Movie` | 1 |
|
||||||
| `TvShow` | 2 |
|
| `TvShow` | 2 |
|
||||||
| `Season` | 3 |
|
| `Season` | 3 |
|
||||||
| `Episode` | 4 |
|
| `Episode` | 4 |
|
||||||
|
| `Audio` | 8 |
|
||||||
File diff suppressed because one or more lines are too long
@@ -8,8 +8,8 @@ Returns the user account data with a valid auth token
|
|||||||
| Field | Type | Required | Description | Example |
|
| Field | Type | Required | Description | Example |
|
||||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||||
| `AdsConsent` | *bool* | :heavy_check_mark: | Unknown | |
|
| `AdsConsent` | *bool* | :heavy_check_mark: | Unknown | |
|
||||||
| `AdsConsentReminderAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | Unknown | |
|
| `AdsConsentReminderAt` | *long* | :heavy_check_mark: | N/A | 1556281940 |
|
||||||
| `AdsConsentSetAt` | [DateTime](https://learn.microsoft.com/en-us/dotnet/api/system.datetime?view=net-5.0) | :heavy_check_mark: | Unknown | |
|
| `AdsConsentSetAt` | *long* | :heavy_check_mark: | N/A | 1556281940 |
|
||||||
| `Anonymous` | *bool* | :heavy_minus_sign: | Unknown | |
|
| `Anonymous` | *bool* | :heavy_minus_sign: | Unknown | |
|
||||||
| `AuthToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf |
|
| `AuthToken` | *string* | :heavy_check_mark: | The account token | CxoUzBTSV5hsxjTpFKaf |
|
||||||
| `BackupCodesCreated` | *bool* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | |
|
| `BackupCodesCreated` | *bool* | :heavy_minus_sign: | If the two-factor authentication backup codes have been created | |
|
||||||
|
|||||||
@@ -16,4 +16,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
|
|||||||
| `Movie` | 1 |
|
| `Movie` | 1 |
|
||||||
| `TvShow` | 2 |
|
| `TvShow` | 2 |
|
||||||
| `Season` | 3 |
|
| `Season` | 3 |
|
||||||
| `Episode` | 4 |
|
| `Episode` | 4 |
|
||||||
|
| `Audio` | 8 |
|
||||||
@@ -16,4 +16,5 @@ E.g. A movie library will not return anything with type 3 as there are no season
|
|||||||
| `Movie` | 1 |
|
| `Movie` | 1 |
|
||||||
| `TvShow` | 2 |
|
| `TvShow` | 2 |
|
||||||
| `Season` | 3 |
|
| `Season` | 3 |
|
||||||
| `Episode` | 4 |
|
| `Episode` | 4 |
|
||||||
|
| `Audio` | 8 |
|
||||||
Reference in New Issue
Block a user