ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.406.0

This commit is contained in:
speakeasybot
2024-10-04 00:27:05 +00:00
parent 2e4350c8c4
commit 025b6c4640
108 changed files with 3282 additions and 7524 deletions

View File

@@ -17,27 +17,19 @@ import dev.plexapi.sdk.models.operations.GetServerActivitiesRequestBuilder;
import dev.plexapi.sdk.models.operations.GetServerActivitiesResponse;
import dev.plexapi.sdk.models.operations.GetServerActivitiesResponseBody;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* Activities are awesome. They provide a way to monitor and control asynchronous operations on the server. In order to receive real-time updates for activities, a client would normally subscribe via either EventSource or Websocket endpoints.
@@ -76,22 +68,6 @@ public class Activities implements
* @throws Exception if the API call fails
*/
public GetServerActivitiesResponse getServerActivitiesDirect() throws Exception {
return getServerActivities(Optional.empty());
}
/**
* Get Server Activities
* Get Server Activities
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetServerActivitiesResponse getServerActivities(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -107,62 +83,45 @@ public class Activities implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -258,24 +217,6 @@ public class Activities implements
*/
public CancelServerActivitiesResponse cancelServerActivities(
String activityUUID) throws Exception {
return cancelServerActivities(activityUUID, Optional.empty());
}
/**
* Cancel Server Activities
* Cancel Server Activities
* @param activityUUID The UUID of the activity to cancel.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public CancelServerActivitiesResponse cancelServerActivities(
String activityUUID,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
CancelServerActivitiesRequest request =
CancelServerActivitiesRequest
.builder()
@@ -299,62 +240,45 @@ public class Activities implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"cancelServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"cancelServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"cancelServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"cancelServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"cancelServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"cancelServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"cancelServerActivities",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -30,16 +30,11 @@ import dev.plexapi.sdk.models.operations.PostUsersSignInDataResponse;
import dev.plexapi.sdk.models.operations.PostUsersSignInDataUserPlexAccount;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.models.operations.Scope;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.SerializedBody;
import dev.plexapi.sdk.utils.Utils.JsonShape;
import dev.plexapi.sdk.utils.Utils;
@@ -49,12 +44,9 @@ import java.lang.Object;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* API Calls regarding authentication for Plex Media Server
@@ -109,27 +101,6 @@ public class Authentication implements
public GetTransientTokenResponse getTransientToken(
GetTransientTokenQueryParamType type,
Scope scope) throws Exception {
return getTransientToken(type, scope, Optional.empty());
}
/**
* Get a Transient Token
* This endpoint provides the caller with a temporary token with the same access level as the caller's token. These tokens are valid for up to 48 hours and are destroyed if the server instance is restarted.
*
* @param type `delegation` - This is the only supported `type` parameter.
* @param scope `all` - This is the only supported `scope` parameter.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetTransientTokenResponse getTransientToken(
GetTransientTokenQueryParamType type,
Scope scope,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
GetTransientTokenRequest request =
GetTransientTokenRequest
.builder()
@@ -157,62 +128,45 @@ public class Authentication implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTransientToken",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTransientToken",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTransientToken",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTransientToken",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTransientToken",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTransientToken",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTransientToken",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -301,26 +255,6 @@ public class Authentication implements
*/
public GetSourceConnectionInformationResponse getSourceConnectionInformation(
String source) throws Exception {
return getSourceConnectionInformation(source, Optional.empty());
}
/**
* Get Source Connection Information
* If a caller requires connection details and a transient token for a source that is known to the server, for example a cloud media provider or shared PMS, then this endpoint can be called. This endpoint is only accessible with either an admin token or a valid transient token generated from an admin token.
* Note: requires Plex Media Server &gt;= 1.15.4.
*
* @param source The source identifier with an included prefix.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetSourceConnectionInformationResponse getSourceConnectionInformation(
String source,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
GetSourceConnectionInformationRequest request =
GetSourceConnectionInformationRequest
.builder()
@@ -347,62 +281,45 @@ public class Authentication implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getSourceConnectionInformation",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSourceConnectionInformation",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getSourceConnectionInformation",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSourceConnectionInformation",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getSourceConnectionInformation",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSourceConnectionInformation",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getSourceConnectionInformation",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -485,24 +402,18 @@ public class Authentication implements
* @throws Exception if the API call fails
*/
public GetTokenDetailsResponse getTokenDetailsDirect() throws Exception {
return getTokenDetails(Optional.empty(), Optional.empty());
return getTokenDetails(Optional.empty());
}
/**
* Get Token Details
* Get the User data from the provided X-Plex-Token
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetTokenDetailsResponse getTokenDetails(
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
String _baseUrl = Utils.templateUrl(GET_TOKEN_DETAILS_SERVERS[0], new HashMap<String, String>());
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
@@ -520,62 +431,45 @@ public class Authentication implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTokenDetails",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTokenDetails",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTokenDetails",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTokenDetails",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTokenDetails",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTokenDetails",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTokenDetails",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -671,7 +565,7 @@ public class Authentication implements
*/
public PostUsersSignInDataResponse postUsersSignInData(
PostUsersSignInDataRequest request) throws Exception {
return postUsersSignInData(request, Optional.empty(), Optional.empty());
return postUsersSignInData(request, Optional.empty());
}
/**
@@ -679,18 +573,12 @@ public class Authentication implements
* Sign in user with username and password and return user data with Plex authentication token
* @param request The request object containing all of the parameters for the API call.
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public PostUsersSignInDataResponse postUsersSignInData(
PostUsersSignInDataRequest request,
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
String _baseUrl = Utils.templateUrl(POST_USERS_SIGN_IN_DATA_SERVERS[0], new HashMap<String, String>());
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
@@ -716,62 +604,45 @@ public class Authentication implements
_req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals));
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"post-users-sign-in-data",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"post-users-sign-in-data",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"post-users-sign-in-data",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"post-users-sign-in-data",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"post-users-sign-in-data",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"post-users-sign-in-data",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"post-users-sign-in-data",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -32,27 +32,19 @@ import dev.plexapi.sdk.models.operations.StopTaskRequest;
import dev.plexapi.sdk.models.operations.StopTaskRequestBuilder;
import dev.plexapi.sdk.models.operations.StopTaskResponse;
import dev.plexapi.sdk.models.operations.TaskName;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* Butler is the task manager of the Plex Media Server Ecosystem.
@@ -88,22 +80,6 @@ public class Butler implements
* @throws Exception if the API call fails
*/
public GetButlerTasksResponse getButlerTasksDirect() throws Exception {
return getButlerTasks(Optional.empty());
}
/**
* Get Butler tasks
* Returns a list of butler tasks
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetButlerTasksResponse getButlerTasks(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -119,62 +95,45 @@ public class Butler implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getButlerTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getButlerTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getButlerTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getButlerTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getButlerTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getButlerTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getButlerTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -278,27 +237,6 @@ public class Butler implements
* @throws Exception if the API call fails
*/
public StartAllTasksResponse startAllTasksDirect() throws Exception {
return startAllTasks(Optional.empty());
}
/**
* Start all Butler tasks
* This endpoint will attempt to start all Butler tasks that are enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
* 1. Any tasks not scheduled to run on the current day will be skipped.
* 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
* 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
* 4. If we are outside the configured window, the task will start immediately.
*
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StartAllTasksResponse startAllTasks(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -314,62 +252,45 @@ public class Butler implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"startAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"startAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"startAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"startAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -454,23 +375,6 @@ public class Butler implements
* @throws Exception if the API call fails
*/
public StopAllTasksResponse stopAllTasksDirect() throws Exception {
return stopAllTasks(Optional.empty());
}
/**
* Stop all Butler tasks
* This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
*
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StopAllTasksResponse stopAllTasks(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -486,62 +390,45 @@ public class Butler implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"stopAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"stopAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"stopAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"stopAllTasks",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -636,29 +523,6 @@ public class Butler implements
*/
public StartTaskResponse startTask(
TaskName taskName) throws Exception {
return startTask(taskName, Optional.empty());
}
/**
* Start a single Butler task
* This endpoint will attempt to start a single Butler task that is enabled in the settings. Butler tasks normally run automatically during a time window configured on the server's Settings page but can be manually started using this endpoint. Tasks will run with the following criteria:
* 1. Any tasks not scheduled to run on the current day will be skipped.
* 2. If a task is configured to run at a random time during the configured window and we are outside that window, the task will start immediately.
* 3. If a task is configured to run at a random time during the configured window and we are within that window, the task will be scheduled at a random time within the window.
* 4. If we are outside the configured window, the task will start immediately.
*
* @param taskName the name of the task to be started.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StartTaskResponse startTask(
TaskName taskName,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
StartTaskRequest request =
StartTaskRequest
.builder()
@@ -682,62 +546,45 @@ public class Butler implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"startTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"startTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"startTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"startTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -824,25 +671,6 @@ public class Butler implements
*/
public StopTaskResponse stopTask(
PathParamTaskName taskName) throws Exception {
return stopTask(taskName, Optional.empty());
}
/**
* Stop a single Butler task
* This endpoint will stop a currently running task by name, or remove it from the list of scheduled tasks if it exists. See the section above for a list of task names for this endpoint.
*
* @param taskName The name of the task to be started.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StopTaskResponse stopTask(
PathParamTaskName taskName,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
StopTaskRequest request =
StopTaskRequest
.builder()
@@ -866,62 +694,45 @@ public class Butler implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"stopTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "404", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"stopTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"stopTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"stopTask",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -25,16 +25,11 @@ import dev.plexapi.sdk.models.operations.GetRecentlyAddedResponseBody;
import dev.plexapi.sdk.models.operations.OnlyTransient;
import dev.plexapi.sdk.models.operations.QueryParamOnlyTransient;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Double;
@@ -42,11 +37,8 @@ import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
@@ -80,7 +72,7 @@ public class Hubs implements
* @throws Exception if the API call fails
*/
public GetGlobalHubsResponse getGlobalHubsDirect() throws Exception {
return getGlobalHubs(Optional.empty(), Optional.empty(), Optional.empty());
return getGlobalHubs(Optional.empty(), Optional.empty());
}
/**
@@ -88,18 +80,12 @@ public class Hubs implements
* Get Global Hubs filtered by the parameters provided.
* @param count The number of items to return with each hub.
* @param onlyTransient Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetGlobalHubsResponse getGlobalHubs(
Optional<Double> count,
Optional<? extends OnlyTransient> onlyTransient,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<? extends OnlyTransient> onlyTransient) throws Exception {
GetGlobalHubsRequest request =
GetGlobalHubsRequest
.builder()
@@ -127,62 +113,45 @@ public class Hubs implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getGlobalHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getGlobalHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getGlobalHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getGlobalHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getGlobalHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getGlobalHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getGlobalHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -280,25 +249,6 @@ public class Hubs implements
*/
public GetRecentlyAddedResponse getRecentlyAdded(
GetRecentlyAddedRequest request) throws Exception {
return getRecentlyAdded(request, Optional.empty());
}
/**
* Get Recently Added
* This endpoint will return the recently added content.
*
* @param request The request object containing all of the parameters for the API call.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetRecentlyAddedResponse getRecentlyAdded(
GetRecentlyAddedRequest request,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -319,62 +269,45 @@ public class Hubs implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-recently-added",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-recently-added",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-recently-added",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-recently-added",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-recently-added",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-recently-added",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-recently-added",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -440,7 +373,7 @@ public class Hubs implements
*/
public GetLibraryHubsResponse getLibraryHubs(
double sectionId) throws Exception {
return getLibraryHubs(sectionId, Optional.empty(), Optional.empty(), Optional.empty());
return getLibraryHubs(sectionId, Optional.empty(), Optional.empty());
}
/**
@@ -450,19 +383,13 @@ public class Hubs implements
* @param sectionId the Id of the library to query
* @param count The number of items to return with each hub.
* @param onlyTransient Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetLibraryHubsResponse getLibraryHubs(
double sectionId,
Optional<Double> count,
Optional<? extends QueryParamOnlyTransient> onlyTransient,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<? extends QueryParamOnlyTransient> onlyTransient) throws Exception {
GetLibraryHubsRequest request =
GetLibraryHubsRequest
.builder()
@@ -493,62 +420,45 @@ public class Hubs implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getLibraryHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getLibraryHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getLibraryHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getLibraryHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getLibraryHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getLibraryHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getLibraryHubs",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

File diff suppressed because it is too large Load Diff

View File

@@ -21,16 +21,11 @@ import dev.plexapi.sdk.models.operations.LogLineResponse;
import dev.plexapi.sdk.models.operations.LogMultiLineRequestBuilder;
import dev.plexapi.sdk.models.operations.LogMultiLineResponse;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.SerializedBody;
import dev.plexapi.sdk.utils.Utils.JsonShape;
import dev.plexapi.sdk.utils.Utils;
@@ -40,11 +35,8 @@ import java.lang.Object;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* Submit logs to the Log Handler for Plex Media Server
@@ -92,35 +84,6 @@ public class Log implements
Level level,
String message,
String source) throws Exception {
return logLine(level, message, source, Optional.empty());
}
/**
* Logging a single line message.
* This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
*
* @param level An integer log level to write to the PMS log with.
0: Error
1: Warning
2: Info
3: Debug
4: Verbose
* @param message The text of the message to write to the log.
* @param source a string indicating the source of the message.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public LogLineResponse logLine(
Level level,
String message,
String source,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
LogLineRequest request =
LogLineRequest
.builder()
@@ -149,62 +112,45 @@ public class Log implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"logLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"logLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"logLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"logLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"logLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"logLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"logLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -331,45 +277,6 @@ public class Log implements
*/
public LogMultiLineResponse logMultiLine(
String request) throws Exception {
return logMultiLine(request, Optional.empty());
}
/**
* Logging a multi-line message
* This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
* It accepts a text/plain request body, where each line represents a distinct log entry.
* Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'.
*
* Log entries are separated by a newline character (`\n`).
* Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
* This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.
*
* The 'level' parameter specifies the log entry's severity or importance, with the following integer values:
* - `0`: Error - Critical issues that require immediate attention.
* - `1`: Warning - Important events that are not critical but may indicate potential issues.
* - `2`: Info - General informational messages about system operation.
* - `3`: Debug - Detailed information useful for debugging purposes.
* - `4`: Verbose - Highly detailed diagnostic information for in-depth analysis.
*
* The 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module).
*
* Example of a single log entry format:
* `level=4&amp;message=Sample%20log%20entry&amp;source=applicationName`
*
* Ensure each parameter is properly URL-encoded to avoid interpretation issues.
*
* @param request The request object containing all of the parameters for the API call.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public LogMultiLineResponse logMultiLine(
String request,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -398,62 +305,45 @@ public class Log implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"logMultiLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"logMultiLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"logMultiLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"logMultiLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"logMultiLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"logMultiLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"logMultiLine",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -538,23 +428,6 @@ public class Log implements
* @throws Exception if the API call fails
*/
public EnablePaperTrailResponse enablePaperTrailDirect() throws Exception {
return enablePaperTrail(Optional.empty());
}
/**
* Enabling Papertrail
* This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
*
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public EnablePaperTrailResponse enablePaperTrail(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -570,62 +443,45 @@ public class Log implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"enablePaperTrail",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "403", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"enablePaperTrail",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"enablePaperTrail",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"enablePaperTrail",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"enablePaperTrail",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"enablePaperTrail",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"enablePaperTrail",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -32,27 +32,19 @@ import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.models.operations.UpdatePlayProgressRequest;
import dev.plexapi.sdk.models.operations.UpdatePlayProgressRequestBuilder;
import dev.plexapi.sdk.models.operations.UpdatePlayProgressResponse;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* API Calls interacting with Plex Media Server Media
@@ -90,24 +82,6 @@ public class Media implements
*/
public MarkPlayedResponse markPlayed(
double key) throws Exception {
return markPlayed(key, Optional.empty());
}
/**
* Mark Media Played
* This will mark the provided media key as Played.
* @param key The media key to mark as played
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public MarkPlayedResponse markPlayed(
double key,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
MarkPlayedRequest request =
MarkPlayedRequest
.builder()
@@ -134,62 +108,45 @@ public class Media implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"markPlayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"markPlayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"markPlayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"markPlayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"markPlayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"markPlayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"markPlayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -274,24 +231,6 @@ public class Media implements
*/
public MarkUnplayedResponse markUnplayed(
double key) throws Exception {
return markUnplayed(key, Optional.empty());
}
/**
* Mark Media Unplayed
* This will mark the provided media key as Unplayed.
* @param key The media key to mark as Unplayed
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public MarkUnplayedResponse markUnplayed(
double key,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
MarkUnplayedRequest request =
MarkUnplayedRequest
.builder()
@@ -318,62 +257,45 @@ public class Media implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"markUnplayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"markUnplayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"markUnplayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"markUnplayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"markUnplayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"markUnplayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"markUnplayed",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -464,29 +386,6 @@ public class Media implements
String key,
double time,
String state) throws Exception {
return updatePlayProgress(key, time, state, Optional.empty());
}
/**
* Update Media Play Progress
* This API command can be used to update the play progress of a media item.
*
* @param key the media key
* @param time The time, in milliseconds, used to set the media playback progress.
* @param state The playback state of the media item.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public UpdatePlayProgressResponse updatePlayProgress(
String key,
double time,
String state,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
UpdatePlayProgressRequest request =
UpdatePlayProgressRequest
.builder()
@@ -515,62 +414,45 @@ public class Media implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"updatePlayProgress",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"updatePlayProgress",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"updatePlayProgress",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"updatePlayProgress",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"updatePlayProgress",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"updatePlayProgress",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"updatePlayProgress",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -655,24 +537,6 @@ public class Media implements
*/
public GetBannerImageResponse getBannerImage(
GetBannerImageRequest request) throws Exception {
return getBannerImage(request, Optional.empty());
}
/**
* Get Banner Image
* Gets the banner image of the media item
* @param request The request object containing all of the parameters for the API call.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetBannerImageResponse getBannerImage(
GetBannerImageRequest request,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -696,62 +560,45 @@ public class Media implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-banner-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-banner-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-banner-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-banner-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-banner-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-banner-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-banner-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -847,24 +694,6 @@ public class Media implements
*/
public GetThumbImageResponse getThumbImage(
GetThumbImageRequest request) throws Exception {
return getThumbImage(request, Optional.empty());
}
/**
* Get Thumb Image
* Gets the thumbnail image of the media item
* @param request The request object containing all of the parameters for the API call.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetThumbImageResponse getThumbImage(
GetThumbImageRequest request,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -888,62 +717,45 @@ public class Media implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-thumb-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-thumb-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-thumb-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-thumb-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-thumb-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-thumb-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-thumb-image",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

File diff suppressed because it is too large Load Diff

View File

@@ -47,28 +47,20 @@ import dev.plexapi.sdk.models.operations.IncludeRelay;
import dev.plexapi.sdk.models.operations.PlexDevice;
import dev.plexapi.sdk.models.operations.ResponseBody;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* API Calls that perform operations directly against https://Plex.tv
@@ -148,24 +140,18 @@ public class Plex implements
* @throws Exception if the API call fails
*/
public GetCompanionsDataResponse getCompanionsDataDirect() throws Exception {
return getCompanionsData(Optional.empty(), Optional.empty());
return getCompanionsData(Optional.empty());
}
/**
* Get Companions Data
* Get Companions Data
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetCompanionsDataResponse getCompanionsData(
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
String _baseUrl = Utils.templateUrl(GET_COMPANIONS_DATA_SERVERS[0], new HashMap<String, String>());
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
@@ -183,62 +169,45 @@ public class Plex implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getCompanionsData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getCompanionsData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getCompanionsData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getCompanionsData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getCompanionsData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getCompanionsData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getCompanionsData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -332,24 +301,18 @@ public class Plex implements
* @throws Exception if the API call fails
*/
public GetUserFriendsResponse getUserFriendsDirect() throws Exception {
return getUserFriends(Optional.empty(), Optional.empty());
return getUserFriends(Optional.empty());
}
/**
* Get list of friends of the user logged in
* Get friends of provided auth token.
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetUserFriendsResponse getUserFriends(
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
String _baseUrl = Utils.templateUrl(GET_USER_FRIENDS_SERVERS[0], new HashMap<String, String>());
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
@@ -367,62 +330,45 @@ public class Plex implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getUserFriends",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getUserFriends",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getUserFriends",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getUserFriends",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getUserFriends",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getUserFriends",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getUserFriends",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -516,24 +462,18 @@ public class Plex implements
* @throws Exception if the API call fails
*/
public GetGeoDataResponse getGeoDataDirect() throws Exception {
return getGeoData(Optional.empty(), Optional.empty());
return getGeoData(Optional.empty());
}
/**
* Get Geo Data
* Returns the geolocation and locale data of the caller
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetGeoDataResponse getGeoData(
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
String _baseUrl = Utils.templateUrl(GET_GEO_DATA_SERVERS[0], new HashMap<String, String>());
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
@@ -548,62 +488,45 @@ public class Plex implements
SDKConfiguration.USER_AGENT);
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getGeoData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getGeoData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getGeoData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getGeoData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getGeoData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getGeoData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getGeoData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -697,22 +620,6 @@ public class Plex implements
* @throws Exception if the API call fails
*/
public GetHomeDataResponse getHomeDataDirect() throws Exception {
return getHomeData(Optional.empty());
}
/**
* Get Plex Home Data
* Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetHomeDataResponse getHomeData(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -728,62 +635,45 @@ public class Plex implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getHomeData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getHomeData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getHomeData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getHomeData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getHomeData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getHomeData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getHomeData",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -877,7 +767,7 @@ public class Plex implements
* @throws Exception if the API call fails
*/
public GetServerResourcesResponse getServerResourcesDirect() throws Exception {
return getServerResources(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
return getServerResources(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
}
/**
@@ -890,7 +780,6 @@ public class Plex implements
* @param includeIPv6 Include IPv6 entries in the results
* @param clientID An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
@@ -899,12 +788,7 @@ public class Plex implements
Optional<? extends IncludeRelay> includeRelay,
Optional<? extends IncludeIPv6> includeIPv6,
Optional<String> clientID,
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
GetServerResourcesRequest request =
GetServerResourcesRequest
.builder()
@@ -937,62 +821,45 @@ public class Plex implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-server-resources",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-server-resources",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-server-resources",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-server-resources",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-server-resources",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-server-resources",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-server-resources",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -1088,7 +955,7 @@ public class Plex implements
*/
public GetPinResponse getPin(
GetPinRequest request) throws Exception {
return getPin(request, Optional.empty(), Optional.empty());
return getPin(request, Optional.empty());
}
/**
@@ -1096,18 +963,12 @@ public class Plex implements
* Retrieve a Pin ID from Plex.tv to use for authentication flows
* @param request The request object containing all of the parameters for the API call.
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetPinResponse getPin(
GetPinRequest request,
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
String _baseUrl = Utils.templateUrl(GET_PIN_SERVERS[0], new HashMap<String, String>());
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
@@ -1128,62 +989,45 @@ public class Plex implements
_req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals));
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getPin",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getPin",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getPin",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getPin",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getPin",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getPin",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getPin",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -1263,7 +1107,7 @@ public class Plex implements
*/
public GetTokenByPinIdResponse getTokenByPinId(
GetTokenByPinIdRequest request) throws Exception {
return getTokenByPinId(request, Optional.empty(), Optional.empty());
return getTokenByPinId(request, Optional.empty());
}
/**
@@ -1271,18 +1115,12 @@ public class Plex implements
* Retrieve an Access Token from Plex.tv after the Pin has been authenticated
* @param request The request object containing all of the parameters for the API call.
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetTokenByPinIdResponse getTokenByPinId(
GetTokenByPinIdRequest request,
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
String _baseUrl = Utils.templateUrl(GET_TOKEN_BY_PIN_ID_SERVERS[0], new HashMap<String, String>());
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
@@ -1300,62 +1138,45 @@ public class Plex implements
_req.addHeaders(Utils.getHeadersFromMetadata(request, this.sdkConfiguration.globals));
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTokenByPinId",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "404", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTokenByPinId",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTokenByPinId",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTokenByPinId",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTokenByPinId",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTokenByPinId",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTokenByPinId",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -36,7 +36,7 @@ class SDKConfiguration {
} };
private static final String LANGUAGE = "java";
public static final String OPENAPI_DOC_VERSION = "0.0.3";
public static final String SDK_VERSION = "0.8.0";
public static final String SDK_VERSION = "0.9.0";
public static final String GEN_VERSION = "2.429.0";
private static final String BASE_PACKAGE = "dev.plexapi.sdk";
public static final String USER_AGENT =

View File

@@ -23,16 +23,11 @@ import dev.plexapi.sdk.models.operations.PerformVoiceSearchRequest;
import dev.plexapi.sdk.models.operations.PerformVoiceSearchRequestBuilder;
import dev.plexapi.sdk.models.operations.PerformVoiceSearchResponse;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Double;
@@ -40,11 +35,8 @@ import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* API Calls that perform search operations with Plex Media Server
@@ -104,7 +96,7 @@ public class Search implements
*/
public PerformSearchResponse performSearch(
String query) throws Exception {
return performSearch(query, Optional.empty(), Optional.empty(), Optional.empty());
return performSearch(query, Optional.empty(), Optional.empty());
}
/**
@@ -125,19 +117,13 @@ public class Search implements
* @param query The query term
* @param sectionId This gives context to the search, and can result in re-ordering of search result hubs
* @param limit The number of items to return per hub
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public PerformSearchResponse performSearch(
String query,
Optional<Double> sectionId,
Optional<Double> limit,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<Double> limit) throws Exception {
PerformSearchRequest request =
PerformSearchRequest
.builder()
@@ -166,62 +152,45 @@ public class Search implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"performSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"performSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"performSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"performSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"performSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"performSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"performSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -314,7 +283,7 @@ public class Search implements
*/
public PerformVoiceSearchResponse performVoiceSearch(
String query) throws Exception {
return performVoiceSearch(query, Optional.empty(), Optional.empty(), Optional.empty());
return performVoiceSearch(query, Optional.empty(), Optional.empty());
}
/**
@@ -327,19 +296,13 @@ public class Search implements
* @param query The query term
* @param sectionId This gives context to the search, and can result in re-ordering of search result hubs
* @param limit The number of items to return per hub
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public PerformVoiceSearchResponse performVoiceSearch(
String query,
Optional<Double> sectionId,
Optional<Double> limit,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<Double> limit) throws Exception {
PerformVoiceSearchRequest request =
PerformVoiceSearchRequest
.builder()
@@ -368,62 +331,45 @@ public class Search implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"performVoiceSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"performVoiceSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"performVoiceSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"performVoiceSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"performVoiceSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"performVoiceSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"performVoiceSearch",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -508,24 +454,6 @@ public class Search implements
*/
public GetSearchResultsResponse getSearchResults(
String query) throws Exception {
return getSearchResults(query, Optional.empty());
}
/**
* Get Search Results
* This will search the database for the string provided.
* @param query The search query string to use
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetSearchResultsResponse getSearchResults(
String query,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
GetSearchResultsRequest request =
GetSearchResultsRequest
.builder()
@@ -552,62 +480,45 @@ public class Search implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getSearchResults",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSearchResults",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getSearchResults",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSearchResults",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getSearchResults",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSearchResults",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getSearchResults",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

File diff suppressed because it is too large Load Diff

View File

@@ -29,16 +29,11 @@ import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.models.operations.StopTranscodeSessionRequest;
import dev.plexapi.sdk.models.operations.StopTranscodeSessionRequestBuilder;
import dev.plexapi.sdk.models.operations.StopTranscodeSessionResponse;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
@@ -46,11 +41,8 @@ import java.lang.Long;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* API Calls that perform search operations with Plex Media Server Sessions
@@ -85,22 +77,6 @@ public class Sessions implements
* @throws Exception if the API call fails
*/
public GetSessionsResponse getSessionsDirect() throws Exception {
return getSessions(Optional.empty());
}
/**
* Get Active Sessions
* This will retrieve the "Now Playing" Information of the PMS.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetSessionsResponse getSessions(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -116,62 +92,45 @@ public class Sessions implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -265,7 +224,7 @@ public class Sessions implements
* @throws Exception if the API call fails
*/
public GetSessionHistoryResponse getSessionHistoryDirect() throws Exception {
return getSessionHistory(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
return getSessionHistory(Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
}
/**
@@ -280,7 +239,6 @@ public class Sessions implements
* @param librarySectionID Filters the results based on the id of a valid library section
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
@@ -288,12 +246,7 @@ public class Sessions implements
Optional<String> sort,
Optional<Long> accountId,
Optional<? extends QueryParamFilter> filter,
Optional<Long> librarySectionID,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<Long> librarySectionID) throws Exception {
GetSessionHistoryRequest request =
GetSessionHistoryRequest
.builder()
@@ -323,62 +276,45 @@ public class Sessions implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getSessionHistory",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSessionHistory",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getSessionHistory",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSessionHistory",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getSessionHistory",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getSessionHistory",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getSessionHistory",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -472,22 +408,6 @@ public class Sessions implements
* @throws Exception if the API call fails
*/
public GetTranscodeSessionsResponse getTranscodeSessionsDirect() throws Exception {
return getTranscodeSessions(Optional.empty());
}
/**
* Get Transcode Sessions
* Get Transcode Sessions
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetTranscodeSessionsResponse getTranscodeSessions(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -503,62 +423,45 @@ public class Sessions implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTranscodeSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTranscodeSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTranscodeSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTranscodeSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTranscodeSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTranscodeSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTranscodeSessions",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -654,24 +557,6 @@ public class Sessions implements
*/
public StopTranscodeSessionResponse stopTranscodeSession(
String sessionKey) throws Exception {
return stopTranscodeSession(sessionKey, Optional.empty());
}
/**
* Stop a Transcode Session
* Stop a Transcode Session
* @param sessionKey the Key of the transcode session to stop
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StopTranscodeSessionResponse stopTranscodeSession(
String sessionKey,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
StopTranscodeSessionRequest request =
StopTranscodeSessionRequest
.builder()
@@ -695,62 +580,45 @@ public class Sessions implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"stopTranscodeSession",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopTranscodeSession",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"stopTranscodeSession",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopTranscodeSession",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"stopTranscodeSession",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"stopTranscodeSession",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"stopTranscodeSession",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -25,16 +25,11 @@ import dev.plexapi.sdk.models.operations.GetStatisticsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetStatisticsResponse;
import dev.plexapi.sdk.models.operations.GetStatisticsResponseBody;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
@@ -42,11 +37,8 @@ import java.lang.Long;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* API Calls that perform operations with Plex Media Server Statistics
@@ -80,7 +72,7 @@ public class Statistics implements
* @throws Exception if the API call fails
*/
public GetStatisticsResponse getStatisticsDirect() throws Exception {
return getStatistics(Optional.empty(), Optional.empty());
return getStatistics(Optional.empty());
}
/**
@@ -89,17 +81,11 @@ public class Statistics implements
* @param timespan The timespan to retrieve statistics for
the exact meaning of this parameter is not known
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetStatisticsResponse getStatistics(
Optional<Long> timespan,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<Long> timespan) throws Exception {
GetStatisticsRequest request =
GetStatisticsRequest
.builder()
@@ -126,62 +112,45 @@ public class Statistics implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -275,7 +244,7 @@ public class Statistics implements
* @throws Exception if the API call fails
*/
public GetResourcesStatisticsResponse getResourcesStatisticsDirect() throws Exception {
return getResourcesStatistics(Optional.empty(), Optional.empty());
return getResourcesStatistics(Optional.empty());
}
/**
@@ -284,17 +253,11 @@ public class Statistics implements
* @param timespan The timespan to retrieve statistics for
the exact meaning of this parameter is not known
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetResourcesStatisticsResponse getResourcesStatistics(
Optional<Long> timespan,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<Long> timespan) throws Exception {
GetResourcesStatisticsRequest request =
GetResourcesStatisticsRequest
.builder()
@@ -321,62 +284,45 @@ public class Statistics implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getResourcesStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getResourcesStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getResourcesStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getResourcesStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getResourcesStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getResourcesStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getResourcesStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -470,7 +416,7 @@ public class Statistics implements
* @throws Exception if the API call fails
*/
public GetBandwidthStatisticsResponse getBandwidthStatisticsDirect() throws Exception {
return getBandwidthStatistics(Optional.empty(), Optional.empty());
return getBandwidthStatistics(Optional.empty());
}
/**
@@ -479,17 +425,11 @@ public class Statistics implements
* @param timespan The timespan to retrieve statistics for
the exact meaning of this parameter is not known
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetBandwidthStatisticsResponse getBandwidthStatistics(
Optional<Long> timespan,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<Long> timespan) throws Exception {
GetBandwidthStatisticsRequest request =
GetBandwidthStatisticsRequest
.builder()
@@ -516,62 +456,45 @@ public class Statistics implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getBandwidthStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getBandwidthStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getBandwidthStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getBandwidthStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getBandwidthStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getBandwidthStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getBandwidthStatistics",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -25,27 +25,19 @@ import dev.plexapi.sdk.models.operations.GetUpdateStatusResponseBody;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.models.operations.Skip;
import dev.plexapi.sdk.models.operations.Tonight;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* This describes the API for searching and applying updates to the Plex Media Server.
@@ -80,22 +72,6 @@ public class Updater implements
* @throws Exception if the API call fails
*/
public GetUpdateStatusResponse getUpdateStatusDirect() throws Exception {
return getUpdateStatus(Optional.empty());
}
/**
* Querying status of updates
* Querying status of updates
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetUpdateStatusResponse getUpdateStatus(
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -111,62 +87,45 @@ public class Updater implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getUpdateStatus",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getUpdateStatus",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getUpdateStatus",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getUpdateStatus",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getUpdateStatus",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getUpdateStatus",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getUpdateStatus",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -260,24 +219,18 @@ public class Updater implements
* @throws Exception if the API call fails
*/
public CheckForUpdatesResponse checkForUpdatesDirect() throws Exception {
return checkForUpdates(Optional.empty(), Optional.empty());
return checkForUpdates(Optional.empty());
}
/**
* Checking for updates
* Checking for updates
* @param download Indicate that you want to start download any updates found.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public CheckForUpdatesResponse checkForUpdates(
Optional<? extends Download> download,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<? extends Download> download) throws Exception {
CheckForUpdatesRequest request =
CheckForUpdatesRequest
.builder()
@@ -304,62 +257,45 @@ public class Updater implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"checkForUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"checkForUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"checkForUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"checkForUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"checkForUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"checkForUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"checkForUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -444,7 +380,7 @@ public class Updater implements
* @throws Exception if the API call fails
*/
public ApplyUpdatesResponse applyUpdatesDirect() throws Exception {
return applyUpdates(Optional.empty(), Optional.empty(), Optional.empty());
return applyUpdates(Optional.empty(), Optional.empty());
}
/**
@@ -453,18 +389,12 @@ public class Updater implements
*
* @param tonight Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install
* @param skip Indicate that the latest version should be marked as skipped. The [Release] entry for this version will have the `state` set to `skipped`.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public ApplyUpdatesResponse applyUpdates(
Optional<? extends Tonight> tonight,
Optional<? extends Skip> skip,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<? extends Skip> skip) throws Exception {
ApplyUpdatesRequest request =
ApplyUpdatesRequest
.builder()
@@ -492,62 +422,45 @@ public class Updater implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"applyUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "500", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"applyUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"applyUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"applyUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"applyUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"applyUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"applyUpdates",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -17,27 +17,19 @@ import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.models.operations.StartUniversalTranscodeRequest;
import dev.plexapi.sdk.models.operations.StartUniversalTranscodeRequestBuilder;
import dev.plexapi.sdk.models.operations.StartUniversalTranscodeResponse;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* API Calls that perform operations with Plex Media Server Videos
@@ -72,24 +64,6 @@ public class Video implements
*/
public GetTimelineResponse getTimeline(
GetTimelineRequest request) throws Exception {
return getTimeline(request, Optional.empty());
}
/**
* Get the timeline for a media item
* Get the timeline for a media item
* @param request The request object containing all of the parameters for the API call.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetTimelineResponse getTimeline(
GetTimelineRequest request,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -110,62 +84,45 @@ public class Video implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTimeline",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTimeline",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTimeline",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTimeline",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"getTimeline",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"getTimeline",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"getTimeline",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
@@ -250,24 +207,6 @@ public class Video implements
*/
public StartUniversalTranscodeResponse startUniversalTranscode(
StartUniversalTranscodeRequest request) throws Exception {
return startUniversalTranscode(request, Optional.empty());
}
/**
* Start Universal Transcode
* Begin a Universal Transcode Session
* @param request The request object containing all of the parameters for the API call.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StartUniversalTranscodeResponse startUniversalTranscode(
StartUniversalTranscodeRequest request,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl, this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
@@ -288,62 +227,45 @@ public class Video implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"startUniversalTranscode",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startUniversalTranscode",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"startUniversalTranscode",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startUniversalTranscode",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"startUniversalTranscode",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"startUniversalTranscode",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"startUniversalTranscode",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -13,28 +13,20 @@ import dev.plexapi.sdk.models.operations.GetWatchListRequestBuilder;
import dev.plexapi.sdk.models.operations.GetWatchListResponse;
import dev.plexapi.sdk.models.operations.GetWatchListResponseBody;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.utils.BackoffStrategy;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.HTTPRequest;
import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl;
import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl;
import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.Retries.NonRetryableException;
import dev.plexapi.sdk.utils.Retries;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.Optional;
/**
* API Calls that perform operations with Plex Media Server Watchlists
@@ -78,7 +70,7 @@ public class Watchlist implements
*/
public GetWatchListResponse getWatchList(
GetWatchListRequest request) throws Exception {
return getWatchList(request, Optional.empty(), Optional.empty());
return getWatchList(request, Optional.empty());
}
/**
@@ -86,18 +78,12 @@ public class Watchlist implements
* Get User Watchlist
* @param request The request object containing all of the parameters for the API call.
* @param serverURL Overrides the server URL.
* @param options additional options
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetWatchListResponse getWatchList(
GetWatchListRequest request,
Optional<String> serverURL,
Optional<Options> options) throws Exception {
if (options.isPresent()) {
options.get().validate(Arrays.asList(Options.Option.RETRY_CONFIG));
}
Optional<String> serverURL) throws Exception {
String _baseUrl = Utils.templateUrl(GET_WATCH_LIST_SERVERS[0], new HashMap<String, String>());
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
@@ -123,62 +109,45 @@ public class Watchlist implements
this.sdkConfiguration.securitySource.getSecurity());
HTTPClient _client = this.sdkConfiguration.defaultClient;
HTTPRequest _finalReq = _req;
RetryConfig _retryConfig;
if (options.isPresent() && options.get().retryConfig().isPresent()) {
_retryConfig = options.get().retryConfig().get();
} else if (this.sdkConfiguration.retryConfig.isPresent()) {
_retryConfig = this.sdkConfiguration.retryConfig.get();
} else {
_retryConfig = RetryConfig.builder()
.backoff(BackoffStrategy.builder()
.initialInterval(500, TimeUnit.MILLISECONDS)
.maxInterval(60000, TimeUnit.MILLISECONDS)
.baseFactor((double)(1.5))
.maxElapsedTime(3600000, TimeUnit.MILLISECONDS)
.retryConnectError(true)
.build())
.build();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-watch-list",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_req.build());
HttpResponse<InputStream> _httpRes;
try {
_httpRes = _client.send(_r);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-watch-list",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-watch-list",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-watch-list",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
List<String> _statusCodes = new ArrayList<>();
_statusCodes.add("5XX");
Retries _retries = Retries.builder()
.action(() -> {
HttpRequest _r = null;
try {
_r = sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
"get-watch-list",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_finalReq.build());
} catch (Exception _e) {
throw new NonRetryableException(_e);
}
try {
return _client.send(_r);
} catch (Exception _e) {
return sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
"get-watch-list",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
Optional.empty(),
Optional.of(_e));
}
})
.retryConfig(_retryConfig)
.statusCodes(_statusCodes)
.build();
HttpResponse<InputStream> _httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
"get-watch-list",
Optional.of(List.of()),
sdkConfiguration.securitySource()),
_retries.run());
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.lang.String;
@@ -16,7 +14,6 @@ public class AddPlaylistContentsRequestBuilder {
private Double playlistID;
private String uri;
private Optional<Double> playQueueID = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallAddPlaylistContents sdk;
public AddPlaylistContentsRequestBuilder(SDKMethodInterfaces.MethodCallAddPlaylistContents sdk) {
@@ -46,27 +43,12 @@ public class AddPlaylistContentsRequestBuilder {
this.playQueueID = playQueueID;
return this;
}
public AddPlaylistContentsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public AddPlaylistContentsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public AddPlaylistContentsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.addPlaylistContents(
playlistID,
uri,
playQueueID,
options);
playQueueID);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
@@ -13,7 +11,6 @@ public class ApplyUpdatesRequestBuilder {
private Optional<? extends Tonight> tonight = Optional.empty();
private Optional<? extends Skip> skip = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallApplyUpdates sdk;
public ApplyUpdatesRequestBuilder(SDKMethodInterfaces.MethodCallApplyUpdates sdk) {
@@ -43,26 +40,11 @@ public class ApplyUpdatesRequestBuilder {
this.skip = skip;
return this;
}
public ApplyUpdatesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public ApplyUpdatesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public ApplyUpdatesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.applyUpdates(
tonight,
skip,
options);
skip);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
public class CancelServerActivitiesRequestBuilder {
private String activityUUID;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallCancelServerActivities sdk;
public CancelServerActivitiesRequestBuilder(SDKMethodInterfaces.MethodCallCancelServerActivities sdk) {
@@ -25,25 +21,10 @@ public class CancelServerActivitiesRequestBuilder {
this.activityUUID = activityUUID;
return this;
}
public CancelServerActivitiesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public CancelServerActivitiesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public CancelServerActivitiesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.cancelServerActivities(
activityUUID,
options);
activityUUID);
}
}

View File

@@ -4,15 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class CheckForUpdatesRequestBuilder {
private Optional<? extends Download> download = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallCheckForUpdates sdk;
public CheckForUpdatesRequestBuilder(SDKMethodInterfaces.MethodCallCheckForUpdates sdk) {
@@ -30,25 +27,10 @@ public class CheckForUpdatesRequestBuilder {
this.download = download;
return this;
}
public CheckForUpdatesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public CheckForUpdatesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public CheckForUpdatesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.checkForUpdates(
download,
options);
download);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.util.Optional;
public class ClearPlaylistContentsRequestBuilder {
private Double playlistID;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallClearPlaylistContents sdk;
public ClearPlaylistContentsRequestBuilder(SDKMethodInterfaces.MethodCallClearPlaylistContents sdk) {
@@ -25,25 +21,10 @@ public class ClearPlaylistContentsRequestBuilder {
this.playlistID = playlistID;
return this;
}
public ClearPlaylistContentsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public ClearPlaylistContentsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public ClearPlaylistContentsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.clearPlaylistContents(
playlistID,
options);
playlistID);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class CreatePlaylistRequestBuilder {
private CreatePlaylistRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallCreatePlaylist sdk;
public CreatePlaylistRequestBuilder(SDKMethodInterfaces.MethodCallCreatePlaylist sdk) {
@@ -24,25 +20,10 @@ public class CreatePlaylistRequestBuilder {
this.request = request;
return this;
}
public CreatePlaylistRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public CreatePlaylistRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public CreatePlaylistResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.createPlaylist(
request,
options);
request);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.util.Optional;
public class DeleteLibraryRequestBuilder {
private Integer sectionKey;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallDeleteLibrary sdk;
public DeleteLibraryRequestBuilder(SDKMethodInterfaces.MethodCallDeleteLibrary sdk) {
@@ -25,25 +21,10 @@ public class DeleteLibraryRequestBuilder {
this.sectionKey = sectionKey;
return this;
}
public DeleteLibraryRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public DeleteLibraryRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public DeleteLibraryResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.deleteLibrary(
sectionKey,
options);
sectionKey);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.util.Optional;
public class DeletePlaylistRequestBuilder {
private Double playlistID;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallDeletePlaylist sdk;
public DeletePlaylistRequestBuilder(SDKMethodInterfaces.MethodCallDeletePlaylist sdk) {
@@ -25,25 +21,10 @@ public class DeletePlaylistRequestBuilder {
this.playlistID = playlistID;
return this;
}
public DeletePlaylistRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public DeletePlaylistRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public DeletePlaylistResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.deletePlaylist(
playlistID,
options);
playlistID);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class EnablePaperTrailRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallEnablePaperTrail sdk;
public EnablePaperTrailRequestBuilder(SDKMethodInterfaces.MethodCallEnablePaperTrail sdk) {
this.sdk = sdk;
}
public EnablePaperTrailRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public EnablePaperTrailRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public EnablePaperTrailResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.enablePaperTrail(
options);
return sdk.enablePaperTrailDirect();
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetAllLibrariesRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetAllLibraries sdk;
public GetAllLibrariesRequestBuilder(SDKMethodInterfaces.MethodCallGetAllLibraries sdk) {
this.sdk = sdk;
}
public GetAllLibrariesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetAllLibrariesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetAllLibrariesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getAllLibraries(
options);
return sdk.getAllLibrariesDirect();
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetAvailableClientsRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetAvailableClients sdk;
public GetAvailableClientsRequestBuilder(SDKMethodInterfaces.MethodCallGetAvailableClients sdk) {
this.sdk = sdk;
}
public GetAvailableClientsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetAvailableClientsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetAvailableClientsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getAvailableClients(
options);
return sdk.getAvailableClientsDirect();
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Long;
import java.util.Optional;
@@ -13,7 +11,6 @@ import java.util.Optional;
public class GetBandwidthStatisticsRequestBuilder {
private Optional<Long> timespan = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetBandwidthStatistics sdk;
public GetBandwidthStatisticsRequestBuilder(SDKMethodInterfaces.MethodCallGetBandwidthStatistics sdk) {
@@ -31,25 +28,10 @@ public class GetBandwidthStatisticsRequestBuilder {
this.timespan = timespan;
return this;
}
public GetBandwidthStatisticsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetBandwidthStatisticsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetBandwidthStatisticsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getBandwidthStatistics(
timespan,
options);
timespan);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetBannerImageRequestBuilder {
private GetBannerImageRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetBannerImage sdk;
public GetBannerImageRequestBuilder(SDKMethodInterfaces.MethodCallGetBannerImage sdk) {
@@ -24,25 +20,10 @@ public class GetBannerImageRequestBuilder {
this.request = request;
return this;
}
public GetBannerImageRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetBannerImageRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetBannerImageResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getBannerImage(
request,
options);
request);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetButlerTasksRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetButlerTasks sdk;
public GetButlerTasksRequestBuilder(SDKMethodInterfaces.MethodCallGetButlerTasks sdk) {
this.sdk = sdk;
}
public GetButlerTasksRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetButlerTasksRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetButlerTasksResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getButlerTasks(
options);
return sdk.getButlerTasksDirect();
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -13,7 +11,6 @@ import java.util.Optional;
public class GetCompanionsDataRequestBuilder {
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetCompanionsData sdk;
public GetCompanionsDataRequestBuilder(SDKMethodInterfaces.MethodCallGetCompanionsData sdk) {
@@ -31,25 +28,10 @@ public class GetCompanionsDataRequestBuilder {
this.serverURL = serverURL;
return this;
}
public GetCompanionsDataRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetCompanionsDataRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetCompanionsDataResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getCompanionsData(
serverURL,
options);
serverURL);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetDevicesRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetDevices sdk;
public GetDevicesRequestBuilder(SDKMethodInterfaces.MethodCallGetDevices sdk) {
this.sdk = sdk;
}
public GetDevicesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetDevicesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetDevicesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getDevices(
options);
return sdk.getDevicesDirect();
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.lang.String;
@@ -15,7 +13,6 @@ public class GetFileHashRequestBuilder {
private String url;
private Optional<Double> type = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetFileHash sdk;
public GetFileHashRequestBuilder(SDKMethodInterfaces.MethodCallGetFileHash sdk) {
@@ -39,26 +36,11 @@ public class GetFileHashRequestBuilder {
this.type = type;
return this;
}
public GetFileHashRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetFileHashRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetFileHashResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getFileHash(
url,
type,
options);
type);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -13,7 +11,6 @@ import java.util.Optional;
public class GetGeoDataRequestBuilder {
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetGeoData sdk;
public GetGeoDataRequestBuilder(SDKMethodInterfaces.MethodCallGetGeoData sdk) {
@@ -31,25 +28,10 @@ public class GetGeoDataRequestBuilder {
this.serverURL = serverURL;
return this;
}
public GetGeoDataRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetGeoDataRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetGeoDataResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getGeoData(
serverURL,
options);
serverURL);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.util.Optional;
@@ -14,7 +12,6 @@ public class GetGlobalHubsRequestBuilder {
private Optional<Double> count = Optional.empty();
private Optional<? extends OnlyTransient> onlyTransient = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetGlobalHubs sdk;
public GetGlobalHubsRequestBuilder(SDKMethodInterfaces.MethodCallGetGlobalHubs sdk) {
@@ -44,26 +41,11 @@ public class GetGlobalHubsRequestBuilder {
this.onlyTransient = onlyTransient;
return this;
}
public GetGlobalHubsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetGlobalHubsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetGlobalHubsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getGlobalHubs(
count,
onlyTransient,
options);
onlyTransient);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetHomeDataRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetHomeData sdk;
public GetHomeDataRequestBuilder(SDKMethodInterfaces.MethodCallGetHomeData sdk) {
this.sdk = sdk;
}
public GetHomeDataRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetHomeDataRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetHomeDataResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getHomeData(
options);
return sdk.getHomeDataDirect();
}
}

View File

@@ -6,8 +6,6 @@ package dev.plexapi.sdk.models.operations;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.util.Optional;
@@ -19,7 +17,6 @@ public class GetLibraryDetailsRequestBuilder {
"0",
new TypeReference<Optional<? extends IncludeDetails>>() {});
private Integer sectionKey;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetLibraryDetails sdk;
public GetLibraryDetailsRequestBuilder(SDKMethodInterfaces.MethodCallGetLibraryDetails sdk) {
@@ -43,29 +40,14 @@ public class GetLibraryDetailsRequestBuilder {
this.sectionKey = sectionKey;
return this;
}
public GetLibraryDetailsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetLibraryDetailsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetLibraryDetailsResponse call() throws Exception {
if (includeDetails == null) {
includeDetails = _SINGLETON_VALUE_IncludeDetails.value();
} Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
}
return sdk.getLibraryDetails(
includeDetails,
sectionKey,
options);
sectionKey);
}
private static final LazySingletonValue<Optional<? extends IncludeDetails>> _SINGLETON_VALUE_IncludeDetails =

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.util.Optional;
@@ -15,7 +13,6 @@ public class GetLibraryHubsRequestBuilder {
private Double sectionId;
private Optional<Double> count = Optional.empty();
private Optional<? extends QueryParamOnlyTransient> onlyTransient = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetLibraryHubs sdk;
public GetLibraryHubsRequestBuilder(SDKMethodInterfaces.MethodCallGetLibraryHubs sdk) {
@@ -51,27 +48,12 @@ public class GetLibraryHubsRequestBuilder {
this.onlyTransient = onlyTransient;
return this;
}
public GetLibraryHubsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetLibraryHubsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetLibraryHubsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getLibraryHubs(
sectionId,
count,
onlyTransient,
options);
onlyTransient);
}
}

View File

@@ -96,8 +96,9 @@ public class GetLibraryItemsMediaContainer {
@JsonProperty("mixedParents")
private Optional<Boolean> mixedParents;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("Metadata")
private List<GetLibraryItemsMetadata> metadata;
private Optional<? extends List<GetLibraryItemsMetadata>> metadata;
/**
* The Meta object is only included in the response if the `includeMeta` parameter is set to `1`.
@@ -130,7 +131,7 @@ public class GetLibraryItemsMediaContainer {
@JsonProperty("viewGroup") String viewGroup,
@JsonProperty("viewMode") Optional<Integer> viewMode,
@JsonProperty("mixedParents") Optional<Boolean> mixedParents,
@JsonProperty("Metadata") List<GetLibraryItemsMetadata> metadata,
@JsonProperty("Metadata") Optional<? extends List<GetLibraryItemsMetadata>> metadata,
@JsonProperty("Meta") Optional<? extends GetLibraryItemsMeta> meta) {
Utils.checkNotNull(type, "type");
Utils.checkNotNull(fieldType, "fieldType");
@@ -196,9 +197,8 @@ public class GetLibraryItemsMediaContainer {
String thumb,
String title1,
String title2,
String viewGroup,
List<GetLibraryItemsMetadata> metadata) {
this(Optional.empty(), Optional.empty(), size, totalSize, offset, content, allowSync, Optional.empty(), art, identifier, librarySectionID, librarySectionTitle, librarySectionUUID, mediaTagPrefix, mediaTagVersion, thumb, title1, title2, viewGroup, Optional.empty(), Optional.empty(), metadata, Optional.empty());
String viewGroup) {
this(Optional.empty(), Optional.empty(), size, totalSize, offset, content, allowSync, Optional.empty(), art, identifier, librarySectionID, librarySectionTitle, librarySectionUUID, mediaTagPrefix, mediaTagVersion, thumb, title1, title2, viewGroup, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
}
@SuppressWarnings("unchecked")
@@ -308,9 +308,10 @@ public class GetLibraryItemsMediaContainer {
return mixedParents;
}
@SuppressWarnings("unchecked")
@JsonIgnore
public List<GetLibraryItemsMetadata> metadata() {
return metadata;
public Optional<List<GetLibraryItemsMetadata>> metadata() {
return (Optional<List<GetLibraryItemsMetadata>>) metadata;
}
/**
@@ -484,6 +485,12 @@ public class GetLibraryItemsMediaContainer {
}
public GetLibraryItemsMediaContainer withMetadata(List<GetLibraryItemsMetadata> metadata) {
Utils.checkNotNull(metadata, "metadata");
this.metadata = Optional.ofNullable(metadata);
return this;
}
public GetLibraryItemsMediaContainer withMetadata(Optional<? extends List<GetLibraryItemsMetadata>> metadata) {
Utils.checkNotNull(metadata, "metadata");
this.metadata = metadata;
return this;
@@ -644,7 +651,7 @@ public class GetLibraryItemsMediaContainer {
private Optional<Boolean> mixedParents = Optional.empty();
private List<GetLibraryItemsMetadata> metadata;
private Optional<? extends List<GetLibraryItemsMetadata>> metadata = Optional.empty();
private Optional<? extends GetLibraryItemsMeta> meta = Optional.empty();
@@ -809,6 +816,12 @@ public class GetLibraryItemsMediaContainer {
}
public Builder metadata(List<GetLibraryItemsMetadata> metadata) {
Utils.checkNotNull(metadata, "metadata");
this.metadata = Optional.ofNullable(metadata);
return this;
}
public Builder metadata(Optional<? extends List<GetLibraryItemsMetadata>> metadata) {
Utils.checkNotNull(metadata, "metadata");
this.metadata = metadata;
return this;

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetLibraryItemsRequestBuilder {
private GetLibraryItemsRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetLibraryItems sdk;
public GetLibraryItemsRequestBuilder(SDKMethodInterfaces.MethodCallGetLibraryItems sdk) {
@@ -24,25 +20,10 @@ public class GetLibraryItemsRequestBuilder {
this.request = request;
return this;
}
public GetLibraryItemsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetLibraryItemsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetLibraryItemsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getLibraryItems(
request,
options);
request);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
public class GetMediaProvidersRequestBuilder {
private String xPlexToken;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetMediaProviders sdk;
public GetMediaProvidersRequestBuilder(SDKMethodInterfaces.MethodCallGetMediaProviders sdk) {
@@ -25,25 +21,10 @@ public class GetMediaProvidersRequestBuilder {
this.xPlexToken = xPlexToken;
return this;
}
public GetMediaProvidersRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetMediaProvidersRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetMediaProvidersResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getMediaProviders(
xPlexToken,
options);
xPlexToken);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Long;
import java.util.Optional;
public class GetMetaDataByRatingKeyRequestBuilder {
private Long ratingKey;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetMetaDataByRatingKey sdk;
public GetMetaDataByRatingKeyRequestBuilder(SDKMethodInterfaces.MethodCallGetMetaDataByRatingKey sdk) {
@@ -25,25 +21,10 @@ public class GetMetaDataByRatingKeyRequestBuilder {
this.ratingKey = ratingKey;
return this;
}
public GetMetaDataByRatingKeyRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetMetaDataByRatingKeyRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetMetaDataByRatingKeyResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getMetaDataByRatingKey(
ratingKey,
options);
ratingKey);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.lang.String;
@@ -15,7 +13,6 @@ public class GetMetadataChildrenRequestBuilder {
private Double ratingKey;
private Optional<String> includeElements = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetMetadataChildren sdk;
public GetMetadataChildrenRequestBuilder(SDKMethodInterfaces.MethodCallGetMetadataChildren sdk) {
@@ -39,26 +36,11 @@ public class GetMetadataChildrenRequestBuilder {
this.includeElements = includeElements;
return this;
}
public GetMetadataChildrenRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetMetadataChildrenRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetMetadataChildrenResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getMetadataChildren(
ratingKey,
includeElements,
options);
includeElements);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetMyPlexAccountRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetMyPlexAccount sdk;
public GetMyPlexAccountRequestBuilder(SDKMethodInterfaces.MethodCallGetMyPlexAccount sdk) {
this.sdk = sdk;
}
public GetMyPlexAccountRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetMyPlexAccountRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetMyPlexAccountResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getMyPlexAccount(
options);
return sdk.getMyPlexAccountDirect();
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetOnDeckRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetOnDeck sdk;
public GetOnDeckRequestBuilder(SDKMethodInterfaces.MethodCallGetOnDeck sdk) {
this.sdk = sdk;
}
public GetOnDeckRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetOnDeckRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetOnDeckResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getOnDeck(
options);
return sdk.getOnDeckDirect();
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -14,7 +12,6 @@ public class GetPinRequestBuilder {
private GetPinRequest request;
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetPin sdk;
public GetPinRequestBuilder(SDKMethodInterfaces.MethodCallGetPin sdk) {
@@ -38,26 +35,11 @@ public class GetPinRequestBuilder {
this.serverURL = serverURL;
return this;
}
public GetPinRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetPinRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetPinResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getPin(
request,
serverURL,
options);
serverURL);
}
}

View File

@@ -4,17 +4,13 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.util.Optional;
public class GetPlaylistContentsRequestBuilder {
private Double playlistID;
private GetPlaylistContentsQueryParamType type;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetPlaylistContents sdk;
public GetPlaylistContentsRequestBuilder(SDKMethodInterfaces.MethodCallGetPlaylistContents sdk) {
@@ -32,26 +28,11 @@ public class GetPlaylistContentsRequestBuilder {
this.type = type;
return this;
}
public GetPlaylistContentsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetPlaylistContentsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetPlaylistContentsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getPlaylistContents(
playlistID,
type,
options);
type);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.util.Optional;
public class GetPlaylistRequestBuilder {
private Double playlistID;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetPlaylist sdk;
public GetPlaylistRequestBuilder(SDKMethodInterfaces.MethodCallGetPlaylist sdk) {
@@ -25,25 +21,10 @@ public class GetPlaylistRequestBuilder {
this.playlistID = playlistID;
return this;
}
public GetPlaylistRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetPlaylistRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetPlaylistResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getPlaylist(
playlistID,
options);
playlistID);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
@@ -13,7 +11,6 @@ public class GetPlaylistsRequestBuilder {
private Optional<? extends PlaylistType> playlistType = Optional.empty();
private Optional<? extends QueryParamSmart> smart = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetPlaylists sdk;
public GetPlaylistsRequestBuilder(SDKMethodInterfaces.MethodCallGetPlaylists sdk) {
@@ -43,26 +40,11 @@ public class GetPlaylistsRequestBuilder {
this.smart = smart;
return this;
}
public GetPlaylistsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetPlaylistsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetPlaylistsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getPlaylists(
playlistType,
smart,
options);
smart);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetRecentlyAddedLibraryRequestBuilder {
private GetRecentlyAddedLibraryRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetRecentlyAddedLibrary sdk;
public GetRecentlyAddedLibraryRequestBuilder(SDKMethodInterfaces.MethodCallGetRecentlyAddedLibrary sdk) {
@@ -24,25 +20,10 @@ public class GetRecentlyAddedLibraryRequestBuilder {
this.request = request;
return this;
}
public GetRecentlyAddedLibraryRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetRecentlyAddedLibraryRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetRecentlyAddedLibraryResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getRecentlyAddedLibrary(
request,
options);
request);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetRecentlyAddedRequestBuilder {
private GetRecentlyAddedRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetRecentlyAdded sdk;
public GetRecentlyAddedRequestBuilder(SDKMethodInterfaces.MethodCallGetRecentlyAdded sdk) {
@@ -24,25 +20,10 @@ public class GetRecentlyAddedRequestBuilder {
this.request = request;
return this;
}
public GetRecentlyAddedRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetRecentlyAddedRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetRecentlyAddedResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getRecentlyAdded(
request,
options);
request);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.util.Optional;
@@ -14,7 +12,6 @@ public class GetRefreshLibraryMetadataRequestBuilder {
private Optional<? extends Force> force = Optional.empty();
private Integer sectionKey;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetRefreshLibraryMetadata sdk;
public GetRefreshLibraryMetadataRequestBuilder(SDKMethodInterfaces.MethodCallGetRefreshLibraryMetadata sdk) {
@@ -38,26 +35,11 @@ public class GetRefreshLibraryMetadataRequestBuilder {
this.sectionKey = sectionKey;
return this;
}
public GetRefreshLibraryMetadataRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetRefreshLibraryMetadataRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetRefreshLibraryMetadataResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getRefreshLibraryMetadata(
force,
sectionKey,
options);
sectionKey);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetResizedPhotoRequestBuilder {
private GetResizedPhotoRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetResizedPhoto sdk;
public GetResizedPhotoRequestBuilder(SDKMethodInterfaces.MethodCallGetResizedPhoto sdk) {
@@ -24,25 +20,10 @@ public class GetResizedPhotoRequestBuilder {
this.request = request;
return this;
}
public GetResizedPhotoRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetResizedPhotoRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetResizedPhotoResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getResizedPhoto(
request,
options);
request);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Long;
import java.util.Optional;
@@ -13,7 +11,6 @@ import java.util.Optional;
public class GetResourcesStatisticsRequestBuilder {
private Optional<Long> timespan = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetResourcesStatistics sdk;
public GetResourcesStatisticsRequestBuilder(SDKMethodInterfaces.MethodCallGetResourcesStatistics sdk) {
@@ -31,25 +28,10 @@ public class GetResourcesStatisticsRequestBuilder {
this.timespan = timespan;
return this;
}
public GetResourcesStatisticsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetResourcesStatisticsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetResourcesStatisticsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getResourcesStatistics(
timespan,
options);
timespan);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetSearchAllLibrariesRequestBuilder {
private GetSearchAllLibrariesRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetSearchAllLibraries sdk;
public GetSearchAllLibrariesRequestBuilder(SDKMethodInterfaces.MethodCallGetSearchAllLibraries sdk) {
@@ -24,25 +20,10 @@ public class GetSearchAllLibrariesRequestBuilder {
this.request = request;
return this;
}
public GetSearchAllLibrariesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetSearchAllLibrariesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetSearchAllLibrariesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getSearchAllLibraries(
request,
options);
request);
}
}

View File

@@ -4,17 +4,13 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.util.Optional;
public class GetSearchLibraryRequestBuilder {
private Integer sectionKey;
private GetSearchLibraryQueryParamType type;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetSearchLibrary sdk;
public GetSearchLibraryRequestBuilder(SDKMethodInterfaces.MethodCallGetSearchLibrary sdk) {
@@ -32,26 +28,11 @@ public class GetSearchLibraryRequestBuilder {
this.type = type;
return this;
}
public GetSearchLibraryRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetSearchLibraryRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetSearchLibraryResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getSearchLibrary(
sectionKey,
type,
options);
type);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
public class GetSearchResultsRequestBuilder {
private String query;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetSearchResults sdk;
public GetSearchResultsRequestBuilder(SDKMethodInterfaces.MethodCallGetSearchResults sdk) {
@@ -25,25 +21,10 @@ public class GetSearchResultsRequestBuilder {
this.query = query;
return this;
}
public GetSearchResultsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetSearchResultsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetSearchResultsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getSearchResults(
query,
options);
query);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetServerActivitiesRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetServerActivities sdk;
public GetServerActivitiesRequestBuilder(SDKMethodInterfaces.MethodCallGetServerActivities sdk) {
this.sdk = sdk;
}
public GetServerActivitiesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetServerActivitiesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetServerActivitiesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getServerActivities(
options);
return sdk.getServerActivitiesDirect();
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetServerCapabilitiesRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetServerCapabilities sdk;
public GetServerCapabilitiesRequestBuilder(SDKMethodInterfaces.MethodCallGetServerCapabilities sdk) {
this.sdk = sdk;
}
public GetServerCapabilitiesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetServerCapabilitiesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetServerCapabilitiesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getServerCapabilities(
options);
return sdk.getServerCapabilitiesDirect();
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetServerIdentityRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetServerIdentity sdk;
public GetServerIdentityRequestBuilder(SDKMethodInterfaces.MethodCallGetServerIdentity sdk) {
this.sdk = sdk;
}
public GetServerIdentityRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetServerIdentityRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetServerIdentityResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getServerIdentity(
options);
return sdk.getServerIdentityDirect();
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetServerListRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetServerList sdk;
public GetServerListRequestBuilder(SDKMethodInterfaces.MethodCallGetServerList sdk) {
this.sdk = sdk;
}
public GetServerListRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetServerListRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetServerListResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getServerList(
options);
return sdk.getServerListDirect();
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetServerPreferencesRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetServerPreferences sdk;
public GetServerPreferencesRequestBuilder(SDKMethodInterfaces.MethodCallGetServerPreferences sdk) {
this.sdk = sdk;
}
public GetServerPreferencesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetServerPreferencesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetServerPreferencesResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getServerPreferences(
options);
return sdk.getServerPreferencesDirect();
}
}

View File

@@ -6,8 +6,6 @@ package dev.plexapi.sdk.models.operations;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -28,7 +26,6 @@ public class GetServerResourcesRequestBuilder {
new TypeReference<Optional<? extends IncludeIPv6>>() {});
private Optional<String> clientID = Optional.empty();
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetServerResources sdk;
public GetServerResourcesRequestBuilder(SDKMethodInterfaces.MethodCallGetServerResources sdk) {
@@ -94,18 +91,6 @@ public class GetServerResourcesRequestBuilder {
this.serverURL = serverURL;
return this;
}
public GetServerResourcesRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetServerResourcesRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetServerResourcesResponse call() throws Exception {
if (includeHttps == null) {
@@ -116,16 +101,13 @@ public class GetServerResourcesRequestBuilder {
}
if (includeIPv6 == null) {
includeIPv6 = _SINGLETON_VALUE_IncludeIPv6.value();
} Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
}
return sdk.getServerResources(
includeHttps,
includeRelay,
includeIPv6,
clientID,
serverURL,
options);
serverURL);
}
private static final LazySingletonValue<Optional<? extends IncludeHttps>> _SINGLETON_VALUE_IncludeHttps =

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Long;
import java.lang.String;
@@ -17,7 +15,6 @@ public class GetSessionHistoryRequestBuilder {
private Optional<Long> accountId = Optional.empty();
private Optional<? extends QueryParamFilter> filter = Optional.empty();
private Optional<Long> librarySectionID = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetSessionHistory sdk;
public GetSessionHistoryRequestBuilder(SDKMethodInterfaces.MethodCallGetSessionHistory sdk) {
@@ -71,28 +68,13 @@ public class GetSessionHistoryRequestBuilder {
this.librarySectionID = librarySectionID;
return this;
}
public GetSessionHistoryRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetSessionHistoryRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetSessionHistoryResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getSessionHistory(
sort,
accountId,
filter,
librarySectionID,
options);
librarySectionID);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetSessionsRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetSessions sdk;
public GetSessionsRequestBuilder(SDKMethodInterfaces.MethodCallGetSessions sdk) {
this.sdk = sdk;
}
public GetSessionsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetSessionsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetSessionsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getSessions(
options);
return sdk.getSessionsDirect();
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
public class GetSourceConnectionInformationRequestBuilder {
private String source;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetSourceConnectionInformation sdk;
public GetSourceConnectionInformationRequestBuilder(SDKMethodInterfaces.MethodCallGetSourceConnectionInformation sdk) {
@@ -25,25 +21,10 @@ public class GetSourceConnectionInformationRequestBuilder {
this.source = source;
return this;
}
public GetSourceConnectionInformationRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetSourceConnectionInformationRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetSourceConnectionInformationResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getSourceConnectionInformation(
source,
options);
source);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Long;
import java.util.Optional;
@@ -13,7 +11,6 @@ import java.util.Optional;
public class GetStatisticsRequestBuilder {
private Optional<Long> timespan = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetStatistics sdk;
public GetStatisticsRequestBuilder(SDKMethodInterfaces.MethodCallGetStatistics sdk) {
@@ -31,25 +28,10 @@ public class GetStatisticsRequestBuilder {
this.timespan = timespan;
return this;
}
public GetStatisticsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetStatisticsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetStatisticsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getStatistics(
timespan,
options);
timespan);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetThumbImageRequestBuilder {
private GetThumbImageRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetThumbImage sdk;
public GetThumbImageRequestBuilder(SDKMethodInterfaces.MethodCallGetThumbImage sdk) {
@@ -24,25 +20,10 @@ public class GetThumbImageRequestBuilder {
this.request = request;
return this;
}
public GetThumbImageRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetThumbImageRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetThumbImageResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getThumbImage(
request,
options);
request);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetTimelineRequestBuilder {
private GetTimelineRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetTimeline sdk;
public GetTimelineRequestBuilder(SDKMethodInterfaces.MethodCallGetTimeline sdk) {
@@ -24,25 +20,10 @@ public class GetTimelineRequestBuilder {
this.request = request;
return this;
}
public GetTimelineRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetTimelineRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetTimelineResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getTimeline(
request,
options);
request);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -14,7 +12,6 @@ public class GetTokenByPinIdRequestBuilder {
private GetTokenByPinIdRequest request;
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetTokenByPinId sdk;
public GetTokenByPinIdRequestBuilder(SDKMethodInterfaces.MethodCallGetTokenByPinId sdk) {
@@ -38,26 +35,11 @@ public class GetTokenByPinIdRequestBuilder {
this.serverURL = serverURL;
return this;
}
public GetTokenByPinIdRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetTokenByPinIdRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetTokenByPinIdResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getTokenByPinId(
request,
serverURL,
options);
serverURL);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -13,7 +11,6 @@ import java.util.Optional;
public class GetTokenDetailsRequestBuilder {
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetTokenDetails sdk;
public GetTokenDetailsRequestBuilder(SDKMethodInterfaces.MethodCallGetTokenDetails sdk) {
@@ -31,25 +28,10 @@ public class GetTokenDetailsRequestBuilder {
this.serverURL = serverURL;
return this;
}
public GetTokenDetailsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetTokenDetailsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetTokenDetailsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getTokenDetails(
serverURL,
options);
serverURL);
}
}

View File

@@ -20,7 +20,6 @@ import java.lang.Long;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -39,19 +38,13 @@ public class GetTokenDetailsUserPlexAccount {
@JsonProperty("adsConsent")
private Optional<Boolean> adsConsent;
/**
* Unknown
*/
@JsonInclude(Include.ALWAYS)
@JsonProperty("adsConsentReminderAt")
private Optional<OffsetDateTime> adsConsentReminderAt;
private Optional<Long> adsConsentReminderAt;
/**
* Unknown
*/
@JsonInclude(Include.ALWAYS)
@JsonProperty("adsConsentSetAt")
private Optional<OffsetDateTime> adsConsentSetAt;
private Optional<Long> adsConsentSetAt;
/**
* Unknown
@@ -292,8 +285,8 @@ public class GetTokenDetailsUserPlexAccount {
@JsonCreator
public GetTokenDetailsUserPlexAccount(
@JsonProperty("adsConsent") Optional<Boolean> adsConsent,
@JsonProperty("adsConsentReminderAt") Optional<OffsetDateTime> adsConsentReminderAt,
@JsonProperty("adsConsentSetAt") Optional<OffsetDateTime> adsConsentSetAt,
@JsonProperty("adsConsentReminderAt") Optional<Long> adsConsentReminderAt,
@JsonProperty("adsConsentSetAt") Optional<Long> adsConsentSetAt,
@JsonProperty("anonymous") JsonNullable<Boolean> anonymous,
@JsonProperty("authToken") String authToken,
@JsonProperty("backupCodesCreated") Optional<Boolean> backupCodesCreated,
@@ -448,19 +441,13 @@ public class GetTokenDetailsUserPlexAccount {
return adsConsent;
}
/**
* Unknown
*/
@JsonIgnore
public Optional<OffsetDateTime> adsConsentReminderAt() {
public Optional<Long> adsConsentReminderAt() {
return adsConsentReminderAt;
}
/**
* Unknown
*/
@JsonIgnore
public Optional<OffsetDateTime> adsConsentSetAt() {
public Optional<Long> adsConsentSetAt() {
return adsConsentSetAt;
}
@@ -781,37 +768,25 @@ public class GetTokenDetailsUserPlexAccount {
return this;
}
/**
* Unknown
*/
public GetTokenDetailsUserPlexAccount withAdsConsentReminderAt(OffsetDateTime adsConsentReminderAt) {
public GetTokenDetailsUserPlexAccount withAdsConsentReminderAt(long adsConsentReminderAt) {
Utils.checkNotNull(adsConsentReminderAt, "adsConsentReminderAt");
this.adsConsentReminderAt = Optional.ofNullable(adsConsentReminderAt);
return this;
}
/**
* Unknown
*/
public GetTokenDetailsUserPlexAccount withAdsConsentReminderAt(Optional<OffsetDateTime> adsConsentReminderAt) {
public GetTokenDetailsUserPlexAccount withAdsConsentReminderAt(Optional<Long> adsConsentReminderAt) {
Utils.checkNotNull(adsConsentReminderAt, "adsConsentReminderAt");
this.adsConsentReminderAt = adsConsentReminderAt;
return this;
}
/**
* Unknown
*/
public GetTokenDetailsUserPlexAccount withAdsConsentSetAt(OffsetDateTime adsConsentSetAt) {
public GetTokenDetailsUserPlexAccount withAdsConsentSetAt(long adsConsentSetAt) {
Utils.checkNotNull(adsConsentSetAt, "adsConsentSetAt");
this.adsConsentSetAt = Optional.ofNullable(adsConsentSetAt);
return this;
}
/**
* Unknown
*/
public GetTokenDetailsUserPlexAccount withAdsConsentSetAt(Optional<OffsetDateTime> adsConsentSetAt) {
public GetTokenDetailsUserPlexAccount withAdsConsentSetAt(Optional<Long> adsConsentSetAt) {
Utils.checkNotNull(adsConsentSetAt, "adsConsentSetAt");
this.adsConsentSetAt = adsConsentSetAt;
return this;
@@ -1459,9 +1434,9 @@ public class GetTokenDetailsUserPlexAccount {
private Optional<Boolean> adsConsent = Optional.empty();
private Optional<OffsetDateTime> adsConsentReminderAt = Optional.empty();
private Optional<Long> adsConsentReminderAt = Optional.empty();
private Optional<OffsetDateTime> adsConsentSetAt = Optional.empty();
private Optional<Long> adsConsentSetAt = Optional.empty();
private JsonNullable<Boolean> anonymous;
@@ -1562,37 +1537,25 @@ public class GetTokenDetailsUserPlexAccount {
return this;
}
/**
* Unknown
*/
public Builder adsConsentReminderAt(OffsetDateTime adsConsentReminderAt) {
public Builder adsConsentReminderAt(long adsConsentReminderAt) {
Utils.checkNotNull(adsConsentReminderAt, "adsConsentReminderAt");
this.adsConsentReminderAt = Optional.ofNullable(adsConsentReminderAt);
return this;
}
/**
* Unknown
*/
public Builder adsConsentReminderAt(Optional<OffsetDateTime> adsConsentReminderAt) {
public Builder adsConsentReminderAt(Optional<Long> adsConsentReminderAt) {
Utils.checkNotNull(adsConsentReminderAt, "adsConsentReminderAt");
this.adsConsentReminderAt = adsConsentReminderAt;
return this;
}
/**
* Unknown
*/
public Builder adsConsentSetAt(OffsetDateTime adsConsentSetAt) {
public Builder adsConsentSetAt(long adsConsentSetAt) {
Utils.checkNotNull(adsConsentSetAt, "adsConsentSetAt");
this.adsConsentSetAt = Optional.ofNullable(adsConsentSetAt);
return this;
}
/**
* Unknown
*/
public Builder adsConsentSetAt(Optional<OffsetDateTime> adsConsentSetAt) {
public Builder adsConsentSetAt(Optional<Long> adsConsentSetAt) {
Utils.checkNotNull(adsConsentSetAt, "adsConsentSetAt");
this.adsConsentSetAt = adsConsentSetAt;
return this;

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Long;
import java.util.Optional;
@@ -14,7 +12,6 @@ public class GetTopWatchedContentRequestBuilder {
private Optional<Long> includeGuids = Optional.empty();
private GetTopWatchedContentQueryParamType type;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetTopWatchedContent sdk;
public GetTopWatchedContentRequestBuilder(SDKMethodInterfaces.MethodCallGetTopWatchedContent sdk) {
@@ -38,26 +35,11 @@ public class GetTopWatchedContentRequestBuilder {
this.type = type;
return this;
}
public GetTopWatchedContentRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetTopWatchedContentRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetTopWatchedContentResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getTopWatchedContent(
includeGuids,
type,
options);
type);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetTranscodeSessionsRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetTranscodeSessions sdk;
public GetTranscodeSessionsRequestBuilder(SDKMethodInterfaces.MethodCallGetTranscodeSessions sdk) {
this.sdk = sdk;
}
public GetTranscodeSessionsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetTranscodeSessionsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetTranscodeSessionsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getTranscodeSessions(
options);
return sdk.getTranscodeSessionsDirect();
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetTransientTokenRequestBuilder {
private GetTransientTokenQueryParamType type;
private Scope scope;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetTransientToken sdk;
public GetTransientTokenRequestBuilder(SDKMethodInterfaces.MethodCallGetTransientToken sdk) {
@@ -31,26 +27,11 @@ public class GetTransientTokenRequestBuilder {
this.scope = scope;
return this;
}
public GetTransientTokenRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetTransientTokenRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetTransientTokenResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getTransientToken(
type,
scope,
options);
scope);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class GetUpdateStatusRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetUpdateStatus sdk;
public GetUpdateStatusRequestBuilder(SDKMethodInterfaces.MethodCallGetUpdateStatus sdk) {
this.sdk = sdk;
}
public GetUpdateStatusRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetUpdateStatusRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetUpdateStatusResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getUpdateStatus(
options);
return sdk.getUpdateStatusDirect();
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -13,7 +11,6 @@ import java.util.Optional;
public class GetUserFriendsRequestBuilder {
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetUserFriends sdk;
public GetUserFriendsRequestBuilder(SDKMethodInterfaces.MethodCallGetUserFriends sdk) {
@@ -31,25 +28,10 @@ public class GetUserFriendsRequestBuilder {
this.serverURL = serverURL;
return this;
}
public GetUserFriendsRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetUserFriendsRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetUserFriendsResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getUserFriends(
serverURL,
options);
serverURL);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -14,7 +12,6 @@ public class GetWatchListRequestBuilder {
private GetWatchListRequest request;
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallGetWatchList sdk;
public GetWatchListRequestBuilder(SDKMethodInterfaces.MethodCallGetWatchList sdk) {
@@ -38,26 +35,11 @@ public class GetWatchListRequestBuilder {
this.serverURL = serverURL;
return this;
}
public GetWatchListRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public GetWatchListRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public GetWatchListResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.getWatchList(
request,
serverURL,
options);
serverURL);
}
}

View File

@@ -4,18 +4,14 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
public class LogLineRequestBuilder {
private Level level;
private String message;
private String source;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallLogLine sdk;
public LogLineRequestBuilder(SDKMethodInterfaces.MethodCallLogLine sdk) {
@@ -39,27 +35,12 @@ public class LogLineRequestBuilder {
this.source = source;
return this;
}
public LogLineRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public LogLineRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public LogLineResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.logLine(
level,
message,
source,
options);
source);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
public class LogMultiLineRequestBuilder {
private String request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallLogMultiLine sdk;
public LogMultiLineRequestBuilder(SDKMethodInterfaces.MethodCallLogMultiLine sdk) {
@@ -25,25 +21,10 @@ public class LogMultiLineRequestBuilder {
this.request = request;
return this;
}
public LogMultiLineRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public LogMultiLineRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public LogMultiLineResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.logMultiLine(
request,
options);
request);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.util.Optional;
public class MarkPlayedRequestBuilder {
private Double key;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallMarkPlayed sdk;
public MarkPlayedRequestBuilder(SDKMethodInterfaces.MethodCallMarkPlayed sdk) {
@@ -25,25 +21,10 @@ public class MarkPlayedRequestBuilder {
this.key = key;
return this;
}
public MarkPlayedRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public MarkPlayedRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public MarkPlayedResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.markPlayed(
key,
options);
key);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.util.Optional;
public class MarkUnplayedRequestBuilder {
private Double key;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallMarkUnplayed sdk;
public MarkUnplayedRequestBuilder(SDKMethodInterfaces.MethodCallMarkUnplayed sdk) {
@@ -25,25 +21,10 @@ public class MarkUnplayedRequestBuilder {
this.key = key;
return this;
}
public MarkUnplayedRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public MarkUnplayedRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public MarkUnplayedResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.markUnplayed(
key,
options);
key);
}
}

View File

@@ -6,8 +6,6 @@ package dev.plexapi.sdk.models.operations;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.lang.String;
@@ -21,7 +19,6 @@ public class PerformSearchRequestBuilder {
"limit",
"3",
new TypeReference<Optional<Double>>() {});
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallPerformSearch sdk;
public PerformSearchRequestBuilder(SDKMethodInterfaces.MethodCallPerformSearch sdk) {
@@ -57,30 +54,15 @@ public class PerformSearchRequestBuilder {
this.limit = limit;
return this;
}
public PerformSearchRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public PerformSearchRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public PerformSearchResponse call() throws Exception {
if (limit == null) {
limit = _SINGLETON_VALUE_Limit.value();
} Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
}
return sdk.performSearch(
query,
sectionId,
limit,
options);
limit);
}
private static final LazySingletonValue<Optional<Double>> _SINGLETON_VALUE_Limit =

View File

@@ -6,8 +6,6 @@ package dev.plexapi.sdk.models.operations;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.lang.String;
@@ -21,7 +19,6 @@ public class PerformVoiceSearchRequestBuilder {
"limit",
"3",
new TypeReference<Optional<Double>>() {});
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallPerformVoiceSearch sdk;
public PerformVoiceSearchRequestBuilder(SDKMethodInterfaces.MethodCallPerformVoiceSearch sdk) {
@@ -57,30 +54,15 @@ public class PerformVoiceSearchRequestBuilder {
this.limit = limit;
return this;
}
public PerformVoiceSearchRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public PerformVoiceSearchRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public PerformVoiceSearchResponse call() throws Exception {
if (limit == null) {
limit = _SINGLETON_VALUE_Limit.value();
} Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
}
return sdk.performVoiceSearch(
query,
sectionId,
limit,
options);
limit);
}
private static final LazySingletonValue<Optional<Double>> _SINGLETON_VALUE_Limit =

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
@@ -14,7 +12,6 @@ public class PostUsersSignInDataRequestBuilder {
private PostUsersSignInDataRequest request;
private Optional<String> serverURL = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallPostUsersSignInData sdk;
public PostUsersSignInDataRequestBuilder(SDKMethodInterfaces.MethodCallPostUsersSignInData sdk) {
@@ -38,26 +35,11 @@ public class PostUsersSignInDataRequestBuilder {
this.serverURL = serverURL;
return this;
}
public PostUsersSignInDataRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public PostUsersSignInDataRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public PostUsersSignInDataResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.postUsersSignInData(
request,
serverURL,
options);
serverURL);
}
}

View File

@@ -20,7 +20,6 @@ import java.lang.Long;
import java.lang.Override;
import java.lang.String;
import java.lang.SuppressWarnings;
import java.time.OffsetDateTime;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
@@ -39,19 +38,13 @@ public class PostUsersSignInDataUserPlexAccount {
@JsonProperty("adsConsent")
private Optional<Boolean> adsConsent;
/**
* Unknown
*/
@JsonInclude(Include.ALWAYS)
@JsonProperty("adsConsentReminderAt")
private Optional<OffsetDateTime> adsConsentReminderAt;
private Optional<Long> adsConsentReminderAt;
/**
* Unknown
*/
@JsonInclude(Include.ALWAYS)
@JsonProperty("adsConsentSetAt")
private Optional<OffsetDateTime> adsConsentSetAt;
private Optional<Long> adsConsentSetAt;
/**
* Unknown
@@ -298,8 +291,8 @@ public class PostUsersSignInDataUserPlexAccount {
@JsonCreator
public PostUsersSignInDataUserPlexAccount(
@JsonProperty("adsConsent") Optional<Boolean> adsConsent,
@JsonProperty("adsConsentReminderAt") Optional<OffsetDateTime> adsConsentReminderAt,
@JsonProperty("adsConsentSetAt") Optional<OffsetDateTime> adsConsentSetAt,
@JsonProperty("adsConsentReminderAt") Optional<Long> adsConsentReminderAt,
@JsonProperty("adsConsentSetAt") Optional<Long> adsConsentSetAt,
@JsonProperty("anonymous") JsonNullable<Boolean> anonymous,
@JsonProperty("authToken") String authToken,
@JsonProperty("backupCodesCreated") Optional<Boolean> backupCodesCreated,
@@ -462,19 +455,13 @@ public class PostUsersSignInDataUserPlexAccount {
return adsConsent;
}
/**
* Unknown
*/
@JsonIgnore
public Optional<OffsetDateTime> adsConsentReminderAt() {
public Optional<Long> adsConsentReminderAt() {
return adsConsentReminderAt;
}
/**
* Unknown
*/
@JsonIgnore
public Optional<OffsetDateTime> adsConsentSetAt() {
public Optional<Long> adsConsentSetAt() {
return adsConsentSetAt;
}
@@ -805,37 +792,25 @@ public class PostUsersSignInDataUserPlexAccount {
return this;
}
/**
* Unknown
*/
public PostUsersSignInDataUserPlexAccount withAdsConsentReminderAt(OffsetDateTime adsConsentReminderAt) {
public PostUsersSignInDataUserPlexAccount withAdsConsentReminderAt(long adsConsentReminderAt) {
Utils.checkNotNull(adsConsentReminderAt, "adsConsentReminderAt");
this.adsConsentReminderAt = Optional.ofNullable(adsConsentReminderAt);
return this;
}
/**
* Unknown
*/
public PostUsersSignInDataUserPlexAccount withAdsConsentReminderAt(Optional<OffsetDateTime> adsConsentReminderAt) {
public PostUsersSignInDataUserPlexAccount withAdsConsentReminderAt(Optional<Long> adsConsentReminderAt) {
Utils.checkNotNull(adsConsentReminderAt, "adsConsentReminderAt");
this.adsConsentReminderAt = adsConsentReminderAt;
return this;
}
/**
* Unknown
*/
public PostUsersSignInDataUserPlexAccount withAdsConsentSetAt(OffsetDateTime adsConsentSetAt) {
public PostUsersSignInDataUserPlexAccount withAdsConsentSetAt(long adsConsentSetAt) {
Utils.checkNotNull(adsConsentSetAt, "adsConsentSetAt");
this.adsConsentSetAt = Optional.ofNullable(adsConsentSetAt);
return this;
}
/**
* Unknown
*/
public PostUsersSignInDataUserPlexAccount withAdsConsentSetAt(Optional<OffsetDateTime> adsConsentSetAt) {
public PostUsersSignInDataUserPlexAccount withAdsConsentSetAt(Optional<Long> adsConsentSetAt) {
Utils.checkNotNull(adsConsentSetAt, "adsConsentSetAt");
this.adsConsentSetAt = adsConsentSetAt;
return this;
@@ -1501,9 +1476,9 @@ public class PostUsersSignInDataUserPlexAccount {
private Optional<Boolean> adsConsent = Optional.empty();
private Optional<OffsetDateTime> adsConsentReminderAt = Optional.empty();
private Optional<Long> adsConsentReminderAt = Optional.empty();
private Optional<OffsetDateTime> adsConsentSetAt = Optional.empty();
private Optional<Long> adsConsentSetAt = Optional.empty();
private JsonNullable<Boolean> anonymous;
@@ -1608,37 +1583,25 @@ public class PostUsersSignInDataUserPlexAccount {
return this;
}
/**
* Unknown
*/
public Builder adsConsentReminderAt(OffsetDateTime adsConsentReminderAt) {
public Builder adsConsentReminderAt(long adsConsentReminderAt) {
Utils.checkNotNull(adsConsentReminderAt, "adsConsentReminderAt");
this.adsConsentReminderAt = Optional.ofNullable(adsConsentReminderAt);
return this;
}
/**
* Unknown
*/
public Builder adsConsentReminderAt(Optional<OffsetDateTime> adsConsentReminderAt) {
public Builder adsConsentReminderAt(Optional<Long> adsConsentReminderAt) {
Utils.checkNotNull(adsConsentReminderAt, "adsConsentReminderAt");
this.adsConsentReminderAt = adsConsentReminderAt;
return this;
}
/**
* Unknown
*/
public Builder adsConsentSetAt(OffsetDateTime adsConsentSetAt) {
public Builder adsConsentSetAt(long adsConsentSetAt) {
Utils.checkNotNull(adsConsentSetAt, "adsConsentSetAt");
this.adsConsentSetAt = Optional.ofNullable(adsConsentSetAt);
return this;
}
/**
* Unknown
*/
public Builder adsConsentSetAt(Optional<OffsetDateTime> adsConsentSetAt) {
public Builder adsConsentSetAt(Optional<Long> adsConsentSetAt) {
Utils.checkNotNull(adsConsentSetAt, "adsConsentSetAt");
this.adsConsentSetAt = adsConsentSetAt;
return this;

View File

@@ -4,7 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import java.lang.Double;
import java.lang.Exception;
import java.lang.Long;
@@ -15,72 +14,61 @@ public class SDKMethodInterfaces {
public interface MethodCallGetServerCapabilities {
GetServerCapabilitiesResponse getServerCapabilities(
Optional<Options> options) throws Exception;
GetServerCapabilitiesResponse getServerCapabilitiesDirect() throws Exception;
}
public interface MethodCallGetServerPreferences {
GetServerPreferencesResponse getServerPreferences(
Optional<Options> options) throws Exception;
GetServerPreferencesResponse getServerPreferencesDirect() throws Exception;
}
public interface MethodCallGetAvailableClients {
GetAvailableClientsResponse getAvailableClients(
Optional<Options> options) throws Exception;
GetAvailableClientsResponse getAvailableClientsDirect() throws Exception;
}
public interface MethodCallGetDevices {
GetDevicesResponse getDevices(
Optional<Options> options) throws Exception;
GetDevicesResponse getDevicesDirect() throws Exception;
}
public interface MethodCallGetServerIdentity {
GetServerIdentityResponse getServerIdentity(
Optional<Options> options) throws Exception;
GetServerIdentityResponse getServerIdentityDirect() throws Exception;
}
public interface MethodCallGetMyPlexAccount {
GetMyPlexAccountResponse getMyPlexAccount(
Optional<Options> options) throws Exception;
GetMyPlexAccountResponse getMyPlexAccountDirect() throws Exception;
}
public interface MethodCallGetResizedPhoto {
GetResizedPhotoResponse getResizedPhoto(
GetResizedPhotoRequest request,
Optional<Options> options) throws Exception;
GetResizedPhotoRequest request) throws Exception;
}
public interface MethodCallGetMediaProviders {
GetMediaProvidersResponse getMediaProviders(
String xPlexToken,
Optional<Options> options) throws Exception;
String xPlexToken) throws Exception;
}
public interface MethodCallGetServerList {
GetServerListResponse getServerList(
Optional<Options> options) throws Exception;
GetServerListResponse getServerListDirect() throws Exception;
}
public interface MethodCallMarkPlayed {
MarkPlayedResponse markPlayed(
double key,
Optional<Options> options) throws Exception;
double key) throws Exception;
}
public interface MethodCallMarkUnplayed {
MarkUnplayedResponse markUnplayed(
double key,
Optional<Options> options) throws Exception;
double key) throws Exception;
}
@@ -88,108 +76,92 @@ public class SDKMethodInterfaces {
UpdatePlayProgressResponse updatePlayProgress(
String key,
double time,
String state,
Optional<Options> options) throws Exception;
String state) throws Exception;
}
public interface MethodCallGetBannerImage {
GetBannerImageResponse getBannerImage(
GetBannerImageRequest request,
Optional<Options> options) throws Exception;
GetBannerImageRequest request) throws Exception;
}
public interface MethodCallGetThumbImage {
GetThumbImageResponse getThumbImage(
GetThumbImageRequest request,
Optional<Options> options) throws Exception;
GetThumbImageRequest request) throws Exception;
}
public interface MethodCallGetTimeline {
GetTimelineResponse getTimeline(
GetTimelineRequest request,
Optional<Options> options) throws Exception;
GetTimelineRequest request) throws Exception;
}
public interface MethodCallStartUniversalTranscode {
StartUniversalTranscodeResponse startUniversalTranscode(
StartUniversalTranscodeRequest request,
Optional<Options> options) throws Exception;
StartUniversalTranscodeRequest request) throws Exception;
}
public interface MethodCallGetServerActivities {
GetServerActivitiesResponse getServerActivities(
Optional<Options> options) throws Exception;
GetServerActivitiesResponse getServerActivitiesDirect() throws Exception;
}
public interface MethodCallCancelServerActivities {
CancelServerActivitiesResponse cancelServerActivities(
String activityUUID,
Optional<Options> options) throws Exception;
String activityUUID) throws Exception;
}
public interface MethodCallGetButlerTasks {
GetButlerTasksResponse getButlerTasks(
Optional<Options> options) throws Exception;
GetButlerTasksResponse getButlerTasksDirect() throws Exception;
}
public interface MethodCallStartAllTasks {
StartAllTasksResponse startAllTasks(
Optional<Options> options) throws Exception;
StartAllTasksResponse startAllTasksDirect() throws Exception;
}
public interface MethodCallStopAllTasks {
StopAllTasksResponse stopAllTasks(
Optional<Options> options) throws Exception;
StopAllTasksResponse stopAllTasksDirect() throws Exception;
}
public interface MethodCallStartTask {
StartTaskResponse startTask(
TaskName taskName,
Optional<Options> options) throws Exception;
TaskName taskName) throws Exception;
}
public interface MethodCallStopTask {
StopTaskResponse stopTask(
PathParamTaskName taskName,
Optional<Options> options) throws Exception;
PathParamTaskName taskName) throws Exception;
}
public interface MethodCallGetCompanionsData {
GetCompanionsDataResponse getCompanionsData(
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
public interface MethodCallGetUserFriends {
GetUserFriendsResponse getUserFriends(
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
public interface MethodCallGetGeoData {
GetGeoDataResponse getGeoData(
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
public interface MethodCallGetHomeData {
GetHomeDataResponse getHomeData(
Optional<Options> options) throws Exception;
GetHomeDataResponse getHomeDataDirect() throws Exception;
}
@@ -199,39 +171,34 @@ public class SDKMethodInterfaces {
Optional<? extends IncludeRelay> includeRelay,
Optional<? extends IncludeIPv6> includeIPv6,
Optional<String> clientID,
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
public interface MethodCallGetPin {
GetPinResponse getPin(
GetPinRequest request,
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
public interface MethodCallGetTokenByPinId {
GetTokenByPinIdResponse getTokenByPinId(
GetTokenByPinIdRequest request,
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
public interface MethodCallGetGlobalHubs {
GetGlobalHubsResponse getGlobalHubs(
Optional<Double> count,
Optional<? extends OnlyTransient> onlyTransient,
Optional<Options> options) throws Exception;
Optional<? extends OnlyTransient> onlyTransient) throws Exception;
}
public interface MethodCallGetRecentlyAdded {
GetRecentlyAddedResponse getRecentlyAdded(
GetRecentlyAddedRequest request,
Optional<Options> options) throws Exception;
GetRecentlyAddedRequest request) throws Exception;
}
@@ -239,8 +206,7 @@ public class SDKMethodInterfaces {
GetLibraryHubsResponse getLibraryHubs(
double sectionId,
Optional<Double> count,
Optional<? extends QueryParamOnlyTransient> onlyTransient,
Optional<Options> options) throws Exception;
Optional<? extends QueryParamOnlyTransient> onlyTransient) throws Exception;
}
@@ -248,8 +214,7 @@ public class SDKMethodInterfaces {
PerformSearchResponse performSearch(
String query,
Optional<Double> sectionId,
Optional<Double> limit,
Optional<Options> options) throws Exception;
Optional<Double> limit) throws Exception;
}
@@ -257,118 +222,102 @@ public class SDKMethodInterfaces {
PerformVoiceSearchResponse performVoiceSearch(
String query,
Optional<Double> sectionId,
Optional<Double> limit,
Optional<Options> options) throws Exception;
Optional<Double> limit) throws Exception;
}
public interface MethodCallGetSearchResults {
GetSearchResultsResponse getSearchResults(
String query,
Optional<Options> options) throws Exception;
String query) throws Exception;
}
public interface MethodCallGetFileHash {
GetFileHashResponse getFileHash(
String url,
Optional<Double> type,
Optional<Options> options) throws Exception;
Optional<Double> type) throws Exception;
}
public interface MethodCallGetRecentlyAddedLibrary {
GetRecentlyAddedLibraryResponse getRecentlyAddedLibrary(
GetRecentlyAddedLibraryRequest request,
Optional<Options> options) throws Exception;
GetRecentlyAddedLibraryRequest request) throws Exception;
}
public interface MethodCallGetAllLibraries {
GetAllLibrariesResponse getAllLibraries(
Optional<Options> options) throws Exception;
GetAllLibrariesResponse getAllLibrariesDirect() throws Exception;
}
public interface MethodCallGetLibraryDetails {
GetLibraryDetailsResponse getLibraryDetails(
Optional<? extends IncludeDetails> includeDetails,
int sectionKey,
Optional<Options> options) throws Exception;
int sectionKey) throws Exception;
}
public interface MethodCallDeleteLibrary {
DeleteLibraryResponse deleteLibrary(
int sectionKey,
Optional<Options> options) throws Exception;
int sectionKey) throws Exception;
}
public interface MethodCallGetLibraryItems {
GetLibraryItemsResponse getLibraryItems(
GetLibraryItemsRequest request,
Optional<Options> options) throws Exception;
GetLibraryItemsRequest request) throws Exception;
}
public interface MethodCallGetRefreshLibraryMetadata {
GetRefreshLibraryMetadataResponse getRefreshLibraryMetadata(
Optional<? extends Force> force,
int sectionKey,
Optional<Options> options) throws Exception;
int sectionKey) throws Exception;
}
public interface MethodCallGetSearchLibrary {
GetSearchLibraryResponse getSearchLibrary(
int sectionKey,
GetSearchLibraryQueryParamType type,
Optional<Options> options) throws Exception;
GetSearchLibraryQueryParamType type) throws Exception;
}
public interface MethodCallGetSearchAllLibraries {
GetSearchAllLibrariesResponse getSearchAllLibraries(
GetSearchAllLibrariesRequest request,
Optional<Options> options) throws Exception;
GetSearchAllLibrariesRequest request) throws Exception;
}
public interface MethodCallGetMetaDataByRatingKey {
GetMetaDataByRatingKeyResponse getMetaDataByRatingKey(
long ratingKey,
Optional<Options> options) throws Exception;
long ratingKey) throws Exception;
}
public interface MethodCallGetMetadataChildren {
GetMetadataChildrenResponse getMetadataChildren(
double ratingKey,
Optional<String> includeElements,
Optional<Options> options) throws Exception;
Optional<String> includeElements) throws Exception;
}
public interface MethodCallGetTopWatchedContent {
GetTopWatchedContentResponse getTopWatchedContent(
Optional<Long> includeGuids,
GetTopWatchedContentQueryParamType type,
Optional<Options> options) throws Exception;
GetTopWatchedContentQueryParamType type) throws Exception;
}
public interface MethodCallGetOnDeck {
GetOnDeckResponse getOnDeck(
Optional<Options> options) throws Exception;
GetOnDeckResponse getOnDeckDirect() throws Exception;
}
public interface MethodCallGetWatchList {
GetWatchListResponse getWatchList(
GetWatchListRequest request,
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
@@ -376,50 +325,43 @@ public class SDKMethodInterfaces {
LogLineResponse logLine(
Level level,
String message,
String source,
Optional<Options> options) throws Exception;
String source) throws Exception;
}
public interface MethodCallLogMultiLine {
LogMultiLineResponse logMultiLine(
String request,
Optional<Options> options) throws Exception;
String request) throws Exception;
}
public interface MethodCallEnablePaperTrail {
EnablePaperTrailResponse enablePaperTrail(
Optional<Options> options) throws Exception;
EnablePaperTrailResponse enablePaperTrailDirect() throws Exception;
}
public interface MethodCallCreatePlaylist {
CreatePlaylistResponse createPlaylist(
CreatePlaylistRequest request,
Optional<Options> options) throws Exception;
CreatePlaylistRequest request) throws Exception;
}
public interface MethodCallGetPlaylists {
GetPlaylistsResponse getPlaylists(
Optional<? extends PlaylistType> playlistType,
Optional<? extends QueryParamSmart> smart,
Optional<Options> options) throws Exception;
Optional<? extends QueryParamSmart> smart) throws Exception;
}
public interface MethodCallGetPlaylist {
GetPlaylistResponse getPlaylist(
double playlistID,
Optional<Options> options) throws Exception;
double playlistID) throws Exception;
}
public interface MethodCallDeletePlaylist {
DeletePlaylistResponse deletePlaylist(
double playlistID,
Optional<Options> options) throws Exception;
double playlistID) throws Exception;
}
@@ -427,23 +369,20 @@ public class SDKMethodInterfaces {
UpdatePlaylistResponse updatePlaylist(
double playlistID,
Optional<String> title,
Optional<String> summary,
Optional<Options> options) throws Exception;
Optional<String> summary) throws Exception;
}
public interface MethodCallGetPlaylistContents {
GetPlaylistContentsResponse getPlaylistContents(
double playlistID,
GetPlaylistContentsQueryParamType type,
Optional<Options> options) throws Exception;
GetPlaylistContentsQueryParamType type) throws Exception;
}
public interface MethodCallClearPlaylistContents {
ClearPlaylistContentsResponse clearPlaylistContents(
double playlistID,
Optional<Options> options) throws Exception;
double playlistID) throws Exception;
}
@@ -451,8 +390,7 @@ public class SDKMethodInterfaces {
AddPlaylistContentsResponse addPlaylistContents(
double playlistID,
String uri,
Optional<Double> playQueueID,
Optional<Options> options) throws Exception;
Optional<Double> playQueueID) throws Exception;
}
@@ -460,65 +398,56 @@ public class SDKMethodInterfaces {
UploadPlaylistResponse uploadPlaylist(
String path,
QueryParamForce force,
long sectionID,
Optional<Options> options) throws Exception;
long sectionID) throws Exception;
}
public interface MethodCallGetTransientToken {
GetTransientTokenResponse getTransientToken(
GetTransientTokenQueryParamType type,
Scope scope,
Optional<Options> options) throws Exception;
Scope scope) throws Exception;
}
public interface MethodCallGetSourceConnectionInformation {
GetSourceConnectionInformationResponse getSourceConnectionInformation(
String source,
Optional<Options> options) throws Exception;
String source) throws Exception;
}
public interface MethodCallGetTokenDetails {
GetTokenDetailsResponse getTokenDetails(
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
public interface MethodCallPostUsersSignInData {
PostUsersSignInDataResponse postUsersSignInData(
PostUsersSignInDataRequest request,
Optional<String> serverURL,
Optional<Options> options) throws Exception;
Optional<String> serverURL) throws Exception;
}
public interface MethodCallGetStatistics {
GetStatisticsResponse getStatistics(
Optional<Long> timespan,
Optional<Options> options) throws Exception;
Optional<Long> timespan) throws Exception;
}
public interface MethodCallGetResourcesStatistics {
GetResourcesStatisticsResponse getResourcesStatistics(
Optional<Long> timespan,
Optional<Options> options) throws Exception;
Optional<Long> timespan) throws Exception;
}
public interface MethodCallGetBandwidthStatistics {
GetBandwidthStatisticsResponse getBandwidthStatistics(
Optional<Long> timespan,
Optional<Options> options) throws Exception;
Optional<Long> timespan) throws Exception;
}
public interface MethodCallGetSessions {
GetSessionsResponse getSessions(
Optional<Options> options) throws Exception;
GetSessionsResponse getSessionsDirect() throws Exception;
}
@@ -527,42 +456,36 @@ public class SDKMethodInterfaces {
Optional<String> sort,
Optional<Long> accountId,
Optional<? extends QueryParamFilter> filter,
Optional<Long> librarySectionID,
Optional<Options> options) throws Exception;
Optional<Long> librarySectionID) throws Exception;
}
public interface MethodCallGetTranscodeSessions {
GetTranscodeSessionsResponse getTranscodeSessions(
Optional<Options> options) throws Exception;
GetTranscodeSessionsResponse getTranscodeSessionsDirect() throws Exception;
}
public interface MethodCallStopTranscodeSession {
StopTranscodeSessionResponse stopTranscodeSession(
String sessionKey,
Optional<Options> options) throws Exception;
String sessionKey) throws Exception;
}
public interface MethodCallGetUpdateStatus {
GetUpdateStatusResponse getUpdateStatus(
Optional<Options> options) throws Exception;
GetUpdateStatusResponse getUpdateStatusDirect() throws Exception;
}
public interface MethodCallCheckForUpdates {
CheckForUpdatesResponse checkForUpdates(
Optional<? extends Download> download,
Optional<Options> options) throws Exception;
Optional<? extends Download> download) throws Exception;
}
public interface MethodCallApplyUpdates {
ApplyUpdatesResponse applyUpdates(
Optional<? extends Tonight> tonight,
Optional<? extends Skip> skip,
Optional<Options> options) throws Exception;
Optional<? extends Skip> skip) throws Exception;
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class StartAllTasksRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallStartAllTasks sdk;
public StartAllTasksRequestBuilder(SDKMethodInterfaces.MethodCallStartAllTasks sdk) {
this.sdk = sdk;
}
public StartAllTasksRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public StartAllTasksRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public StartAllTasksResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.startAllTasks(
options);
return sdk.startAllTasksDirect();
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class StartTaskRequestBuilder {
private TaskName taskName;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallStartTask sdk;
public StartTaskRequestBuilder(SDKMethodInterfaces.MethodCallStartTask sdk) {
@@ -24,25 +20,10 @@ public class StartTaskRequestBuilder {
this.taskName = taskName;
return this;
}
public StartTaskRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public StartTaskRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public StartTaskResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.startTask(
taskName,
options);
taskName);
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class StartUniversalTranscodeRequestBuilder {
private StartUniversalTranscodeRequest request;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallStartUniversalTranscode sdk;
public StartUniversalTranscodeRequestBuilder(SDKMethodInterfaces.MethodCallStartUniversalTranscode sdk) {
@@ -24,25 +20,10 @@ public class StartUniversalTranscodeRequestBuilder {
this.request = request;
return this;
}
public StartUniversalTranscodeRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public StartUniversalTranscodeRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public StartUniversalTranscodeResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.startUniversalTranscode(
request,
options);
request);
}
}

