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

@@ -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")