mirror of
https://github.com/LukeHagar/plexjava.git
synced 2025-12-06 12:37:47 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.406.0
This commit is contained in:
@@ -17,19 +17,27 @@ 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.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* 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.
|
||||
@@ -68,6 +76,22 @@ 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(
|
||||
@@ -83,45 +107,62 @@ public class Activities implements
|
||||
this.sdkConfiguration.securitySource.getSecurity());
|
||||
|
||||
HTTPClient _client = this.sdkConfiguration.defaultClient;
|
||||
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));
|
||||
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();
|
||||
}
|
||||
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")
|
||||
@@ -217,6 +258,24 @@ 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()
|
||||
@@ -240,45 +299,62 @@ public class Activities implements
|
||||
this.sdkConfiguration.securitySource.getSecurity());
|
||||
|
||||
HTTPClient _client = this.sdkConfiguration.defaultClient;
|
||||
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));
|
||||
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();
|
||||
}
|
||||
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")
|
||||
|
||||
Reference in New Issue
Block a user