View File

@@ -4,37 +4,17 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class StopAllTasksRequestBuilder {
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallStopAllTasks sdk;
public StopAllTasksRequestBuilder(SDKMethodInterfaces.MethodCallStopAllTasks sdk) {
this.sdk = sdk;
}
public StopAllTasksRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public StopAllTasksRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public StopAllTasksResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.stopAllTasks(
options);
return sdk.stopAllTasksDirect();
}
}

View File

@@ -4,15 +4,11 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.util.Optional;
public class StopTaskRequestBuilder {
private PathParamTaskName taskName;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallStopTask sdk;
public StopTaskRequestBuilder(SDKMethodInterfaces.MethodCallStopTask sdk) {
@@ -24,25 +20,10 @@ public class StopTaskRequestBuilder {
this.taskName = taskName;
return this;
}
public StopTaskRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public StopTaskRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public StopTaskResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.stopTask(
taskName,
options);
taskName);
}
}

View File

@@ -4,16 +4,12 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Optional;
public class StopTranscodeSessionRequestBuilder {
private String sessionKey;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallStopTranscodeSession sdk;
public StopTranscodeSessionRequestBuilder(SDKMethodInterfaces.MethodCallStopTranscodeSession sdk) {
@@ -25,25 +21,10 @@ public class StopTranscodeSessionRequestBuilder {
this.sessionKey = sessionKey;
return this;
}
public StopTranscodeSessionRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public StopTranscodeSessionRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public StopTranscodeSessionResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.stopTranscodeSession(
sessionKey,
options);
sessionKey);
}
}

