mirror of
https://github.com/LukeHagar/plexjava.git
synced 2025-12-06 20:47:45 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.406.0
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user