View File

@@ -4,19 +4,15 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.lang.String;
import java.util.Optional;
public class UpdatePlayProgressRequestBuilder {
private String key;
private Double time;
private String state;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallUpdatePlayProgress sdk;
public UpdatePlayProgressRequestBuilder(SDKMethodInterfaces.MethodCallUpdatePlayProgress sdk) {
@@ -40,27 +36,12 @@ public class UpdatePlayProgressRequestBuilder {
this.state = state;
return this;
}
public UpdatePlayProgressRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public UpdatePlayProgressRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public UpdatePlayProgressResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.updatePlayProgress(
key,
time,
state,
options);
state);
}
}

View File

@@ -4,8 +4,6 @@
package dev.plexapi.sdk.models.operations;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Double;
import java.lang.String;
@@ -16,7 +14,6 @@ public class UpdatePlaylistRequestBuilder {
private Double playlistID;
private Optional<String> title = Optional.empty();
private Optional<String> summary = Optional.empty();
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallUpdatePlaylist sdk;
public UpdatePlaylistRequestBuilder(SDKMethodInterfaces.MethodCallUpdatePlaylist sdk) {
@@ -52,27 +49,12 @@ public class UpdatePlaylistRequestBuilder {
this.summary = summary;
return this;
}
public UpdatePlaylistRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public UpdatePlaylistRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public UpdatePlaylistResponse call() throws Exception {
Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
return sdk.updatePlaylist(
playlistID,
title,
summary,
options);
summary);
}
}

View File

@@ -6,19 +6,15 @@ package dev.plexapi.sdk.models.operations;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.utils.LazySingletonValue;
import dev.plexapi.sdk.utils.Options;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.Utils;
import java.lang.Long;
import java.lang.String;
import java.util.Optional;
public class UploadPlaylistRequestBuilder {
private String path;
private QueryParamForce force;
private Long sectionID;
private Optional<RetryConfig> retryConfig = Optional.empty();
private final SDKMethodInterfaces.MethodCallUploadPlaylist sdk;
public UploadPlaylistRequestBuilder(SDKMethodInterfaces.MethodCallUploadPlaylist sdk) {
@@ -42,30 +38,15 @@ public class UploadPlaylistRequestBuilder {
this.sectionID = sectionID;
return this;
}
public UploadPlaylistRequestBuilder retryConfig(RetryConfig retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = Optional.of(retryConfig);
return this;
}
public UploadPlaylistRequestBuilder retryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
return this;
}
public UploadPlaylistResponse call() throws Exception {
if (sectionID == null) {
sectionID = _SINGLETON_VALUE_SectionID.value();
} Optional<Options> options = Optional.of(Options.builder()
.retryConfig(retryConfig)
.build());
}
return sdk.uploadPlaylist(
path,
force,
sectionID,
options);
sectionID);
}
private static final LazySingletonValue<Long> _SINGLETON_VALUE_SectionID =