ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.615.2

This commit is contained in:
speakeasybot
2025-09-16 00:29:53 +00:00
parent aa85c1813b
commit 820f55d192
1706 changed files with 122642 additions and 37790 deletions

View File

@@ -3,32 +3,18 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.CancelServerActivitiesBadRequest;
import dev.plexapi.sdk.models.errors.CancelServerActivitiesUnauthorized;
import dev.plexapi.sdk.models.errors.GetServerActivitiesBadRequest;
import dev.plexapi.sdk.models.errors.GetServerActivitiesUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.CancelServerActivitiesRequest;
import dev.plexapi.sdk.models.operations.CancelServerActivitiesRequestBuilder;
import dev.plexapi.sdk.models.operations.CancelServerActivitiesResponse;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.CancelServerActivities;
import dev.plexapi.sdk.operations.GetServerActivities;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
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.
@@ -39,16 +25,23 @@ import java.util.Optional;
* - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)
* - The may contain a `Response` object which attributes which represent the result of the asynchronous operation.
*/
public class Activities implements
MethodCallGetServerActivities,
MethodCallCancelServerActivities {
public class Activities {
private final SDKConfiguration sdkConfiguration;
private final AsyncActivities asyncSDK;
Activities(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncActivities(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncActivities async() {
return asyncSDK;
}
/**
* Get Server Activities
@@ -58,7 +51,7 @@ public class Activities implements
* @return The call builder
*/
public GetServerActivitiesRequestBuilder getServerActivities() {
return new GetServerActivitiesRequestBuilder(this);
return new GetServerActivitiesRequestBuilder(sdkConfiguration);
}
/**
@@ -70,153 +63,11 @@ public class Activities implements
* @throws Exception if the API call fails
*/
public GetServerActivitiesResponse getServerActivitiesDirect() throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/activities");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getServerActivities",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getServerActivities",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getServerActivities",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getServerActivities",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetServerActivitiesResponse.Builder _resBuilder =
GetServerActivitiesResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetServerActivitiesResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetServerActivitiesResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetServerActivitiesResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetServerActivitiesBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetServerActivitiesBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetServerActivitiesUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetServerActivitiesUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestlessOperation<GetServerActivitiesResponse> operation
= new GetServerActivities.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest());
}
/**
* Cancel Server Activities
*
@@ -225,7 +76,7 @@ public class Activities implements
* @return The call builder
*/
public CancelServerActivitiesRequestBuilder cancelServerActivities() {
return new CancelServerActivitiesRequestBuilder(this);
return new CancelServerActivitiesRequestBuilder(sdkConfiguration);
}
/**
@@ -237,148 +88,15 @@ public class Activities implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public CancelServerActivitiesResponse cancelServerActivities(
String activityUUID) throws Exception {
public CancelServerActivitiesResponse cancelServerActivities(String activityUUID) throws Exception {
CancelServerActivitiesRequest request =
CancelServerActivitiesRequest
.builder()
.activityUUID(activityUUID)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
CancelServerActivitiesRequest.class,
_baseUrl,
"/activities/{activityUUID}",
request, null);
HTTPRequest _req = new HTTPRequest(_url, "DELETE");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"cancelServerActivities",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"cancelServerActivities",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"cancelServerActivities",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"cancelServerActivities",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
CancelServerActivitiesResponse.Builder _resBuilder =
CancelServerActivitiesResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
CancelServerActivitiesResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
CancelServerActivitiesBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<CancelServerActivitiesBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
CancelServerActivitiesUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<CancelServerActivitiesUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<CancelServerActivitiesRequest, CancelServerActivitiesResponse> operation
= new CancelServerActivities.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -0,0 +1,104 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.CancelServerActivitiesRequest;
import dev.plexapi.sdk.models.operations.async.CancelServerActivitiesRequestBuilder;
import dev.plexapi.sdk.models.operations.async.CancelServerActivitiesResponse;
import dev.plexapi.sdk.models.operations.async.GetServerActivitiesRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetServerActivitiesResponse;
import dev.plexapi.sdk.operations.CancelServerActivities;
import dev.plexapi.sdk.operations.GetServerActivities;
import java.lang.String;
import java.util.concurrent.CompletableFuture;
/**
* 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.
* Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.
* Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details:
* - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity.
* - They must contain an `type` which is used by clients to distinguish the specific activity.
* - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)
* - The may contain a `Response` object which attributes which represent the result of the asynchronous operation.
*/
public class AsyncActivities {
private final SDKConfiguration sdkConfiguration;
private final Activities syncSDK;
AsyncActivities(Activities syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Activities sync() {
return syncSDK;
}
/**
* Get Server Activities
*
* <p>Get Server Activities
*
* @return The async call builder
*/
public GetServerActivitiesRequestBuilder getServerActivities() {
return new GetServerActivitiesRequestBuilder(sdkConfiguration);
}
/**
* Get Server Activities
*
* <p>Get Server Activities
*
* @return CompletableFuture&lt;GetServerActivitiesResponse&gt; - The async response
*/
public CompletableFuture<GetServerActivitiesResponse> getServerActivitiesDirect() {
AsyncRequestlessOperation<GetServerActivitiesResponse> operation
= new GetServerActivities.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Cancel Server Activities
*
* <p>Cancel Server Activities
*
* @return The async call builder
*/
public CancelServerActivitiesRequestBuilder cancelServerActivities() {
return new CancelServerActivitiesRequestBuilder(sdkConfiguration);
}
/**
* Cancel Server Activities
*
* <p>Cancel Server Activities
*
* @param activityUUID The UUID of the activity to cancel.
* @return CompletableFuture&lt;CancelServerActivitiesResponse&gt; - The async response
*/
public CompletableFuture<CancelServerActivitiesResponse> cancelServerActivities(String activityUUID) {
CancelServerActivitiesRequest request =
CancelServerActivitiesRequest
.builder()
.activityUUID(activityUUID)
.build();
AsyncRequestOperation<CancelServerActivitiesRequest, CancelServerActivitiesResponse> operation
= new CancelServerActivities.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,197 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation;
import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationRequest;
import dev.plexapi.sdk.models.operations.GetTransientTokenQueryParamType;
import dev.plexapi.sdk.models.operations.GetTransientTokenRequest;
import dev.plexapi.sdk.models.operations.PostUsersSignInDataRequest;
import dev.plexapi.sdk.models.operations.Scope;
import dev.plexapi.sdk.models.operations.async.GetSourceConnectionInformationRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetSourceConnectionInformationResponse;
import dev.plexapi.sdk.models.operations.async.GetTokenDetailsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetTokenDetailsResponse;
import dev.plexapi.sdk.models.operations.async.GetTransientTokenRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetTransientTokenResponse;
import dev.plexapi.sdk.models.operations.async.PostUsersSignInDataRequestBuilder;
import dev.plexapi.sdk.models.operations.async.PostUsersSignInDataResponse;
import dev.plexapi.sdk.operations.GetSourceConnectionInformation;
import dev.plexapi.sdk.operations.GetTokenDetails;
import dev.plexapi.sdk.operations.GetTransientToken;
import dev.plexapi.sdk.operations.PostUsersSignInData;
import java.lang.String;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* API Calls regarding authentication for Plex Media Server
*/
public class AsyncAuthentication {
private final SDKConfiguration sdkConfiguration;
private final Authentication syncSDK;
AsyncAuthentication(Authentication syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Authentication sync() {
return syncSDK;
}
/**
* Get a Transient Token
*
* <p>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.
*
* @return The async call builder
*/
public GetTransientTokenRequestBuilder getTransientToken() {
return new GetTransientTokenRequestBuilder(sdkConfiguration);
}
/**
* Get a Transient Token
*
* <p>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.
* @return CompletableFuture&lt;GetTransientTokenResponse&gt; - The async response
*/
public CompletableFuture<GetTransientTokenResponse> getTransientToken(GetTransientTokenQueryParamType type, Scope scope) {
GetTransientTokenRequest request =
GetTransientTokenRequest
.builder()
.type(type)
.scope(scope)
.build();
AsyncRequestOperation<GetTransientTokenRequest, GetTransientTokenResponse> operation
= new GetTransientToken.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Source Connection Information
*
* <p>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.
*
* @return The async call builder
*/
public GetSourceConnectionInformationRequestBuilder getSourceConnectionInformation() {
return new GetSourceConnectionInformationRequestBuilder(sdkConfiguration);
}
/**
* Get Source Connection Information
*
* <p>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.
* @return CompletableFuture&lt;GetSourceConnectionInformationResponse&gt; - The async response
*/
public CompletableFuture<GetSourceConnectionInformationResponse> getSourceConnectionInformation(String source) {
GetSourceConnectionInformationRequest request =
GetSourceConnectionInformationRequest
.builder()
.source(source)
.build();
AsyncRequestOperation<GetSourceConnectionInformationRequest, GetSourceConnectionInformationResponse> operation
= new GetSourceConnectionInformation.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Token Details
*
* <p>Get the User data from the provided X-Plex-Token
*
* @return The async call builder
*/
public GetTokenDetailsRequestBuilder getTokenDetails() {
return new GetTokenDetailsRequestBuilder(sdkConfiguration);
}
/**
* Get Token Details
*
* <p>Get the User data from the provided X-Plex-Token
*
* @return CompletableFuture&lt;GetTokenDetailsResponse&gt; - The async response
*/
public CompletableFuture<GetTokenDetailsResponse> getTokenDetailsDirect() {
return getTokenDetails(Optional.empty());
}
/**
* Get Token Details
*
* <p>Get the User data from the provided X-Plex-Token
*
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;GetTokenDetailsResponse&gt; - The async response
*/
public CompletableFuture<GetTokenDetailsResponse> getTokenDetails(Optional<String> serverURL) {
AsyncRequestlessOperation<GetTokenDetailsResponse> operation
= new GetTokenDetails.Async(sdkConfiguration, serverURL);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get User Sign In Data
*
* <p>Sign in user with username and password and return user data with Plex authentication token
*
* @return The async call builder
*/
public PostUsersSignInDataRequestBuilder postUsersSignInData() {
return new PostUsersSignInDataRequestBuilder(sdkConfiguration);
}
/**
* Get User Sign In Data
*
* <p>Sign in user with username and password and return user data with Plex authentication token
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;PostUsersSignInDataResponse&gt; - The async response
*/
public CompletableFuture<PostUsersSignInDataResponse> postUsersSignInData(PostUsersSignInDataRequest request) {
return postUsersSignInData(request, Optional.empty());
}
/**
* Get User Sign In Data
*
* <p>Sign in user with username and password and return user data with Plex authentication token
*
* @param request The request object containing all the parameters for the API call.
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;PostUsersSignInDataResponse&gt; - The async response
*/
public CompletableFuture<PostUsersSignInDataResponse> postUsersSignInData(PostUsersSignInDataRequest request, Optional<String> serverURL) {
AsyncRequestOperation<PostUsersSignInDataRequest, PostUsersSignInDataResponse> operation
= new PostUsersSignInData.Async(sdkConfiguration, serverURL);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,209 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.PathParamTaskName;
import dev.plexapi.sdk.models.operations.StartTaskRequest;
import dev.plexapi.sdk.models.operations.StopTaskRequest;
import dev.plexapi.sdk.models.operations.TaskName;
import dev.plexapi.sdk.models.operations.async.GetButlerTasksRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetButlerTasksResponse;
import dev.plexapi.sdk.models.operations.async.StartAllTasksRequestBuilder;
import dev.plexapi.sdk.models.operations.async.StartAllTasksResponse;
import dev.plexapi.sdk.models.operations.async.StartTaskRequestBuilder;
import dev.plexapi.sdk.models.operations.async.StartTaskResponse;
import dev.plexapi.sdk.models.operations.async.StopAllTasksRequestBuilder;
import dev.plexapi.sdk.models.operations.async.StopAllTasksResponse;
import dev.plexapi.sdk.models.operations.async.StopTaskRequestBuilder;
import dev.plexapi.sdk.models.operations.async.StopTaskResponse;
import dev.plexapi.sdk.operations.GetButlerTasks;
import dev.plexapi.sdk.operations.StartAllTasks;
import dev.plexapi.sdk.operations.StartTask;
import dev.plexapi.sdk.operations.StopAllTasks;
import dev.plexapi.sdk.operations.StopTask;
import java.util.concurrent.CompletableFuture;
/**
* Butler is the task manager of the Plex Media Server Ecosystem.
*/
public class AsyncButler {
private final SDKConfiguration sdkConfiguration;
private final Butler syncSDK;
AsyncButler(Butler syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Butler sync() {
return syncSDK;
}
/**
* Get Butler tasks
*
* <p>Returns a list of butler tasks
*
* @return The async call builder
*/
public GetButlerTasksRequestBuilder getButlerTasks() {
return new GetButlerTasksRequestBuilder(sdkConfiguration);
}
/**
* Get Butler tasks
*
* <p>Returns a list of butler tasks
*
* @return CompletableFuture&lt;GetButlerTasksResponse&gt; - The async response
*/
public CompletableFuture<GetButlerTasksResponse> getButlerTasksDirect() {
AsyncRequestlessOperation<GetButlerTasksResponse> operation
= new GetButlerTasks.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Start all Butler tasks
*
* <p>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.
*
* @return The async call builder
*/
public StartAllTasksRequestBuilder startAllTasks() {
return new StartAllTasksRequestBuilder(sdkConfiguration);
}
/**
* Start all Butler tasks
*
* <p>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.
*
* @return CompletableFuture&lt;StartAllTasksResponse&gt; - The async response
*/
public CompletableFuture<StartAllTasksResponse> startAllTasksDirect() {
AsyncRequestlessOperation<StartAllTasksResponse> operation
= new StartAllTasks.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Stop all Butler tasks
*
* <p>This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
*
* @return The async call builder
*/
public StopAllTasksRequestBuilder stopAllTasks() {
return new StopAllTasksRequestBuilder(sdkConfiguration);
}
/**
* Stop all Butler tasks
*
* <p>This endpoint will stop all currently running tasks and remove any scheduled tasks from the queue.
*
* @return CompletableFuture&lt;StopAllTasksResponse&gt; - The async response
*/
public CompletableFuture<StopAllTasksResponse> stopAllTasksDirect() {
AsyncRequestlessOperation<StopAllTasksResponse> operation
= new StopAllTasks.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Start a single Butler task
*
* <p>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.
*
* @return The async call builder
*/
public StartTaskRequestBuilder startTask() {
return new StartTaskRequestBuilder(sdkConfiguration);
}
/**
* Start a single Butler task
*
* <p>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.
* @return CompletableFuture&lt;StartTaskResponse&gt; - The async response
*/
public CompletableFuture<StartTaskResponse> startTask(TaskName taskName) {
StartTaskRequest request =
StartTaskRequest
.builder()
.taskName(taskName)
.build();
AsyncRequestOperation<StartTaskRequest, StartTaskResponse> operation
= new StartTask.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Stop a single Butler task
*
* <p>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.
*
* @return The async call builder
*/
public StopTaskRequestBuilder stopTask() {
return new StopTaskRequestBuilder(sdkConfiguration);
}
/**
* Stop a single Butler task
*
* <p>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.
* @return CompletableFuture&lt;StopTaskResponse&gt; - The async response
*/
public CompletableFuture<StopTaskResponse> stopTask(PathParamTaskName taskName) {
StopTaskRequest request =
StopTaskRequest
.builder()
.taskName(taskName)
.build();
AsyncRequestOperation<StopTaskRequest, StopTaskResponse> operation
= new StopTask.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,169 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetGlobalHubsRequest;
import dev.plexapi.sdk.models.operations.GetLibraryHubsRequest;
import dev.plexapi.sdk.models.operations.GetRecentlyAddedRequest;
import dev.plexapi.sdk.models.operations.OnlyTransient;
import dev.plexapi.sdk.models.operations.QueryParamOnlyTransient;
import dev.plexapi.sdk.models.operations.async.GetGlobalHubsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetGlobalHubsResponse;
import dev.plexapi.sdk.models.operations.async.GetLibraryHubsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetLibraryHubsResponse;
import dev.plexapi.sdk.models.operations.async.GetRecentlyAddedRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetRecentlyAddedResponse;
import dev.plexapi.sdk.operations.GetGlobalHubs;
import dev.plexapi.sdk.operations.GetLibraryHubs;
import dev.plexapi.sdk.operations.GetRecentlyAdded;
import java.lang.Double;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
*/
public class AsyncHubs {
private final SDKConfiguration sdkConfiguration;
private final Hubs syncSDK;
AsyncHubs(Hubs syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Hubs sync() {
return syncSDK;
}
/**
* Get Global Hubs
*
* <p>Get Global Hubs filtered by the parameters provided.
*
* @return The async call builder
*/
public GetGlobalHubsRequestBuilder getGlobalHubs() {
return new GetGlobalHubsRequestBuilder(sdkConfiguration);
}
/**
* Get Global Hubs
*
* <p>Get Global Hubs filtered by the parameters provided.
*
* @return CompletableFuture&lt;GetGlobalHubsResponse&gt; - The async response
*/
public CompletableFuture<GetGlobalHubsResponse> getGlobalHubsDirect() {
return getGlobalHubs(Optional.empty(), Optional.empty());
}
/**
* Get Global Hubs
*
* <p>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).
* @return CompletableFuture&lt;GetGlobalHubsResponse&gt; - The async response
*/
public CompletableFuture<GetGlobalHubsResponse> getGlobalHubs(Optional<Double> count, Optional<? extends OnlyTransient> onlyTransient) {
GetGlobalHubsRequest request =
GetGlobalHubsRequest
.builder()
.count(count)
.onlyTransient(onlyTransient)
.build();
AsyncRequestOperation<GetGlobalHubsRequest, GetGlobalHubsResponse> operation
= new GetGlobalHubs.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Recently Added
*
* <p>This endpoint will return the recently added content.
*
* @return The async call builder
*/
public GetRecentlyAddedRequestBuilder getRecentlyAdded() {
return new GetRecentlyAddedRequestBuilder(sdkConfiguration);
}
/**
* Get Recently Added
*
* <p>This endpoint will return the recently added content.
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetRecentlyAddedResponse&gt; - The async response
*/
public CompletableFuture<GetRecentlyAddedResponse> getRecentlyAdded(GetRecentlyAddedRequest request) {
AsyncRequestOperation<GetRecentlyAddedRequest, GetRecentlyAddedResponse> operation
= new GetRecentlyAdded.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get library specific hubs
*
* <p>This endpoint will return a list of library specific hubs
*
* @return The async call builder
*/
public GetLibraryHubsRequestBuilder getLibraryHubs() {
return new GetLibraryHubsRequestBuilder(sdkConfiguration);
}
/**
* Get library specific hubs
*
* <p>This endpoint will return a list of library specific hubs
*
* @param sectionId the Id of the library to query
* @return CompletableFuture&lt;GetLibraryHubsResponse&gt; - The async response
*/
public CompletableFuture<GetLibraryHubsResponse> getLibraryHubs(double sectionId) {
return getLibraryHubs(sectionId, Optional.empty(), Optional.empty());
}
/**
* Get library specific hubs
*
* <p>This endpoint will return a list of library specific hubs
*
* @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).
* @return CompletableFuture&lt;GetLibraryHubsResponse&gt; - The async response
*/
public CompletableFuture<GetLibraryHubsResponse> getLibraryHubs(
double sectionId, Optional<Double> count,
Optional<? extends QueryParamOnlyTransient> onlyTransient) {
GetLibraryHubsRequest request =
GetLibraryHubsRequest
.builder()
.sectionId(sectionId)
.count(count)
.onlyTransient(onlyTransient)
.build();
AsyncRequestOperation<GetLibraryHubsRequest, GetLibraryHubsResponse> operation
= new GetLibraryHubs.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,181 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation;
import dev.plexapi.sdk.models.operations.Level;
import dev.plexapi.sdk.models.operations.LogLineRequest;
import dev.plexapi.sdk.models.operations.async.EnablePaperTrailRequestBuilder;
import dev.plexapi.sdk.models.operations.async.EnablePaperTrailResponse;
import dev.plexapi.sdk.models.operations.async.LogLineRequestBuilder;
import dev.plexapi.sdk.models.operations.async.LogLineResponse;
import dev.plexapi.sdk.models.operations.async.LogMultiLineRequestBuilder;
import dev.plexapi.sdk.models.operations.async.LogMultiLineResponse;
import dev.plexapi.sdk.operations.EnablePaperTrail;
import dev.plexapi.sdk.operations.LogLine;
import dev.plexapi.sdk.operations.LogMultiLine;
import java.lang.String;
import java.util.concurrent.CompletableFuture;
/**
* Submit logs to the Log Handler for Plex Media Server
*/
public class AsyncLog {
private final SDKConfiguration sdkConfiguration;
private final Log syncSDK;
AsyncLog(Log syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Log sync() {
return syncSDK;
}
/**
* Logging a single line message.
*
* <p>This endpoint will write a single-line log message, including a level and source to the main Plex Media Server log.
*
* @return The async call builder
*/
public LogLineRequestBuilder logLine() {
return new LogLineRequestBuilder(sdkConfiguration);
}
/**
* Logging a single line message.
*
* <p>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.
* @return CompletableFuture&lt;LogLineResponse&gt; - The async response
*/
public CompletableFuture<LogLineResponse> logLine(
Level level, String message,
String source) {
LogLineRequest request =
LogLineRequest
.builder()
.level(level)
.message(message)
.source(source)
.build();
AsyncRequestOperation<LogLineRequest, LogLineResponse> operation
= new LogLine.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Logging a multi-line message
*
* <p>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'.
*
* <p>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.
*
* <p>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.
*
* <p>The 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module).
*
* <p>Example of a single log entry format:
* `level=4&amp;message=Sample%20log%20entry&amp;source=applicationName`
*
* <p>Ensure each parameter is properly URL-encoded to avoid interpretation issues.
*
* @return The async call builder
*/
public LogMultiLineRequestBuilder logMultiLine() {
return new LogMultiLineRequestBuilder(sdkConfiguration);
}
/**
* Logging a multi-line message
*
* <p>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'.
*
* <p>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.
*
* <p>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.
*
* <p>The 'message' parameter contains the log text, and 'source' identifies the log message's origin (e.g., an application name or module).
*
* <p>Example of a single log entry format:
* `level=4&amp;message=Sample%20log%20entry&amp;source=applicationName`
*
* <p>Ensure each parameter is properly URL-encoded to avoid interpretation issues.
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;LogMultiLineResponse&gt; - The async response
*/
public CompletableFuture<LogMultiLineResponse> logMultiLine(String request) {
AsyncRequestOperation<String, LogMultiLineResponse> operation
= new LogMultiLine.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Enabling Papertrail
*
* <p>This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
*
* @return The async call builder
*/
public EnablePaperTrailRequestBuilder enablePaperTrail() {
return new EnablePaperTrailRequestBuilder(sdkConfiguration);
}
/**
* Enabling Papertrail
*
* <p>This endpoint will enable all Plex Media Serverlogs to be sent to the Papertrail networked logging site for a period of time.
*
* @return CompletableFuture&lt;EnablePaperTrailResponse&gt; - The async response
*/
public CompletableFuture<EnablePaperTrailResponse> enablePaperTrailDirect() {
AsyncRequestlessOperation<EnablePaperTrailResponse> operation
= new EnablePaperTrail.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,208 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetBannerImageRequest;
import dev.plexapi.sdk.models.operations.GetThumbImageRequest;
import dev.plexapi.sdk.models.operations.MarkPlayedRequest;
import dev.plexapi.sdk.models.operations.MarkUnplayedRequest;
import dev.plexapi.sdk.models.operations.UpdatePlayProgressRequest;
import dev.plexapi.sdk.models.operations.async.GetBannerImageRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetBannerImageResponse;
import dev.plexapi.sdk.models.operations.async.GetThumbImageRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetThumbImageResponse;
import dev.plexapi.sdk.models.operations.async.MarkPlayedRequestBuilder;
import dev.plexapi.sdk.models.operations.async.MarkPlayedResponse;
import dev.plexapi.sdk.models.operations.async.MarkUnplayedRequestBuilder;
import dev.plexapi.sdk.models.operations.async.MarkUnplayedResponse;
import dev.plexapi.sdk.models.operations.async.UpdatePlayProgressRequestBuilder;
import dev.plexapi.sdk.models.operations.async.UpdatePlayProgressResponse;
import dev.plexapi.sdk.operations.GetBannerImage;
import dev.plexapi.sdk.operations.GetThumbImage;
import dev.plexapi.sdk.operations.MarkPlayed;
import dev.plexapi.sdk.operations.MarkUnplayed;
import dev.plexapi.sdk.operations.UpdatePlayProgress;
import java.lang.String;
import java.util.concurrent.CompletableFuture;
/**
* API Calls interacting with Plex Media Server Media
*/
public class AsyncMedia {
private final SDKConfiguration sdkConfiguration;
private final Media syncSDK;
AsyncMedia(Media syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Media sync() {
return syncSDK;
}
/**
* Mark Media Played
*
* <p>This will mark the provided media key as Played.
*
* @return The async call builder
*/
public MarkPlayedRequestBuilder markPlayed() {
return new MarkPlayedRequestBuilder(sdkConfiguration);
}
/**
* Mark Media Played
*
* <p>This will mark the provided media key as Played.
*
* @param key The media key to mark as played
* @return CompletableFuture&lt;MarkPlayedResponse&gt; - The async response
*/
public CompletableFuture<MarkPlayedResponse> markPlayed(double key) {
MarkPlayedRequest request =
MarkPlayedRequest
.builder()
.key(key)
.build();
AsyncRequestOperation<MarkPlayedRequest, MarkPlayedResponse> operation
= new MarkPlayed.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Mark Media Unplayed
*
* <p>This will mark the provided media key as Unplayed.
*
* @return The async call builder
*/
public MarkUnplayedRequestBuilder markUnplayed() {
return new MarkUnplayedRequestBuilder(sdkConfiguration);
}
/**
* Mark Media Unplayed
*
* <p>This will mark the provided media key as Unplayed.
*
* @param key The media key to mark as Unplayed
* @return CompletableFuture&lt;MarkUnplayedResponse&gt; - The async response
*/
public CompletableFuture<MarkUnplayedResponse> markUnplayed(double key) {
MarkUnplayedRequest request =
MarkUnplayedRequest
.builder()
.key(key)
.build();
AsyncRequestOperation<MarkUnplayedRequest, MarkUnplayedResponse> operation
= new MarkUnplayed.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Update Media Play Progress
*
* <p>This API command can be used to update the play progress of a media item.
*
* @return The async call builder
*/
public UpdatePlayProgressRequestBuilder updatePlayProgress() {
return new UpdatePlayProgressRequestBuilder(sdkConfiguration);
}
/**
* Update Media Play Progress
*
* <p>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.
* @return CompletableFuture&lt;UpdatePlayProgressResponse&gt; - The async response
*/
public CompletableFuture<UpdatePlayProgressResponse> updatePlayProgress(
String key, double time,
String state) {
UpdatePlayProgressRequest request =
UpdatePlayProgressRequest
.builder()
.key(key)
.time(time)
.state(state)
.build();
AsyncRequestOperation<UpdatePlayProgressRequest, UpdatePlayProgressResponse> operation
= new UpdatePlayProgress.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Banner Image
*
* <p>Gets the banner image of the media item
*
* @return The async call builder
*/
public GetBannerImageRequestBuilder getBannerImage() {
return new GetBannerImageRequestBuilder(sdkConfiguration);
}
/**
* Get Banner Image
*
* <p>Gets the banner image of the media item
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetBannerImageResponse&gt; - The async response
*/
public CompletableFuture<GetBannerImageResponse> getBannerImage(GetBannerImageRequest request) {
AsyncRequestOperation<GetBannerImageRequest, GetBannerImageResponse> operation
= new GetBannerImage.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Thumb Image
*
* <p>Gets the thumbnail image of the media item
*
* @return The async call builder
*/
public GetThumbImageRequestBuilder getThumbImage() {
return new GetThumbImageRequestBuilder(sdkConfiguration);
}
/**
* Get Thumb Image
*
* <p>Gets the thumbnail image of the media item
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetThumbImageResponse&gt; - The async response
*/
public CompletableFuture<GetThumbImageResponse> getThumbImage(GetThumbImageRequest request) {
AsyncRequestOperation<GetThumbImageRequest, GetThumbImageResponse> operation
= new GetThumbImage.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,449 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.AddPlaylistContentsRequest;
import dev.plexapi.sdk.models.operations.ClearPlaylistContentsRequest;
import dev.plexapi.sdk.models.operations.CreatePlaylistRequest;
import dev.plexapi.sdk.models.operations.DeletePlaylistRequest;
import dev.plexapi.sdk.models.operations.GetPlaylistContentsQueryParamType;
import dev.plexapi.sdk.models.operations.GetPlaylistContentsRequest;
import dev.plexapi.sdk.models.operations.GetPlaylistRequest;
import dev.plexapi.sdk.models.operations.GetPlaylistsRequest;
import dev.plexapi.sdk.models.operations.PlaylistType;
import dev.plexapi.sdk.models.operations.QueryParamForce;
import dev.plexapi.sdk.models.operations.QueryParamSmart;
import dev.plexapi.sdk.models.operations.UpdatePlaylistRequest;
import dev.plexapi.sdk.models.operations.UploadPlaylistRequest;
import dev.plexapi.sdk.models.operations.async.AddPlaylistContentsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.AddPlaylistContentsResponse;
import dev.plexapi.sdk.models.operations.async.ClearPlaylistContentsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.ClearPlaylistContentsResponse;
import dev.plexapi.sdk.models.operations.async.CreatePlaylistRequestBuilder;
import dev.plexapi.sdk.models.operations.async.CreatePlaylistResponse;
import dev.plexapi.sdk.models.operations.async.DeletePlaylistRequestBuilder;
import dev.plexapi.sdk.models.operations.async.DeletePlaylistResponse;
import dev.plexapi.sdk.models.operations.async.GetPlaylistContentsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetPlaylistContentsResponse;
import dev.plexapi.sdk.models.operations.async.GetPlaylistRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetPlaylistResponse;
import dev.plexapi.sdk.models.operations.async.GetPlaylistsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetPlaylistsResponse;
import dev.plexapi.sdk.models.operations.async.UpdatePlaylistRequestBuilder;
import dev.plexapi.sdk.models.operations.async.UpdatePlaylistResponse;
import dev.plexapi.sdk.models.operations.async.UploadPlaylistRequestBuilder;
import dev.plexapi.sdk.models.operations.async.UploadPlaylistResponse;
import dev.plexapi.sdk.operations.AddPlaylistContents;
import dev.plexapi.sdk.operations.ClearPlaylistContents;
import dev.plexapi.sdk.operations.CreatePlaylist;
import dev.plexapi.sdk.operations.DeletePlaylist;
import dev.plexapi.sdk.operations.GetPlaylist;
import dev.plexapi.sdk.operations.GetPlaylistContents;
import dev.plexapi.sdk.operations.GetPlaylists;
import dev.plexapi.sdk.operations.UpdatePlaylist;
import dev.plexapi.sdk.operations.UploadPlaylist;
import java.lang.Double;
import java.lang.String;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017").
* They can be organized in (optionally nesting) folders.
* Retrieving a playlist, or its items, will trigger a refresh of its metadata.
* This may cause the duration and number of items to change.
*/
public class AsyncPlaylists {
private final SDKConfiguration sdkConfiguration;
private final Playlists syncSDK;
AsyncPlaylists(Playlists syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Playlists sync() {
return syncSDK;
}
/**
* Create a Playlist
*
* <p>Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass:
* - `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`).
* - `playQueueID` - To create a playlist from an existing play queue.
*
* @return The async call builder
*/
public CreatePlaylistRequestBuilder createPlaylist() {
return new CreatePlaylistRequestBuilder(sdkConfiguration);
}
/**
* Create a Playlist
*
* <p>Create a new playlist. By default the playlist is blank. To create a playlist along with a first item, pass:
* - `uri` - The content URI for what we're playing (e.g. `server://1234/com.plexapp.plugins.library/library/metadata/1`).
* - `playQueueID` - To create a playlist from an existing play queue.
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;CreatePlaylistResponse&gt; - The async response
*/
public CompletableFuture<CreatePlaylistResponse> createPlaylist(CreatePlaylistRequest request) {
AsyncRequestOperation<CreatePlaylistRequest, CreatePlaylistResponse> operation
= new CreatePlaylist.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get All Playlists
*
* <p>Get All Playlists given the specified filters.
*
* @return The async call builder
*/
public GetPlaylistsRequestBuilder getPlaylists() {
return new GetPlaylistsRequestBuilder(sdkConfiguration);
}
/**
* Get All Playlists
*
* <p>Get All Playlists given the specified filters.
*
* @return CompletableFuture&lt;GetPlaylistsResponse&gt; - The async response
*/
public CompletableFuture<GetPlaylistsResponse> getPlaylistsDirect() {
return getPlaylists(Optional.empty(), Optional.empty());
}
/**
* Get All Playlists
*
* <p>Get All Playlists given the specified filters.
*
* @param playlistType limit to a type of playlist.
* @param smart type of playlists to return (default is all).
* @return CompletableFuture&lt;GetPlaylistsResponse&gt; - The async response
*/
public CompletableFuture<GetPlaylistsResponse> getPlaylists(Optional<? extends PlaylistType> playlistType, Optional<? extends QueryParamSmart> smart) {
GetPlaylistsRequest request =
GetPlaylistsRequest
.builder()
.playlistType(playlistType)
.smart(smart)
.build();
AsyncRequestOperation<GetPlaylistsRequest, GetPlaylistsResponse> operation
= new GetPlaylists.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Retrieve Playlist
*
* <p>Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item:
* Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing.
*
* @return The async call builder
*/
public GetPlaylistRequestBuilder getPlaylist() {
return new GetPlaylistRequestBuilder(sdkConfiguration);
}
/**
* Retrieve Playlist
*
* <p>Gets detailed metadata for a playlist. A playlist for many purposes (rating, editing metadata, tagging), can be treated like a regular metadata item:
* Smart playlist details contain the `content` attribute. This is the content URI for the generator. This can then be parsed by a client to provide smart playlist editing.
*
* @param playlistID the ID of the playlist
* @return CompletableFuture&lt;GetPlaylistResponse&gt; - The async response
*/
public CompletableFuture<GetPlaylistResponse> getPlaylist(double playlistID) {
GetPlaylistRequest request =
GetPlaylistRequest
.builder()
.playlistID(playlistID)
.build();
AsyncRequestOperation<GetPlaylistRequest, GetPlaylistResponse> operation
= new GetPlaylist.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Deletes a Playlist
*
* <p>This endpoint will delete a playlist
*
* @return The async call builder
*/
public DeletePlaylistRequestBuilder deletePlaylist() {
return new DeletePlaylistRequestBuilder(sdkConfiguration);
}
/**
* Deletes a Playlist
*
* <p>This endpoint will delete a playlist
*
* @param playlistID the ID of the playlist
* @return CompletableFuture&lt;DeletePlaylistResponse&gt; - The async response
*/
public CompletableFuture<DeletePlaylistResponse> deletePlaylist(double playlistID) {
DeletePlaylistRequest request =
DeletePlaylistRequest
.builder()
.playlistID(playlistID)
.build();
AsyncRequestOperation<DeletePlaylistRequest, DeletePlaylistResponse> operation
= new DeletePlaylist.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Update a Playlist
*
* <p>From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
*
* @return The async call builder
*/
public UpdatePlaylistRequestBuilder updatePlaylist() {
return new UpdatePlaylistRequestBuilder(sdkConfiguration);
}
/**
* Update a Playlist
*
* <p>From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
*
* @param playlistID the ID of the playlist
* @return CompletableFuture&lt;UpdatePlaylistResponse&gt; - The async response
*/
public CompletableFuture<UpdatePlaylistResponse> updatePlaylist(double playlistID) {
return updatePlaylist(playlistID, Optional.empty(), Optional.empty());
}
/**
* Update a Playlist
*
* <p>From PMS version 1.9.1 clients can also edit playlist metadata using this endpoint as they would via `PUT /library/metadata/{playlistID}`
*
* @param playlistID the ID of the playlist
* @param title name of the playlist
* @param summary summary description of the playlist
* @return CompletableFuture&lt;UpdatePlaylistResponse&gt; - The async response
*/
public CompletableFuture<UpdatePlaylistResponse> updatePlaylist(
double playlistID, Optional<String> title,
Optional<String> summary) {
UpdatePlaylistRequest request =
UpdatePlaylistRequest
.builder()
.playlistID(playlistID)
.title(title)
.summary(summary)
.build();
AsyncRequestOperation<UpdatePlaylistRequest, UpdatePlaylistResponse> operation
= new UpdatePlaylist.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Retrieve Playlist Contents
*
* <p>Gets the contents of a playlist. Should be paged by clients via standard mechanisms.
* By default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter.
* For example, you could use this to display a list of recently added albums vis a smart playlist.
* Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items.
*
* @return The async call builder
*/
public GetPlaylistContentsRequestBuilder getPlaylistContents() {
return new GetPlaylistContentsRequestBuilder(sdkConfiguration);
}
/**
* Retrieve Playlist Contents
*
* <p>Gets the contents of a playlist. Should be paged by clients via standard mechanisms.
* By default leaves are returned (e.g. episodes, movies). In order to return other types you can use the `type` parameter.
* For example, you could use this to display a list of recently added albums vis a smart playlist.
* Note that for dumb playlists, items have a `playlistItemID` attribute which is used for deleting or moving items.
*
* @param playlistID the ID of the playlist
* @param type The type of media to retrieve or filter by.
* 1 = movie
* 2 = show
* 3 = season
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*
* @return CompletableFuture&lt;GetPlaylistContentsResponse&gt; - The async response
*/
public CompletableFuture<GetPlaylistContentsResponse> getPlaylistContents(double playlistID, GetPlaylistContentsQueryParamType type) {
GetPlaylistContentsRequest request =
GetPlaylistContentsRequest
.builder()
.playlistID(playlistID)
.type(type)
.build();
AsyncRequestOperation<GetPlaylistContentsRequest, GetPlaylistContentsResponse> operation
= new GetPlaylistContents.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Delete Playlist Contents
*
* <p>Clears a playlist, only works with dumb playlists. Returns the playlist.
*
* @return The async call builder
*/
public ClearPlaylistContentsRequestBuilder clearPlaylistContents() {
return new ClearPlaylistContentsRequestBuilder(sdkConfiguration);
}
/**
* Delete Playlist Contents
*
* <p>Clears a playlist, only works with dumb playlists. Returns the playlist.
*
* @param playlistID the ID of the playlist
* @return CompletableFuture&lt;ClearPlaylistContentsResponse&gt; - The async response
*/
public CompletableFuture<ClearPlaylistContentsResponse> clearPlaylistContents(double playlistID) {
ClearPlaylistContentsRequest request =
ClearPlaylistContentsRequest
.builder()
.playlistID(playlistID)
.build();
AsyncRequestOperation<ClearPlaylistContentsRequest, ClearPlaylistContentsResponse> operation
= new ClearPlaylistContents.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Adding to a Playlist
*
* <p>Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist.
* With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist.
*
* @return The async call builder
*/
public AddPlaylistContentsRequestBuilder addPlaylistContents() {
return new AddPlaylistContentsRequestBuilder(sdkConfiguration);
}
/**
* Adding to a Playlist
*
* <p>Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist.
* With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist.
*
* @param playlistID the ID of the playlist
* @param uri the content URI for the playlist
* @return CompletableFuture&lt;AddPlaylistContentsResponse&gt; - The async response
*/
public CompletableFuture<AddPlaylistContentsResponse> addPlaylistContents(double playlistID, String uri) {
return addPlaylistContents(playlistID, uri, Optional.empty());
}
/**
* Adding to a Playlist
*
* <p>Adds a generator to a playlist, same parameters as the POST to create. With a dumb playlist, this adds the specified items to the playlist.
* With a smart playlist, passing a new `uri` parameter replaces the rules for the playlist. Returns the playlist.
*
* @param playlistID the ID of the playlist
* @param uri the content URI for the playlist
* @param playQueueID the play queue to add to a playlist
* @return CompletableFuture&lt;AddPlaylistContentsResponse&gt; - The async response
*/
public CompletableFuture<AddPlaylistContentsResponse> addPlaylistContents(
double playlistID, String uri,
Optional<Double> playQueueID) {
AddPlaylistContentsRequest request =
AddPlaylistContentsRequest
.builder()
.playlistID(playlistID)
.uri(uri)
.playQueueID(playQueueID)
.build();
AsyncRequestOperation<AddPlaylistContentsRequest, AddPlaylistContentsResponse> operation
= new AddPlaylistContents.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Upload Playlist
*
* <p>Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file.
*
* @return The async call builder
*/
public UploadPlaylistRequestBuilder uploadPlaylist() {
return new UploadPlaylistRequestBuilder(sdkConfiguration);
}
/**
* Upload Playlist
*
* <p>Imports m3u playlists by passing a path on the server to scan for m3u-formatted playlist files, or a path to a single playlist file.
*
* @param path absolute path to a directory on the server where m3u files are stored, or the absolute path to a playlist file on the server.
* If the `path` argument is a directory, that path will be scanned for playlist files to be processed.
* Each file in that directory creates a separate playlist, with a name based on the filename of the file that created it.
* The GUID of each playlist is based on the filename.
* If the `path` argument is a file, that file will be used to create a new playlist, with the name based on the filename of the file that created it.
* The GUID of each playlist is based on the filename.
*
* @param force Force overwriting of duplicate playlists.
* By default, a playlist file uploaded with the same path will overwrite the existing playlist.
* The `force` argument is used to disable overwriting.
* If the `force` argument is set to 0, a new playlist will be created suffixed with the date and time that the duplicate was uploaded.
*
* @param sectionID Possibly the section ID to upload the playlist to, we are not certain.
* @return CompletableFuture&lt;UploadPlaylistResponse&gt; - The async response
*/
public CompletableFuture<UploadPlaylistResponse> uploadPlaylist(
String path, QueryParamForce force,
long sectionID) {
UploadPlaylistRequest request =
UploadPlaylistRequest
.builder()
.path(path)
.force(force)
.sectionID(sectionID)
.build();
AsyncRequestOperation<UploadPlaylistRequest, UploadPlaylistResponse> operation
= new UploadPlaylist.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,339 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetPinRequest;
import dev.plexapi.sdk.models.operations.GetServerResourcesRequest;
import dev.plexapi.sdk.models.operations.GetTokenByPinIdRequest;
import dev.plexapi.sdk.models.operations.IncludeHttps;
import dev.plexapi.sdk.models.operations.IncludeIPv6;
import dev.plexapi.sdk.models.operations.IncludeRelay;
import dev.plexapi.sdk.models.operations.async.GetCompanionsDataRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetCompanionsDataResponse;
import dev.plexapi.sdk.models.operations.async.GetGeoDataRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetGeoDataResponse;
import dev.plexapi.sdk.models.operations.async.GetHomeDataRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetHomeDataResponse;
import dev.plexapi.sdk.models.operations.async.GetPinRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetPinResponse;
import dev.plexapi.sdk.models.operations.async.GetServerResourcesRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetServerResourcesResponse;
import dev.plexapi.sdk.models.operations.async.GetTokenByPinIdRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetTokenByPinIdResponse;
import dev.plexapi.sdk.models.operations.async.GetUserFriendsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetUserFriendsResponse;
import dev.plexapi.sdk.operations.GetCompanionsData;
import dev.plexapi.sdk.operations.GetGeoData;
import dev.plexapi.sdk.operations.GetHomeData;
import dev.plexapi.sdk.operations.GetPin;
import dev.plexapi.sdk.operations.GetServerResources;
import dev.plexapi.sdk.operations.GetTokenByPinId;
import dev.plexapi.sdk.operations.GetUserFriends;
import java.lang.String;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* API Calls that perform operations directly against https://Plex.tv
*/
public class AsyncPlex {
private final SDKConfiguration sdkConfiguration;
private final Plex syncSDK;
AsyncPlex(Plex syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Plex sync() {
return syncSDK;
}
/**
* Get Companions Data
*
* <p>Get Companions Data
*
* @return The async call builder
*/
public GetCompanionsDataRequestBuilder getCompanionsData() {
return new GetCompanionsDataRequestBuilder(sdkConfiguration);
}
/**
* Get Companions Data
*
* <p>Get Companions Data
*
* @return CompletableFuture&lt;GetCompanionsDataResponse&gt; - The async response
*/
public CompletableFuture<GetCompanionsDataResponse> getCompanionsDataDirect() {
return getCompanionsData(Optional.empty());
}
/**
* Get Companions Data
*
* <p>Get Companions Data
*
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;GetCompanionsDataResponse&gt; - The async response
*/
public CompletableFuture<GetCompanionsDataResponse> getCompanionsData(Optional<String> serverURL) {
AsyncRequestlessOperation<GetCompanionsDataResponse> operation
= new GetCompanionsData.Async(sdkConfiguration, serverURL);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get list of friends of the user logged in
*
* <p>Get friends of provided auth token.
*
* @return The async call builder
*/
public GetUserFriendsRequestBuilder getUserFriends() {
return new GetUserFriendsRequestBuilder(sdkConfiguration);
}
/**
* Get list of friends of the user logged in
*
* <p>Get friends of provided auth token.
*
* @return CompletableFuture&lt;GetUserFriendsResponse&gt; - The async response
*/
public CompletableFuture<GetUserFriendsResponse> getUserFriendsDirect() {
return getUserFriends(Optional.empty());
}
/**
* Get list of friends of the user logged in
*
* <p>Get friends of provided auth token.
*
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;GetUserFriendsResponse&gt; - The async response
*/
public CompletableFuture<GetUserFriendsResponse> getUserFriends(Optional<String> serverURL) {
AsyncRequestlessOperation<GetUserFriendsResponse> operation
= new GetUserFriends.Async(sdkConfiguration, serverURL);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get Geo Data
*
* <p>Returns the geolocation and locale data of the caller
*
* @return The async call builder
*/
public GetGeoDataRequestBuilder getGeoData() {
return new GetGeoDataRequestBuilder(sdkConfiguration);
}
/**
* Get Geo Data
*
* <p>Returns the geolocation and locale data of the caller
*
* @return CompletableFuture&lt;GetGeoDataResponse&gt; - The async response
*/
public CompletableFuture<GetGeoDataResponse> getGeoDataDirect() {
return getGeoData(Optional.empty());
}
/**
* Get Geo Data
*
* <p>Returns the geolocation and locale data of the caller
*
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;GetGeoDataResponse&gt; - The async response
*/
public CompletableFuture<GetGeoDataResponse> getGeoData(Optional<String> serverURL) {
AsyncRequestlessOperation<GetGeoDataResponse> operation
= new GetGeoData.Async(sdkConfiguration, serverURL);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get Plex Home Data
*
* <p>Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status.
*
* @return The async call builder
*/
public GetHomeDataRequestBuilder getHomeData() {
return new GetHomeDataRequestBuilder(sdkConfiguration);
}
/**
* Get Plex Home Data
*
* <p>Retrieves the home data for the authenticated user, including details like home ID, name, guest access information, and subscription status.
*
* @return CompletableFuture&lt;GetHomeDataResponse&gt; - The async response
*/
public CompletableFuture<GetHomeDataResponse> getHomeDataDirect() {
AsyncRequestlessOperation<GetHomeDataResponse> operation
= new GetHomeData.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get Server Resources
*
* <p>Get Plex server access tokens and server connections
*
* @return The async call builder
*/
public GetServerResourcesRequestBuilder getServerResources() {
return new GetServerResourcesRequestBuilder(sdkConfiguration);
}
/**
* Get Server Resources
*
* <p>Get Plex server access tokens and server connections
*
* @param clientID An opaque identifier unique to the client (UUID, serial number, or other unique device ID)
* @return CompletableFuture&lt;GetServerResourcesResponse&gt; - The async response
*/
public CompletableFuture<GetServerResourcesResponse> getServerResources(String clientID) {
return getServerResources(
Optional.empty(), Optional.empty(), Optional.empty(),
clientID, Optional.empty());
}
/**
* Get Server Resources
*
* <p>Get Plex server access tokens and server connections
*
* @param includeHttps Include Https entries in the results
* @param includeRelay Include Relay addresses in the results
* E.g: https://10-0-0-25.bbf8e10c7fa20447cacee74cd9914cde.plex.direct:32400
*
* @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.
* @return CompletableFuture&lt;GetServerResourcesResponse&gt; - The async response
*/
public CompletableFuture<GetServerResourcesResponse> getServerResources(
Optional<? extends IncludeHttps> includeHttps, Optional<? extends IncludeRelay> includeRelay,
Optional<? extends IncludeIPv6> includeIPv6, String clientID,
Optional<String> serverURL) {
GetServerResourcesRequest request =
GetServerResourcesRequest
.builder()
.includeHttps(includeHttps)
.includeRelay(includeRelay)
.includeIPv6(includeIPv6)
.clientID(clientID)
.build();
AsyncRequestOperation<GetServerResourcesRequest, GetServerResourcesResponse> operation
= new GetServerResources.Async(sdkConfiguration, serverURL);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get a Pin
*
* <p>Retrieve a Pin ID from Plex.tv to use for authentication flows
*
* @return The async call builder
*/
public GetPinRequestBuilder getPin() {
return new GetPinRequestBuilder(sdkConfiguration);
}
/**
* Get a Pin
*
* <p>Retrieve a Pin ID from Plex.tv to use for authentication flows
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetPinResponse&gt; - The async response
*/
public CompletableFuture<GetPinResponse> getPin(GetPinRequest request) {
return getPin(request, Optional.empty());
}
/**
* Get a Pin
*
* <p>Retrieve a Pin ID from Plex.tv to use for authentication flows
*
* @param request The request object containing all the parameters for the API call.
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;GetPinResponse&gt; - The async response
*/
public CompletableFuture<GetPinResponse> getPin(GetPinRequest request, Optional<String> serverURL) {
AsyncRequestOperation<GetPinRequest, GetPinResponse> operation
= new GetPin.Async(sdkConfiguration, serverURL);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Access Token by PinId
*
* <p>Retrieve an Access Token from Plex.tv after the Pin has been authenticated
*
* @return The async call builder
*/
public GetTokenByPinIdRequestBuilder getTokenByPinId() {
return new GetTokenByPinIdRequestBuilder(sdkConfiguration);
}
/**
* Get Access Token by PinId
*
* <p>Retrieve an Access Token from Plex.tv after the Pin has been authenticated
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetTokenByPinIdResponse&gt; - The async response
*/
public CompletableFuture<GetTokenByPinIdResponse> getTokenByPinId(GetTokenByPinIdRequest request) {
return getTokenByPinId(request, Optional.empty());
}
/**
* Get Access Token by PinId
*
* <p>Retrieve an Access Token from Plex.tv after the Pin has been authenticated
*
* @param request The request object containing all the parameters for the API call.
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;GetTokenByPinIdResponse&gt; - The async response
*/
public CompletableFuture<GetTokenByPinIdResponse> getTokenByPinId(GetTokenByPinIdRequest request, Optional<String> serverURL) {
AsyncRequestOperation<GetTokenByPinIdRequest, GetTokenByPinIdResponse> operation
= new GetTokenByPinId.Async(sdkConfiguration, serverURL);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,254 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
/**
* Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server
*
* <p># Plex Media Server OpenAPI Specification
*
* <p>An Open Source OpenAPI Specification for Plex Media Server
*
* <p>Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)
*
* <p>## Documentation
*
* <p>[API Documentation](https://plexapi.dev)
*
* <p>## SDKs
*
* <p>The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the [main specification Repository](https://github.com/LukeHagar/plex-api-spec).
*
* <p>| Language | Repository | Releases | Other |
* | --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
* | Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - |
* | JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - |
* | Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |
* | Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - |
* | Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - |
* | PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - |
* | Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - |
* | C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | -
*/
public class AsyncPlexAPI {
/**
* Operations against the Plex Media Server System.
*/
private final AsyncServer server;
/**
* API Calls interacting with Plex Media Server Media
*/
private final AsyncMedia media;
/**
* API Calls that perform operations with Plex Media Server Videos
*/
private final AsyncVideo video;
/**
* 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.
* Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.
* Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details:
* - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity.
* - They must contain an `type` which is used by clients to distinguish the specific activity.
* - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)
* - The may contain a `Response` object which attributes which represent the result of the asynchronous operation.
*/
private final AsyncActivities activities;
/**
* Butler is the task manager of the Plex Media Server Ecosystem.
*/
private final AsyncButler butler;
/**
* API Calls that perform operations directly against https://Plex.tv
*/
private final AsyncPlex plex;
/**
* Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
*/
private final AsyncHubs hubs;
/**
* API Calls that perform search operations with Plex Media Server
*/
private final AsyncSearch search;
/**
* API Calls interacting with Plex Media Server Libraries
*/
private final AsyncLibrary library;
/**
* API Calls that perform operations with Plex Media Server Watchlists
*/
private final AsyncWatchlist watchlist;
/**
* Submit logs to the Log Handler for Plex Media Server
*/
private final AsyncLog log;
/**
* Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017").
* They can be organized in (optionally nesting) folders.
* Retrieving a playlist, or its items, will trigger a refresh of its metadata.
* This may cause the duration and number of items to change.
*/
private final AsyncPlaylists playlists;
/**
* API Calls regarding authentication for Plex Media Server
*/
private final AsyncAuthentication authentication;
/**
* API Calls that perform operations with Plex Media Server Statistics
*/
private final AsyncStatistics statistics;
/**
* API Calls that perform search operations with Plex Media Server Sessions
*/
private final AsyncSessions sessions;
/**
* This describes the API for searching and applying updates to the Plex Media Server.
* Updates to the status can be observed via the Event API.
*/
private final AsyncUpdater updater;
private final AsyncUsers users;
/**
* Operations against the Plex Media Server System.
*/
public AsyncServer server() {
return server;
}
/**
* API Calls interacting with Plex Media Server Media
*/
public AsyncMedia media() {
return media;
}
/**
* API Calls that perform operations with Plex Media Server Videos
*/
public AsyncVideo video() {
return video;
}
/**
* 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.
* Activities are associated with HTTP replies via a special `X-Plex-Activity` header which contains the UUID of the activity.
* Activities are optional cancellable. If cancellable, they may be cancelled via the `DELETE` endpoint. Other details:
* - They can contain a `progress` (from 0 to 100) marking the percent completion of the activity.
* - They must contain an `type` which is used by clients to distinguish the specific activity.
* - They may contain a `Context` object with attributes which associate the activity with various specific entities (items, libraries, etc.)
* - The may contain a `Response` object which attributes which represent the result of the asynchronous operation.
*/
public AsyncActivities activities() {
return activities;
}
/**
* Butler is the task manager of the Plex Media Server Ecosystem.
*/
public AsyncButler butler() {
return butler;
}
/**
* API Calls that perform operations directly against https://Plex.tv
*/
public AsyncPlex plex() {
return plex;
}
/**
* Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
*/
public AsyncHubs hubs() {
return hubs;
}
/**
* API Calls that perform search operations with Plex Media Server
*/
public AsyncSearch search() {
return search;
}
/**
* API Calls interacting with Plex Media Server Libraries
*/
public AsyncLibrary library() {
return library;
}
/**
* API Calls that perform operations with Plex Media Server Watchlists
*/
public AsyncWatchlist watchlist() {
return watchlist;
}
/**
* Submit logs to the Log Handler for Plex Media Server
*/
public AsyncLog log() {
return log;
}
/**
* Playlists are ordered collections of media. They can be dumb (just a list of media) or smart (based on a media query, such as "all albums from 2017").
* They can be organized in (optionally nesting) folders.
* Retrieving a playlist, or its items, will trigger a refresh of its metadata.
* This may cause the duration and number of items to change.
*/
public AsyncPlaylists playlists() {
return playlists;
}
/**
* API Calls regarding authentication for Plex Media Server
*/
public AsyncAuthentication authentication() {
return authentication;
}
/**
* API Calls that perform operations with Plex Media Server Statistics
*/
public AsyncStatistics statistics() {
return statistics;
}
/**
* API Calls that perform search operations with Plex Media Server Sessions
*/
public AsyncSessions sessions() {
return sessions;
}
/**
* This describes the API for searching and applying updates to the Plex Media Server.
* Updates to the status can be observed via the Event API.
*/
public AsyncUpdater updater() {
return updater;
}
public AsyncUsers users() {
return users;
}
private final SDKConfiguration sdkConfiguration;
private final PlexAPI syncSDK;
AsyncPlexAPI(PlexAPI syncSDK, SDKConfiguration sdkConfiguration) {
this.syncSDK = syncSDK;
this.sdkConfiguration = sdkConfiguration;
this.server = new AsyncServer(syncSDK.server(), sdkConfiguration);
this.media = new AsyncMedia(syncSDK.media(), sdkConfiguration);
this.video = new AsyncVideo(syncSDK.video(), sdkConfiguration);
this.activities = new AsyncActivities(syncSDK.activities(), sdkConfiguration);
this.butler = new AsyncButler(syncSDK.butler(), sdkConfiguration);
this.plex = new AsyncPlex(syncSDK.plex(), sdkConfiguration);
this.hubs = new AsyncHubs(syncSDK.hubs(), sdkConfiguration);
this.search = new AsyncSearch(syncSDK.search(), sdkConfiguration);
this.library = new AsyncLibrary(syncSDK.library(), sdkConfiguration);
this.watchlist = new AsyncWatchlist(syncSDK.watchlist(), sdkConfiguration);
this.log = new AsyncLog(syncSDK.log(), sdkConfiguration);
this.playlists = new AsyncPlaylists(syncSDK.playlists(), sdkConfiguration);
this.authentication = new AsyncAuthentication(syncSDK.authentication(), sdkConfiguration);
this.statistics = new AsyncStatistics(syncSDK.statistics(), sdkConfiguration);
this.sessions = new AsyncSessions(syncSDK.sessions(), sdkConfiguration);
this.updater = new AsyncUpdater(syncSDK.updater(), sdkConfiguration);
this.users = new AsyncUsers(syncSDK.users(), sdkConfiguration);
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public PlexAPI sync() {
return syncSDK;
}
}

View File

@@ -0,0 +1,220 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetSearchResultsRequest;
import dev.plexapi.sdk.models.operations.PerformSearchRequest;
import dev.plexapi.sdk.models.operations.PerformVoiceSearchRequest;
import dev.plexapi.sdk.models.operations.async.GetSearchResultsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetSearchResultsResponse;
import dev.plexapi.sdk.models.operations.async.PerformSearchRequestBuilder;
import dev.plexapi.sdk.models.operations.async.PerformSearchResponse;
import dev.plexapi.sdk.models.operations.async.PerformVoiceSearchRequestBuilder;
import dev.plexapi.sdk.models.operations.async.PerformVoiceSearchResponse;
import dev.plexapi.sdk.operations.GetSearchResults;
import dev.plexapi.sdk.operations.PerformSearch;
import dev.plexapi.sdk.operations.PerformVoiceSearch;
import java.lang.Double;
import java.lang.String;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* API Calls that perform search operations with Plex Media Server
*/
public class AsyncSearch {
private final SDKConfiguration sdkConfiguration;
private final Search syncSDK;
AsyncSearch(Search syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Search sync() {
return syncSDK;
}
/**
* Perform a search
*
* <p>This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor).
*
* <p>In the response's items, the following extra attributes are returned to further describe or disambiguate the result:
*
* <p>- `reason`: The reason for the result, if not because of a direct search term match; can be either:
* - `section`: There are multiple identical results from different sections.
* - `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language).
* - `&lt;hub identifier&gt;`: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor`
* - `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold").
* - `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID.
*
* <p>This request is intended to be very fast, and called as the user types.
*
* @return The async call builder
*/
public PerformSearchRequestBuilder performSearch() {
return new PerformSearchRequestBuilder(sdkConfiguration);
}
/**
* Perform a search
*
* <p>This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor).
*
* <p>In the response's items, the following extra attributes are returned to further describe or disambiguate the result:
*
* <p>- `reason`: The reason for the result, if not because of a direct search term match; can be either:
* - `section`: There are multiple identical results from different sections.
* - `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language).
* - `&lt;hub identifier&gt;`: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor`
* - `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold").
* - `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID.
*
* <p>This request is intended to be very fast, and called as the user types.
*
* @param query The query term
* @return CompletableFuture&lt;PerformSearchResponse&gt; - The async response
*/
public CompletableFuture<PerformSearchResponse> performSearch(String query) {
return performSearch(query, Optional.empty(), Optional.empty());
}
/**
* Perform a search
*
* <p>This endpoint performs a search across all library sections, or a single section, and returns matches as hubs, split up by type. It performs spell checking, looks for partial matches, and orders the hubs based on quality of results. In addition, based on matches, it will return other related matches (e.g. for a genre match, it may return movies in that genre, or for an actor match, movies with that actor).
*
* <p>In the response's items, the following extra attributes are returned to further describe or disambiguate the result:
*
* <p>- `reason`: The reason for the result, if not because of a direct search term match; can be either:
* - `section`: There are multiple identical results from different sections.
* - `originalTitle`: There was a search term match from the original title field (sometimes those can be very different or in a foreign language).
* - `&lt;hub identifier&gt;`: If the reason for the result is due to a result in another hub, the source hub identifier is returned. For example, if the search is for "dylan" then Bob Dylan may be returned as an artist result, an a few of his albums returned as album results with a reason code of `artist` (the identifier of that particular hub). Or if the search is for "arnold", there might be movie results returned with a reason of `actor`
* - `reasonTitle`: The string associated with the reason code. For a section reason, it'll be the section name; For a hub identifier, it'll be a string associated with the match (e.g. `Arnold Schwarzenegger` for movies which were returned because the search was for "arnold").
* - `reasonID`: The ID of the item associated with the reason for the result. This might be a section ID, a tag ID, an artist ID, or a show ID.
*
* <p>This request is intended to be very fast, and called as the user types.
*
* @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
* @return CompletableFuture&lt;PerformSearchResponse&gt; - The async response
*/
public CompletableFuture<PerformSearchResponse> performSearch(
String query, Optional<Double> sectionId,
Optional<Double> limit) {
PerformSearchRequest request =
PerformSearchRequest
.builder()
.query(query)
.sectionId(sectionId)
.limit(limit)
.build();
AsyncRequestOperation<PerformSearchRequest, PerformSearchResponse> operation
= new PerformSearch.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Perform a voice search
*
* <p>This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint.
* It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint.
* Whenever possible, clients should limit the search to the appropriate type.
* Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.
*
* @return The async call builder
*/
public PerformVoiceSearchRequestBuilder performVoiceSearch() {
return new PerformVoiceSearchRequestBuilder(sdkConfiguration);
}
/**
* Perform a voice search
*
* <p>This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint.
* It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint.
* Whenever possible, clients should limit the search to the appropriate type.
* Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.
*
* @param query The query term
* @return CompletableFuture&lt;PerformVoiceSearchResponse&gt; - The async response
*/
public CompletableFuture<PerformVoiceSearchResponse> performVoiceSearch(String query) {
return performVoiceSearch(query, Optional.empty(), Optional.empty());
}
/**
* Perform a voice search
*
* <p>This endpoint performs a search specifically tailored towards voice or other imprecise input which may work badly with the substring and spell-checking heuristics used by the `/hubs/search` endpoint.
* It uses a [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) heuristic to search titles, and as such is much slower than the other search endpoint.
* Whenever possible, clients should limit the search to the appropriate type.
* Results, as well as their containing per-type hubs, contain a `distance` attribute which can be used to judge result quality.
*
* @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
* @return CompletableFuture&lt;PerformVoiceSearchResponse&gt; - The async response
*/
public CompletableFuture<PerformVoiceSearchResponse> performVoiceSearch(
String query, Optional<Double> sectionId,
Optional<Double> limit) {
PerformVoiceSearchRequest request =
PerformVoiceSearchRequest
.builder()
.query(query)
.sectionId(sectionId)
.limit(limit)
.build();
AsyncRequestOperation<PerformVoiceSearchRequest, PerformVoiceSearchResponse> operation
= new PerformVoiceSearch.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Search Results
*
* <p>This will search the database for the string provided.
*
* @return The async call builder
*/
public GetSearchResultsRequestBuilder getSearchResults() {
return new GetSearchResultsRequestBuilder(sdkConfiguration);
}
/**
* Get Search Results
*
* <p>This will search the database for the string provided.
*
* @param query The search query string to use
* @return CompletableFuture&lt;GetSearchResultsResponse&gt; - The async response
*/
public CompletableFuture<GetSearchResultsResponse> getSearchResults(String query) {
GetSearchResultsRequest request =
GetSearchResultsRequest
.builder()
.query(query)
.build();
AsyncRequestOperation<GetSearchResultsRequest, GetSearchResultsResponse> operation
= new GetSearchResults.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,303 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetMediaProvidersRequest;
import dev.plexapi.sdk.models.operations.GetResizedPhotoRequest;
import dev.plexapi.sdk.models.operations.async.GetAvailableClientsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetAvailableClientsResponse;
import dev.plexapi.sdk.models.operations.async.GetDevicesRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetDevicesResponse;
import dev.plexapi.sdk.models.operations.async.GetMediaProvidersRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetMediaProvidersResponse;
import dev.plexapi.sdk.models.operations.async.GetMyPlexAccountRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetMyPlexAccountResponse;
import dev.plexapi.sdk.models.operations.async.GetResizedPhotoRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetResizedPhotoResponse;
import dev.plexapi.sdk.models.operations.async.GetServerCapabilitiesRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetServerCapabilitiesResponse;
import dev.plexapi.sdk.models.operations.async.GetServerIdentityRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetServerIdentityResponse;
import dev.plexapi.sdk.models.operations.async.GetServerListRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetServerListResponse;
import dev.plexapi.sdk.models.operations.async.GetServerPreferencesRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetServerPreferencesResponse;
import dev.plexapi.sdk.operations.GetAvailableClients;
import dev.plexapi.sdk.operations.GetDevices;
import dev.plexapi.sdk.operations.GetMediaProviders;
import dev.plexapi.sdk.operations.GetMyPlexAccount;
import dev.plexapi.sdk.operations.GetResizedPhoto;
import dev.plexapi.sdk.operations.GetServerCapabilities;
import dev.plexapi.sdk.operations.GetServerIdentity;
import dev.plexapi.sdk.operations.GetServerList;
import dev.plexapi.sdk.operations.GetServerPreferences;
import java.lang.String;
import java.util.concurrent.CompletableFuture;
/**
* Operations against the Plex Media Server System.
*/
public class AsyncServer {
private final SDKConfiguration sdkConfiguration;
private final Server syncSDK;
AsyncServer(Server syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Server sync() {
return syncSDK;
}
/**
* Get Server Capabilities
*
* <p>Get Server Capabilities
*
* @return The async call builder
*/
public GetServerCapabilitiesRequestBuilder getServerCapabilities() {
return new GetServerCapabilitiesRequestBuilder(sdkConfiguration);
}
/**
* Get Server Capabilities
*
* <p>Get Server Capabilities
*
* @return CompletableFuture&lt;GetServerCapabilitiesResponse&gt; - The async response
*/
public CompletableFuture<GetServerCapabilitiesResponse> getServerCapabilitiesDirect() {
AsyncRequestlessOperation<GetServerCapabilitiesResponse> operation
= new GetServerCapabilities.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get Server Preferences
*
* <p>Get Server Preferences
*
* @return The async call builder
*/
public GetServerPreferencesRequestBuilder getServerPreferences() {
return new GetServerPreferencesRequestBuilder(sdkConfiguration);
}
/**
* Get Server Preferences
*
* <p>Get Server Preferences
*
* @return CompletableFuture&lt;GetServerPreferencesResponse&gt; - The async response
*/
public CompletableFuture<GetServerPreferencesResponse> getServerPreferencesDirect() {
AsyncRequestlessOperation<GetServerPreferencesResponse> operation
= new GetServerPreferences.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get Available Clients
*
* <p>Get Available Clients
*
* @return The async call builder
*/
public GetAvailableClientsRequestBuilder getAvailableClients() {
return new GetAvailableClientsRequestBuilder(sdkConfiguration);
}
/**
* Get Available Clients
*
* <p>Get Available Clients
*
* @return CompletableFuture&lt;GetAvailableClientsResponse&gt; - The async response
*/
public CompletableFuture<GetAvailableClientsResponse> getAvailableClientsDirect() {
AsyncRequestlessOperation<GetAvailableClientsResponse> operation
= new GetAvailableClients.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get Devices
*
* <p>Get Devices
*
* @return The async call builder
*/
public GetDevicesRequestBuilder getDevices() {
return new GetDevicesRequestBuilder(sdkConfiguration);
}
/**
* Get Devices
*
* <p>Get Devices
*
* @return CompletableFuture&lt;GetDevicesResponse&gt; - The async response
*/
public CompletableFuture<GetDevicesResponse> getDevicesDirect() {
AsyncRequestlessOperation<GetDevicesResponse> operation
= new GetDevices.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get Server Identity
*
* <p>This request is useful to determine if the server is online or offline
*
* @return The async call builder
*/
public GetServerIdentityRequestBuilder getServerIdentity() {
return new GetServerIdentityRequestBuilder(sdkConfiguration);
}
/**
* Get Server Identity
*
* <p>This request is useful to determine if the server is online or offline
*
* @return CompletableFuture&lt;GetServerIdentityResponse&gt; - The async response
*/
public CompletableFuture<GetServerIdentityResponse> getServerIdentityDirect() {
AsyncRequestlessOperation<GetServerIdentityResponse> operation
= new GetServerIdentity.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get MyPlex Account
*
* <p>Returns MyPlex Account Information
*
* @return The async call builder
*/
public GetMyPlexAccountRequestBuilder getMyPlexAccount() {
return new GetMyPlexAccountRequestBuilder(sdkConfiguration);
}
/**
* Get MyPlex Account
*
* <p>Returns MyPlex Account Information
*
* @return CompletableFuture&lt;GetMyPlexAccountResponse&gt; - The async response
*/
public CompletableFuture<GetMyPlexAccountResponse> getMyPlexAccountDirect() {
AsyncRequestlessOperation<GetMyPlexAccountResponse> operation
= new GetMyPlexAccount.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get a Resized Photo
*
* <p>Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
*
* @return The async call builder
*/
public GetResizedPhotoRequestBuilder getResizedPhoto() {
return new GetResizedPhotoRequestBuilder(sdkConfiguration);
}
/**
* Get a Resized Photo
*
* <p>Plex's Photo transcoder is used throughout the service to serve images at specified sizes.
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetResizedPhotoResponse&gt; - The async response
*/
public CompletableFuture<GetResizedPhotoResponse> getResizedPhoto(GetResizedPhotoRequest request) {
AsyncRequestOperation<GetResizedPhotoRequest, GetResizedPhotoResponse> operation
= new GetResizedPhoto.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Media Providers
*
* <p>Retrieves media providers and their features from the Plex server.
*
* @return The async call builder
*/
public GetMediaProvidersRequestBuilder getMediaProviders() {
return new GetMediaProvidersRequestBuilder(sdkConfiguration);
}
/**
* Get Media Providers
*
* <p>Retrieves media providers and their features from the Plex server.
*
* @param xPlexToken An authentication token, obtained from plex.tv
* @return CompletableFuture&lt;GetMediaProvidersResponse&gt; - The async response
*/
public CompletableFuture<GetMediaProvidersResponse> getMediaProviders(String xPlexToken) {
GetMediaProvidersRequest request =
GetMediaProvidersRequest
.builder()
.xPlexToken(xPlexToken)
.build();
AsyncRequestOperation<GetMediaProvidersRequest, GetMediaProvidersResponse> operation
= new GetMediaProviders.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Server List
*
* <p>Get Server List
*
* @return The async call builder
*/
public GetServerListRequestBuilder getServerList() {
return new GetServerListRequestBuilder(sdkConfiguration);
}
/**
* Get Server List
*
* <p>Get Server List
*
* @return CompletableFuture&lt;GetServerListResponse&gt; - The async response
*/
public CompletableFuture<GetServerListResponse> getServerListDirect() {
AsyncRequestlessOperation<GetServerListResponse> operation
= new GetServerList.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,192 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetSessionHistoryRequest;
import dev.plexapi.sdk.models.operations.QueryParamFilter;
import dev.plexapi.sdk.models.operations.StopTranscodeSessionRequest;
import dev.plexapi.sdk.models.operations.async.GetSessionHistoryRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetSessionHistoryResponse;
import dev.plexapi.sdk.models.operations.async.GetSessionsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetSessionsResponse;
import dev.plexapi.sdk.models.operations.async.GetTranscodeSessionsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetTranscodeSessionsResponse;
import dev.plexapi.sdk.models.operations.async.StopTranscodeSessionRequestBuilder;
import dev.plexapi.sdk.models.operations.async.StopTranscodeSessionResponse;
import dev.plexapi.sdk.operations.GetSessionHistory;
import dev.plexapi.sdk.operations.GetSessions;
import dev.plexapi.sdk.operations.GetTranscodeSessions;
import dev.plexapi.sdk.operations.StopTranscodeSession;
import java.lang.Long;
import java.lang.String;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* API Calls that perform search operations with Plex Media Server Sessions
*/
public class AsyncSessions {
private final SDKConfiguration sdkConfiguration;
private final Sessions syncSDK;
AsyncSessions(Sessions syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Sessions sync() {
return syncSDK;
}
/**
* Get Active Sessions
*
* <p>This will retrieve the "Now Playing" Information of the PMS.
*
* @return The async call builder
*/
public GetSessionsRequestBuilder getSessions() {
return new GetSessionsRequestBuilder(sdkConfiguration);
}
/**
* Get Active Sessions
*
* <p>This will retrieve the "Now Playing" Information of the PMS.
*
* @return CompletableFuture&lt;GetSessionsResponse&gt; - The async response
*/
public CompletableFuture<GetSessionsResponse> getSessionsDirect() {
AsyncRequestlessOperation<GetSessionsResponse> operation
= new GetSessions.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Get Session History
*
* <p>This will Retrieve a listing of all history views.
*
* @return The async call builder
*/
public GetSessionHistoryRequestBuilder getSessionHistory() {
return new GetSessionHistoryRequestBuilder(sdkConfiguration);
}
/**
* Get Session History
*
* <p>This will Retrieve a listing of all history views.
*
* @return CompletableFuture&lt;GetSessionHistoryResponse&gt; - The async response
*/
public CompletableFuture<GetSessionHistoryResponse> getSessionHistoryDirect() {
return getSessionHistory(
Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty());
}
/**
* Get Session History
*
* <p>This will Retrieve a listing of all history views.
*
* @param sort Sorts the results by the specified field followed by the direction (asc, desc)
*
* @param accountId Filter results by those that are related to a specific users id
*
* @param filter Filters content by field and direction/equality
* (Unknown if viewedAt is the only supported column)
*
* @param librarySectionID Filters the results based on the id of a valid library section
*
* @return CompletableFuture&lt;GetSessionHistoryResponse&gt; - The async response
*/
public CompletableFuture<GetSessionHistoryResponse> getSessionHistory(
Optional<String> sort, Optional<Long> accountId,
Optional<? extends QueryParamFilter> filter, Optional<Long> librarySectionID) {
GetSessionHistoryRequest request =
GetSessionHistoryRequest
.builder()
.sort(sort)
.accountId(accountId)
.filter(filter)
.librarySectionID(librarySectionID)
.build();
AsyncRequestOperation<GetSessionHistoryRequest, GetSessionHistoryResponse> operation
= new GetSessionHistory.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Transcode Sessions
*
* <p>Get Transcode Sessions
*
* @return The async call builder
*/
public GetTranscodeSessionsRequestBuilder getTranscodeSessions() {
return new GetTranscodeSessionsRequestBuilder(sdkConfiguration);
}
/**
* Get Transcode Sessions
*
* <p>Get Transcode Sessions
*
* @return CompletableFuture&lt;GetTranscodeSessionsResponse&gt; - The async response
*/
public CompletableFuture<GetTranscodeSessionsResponse> getTranscodeSessionsDirect() {
AsyncRequestlessOperation<GetTranscodeSessionsResponse> operation
= new GetTranscodeSessions.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Stop a Transcode Session
*
* <p>Stop a Transcode Session
*
* @return The async call builder
*/
public StopTranscodeSessionRequestBuilder stopTranscodeSession() {
return new StopTranscodeSessionRequestBuilder(sdkConfiguration);
}
/**
* Stop a Transcode Session
*
* <p>Stop a Transcode Session
*
* @param sessionKey the Key of the transcode session to stop
* @return CompletableFuture&lt;StopTranscodeSessionResponse&gt; - The async response
*/
public CompletableFuture<StopTranscodeSessionResponse> stopTranscodeSession(String sessionKey) {
StopTranscodeSessionRequest request =
StopTranscodeSessionRequest
.builder()
.sessionKey(sessionKey)
.build();
AsyncRequestOperation<StopTranscodeSessionRequest, StopTranscodeSessionResponse> operation
= new StopTranscodeSession.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,180 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsRequest;
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsRequest;
import dev.plexapi.sdk.models.operations.GetStatisticsRequest;
import dev.plexapi.sdk.models.operations.async.GetBandwidthStatisticsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetBandwidthStatisticsResponse;
import dev.plexapi.sdk.models.operations.async.GetResourcesStatisticsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetResourcesStatisticsResponse;
import dev.plexapi.sdk.models.operations.async.GetStatisticsRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetStatisticsResponse;
import dev.plexapi.sdk.operations.GetBandwidthStatistics;
import dev.plexapi.sdk.operations.GetResourcesStatistics;
import dev.plexapi.sdk.operations.GetStatistics;
import java.lang.Long;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* API Calls that perform operations with Plex Media Server Statistics
*/
public class AsyncStatistics {
private final SDKConfiguration sdkConfiguration;
private final Statistics syncSDK;
AsyncStatistics(Statistics syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Statistics sync() {
return syncSDK;
}
/**
* Get Media Statistics
*
* <p>This will return the media statistics for the server
*
* @return The async call builder
*/
public GetStatisticsRequestBuilder getStatistics() {
return new GetStatisticsRequestBuilder(sdkConfiguration);
}
/**
* Get Media Statistics
*
* <p>This will return the media statistics for the server
*
* @return CompletableFuture&lt;GetStatisticsResponse&gt; - The async response
*/
public CompletableFuture<GetStatisticsResponse> getStatisticsDirect() {
return getStatistics(Optional.empty());
}
/**
* Get Media Statistics
*
* <p>This will return the media statistics for the server
*
* @param timespan The timespan to retrieve statistics for
* the exact meaning of this parameter is not known
*
* @return CompletableFuture&lt;GetStatisticsResponse&gt; - The async response
*/
public CompletableFuture<GetStatisticsResponse> getStatistics(Optional<Long> timespan) {
GetStatisticsRequest request =
GetStatisticsRequest
.builder()
.timespan(timespan)
.build();
AsyncRequestOperation<GetStatisticsRequest, GetStatisticsResponse> operation
= new GetStatistics.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Resources Statistics
*
* <p>This will return the resources for the server
*
* @return The async call builder
*/
public GetResourcesStatisticsRequestBuilder getResourcesStatistics() {
return new GetResourcesStatisticsRequestBuilder(sdkConfiguration);
}
/**
* Get Resources Statistics
*
* <p>This will return the resources for the server
*
* @return CompletableFuture&lt;GetResourcesStatisticsResponse&gt; - The async response
*/
public CompletableFuture<GetResourcesStatisticsResponse> getResourcesStatisticsDirect() {
return getResourcesStatistics(Optional.empty());
}
/**
* Get Resources Statistics
*
* <p>This will return the resources for the server
*
* @param timespan The timespan to retrieve statistics for
* the exact meaning of this parameter is not known
*
* @return CompletableFuture&lt;GetResourcesStatisticsResponse&gt; - The async response
*/
public CompletableFuture<GetResourcesStatisticsResponse> getResourcesStatistics(Optional<Long> timespan) {
GetResourcesStatisticsRequest request =
GetResourcesStatisticsRequest
.builder()
.timespan(timespan)
.build();
AsyncRequestOperation<GetResourcesStatisticsRequest, GetResourcesStatisticsResponse> operation
= new GetResourcesStatistics.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Get Bandwidth Statistics
*
* <p>This will return the bandwidth statistics for the server
*
* @return The async call builder
*/
public GetBandwidthStatisticsRequestBuilder getBandwidthStatistics() {
return new GetBandwidthStatisticsRequestBuilder(sdkConfiguration);
}
/**
* Get Bandwidth Statistics
*
* <p>This will return the bandwidth statistics for the server
*
* @return CompletableFuture&lt;GetBandwidthStatisticsResponse&gt; - The async response
*/
public CompletableFuture<GetBandwidthStatisticsResponse> getBandwidthStatisticsDirect() {
return getBandwidthStatistics(Optional.empty());
}
/**
* Get Bandwidth Statistics
*
* <p>This will return the bandwidth statistics for the server
*
* @param timespan The timespan to retrieve statistics for
* the exact meaning of this parameter is not known
*
* @return CompletableFuture&lt;GetBandwidthStatisticsResponse&gt; - The async response
*/
public CompletableFuture<GetBandwidthStatisticsResponse> getBandwidthStatistics(Optional<Long> timespan) {
GetBandwidthStatisticsRequest request =
GetBandwidthStatisticsRequest
.builder()
.timespan(timespan)
.build();
AsyncRequestOperation<GetBandwidthStatisticsRequest, GetBandwidthStatisticsResponse> operation
= new GetBandwidthStatistics.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,162 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.ApplyUpdatesRequest;
import dev.plexapi.sdk.models.operations.CheckForUpdatesRequest;
import dev.plexapi.sdk.models.operations.Download;
import dev.plexapi.sdk.models.operations.Skip;
import dev.plexapi.sdk.models.operations.Tonight;
import dev.plexapi.sdk.models.operations.async.ApplyUpdatesRequestBuilder;
import dev.plexapi.sdk.models.operations.async.ApplyUpdatesResponse;
import dev.plexapi.sdk.models.operations.async.CheckForUpdatesRequestBuilder;
import dev.plexapi.sdk.models.operations.async.CheckForUpdatesResponse;
import dev.plexapi.sdk.models.operations.async.GetUpdateStatusRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetUpdateStatusResponse;
import dev.plexapi.sdk.operations.ApplyUpdates;
import dev.plexapi.sdk.operations.CheckForUpdates;
import dev.plexapi.sdk.operations.GetUpdateStatus;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* This describes the API for searching and applying updates to the Plex Media Server.
* Updates to the status can be observed via the Event API.
*/
public class AsyncUpdater {
private final SDKConfiguration sdkConfiguration;
private final Updater syncSDK;
AsyncUpdater(Updater syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Updater sync() {
return syncSDK;
}
/**
* Querying status of updates
*
* <p>Querying status of updates
*
* @return The async call builder
*/
public GetUpdateStatusRequestBuilder getUpdateStatus() {
return new GetUpdateStatusRequestBuilder(sdkConfiguration);
}
/**
* Querying status of updates
*
* <p>Querying status of updates
*
* @return CompletableFuture&lt;GetUpdateStatusResponse&gt; - The async response
*/
public CompletableFuture<GetUpdateStatusResponse> getUpdateStatusDirect() {
AsyncRequestlessOperation<GetUpdateStatusResponse> operation
= new GetUpdateStatus.Async(sdkConfiguration);
return operation.doRequest()
.thenCompose(operation::handleResponse);
}
/**
* Checking for updates
*
* <p>Checking for updates
*
* @return The async call builder
*/
public CheckForUpdatesRequestBuilder checkForUpdates() {
return new CheckForUpdatesRequestBuilder(sdkConfiguration);
}
/**
* Checking for updates
*
* <p>Checking for updates
*
* @return CompletableFuture&lt;CheckForUpdatesResponse&gt; - The async response
*/
public CompletableFuture<CheckForUpdatesResponse> checkForUpdatesDirect() {
return checkForUpdates(Optional.empty());
}
/**
* Checking for updates
*
* <p>Checking for updates
*
* @param download Indicate that you want to start download any updates found.
* @return CompletableFuture&lt;CheckForUpdatesResponse&gt; - The async response
*/
public CompletableFuture<CheckForUpdatesResponse> checkForUpdates(Optional<? extends Download> download) {
CheckForUpdatesRequest request =
CheckForUpdatesRequest
.builder()
.download(download)
.build();
AsyncRequestOperation<CheckForUpdatesRequest, CheckForUpdatesResponse> operation
= new CheckForUpdates.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Apply Updates
*
* <p>Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
*
* @return The async call builder
*/
public ApplyUpdatesRequestBuilder applyUpdates() {
return new ApplyUpdatesRequestBuilder(sdkConfiguration);
}
/**
* Apply Updates
*
* <p>Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
*
* @return CompletableFuture&lt;ApplyUpdatesResponse&gt; - The async response
*/
public CompletableFuture<ApplyUpdatesResponse> applyUpdatesDirect() {
return applyUpdates(Optional.empty(), Optional.empty());
}
/**
* Apply Updates
*
* <p>Note that these two parameters are effectively mutually exclusive. The `tonight` parameter takes precedence and `skip` will be ignored if `tonight` is also passed
*
* @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`.
* @return CompletableFuture&lt;ApplyUpdatesResponse&gt; - The async response
*/
public CompletableFuture<ApplyUpdatesResponse> applyUpdates(Optional<? extends Tonight> tonight, Optional<? extends Skip> skip) {
ApplyUpdatesRequest request =
ApplyUpdatesRequest
.builder()
.tonight(tonight)
.skip(skip)
.build();
AsyncRequestOperation<ApplyUpdatesRequest, ApplyUpdatesResponse> operation
= new ApplyUpdates.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,75 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetUsersRequest;
import dev.plexapi.sdk.models.operations.async.GetUsersRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetUsersResponse;
import dev.plexapi.sdk.operations.GetUsers;
import java.lang.String;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
public class AsyncUsers {
private final SDKConfiguration sdkConfiguration;
private final Users syncSDK;
AsyncUsers(Users syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Users sync() {
return syncSDK;
}
/**
* Get list of all connected users
*
* <p>Get list of all users that are friends and have library access with the provided Plex authentication token
*
* @return The async call builder
*/
public GetUsersRequestBuilder getUsers() {
return new GetUsersRequestBuilder(sdkConfiguration);
}
/**
* Get list of all connected users
*
* <p>Get list of all users that are friends and have library access with the provided Plex authentication token
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetUsersResponse&gt; - The async response
*/
public CompletableFuture<GetUsersResponse> getUsers(GetUsersRequest request) {
return getUsers(request, Optional.empty());
}
/**
* Get list of all connected users
*
* <p>Get list of all users that are friends and have library access with the provided Plex authentication token
*
* @param request The request object containing all the parameters for the API call.
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;GetUsersResponse&gt; - The async response
*/
public CompletableFuture<GetUsersResponse> getUsers(GetUsersRequest request, Optional<String> serverURL) {
AsyncRequestOperation<GetUsersRequest, GetUsersResponse> operation
= new GetUsers.Async(sdkConfiguration, serverURL);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,93 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetTimelineRequest;
import dev.plexapi.sdk.models.operations.StartUniversalTranscodeRequest;
import dev.plexapi.sdk.models.operations.async.GetTimelineRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetTimelineResponse;
import dev.plexapi.sdk.models.operations.async.StartUniversalTranscodeRequestBuilder;
import dev.plexapi.sdk.models.operations.async.StartUniversalTranscodeResponse;
import dev.plexapi.sdk.operations.GetTimeline;
import dev.plexapi.sdk.operations.StartUniversalTranscode;
import java.util.concurrent.CompletableFuture;
/**
* API Calls that perform operations with Plex Media Server Videos
*/
public class AsyncVideo {
private final SDKConfiguration sdkConfiguration;
private final Video syncSDK;
AsyncVideo(Video syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Video sync() {
return syncSDK;
}
/**
* Get the timeline for a media item
*
* <p>Get the timeline for a media item
*
* @return The async call builder
*/
public GetTimelineRequestBuilder getTimeline() {
return new GetTimelineRequestBuilder(sdkConfiguration);
}
/**
* Get the timeline for a media item
*
* <p>Get the timeline for a media item
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetTimelineResponse&gt; - The async response
*/
public CompletableFuture<GetTimelineResponse> getTimeline(GetTimelineRequest request) {
AsyncRequestOperation<GetTimelineRequest, GetTimelineResponse> operation
= new GetTimeline.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
/**
* Start Universal Transcode
*
* <p>Begin a Universal Transcode Session
*
* @return The async call builder
*/
public StartUniversalTranscodeRequestBuilder startUniversalTranscode() {
return new StartUniversalTranscodeRequestBuilder(sdkConfiguration);
}
/**
* Start Universal Transcode
*
* <p>Begin a Universal Transcode Session
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;StartUniversalTranscodeResponse&gt; - The async response
*/
public CompletableFuture<StartUniversalTranscodeResponse> startUniversalTranscode(StartUniversalTranscodeRequest request) {
AsyncRequestOperation<StartUniversalTranscodeRequest, StartUniversalTranscodeResponse> operation
= new StartUniversalTranscode.Async(sdkConfiguration);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -0,0 +1,77 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk;
import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation;
import dev.plexapi.sdk.models.operations.GetWatchListRequest;
import dev.plexapi.sdk.models.operations.async.GetWatchListRequestBuilder;
import dev.plexapi.sdk.models.operations.async.GetWatchListResponse;
import dev.plexapi.sdk.operations.GetWatchList;
import java.lang.String;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
/**
* API Calls that perform operations with Plex Media Server Watchlists
*/
public class AsyncWatchlist {
private final SDKConfiguration sdkConfiguration;
private final Watchlist syncSDK;
AsyncWatchlist(Watchlist syncSDK, SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.syncSDK = syncSDK;
}
/**
* Switches to the sync SDK.
*
* @return The sync SDK
*/
public Watchlist sync() {
return syncSDK;
}
/**
* Get User Watchlist
*
* <p>Get User Watchlist
*
* @return The async call builder
*/
public GetWatchListRequestBuilder getWatchList() {
return new GetWatchListRequestBuilder(sdkConfiguration);
}
/**
* Get User Watchlist
*
* <p>Get User Watchlist
*
* @param request The request object containing all the parameters for the API call.
* @return CompletableFuture&lt;GetWatchListResponse&gt; - The async response
*/
public CompletableFuture<GetWatchListResponse> getWatchList(GetWatchListRequest request) {
return getWatchList(request, Optional.empty());
}
/**
* Get User Watchlist
*
* <p>Get User Watchlist
*
* @param request The request object containing all the parameters for the API call.
* @param serverURL Overrides the server URL.
* @return CompletableFuture&lt;GetWatchListResponse&gt; - The async response
*/
public CompletableFuture<GetWatchListResponse> getWatchList(GetWatchListRequest request, Optional<String> serverURL) {
AsyncRequestOperation<GetWatchListRequest, GetWatchListResponse> operation
= new GetWatchList.Async(sdkConfiguration, serverURL);
return operation.doRequest(request)
.thenCompose(operation::handleResponse);
}
}

View File

@@ -3,22 +3,14 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetSourceConnectionInformationBadRequest;
import dev.plexapi.sdk.models.errors.GetSourceConnectionInformationUnauthorized;
import dev.plexapi.sdk.models.errors.GetTokenDetailsBadRequest;
import dev.plexapi.sdk.models.errors.GetTokenDetailsUnauthorized;
import dev.plexapi.sdk.models.errors.GetTransientTokenBadRequest;
import dev.plexapi.sdk.models.errors.GetTransientTokenUnauthorized;
import dev.plexapi.sdk.models.errors.PostUsersSignInDataBadRequest;
import dev.plexapi.sdk.models.errors.PostUsersSignInDataUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import static dev.plexapi.sdk.operations.Operations.RequestlessOperation;
import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationRequest;
import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationRequestBuilder;
import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationResponse;
import dev.plexapi.sdk.models.operations.GetTokenDetailsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetTokenDetailsResponse;
import dev.plexapi.sdk.models.operations.GetTokenDetailsUserPlexAccount;
import dev.plexapi.sdk.models.operations.GetTransientTokenQueryParamType;
import dev.plexapi.sdk.models.operations.GetTransientTokenRequest;
import dev.plexapi.sdk.models.operations.GetTransientTokenRequestBuilder;
@@ -26,56 +18,35 @@ import dev.plexapi.sdk.models.operations.GetTransientTokenResponse;
import dev.plexapi.sdk.models.operations.PostUsersSignInDataRequest;
import dev.plexapi.sdk.models.operations.PostUsersSignInDataRequestBuilder;
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.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.SerializedBody;
import dev.plexapi.sdk.utils.Utils.JsonShape;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetSourceConnectionInformation;
import dev.plexapi.sdk.operations.GetTokenDetails;
import dev.plexapi.sdk.operations.GetTransientToken;
import dev.plexapi.sdk.operations.PostUsersSignInData;
import java.lang.Exception;
import java.lang.Object;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
/**
* API Calls regarding authentication for Plex Media Server
*/
public class Authentication implements
MethodCallGetTransientToken,
MethodCallGetSourceConnectionInformation,
MethodCallGetTokenDetails,
MethodCallPostUsersSignInData {
/**
* GET_TOKEN_DETAILS_SERVERS contains the list of server urls available to the SDK.
*/
public static final String[] GET_TOKEN_DETAILS_SERVERS = {
"https://plex.tv/api/v2",
};
/**
* POST_USERS_SIGN_IN_DATA_SERVERS contains the list of server urls available to the SDK.
*/
public static final String[] POST_USERS_SIGN_IN_DATA_SERVERS = {
"https://plex.tv/api/v2",
};
public class Authentication {
private final SDKConfiguration sdkConfiguration;
private final AsyncAuthentication asyncSDK;
Authentication(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncAuthentication(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncAuthentication async() {
return asyncSDK;
}
/**
* Get a Transient Token
@@ -85,7 +56,7 @@ public class Authentication implements
* @return The call builder
*/
public GetTransientTokenRequestBuilder getTransientToken() {
return new GetTransientTokenRequestBuilder(this);
return new GetTransientTokenRequestBuilder(sdkConfiguration);
}
/**
@@ -98,157 +69,18 @@ public class Authentication implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetTransientTokenResponse getTransientToken(
GetTransientTokenQueryParamType type,
Scope scope) throws Exception {
public GetTransientTokenResponse getTransientToken(GetTransientTokenQueryParamType type, Scope scope) throws Exception {
GetTransientTokenRequest request =
GetTransientTokenRequest
.builder()
.type(type)
.scope(scope)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/security/token");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetTransientTokenRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTransientToken",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getTransientToken",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTransientToken",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTransientToken",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetTransientTokenResponse.Builder _resBuilder =
GetTransientTokenResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetTransientTokenResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTransientTokenBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTransientTokenBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTransientTokenUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTransientTokenUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetTransientTokenRequest, GetTransientTokenResponse> operation
= new GetTransientToken.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Source Connection Information
*
@@ -258,7 +90,7 @@ public class Authentication implements
* @return The call builder
*/
public GetSourceConnectionInformationRequestBuilder getSourceConnectionInformation() {
return new GetSourceConnectionInformationRequestBuilder(this);
return new GetSourceConnectionInformationRequestBuilder(sdkConfiguration);
}
/**
@@ -271,155 +103,17 @@ public class Authentication implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetSourceConnectionInformationResponse getSourceConnectionInformation(
String source) throws Exception {
public GetSourceConnectionInformationResponse getSourceConnectionInformation(String source) throws Exception {
GetSourceConnectionInformationRequest request =
GetSourceConnectionInformationRequest
.builder()
.source(source)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/security/resources");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetSourceConnectionInformationRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSourceConnectionInformation",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getSourceConnectionInformation",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSourceConnectionInformation",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSourceConnectionInformation",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetSourceConnectionInformationResponse.Builder _resBuilder =
GetSourceConnectionInformationResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetSourceConnectionInformationResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSourceConnectionInformationBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSourceConnectionInformationBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSourceConnectionInformationUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSourceConnectionInformationUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetSourceConnectionInformationRequest, GetSourceConnectionInformationResponse> operation
= new GetSourceConnectionInformation.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Token Details
*
@@ -428,7 +122,7 @@ public class Authentication implements
* @return The call builder
*/
public GetTokenDetailsRequestBuilder getTokenDetails() {
return new GetTokenDetailsRequestBuilder(this);
return new GetTokenDetailsRequestBuilder(sdkConfiguration);
}
/**
@@ -442,7 +136,7 @@ public class Authentication implements
public GetTokenDetailsResponse getTokenDetailsDirect() throws Exception {
return getTokenDetails(Optional.empty());
}
/**
* Get Token Details
*
@@ -452,159 +146,12 @@ public class Authentication implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetTokenDetailsResponse getTokenDetails(
Optional<String> serverURL) throws Exception {
final String _baseUrl;
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
} else {
_baseUrl = Utils.templateUrl(GET_TOKEN_DETAILS_SERVERS[0], new HashMap<String, String>());
}
String _url = Utils.generateURL(
_baseUrl,
"/user");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTokenDetails",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getTokenDetails",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTokenDetails",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTokenDetails",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetTokenDetailsResponse.Builder _resBuilder =
GetTokenDetailsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetTokenDetailsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTokenDetailsUserPlexAccount _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTokenDetailsUserPlexAccount>() {});
_res.withUserPlexAccount(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTokenDetailsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTokenDetailsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTokenDetailsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTokenDetailsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public GetTokenDetailsResponse getTokenDetails(Optional<String> serverURL) throws Exception {
RequestlessOperation<GetTokenDetailsResponse> operation
= new GetTokenDetails.Sync(sdkConfiguration, serverURL);
return operation.handleResponse(operation.doRequest());
}
/**
* Get User Sign In Data
*
@@ -613,7 +160,7 @@ public class Authentication implements
* @return The call builder
*/
public PostUsersSignInDataRequestBuilder postUsersSignInData() {
return new PostUsersSignInDataRequestBuilder(this);
return new PostUsersSignInDataRequestBuilder(sdkConfiguration);
}
/**
@@ -621,183 +168,28 @@ public class Authentication implements
*
* <p>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 request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public PostUsersSignInDataResponse postUsersSignInData(
PostUsersSignInDataRequest request) throws Exception {
public PostUsersSignInDataResponse postUsersSignInData(PostUsersSignInDataRequest request) throws Exception {
return postUsersSignInData(request, Optional.empty());
}
/**
* Get User Sign In Data
*
* <p>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 request The request object containing all the parameters for the API call.
* @param serverURL Overrides the server URL.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public PostUsersSignInDataResponse postUsersSignInData(
PostUsersSignInDataRequest request,
Optional<String> serverURL) throws Exception {
final String _baseUrl;
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
} else {
_baseUrl = Utils.templateUrl(POST_USERS_SIGN_IN_DATA_SERVERS[0], new HashMap<String, String>());
}
String _url = Utils.generateURL(
_baseUrl,
"/users/signin");
HTTPRequest _req = new HTTPRequest(_url, "POST");
Object _convertedRequest = Utils.convertToShape(
request,
JsonShape.DEFAULT,
new TypeReference<PostUsersSignInDataRequest>() {});
SerializedBody _serializedRequestBody = Utils.serializeRequestBody(
_convertedRequest,
"requestBody",
"form",
false);
_req.setBody(Optional.ofNullable(_serializedRequestBody));
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addHeaders(Utils.getHeadersFromMetadata(request, null));
Optional<SecuritySource> _hookSecuritySource = Optional.empty();
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"post-users-sign-in-data",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"post-users-sign-in-data",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"post-users-sign-in-data",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"post-users-sign-in-data",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
PostUsersSignInDataResponse.Builder _resBuilder =
PostUsersSignInDataResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
PostUsersSignInDataResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "201")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
PostUsersSignInDataUserPlexAccount _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<PostUsersSignInDataUserPlexAccount>() {});
_res.withUserPlexAccount(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
PostUsersSignInDataBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<PostUsersSignInDataBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
PostUsersSignInDataUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<PostUsersSignInDataUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public PostUsersSignInDataResponse postUsersSignInData(PostUsersSignInDataRequest request, Optional<String> serverURL) throws Exception {
RequestOperation<PostUsersSignInDataRequest, PostUsersSignInDataResponse> operation
= new PostUsersSignInData.Sync(sdkConfiguration, serverURL);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -3,23 +3,12 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetButlerTasksBadRequest;
import dev.plexapi.sdk.models.errors.GetButlerTasksUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import dev.plexapi.sdk.models.errors.StartAllTasksBadRequest;
import dev.plexapi.sdk.models.errors.StartAllTasksUnauthorized;
import dev.plexapi.sdk.models.errors.StartTaskBadRequest;
import dev.plexapi.sdk.models.errors.StartTaskUnauthorized;
import dev.plexapi.sdk.models.errors.StopAllTasksBadRequest;
import dev.plexapi.sdk.models.errors.StopAllTasksUnauthorized;
import dev.plexapi.sdk.models.errors.StopTaskBadRequest;
import dev.plexapi.sdk.models.errors.StopTaskUnauthorized;
import static dev.plexapi.sdk.operations.Operations.RequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetButlerTasksRequestBuilder;
import dev.plexapi.sdk.models.operations.GetButlerTasksResponse;
import dev.plexapi.sdk.models.operations.GetButlerTasksResponseBody;
import dev.plexapi.sdk.models.operations.PathParamTaskName;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
import dev.plexapi.sdk.models.operations.StartAllTasksRequestBuilder;
import dev.plexapi.sdk.models.operations.StartAllTasksResponse;
import dev.plexapi.sdk.models.operations.StartTaskRequest;
@@ -31,36 +20,33 @@ 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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetButlerTasks;
import dev.plexapi.sdk.operations.StartAllTasks;
import dev.plexapi.sdk.operations.StartTask;
import dev.plexapi.sdk.operations.StopAllTasks;
import dev.plexapi.sdk.operations.StopTask;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* Butler is the task manager of the Plex Media Server Ecosystem.
*/
public class Butler implements
MethodCallGetButlerTasks,
MethodCallStartAllTasks,
MethodCallStopAllTasks,
MethodCallStartTask,
MethodCallStopTask {
public class Butler {
private final SDKConfiguration sdkConfiguration;
private final AsyncButler asyncSDK;
Butler(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncButler(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncButler async() {
return asyncSDK;
}
/**
* Get Butler tasks
@@ -70,7 +56,7 @@ public class Butler implements
* @return The call builder
*/
public GetButlerTasksRequestBuilder getButlerTasks() {
return new GetButlerTasksRequestBuilder(this);
return new GetButlerTasksRequestBuilder(sdkConfiguration);
}
/**
@@ -82,153 +68,11 @@ public class Butler implements
* @throws Exception if the API call fails
*/
public GetButlerTasksResponse getButlerTasksDirect() throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/butler");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getButlerTasks",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getButlerTasks",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getButlerTasks",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getButlerTasks",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetButlerTasksResponse.Builder _resBuilder =
GetButlerTasksResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetButlerTasksResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetButlerTasksResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetButlerTasksResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetButlerTasksBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetButlerTasksBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetButlerTasksUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetButlerTasksUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestlessOperation<GetButlerTasksResponse> operation
= new GetButlerTasks.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest());
}
/**
* Start all Butler tasks
*
@@ -241,7 +85,7 @@ public class Butler implements
* @return The call builder
*/
public StartAllTasksRequestBuilder startAllTasks() {
return new StartAllTasksRequestBuilder(this);
return new StartAllTasksRequestBuilder(sdkConfiguration);
}
/**
@@ -257,142 +101,11 @@ public class Butler implements
* @throws Exception if the API call fails
*/
public StartAllTasksResponse startAllTasksDirect() throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/butler");
HTTPRequest _req = new HTTPRequest(_url, "POST");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"startAllTasks",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"startAllTasks",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"startAllTasks",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"startAllTasks",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
StartAllTasksResponse.Builder _resBuilder =
StartAllTasksResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
StartAllTasksResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StartAllTasksBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StartAllTasksBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StartAllTasksUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StartAllTasksUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestlessOperation<StartAllTasksResponse> operation
= new StartAllTasks.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest());
}
/**
* Stop all Butler tasks
*
@@ -401,7 +114,7 @@ public class Butler implements
* @return The call builder
*/
public StopAllTasksRequestBuilder stopAllTasks() {
return new StopAllTasksRequestBuilder(this);
return new StopAllTasksRequestBuilder(sdkConfiguration);
}
/**
@@ -413,142 +126,11 @@ public class Butler implements
* @throws Exception if the API call fails
*/
public StopAllTasksResponse stopAllTasksDirect() throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/butler");
HTTPRequest _req = new HTTPRequest(_url, "DELETE");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopAllTasks",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"stopAllTasks",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopAllTasks",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopAllTasks",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
StopAllTasksResponse.Builder _resBuilder =
StopAllTasksResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
StopAllTasksResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StopAllTasksBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StopAllTasksBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StopAllTasksUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StopAllTasksUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestlessOperation<StopAllTasksResponse> operation
= new StopAllTasks.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest());
}
/**
* Start a single Butler task
*
@@ -561,7 +143,7 @@ public class Butler implements
* @return The call builder
*/
public StartTaskRequestBuilder startTask() {
return new StartTaskRequestBuilder(this);
return new StartTaskRequestBuilder(sdkConfiguration);
}
/**
@@ -577,152 +159,17 @@ public class Butler implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StartTaskResponse startTask(
TaskName taskName) throws Exception {
public StartTaskResponse startTask(TaskName taskName) throws Exception {
StartTaskRequest request =
StartTaskRequest
.builder()
.taskName(taskName)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
StartTaskRequest.class,
_baseUrl,
"/butler/{taskName}",
request, null);
HTTPRequest _req = new HTTPRequest(_url, "POST");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"startTask",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"startTask",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"startTask",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"startTask",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
StartTaskResponse.Builder _resBuilder =
StartTaskResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
StartTaskResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200", "202")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StartTaskBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StartTaskBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StartTaskUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StartTaskUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<StartTaskRequest, StartTaskResponse> operation
= new StartTask.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Stop a single Butler task
*
@@ -731,7 +178,7 @@ public class Butler implements
* @return The call builder
*/
public StopTaskRequestBuilder stopTask() {
return new StopTaskRequestBuilder(this);
return new StopTaskRequestBuilder(sdkConfiguration);
}
/**
@@ -743,148 +190,15 @@ public class Butler implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StopTaskResponse stopTask(
PathParamTaskName taskName) throws Exception {
public StopTaskResponse stopTask(PathParamTaskName taskName) throws Exception {
StopTaskRequest request =
StopTaskRequest
.builder()
.taskName(taskName)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
StopTaskRequest.class,
_baseUrl,
"/butler/{taskName}",
request, null);
HTTPRequest _req = new HTTPRequest(_url, "DELETE");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopTask",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"stopTask",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopTask",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopTask",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
StopTaskResponse.Builder _resBuilder =
StopTaskResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
StopTaskResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StopTaskBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StopTaskBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StopTaskUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StopTaskUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "404", "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<StopTaskRequest, StopTaskResponse> operation
= new StopTask.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -3,56 +3,46 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetGlobalHubsBadRequest;
import dev.plexapi.sdk.models.errors.GetGlobalHubsUnauthorized;
import dev.plexapi.sdk.models.errors.GetLibraryHubsBadRequest;
import dev.plexapi.sdk.models.errors.GetLibraryHubsUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetGlobalHubsRequest;
import dev.plexapi.sdk.models.operations.GetGlobalHubsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetGlobalHubsResponse;
import dev.plexapi.sdk.models.operations.GetGlobalHubsResponseBody;
import dev.plexapi.sdk.models.operations.GetLibraryHubsRequest;
import dev.plexapi.sdk.models.operations.GetLibraryHubsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetLibraryHubsResponse;
import dev.plexapi.sdk.models.operations.GetLibraryHubsResponseBody;
import dev.plexapi.sdk.models.operations.GetRecentlyAddedRequest;
import dev.plexapi.sdk.models.operations.GetRecentlyAddedRequestBuilder;
import dev.plexapi.sdk.models.operations.GetRecentlyAddedResponse;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetGlobalHubs;
import dev.plexapi.sdk.operations.GetLibraryHubs;
import dev.plexapi.sdk.operations.GetRecentlyAdded;
import java.lang.Double;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* Hubs are a structured two-dimensional container for media, generally represented by multiple horizontal rows.
*/
public class Hubs implements
MethodCallGetGlobalHubs,
MethodCallGetRecentlyAdded,
MethodCallGetLibraryHubs {
public class Hubs {
private final SDKConfiguration sdkConfiguration;
private final AsyncHubs asyncSDK;
Hubs(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncHubs(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncHubs async() {
return asyncSDK;
}
/**
* Get Global Hubs
@@ -62,7 +52,7 @@ public class Hubs implements
* @return The call builder
*/
public GetGlobalHubsRequestBuilder getGlobalHubs() {
return new GetGlobalHubsRequestBuilder(this);
return new GetGlobalHubsRequestBuilder(sdkConfiguration);
}
/**
@@ -76,7 +66,7 @@ public class Hubs implements
public GetGlobalHubsResponse getGlobalHubsDirect() throws Exception {
return getGlobalHubs(Optional.empty(), Optional.empty());
}
/**
* Get Global Hubs
*
@@ -87,168 +77,18 @@ public class Hubs implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetGlobalHubsResponse getGlobalHubs(
Optional<Double> count,
Optional<? extends OnlyTransient> onlyTransient) throws Exception {
public GetGlobalHubsResponse getGlobalHubs(Optional<Double> count, Optional<? extends OnlyTransient> onlyTransient) throws Exception {
GetGlobalHubsRequest request =
GetGlobalHubsRequest
.builder()
.count(count)
.onlyTransient(onlyTransient)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/hubs");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetGlobalHubsRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getGlobalHubs",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getGlobalHubs",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getGlobalHubs",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getGlobalHubs",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetGlobalHubsResponse.Builder _resBuilder =
GetGlobalHubsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetGlobalHubsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetGlobalHubsResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetGlobalHubsResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetGlobalHubsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetGlobalHubsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetGlobalHubsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetGlobalHubsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetGlobalHubsRequest, GetGlobalHubsResponse> operation
= new GetGlobalHubs.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Recently Added
*
@@ -257,7 +97,7 @@ public class Hubs implements
* @return The call builder
*/
public GetRecentlyAddedRequestBuilder getRecentlyAdded() {
return new GetRecentlyAddedRequestBuilder(this);
return new GetRecentlyAddedRequestBuilder(sdkConfiguration);
}
/**
@@ -265,132 +105,16 @@ public class Hubs implements
*
* <p>This endpoint will return the recently added content.
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetRecentlyAddedResponse getRecentlyAdded(
GetRecentlyAddedRequest request) throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/hubs/home/recentlyAdded");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetRecentlyAddedRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-recently-added",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"get-recently-added",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-recently-added",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-recently-added",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetRecentlyAddedResponse.Builder _resBuilder =
GetRecentlyAddedResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetRecentlyAddedResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetRecentlyAddedResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetRecentlyAddedResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public GetRecentlyAddedResponse getRecentlyAdded(GetRecentlyAddedRequest request) throws Exception {
RequestOperation<GetRecentlyAddedRequest, GetRecentlyAddedResponse> operation
= new GetRecentlyAdded.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get library specific hubs
*
@@ -399,7 +123,7 @@ public class Hubs implements
* @return The call builder
*/
public GetLibraryHubsRequestBuilder getLibraryHubs() {
return new GetLibraryHubsRequestBuilder(this);
return new GetLibraryHubsRequestBuilder(sdkConfiguration);
}
/**
@@ -411,11 +135,10 @@ public class Hubs implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetLibraryHubsResponse getLibraryHubs(
double sectionId) throws Exception {
public GetLibraryHubsResponse getLibraryHubs(double sectionId) throws Exception {
return getLibraryHubs(sectionId, Optional.empty(), Optional.empty());
}
/**
* Get library specific hubs
*
@@ -428,8 +151,7 @@ public class Hubs implements
* @throws Exception if the API call fails
*/
public GetLibraryHubsResponse getLibraryHubs(
double sectionId,
Optional<Double> count,
double sectionId, Optional<Double> count,
Optional<? extends QueryParamOnlyTransient> onlyTransient) throws Exception {
GetLibraryHubsRequest request =
GetLibraryHubsRequest
@@ -438,157 +160,9 @@ public class Hubs implements
.count(count)
.onlyTransient(onlyTransient)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
GetLibraryHubsRequest.class,
_baseUrl,
"/hubs/sections/{sectionId}",
request, null);
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetLibraryHubsRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getLibraryHubs",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getLibraryHubs",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getLibraryHubs",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getLibraryHubs",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetLibraryHubsResponse.Builder _resBuilder =
GetLibraryHubsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetLibraryHubsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetLibraryHubsResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetLibraryHubsResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetLibraryHubsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetLibraryHubsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetLibraryHubsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetLibraryHubsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetLibraryHubsRequest, GetLibraryHubsResponse> operation
= new GetLibraryHubs.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,14 +3,9 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.EnablePaperTrailBadRequest;
import dev.plexapi.sdk.models.errors.EnablePaperTrailUnauthorized;
import dev.plexapi.sdk.models.errors.LogLineBadRequest;
import dev.plexapi.sdk.models.errors.LogLineUnauthorized;
import dev.plexapi.sdk.models.errors.LogMultiLineBadRequest;
import dev.plexapi.sdk.models.errors.LogMultiLineUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import static dev.plexapi.sdk.operations.Operations.RequestlessOperation;
import dev.plexapi.sdk.models.operations.EnablePaperTrailRequestBuilder;
import dev.plexapi.sdk.models.operations.EnablePaperTrailResponse;
import dev.plexapi.sdk.models.operations.Level;
@@ -19,38 +14,32 @@ import dev.plexapi.sdk.models.operations.LogLineRequestBuilder;
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.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.SerializedBody;
import dev.plexapi.sdk.utils.Utils.JsonShape;
import dev.plexapi.sdk.utils.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.EnablePaperTrail;
import dev.plexapi.sdk.operations.LogLine;
import dev.plexapi.sdk.operations.LogMultiLine;
import java.lang.Exception;
import java.lang.Object;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* Submit logs to the Log Handler for Plex Media Server
*/
public class Log implements
MethodCallLogLine,
MethodCallLogMultiLine,
MethodCallEnablePaperTrail {
public class Log {
private final SDKConfiguration sdkConfiguration;
private final AsyncLog asyncSDK;
Log(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncLog(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncLog async() {
return asyncSDK;
}
/**
* Logging a single line message.
@@ -60,7 +49,7 @@ public class Log implements
* @return The call builder
*/
public LogLineRequestBuilder logLine() {
return new LogLineRequestBuilder(this);
return new LogLineRequestBuilder(sdkConfiguration);
}
/**
@@ -81,8 +70,7 @@ public class Log implements
* @throws Exception if the API call fails
*/
public LogLineResponse logLine(
Level level,
String message,
Level level, String message,
String source) throws Exception {
LogLineRequest request =
LogLineRequest
@@ -91,148 +79,11 @@ public class Log implements
.message(message)
.source(source)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/log");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
LogLineRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"logLine",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"logLine",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"logLine",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"logLine",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
LogLineResponse.Builder _resBuilder =
LogLineResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
LogLineResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
LogLineBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<LogLineBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
LogLineUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<LogLineUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<LogLineRequest, LogLineResponse> operation
= new LogLine.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Logging a multi-line message
*
@@ -261,7 +112,7 @@ public class Log implements
* @return The call builder
*/
public LogMultiLineRequestBuilder logMultiLine() {
return new LogMultiLineRequestBuilder(this);
return new LogMultiLineRequestBuilder(sdkConfiguration);
}
/**
@@ -289,161 +140,16 @@ public class Log implements
*
* <p>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 request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public LogMultiLineResponse logMultiLine(
String request) throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/log");
HTTPRequest _req = new HTTPRequest(_url, "POST");
Object _convertedRequest = Utils.convertToShape(
request,
JsonShape.DEFAULT,
new TypeReference<String>() {});
SerializedBody _serializedRequestBody = Utils.serializeRequestBody(
_convertedRequest,
"request",
"string",
false);
if (_serializedRequestBody == null) {
throw new Exception("Request body is required");
}
_req.setBody(Optional.ofNullable(_serializedRequestBody));
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"logMultiLine",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"logMultiLine",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"logMultiLine",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"logMultiLine",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
LogMultiLineResponse.Builder _resBuilder =
LogMultiLineResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
LogMultiLineResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
LogMultiLineBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<LogMultiLineBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
LogMultiLineUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<LogMultiLineUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public LogMultiLineResponse logMultiLine(String request) throws Exception {
RequestOperation<String, LogMultiLineResponse> operation
= new LogMultiLine.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Enabling Papertrail
*
@@ -452,7 +158,7 @@ public class Log implements
* @return The call builder
*/
public EnablePaperTrailRequestBuilder enablePaperTrail() {
return new EnablePaperTrailRequestBuilder(this);
return new EnablePaperTrailRequestBuilder(sdkConfiguration);
}
/**
@@ -464,138 +170,9 @@ public class Log implements
* @throws Exception if the API call fails
*/
public EnablePaperTrailResponse enablePaperTrailDirect() throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/log/networked");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"enablePaperTrail",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"enablePaperTrail",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"enablePaperTrail",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"enablePaperTrail",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
EnablePaperTrailResponse.Builder _resBuilder =
EnablePaperTrailResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
EnablePaperTrailResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
EnablePaperTrailBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<EnablePaperTrailBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
EnablePaperTrailUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<EnablePaperTrailUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "403", "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestlessOperation<EnablePaperTrailResponse> operation
= new EnablePaperTrail.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest());
}
}

View File

@@ -3,18 +3,8 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetBannerImageBadRequest;
import dev.plexapi.sdk.models.errors.GetBannerImageUnauthorized;
import dev.plexapi.sdk.models.errors.GetThumbImageBadRequest;
import dev.plexapi.sdk.models.errors.GetThumbImageUnauthorized;
import dev.plexapi.sdk.models.errors.MarkPlayedBadRequest;
import dev.plexapi.sdk.models.errors.MarkPlayedUnauthorized;
import dev.plexapi.sdk.models.errors.MarkUnplayedBadRequest;
import dev.plexapi.sdk.models.errors.MarkUnplayedUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import dev.plexapi.sdk.models.errors.UpdatePlayProgressBadRequest;
import dev.plexapi.sdk.models.errors.UpdatePlayProgressUnauthorized;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetBannerImageRequest;
import dev.plexapi.sdk.models.operations.GetBannerImageRequestBuilder;
import dev.plexapi.sdk.models.operations.GetBannerImageResponse;
@@ -27,40 +17,37 @@ import dev.plexapi.sdk.models.operations.MarkPlayedResponse;
import dev.plexapi.sdk.models.operations.MarkUnplayedRequest;
import dev.plexapi.sdk.models.operations.MarkUnplayedRequestBuilder;
import dev.plexapi.sdk.models.operations.MarkUnplayedResponse;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetBannerImage;
import dev.plexapi.sdk.operations.GetThumbImage;
import dev.plexapi.sdk.operations.MarkPlayed;
import dev.plexapi.sdk.operations.MarkUnplayed;
import dev.plexapi.sdk.operations.UpdatePlayProgress;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* API Calls interacting with Plex Media Server Media
*/
public class Media implements
MethodCallMarkPlayed,
MethodCallMarkUnplayed,
MethodCallUpdatePlayProgress,
MethodCallGetBannerImage,
MethodCallGetThumbImage {
public class Media {
private final SDKConfiguration sdkConfiguration;
private final AsyncMedia asyncSDK;
Media(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncMedia(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncMedia async() {
return asyncSDK;
}
/**
* Mark Media Played
@@ -70,7 +57,7 @@ public class Media implements
* @return The call builder
*/
public MarkPlayedRequestBuilder markPlayed() {
return new MarkPlayedRequestBuilder(this);
return new MarkPlayedRequestBuilder(sdkConfiguration);
}
/**
@@ -82,155 +69,17 @@ public class Media implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public MarkPlayedResponse markPlayed(
double key) throws Exception {
public MarkPlayedResponse markPlayed(double key) throws Exception {
MarkPlayedRequest request =
MarkPlayedRequest
.builder()
.key(key)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/:/scrobble");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
MarkPlayedRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"markPlayed",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"markPlayed",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"markPlayed",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"markPlayed",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
MarkPlayedResponse.Builder _resBuilder =
MarkPlayedResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
MarkPlayedResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
MarkPlayedBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<MarkPlayedBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
MarkPlayedUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<MarkPlayedUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<MarkPlayedRequest, MarkPlayedResponse> operation
= new MarkPlayed.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Mark Media Unplayed
*
@@ -239,7 +88,7 @@ public class Media implements
* @return The call builder
*/
public MarkUnplayedRequestBuilder markUnplayed() {
return new MarkUnplayedRequestBuilder(this);
return new MarkUnplayedRequestBuilder(sdkConfiguration);
}
/**
@@ -251,155 +100,17 @@ public class Media implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public MarkUnplayedResponse markUnplayed(
double key) throws Exception {
public MarkUnplayedResponse markUnplayed(double key) throws Exception {
MarkUnplayedRequest request =
MarkUnplayedRequest
.builder()
.key(key)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/:/unscrobble");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
MarkUnplayedRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"markUnplayed",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"markUnplayed",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"markUnplayed",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"markUnplayed",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
MarkUnplayedResponse.Builder _resBuilder =
MarkUnplayedResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
MarkUnplayedResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
MarkUnplayedBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<MarkUnplayedBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
MarkUnplayedUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<MarkUnplayedUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<MarkUnplayedRequest, MarkUnplayedResponse> operation
= new MarkUnplayed.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Update Media Play Progress
*
@@ -408,7 +119,7 @@ public class Media implements
* @return The call builder
*/
public UpdatePlayProgressRequestBuilder updatePlayProgress() {
return new UpdatePlayProgressRequestBuilder(this);
return new UpdatePlayProgressRequestBuilder(sdkConfiguration);
}
/**
@@ -423,8 +134,7 @@ public class Media implements
* @throws Exception if the API call fails
*/
public UpdatePlayProgressResponse updatePlayProgress(
String key,
double time,
String key, double time,
String state) throws Exception {
UpdatePlayProgressRequest request =
UpdatePlayProgressRequest
@@ -433,148 +143,11 @@ public class Media implements
.time(time)
.state(state)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/:/progress");
HTTPRequest _req = new HTTPRequest(_url, "POST");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
UpdatePlayProgressRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"updatePlayProgress",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"updatePlayProgress",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"updatePlayProgress",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"updatePlayProgress",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
UpdatePlayProgressResponse.Builder _resBuilder =
UpdatePlayProgressResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
UpdatePlayProgressResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
UpdatePlayProgressBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<UpdatePlayProgressBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
UpdatePlayProgressUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<UpdatePlayProgressUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<UpdatePlayProgressRequest, UpdatePlayProgressResponse> operation
= new UpdatePlayProgress.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Banner Image
*
@@ -583,7 +156,7 @@ public class Media implements
* @return The call builder
*/
public GetBannerImageRequestBuilder getBannerImage() {
return new GetBannerImageRequestBuilder(this);
return new GetBannerImageRequestBuilder(sdkConfiguration);
}
/**
@@ -591,167 +164,16 @@ public class Media implements
*
* <p>Gets the banner image of the media item
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetBannerImageResponse getBannerImage(
GetBannerImageRequest request) throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
GetBannerImageRequest.class,
_baseUrl,
"/library/metadata/{ratingKey}/banner",
request, null);
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "image/jpeg")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetBannerImageRequest.class,
request,
null));
_req.addHeaders(Utils.getHeadersFromMetadata(request, null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-banner-image",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"get-banner-image",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-banner-image",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-banner-image",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetBannerImageResponse.Builder _resBuilder =
GetBannerImageResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200") && Utils.contentTypeMatches(_contentType, "image/jpeg")) {
_resBuilder.responseStream(_httpRes.body());
}
GetBannerImageResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
_res.withHeaders(_httpRes.headers().map());
if (Utils.contentTypeMatches(_contentType, "image/jpeg")) {
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetBannerImageBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetBannerImageBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetBannerImageUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetBannerImageUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public GetBannerImageResponse getBannerImage(GetBannerImageRequest request) throws Exception {
RequestOperation<GetBannerImageRequest, GetBannerImageResponse> operation
= new GetBannerImage.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Thumb Image
*
@@ -760,7 +182,7 @@ public class Media implements
* @return The call builder
*/
public GetThumbImageRequestBuilder getThumbImage() {
return new GetThumbImageRequestBuilder(this);
return new GetThumbImageRequestBuilder(sdkConfiguration);
}
/**
@@ -768,163 +190,14 @@ public class Media implements
*
* <p>Gets the thumbnail image of the media item
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetThumbImageResponse getThumbImage(
GetThumbImageRequest request) throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
GetThumbImageRequest.class,
_baseUrl,
"/library/metadata/{ratingKey}/thumb",
request, null);
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "image/jpeg")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetThumbImageRequest.class,
request,
null));
_req.addHeaders(Utils.getHeadersFromMetadata(request, null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-thumb-image",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"get-thumb-image",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-thumb-image",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-thumb-image",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetThumbImageResponse.Builder _resBuilder =
GetThumbImageResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200") && Utils.contentTypeMatches(_contentType, "image/jpeg")) {
_resBuilder.responseStream(_httpRes.body());
}
GetThumbImageResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
_res.withHeaders(_httpRes.headers().map());
if (Utils.contentTypeMatches(_contentType, "image/jpeg")) {
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetThumbImageBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetThumbImageBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetThumbImageUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetThumbImageUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public GetThumbImageResponse getThumbImage(GetThumbImageRequest request) throws Exception {
RequestOperation<GetThumbImageRequest, GetThumbImageResponse> operation
= new GetThumbImage.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.Hook.SdkInitData;
import dev.plexapi.sdk.utils.RetryConfig;
import dev.plexapi.sdk.utils.SpeakeasyHTTPClient;
import dev.plexapi.sdk.utils.Utils;
import java.lang.String;
import java.util.Map;
@@ -145,6 +146,7 @@ public class PlexAPI {
*/
private final Updater updater;
private final Users users;
/**
@@ -269,11 +271,13 @@ public class PlexAPI {
return updater;
}
public Users users() {
return users;
}
private SDKConfiguration sdkConfiguration;
private final SDKConfiguration sdkConfiguration;
private final AsyncPlexAPI asyncSDK;
/**
* The Builder class allows the configuration of a new instance of the SDK.
@@ -368,6 +372,23 @@ public class PlexAPI {
this.sdkConfiguration.setRetryConfig(Optional.of(retryConfig));
return this;
}
/**
* Enables debug logging for HTTP requests and responses, including JSON body content.
* <p>
* Convenience method that calls {@link HTTPClient#enableDebugLogging(boolean)}.
* {@link SpeakeasyHTTPClient} honors this setting. If you are using a custom HTTP client,
* it is up to the custom client to honor this setting.
* </p>
*
* @param enabled Whether to enable debug logging.
* @return The builder instance.
*/
public Builder enableHTTPDebugLogging(boolean enabled) {
this.sdkConfiguration.client().enableDebugLogging(enabled);
return this;
}
/**
* ServerProtocol
*
@@ -504,9 +525,22 @@ public class PlexAPI {
this.sessions = new Sessions(sdkConfiguration);
this.updater = new Updater(sdkConfiguration);
this.users = new Users(sdkConfiguration);
SdkInitData data = this.sdkConfiguration.hooks().sdkInit(new SdkInitData(this.sdkConfiguration.resolvedServerUrl(), this.sdkConfiguration.client()));
SdkInitData data = this.sdkConfiguration.hooks().sdkInit(
new SdkInitData(
this.sdkConfiguration.resolvedServerUrl(),
this.sdkConfiguration.client()));
this.sdkConfiguration.setServerUrl(data.baseUrl());
this.sdkConfiguration.setClient(data.client());
this.asyncSDK = new AsyncPlexAPI(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncPlexAPI async() {
return asyncSDK;
}
}

View File

@@ -4,6 +4,7 @@
package dev.plexapi.sdk;
import dev.plexapi.sdk.hooks.SDKHooks;
import dev.plexapi.sdk.utils.AsyncHooks;
import dev.plexapi.sdk.utils.HTTPClient;
import dev.plexapi.sdk.utils.Hooks;
import dev.plexapi.sdk.utils.RetryConfig;
@@ -16,13 +17,15 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
public 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.17.1";
public static final String GEN_VERSION = "2.623.0";
public static final String SDK_VERSION = "0.18.0";
public static final String GEN_VERSION = "2.698.4";
private static final String BASE_PACKAGE = "dev.plexapi.sdk";
public static final String USER_AGENT =
String.format("speakeasy-sdk/%s %s %s %s %s",
@@ -113,11 +116,12 @@ public class SDKConfiguration {
this._hooks = hooks;
}
/**
/**
* Initializes state (for example hooks).
**/
public void initialize() {
SDKHooks.initialize(_hooks);
SDKHooks.initialize(_asyncHooks);
}
@@ -130,9 +134,30 @@ public class SDKConfiguration {
public Optional<RetryConfig> retryConfig() {
return retryConfig;
}
public void setRetryConfig(Optional<RetryConfig> retryConfig) {
Utils.checkNotNull(retryConfig, "retryConfig");
this.retryConfig = retryConfig;
}
private ScheduledExecutorService retryScheduler = Executors.newSingleThreadScheduledExecutor();
public ScheduledExecutorService retryScheduler() {
return retryScheduler;
}
public void setAsyncRetryScheduler(ScheduledExecutorService retryScheduler) {
Utils.checkNotNull(retryScheduler, "retryScheduler");
this.retryScheduler = retryScheduler;
}
private AsyncHooks _asyncHooks = new AsyncHooks();
public AsyncHooks asyncHooks() {
return _asyncHooks;
}
public void setAsyncHooks(AsyncHooks asyncHooks) {
Utils.checkNotNull(asyncHooks, "asyncHooks");
this._asyncHooks = asyncHooks;
}
}

View File

@@ -3,54 +3,45 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetSearchResultsBadRequest;
import dev.plexapi.sdk.models.errors.GetSearchResultsUnauthorized;
import dev.plexapi.sdk.models.errors.PerformSearchBadRequest;
import dev.plexapi.sdk.models.errors.PerformSearchUnauthorized;
import dev.plexapi.sdk.models.errors.PerformVoiceSearchBadRequest;
import dev.plexapi.sdk.models.errors.PerformVoiceSearchUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetSearchResultsRequest;
import dev.plexapi.sdk.models.operations.GetSearchResultsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetSearchResultsResponse;
import dev.plexapi.sdk.models.operations.GetSearchResultsResponseBody;
import dev.plexapi.sdk.models.operations.PerformSearchRequest;
import dev.plexapi.sdk.models.operations.PerformSearchRequestBuilder;
import dev.plexapi.sdk.models.operations.PerformSearchResponse;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetSearchResults;
import dev.plexapi.sdk.operations.PerformSearch;
import dev.plexapi.sdk.operations.PerformVoiceSearch;
import java.lang.Double;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* API Calls that perform search operations with Plex Media Server
*/
public class Search implements
MethodCallPerformSearch,
MethodCallPerformVoiceSearch,
MethodCallGetSearchResults {
public class Search {
private final SDKConfiguration sdkConfiguration;
private final AsyncSearch asyncSDK;
Search(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncSearch(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncSearch async() {
return asyncSDK;
}
/**
* Perform a search
@@ -71,7 +62,7 @@ public class Search implements
* @return The call builder
*/
public PerformSearchRequestBuilder performSearch() {
return new PerformSearchRequestBuilder(this);
return new PerformSearchRequestBuilder(sdkConfiguration);
}
/**
@@ -94,11 +85,10 @@ public class Search implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public PerformSearchResponse performSearch(
String query) throws Exception {
public PerformSearchResponse performSearch(String query) throws Exception {
return performSearch(query, Optional.empty(), Optional.empty());
}
/**
* Perform a search
*
@@ -122,8 +112,7 @@ public class Search implements
* @throws Exception if the API call fails
*/
public PerformSearchResponse performSearch(
String query,
Optional<Double> sectionId,
String query, Optional<Double> sectionId,
Optional<Double> limit) throws Exception {
PerformSearchRequest request =
PerformSearchRequest
@@ -132,148 +121,11 @@ public class Search implements
.sectionId(sectionId)
.limit(limit)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/hubs/search");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
PerformSearchRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"performSearch",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"performSearch",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"performSearch",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"performSearch",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
PerformSearchResponse.Builder _resBuilder =
PerformSearchResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
PerformSearchResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
PerformSearchBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<PerformSearchBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
PerformSearchUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<PerformSearchUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<PerformSearchRequest, PerformSearchResponse> operation
= new PerformSearch.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Perform a voice search
*
@@ -285,7 +137,7 @@ public class Search implements
* @return The call builder
*/
public PerformVoiceSearchRequestBuilder performVoiceSearch() {
return new PerformVoiceSearchRequestBuilder(this);
return new PerformVoiceSearchRequestBuilder(sdkConfiguration);
}
/**
@@ -300,11 +152,10 @@ public class Search implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public PerformVoiceSearchResponse performVoiceSearch(
String query) throws Exception {
public PerformVoiceSearchResponse performVoiceSearch(String query) throws Exception {
return performVoiceSearch(query, Optional.empty(), Optional.empty());
}
/**
* Perform a voice search
*
@@ -320,8 +171,7 @@ public class Search implements
* @throws Exception if the API call fails
*/
public PerformVoiceSearchResponse performVoiceSearch(
String query,
Optional<Double> sectionId,
String query, Optional<Double> sectionId,
Optional<Double> limit) throws Exception {
PerformVoiceSearchRequest request =
PerformVoiceSearchRequest
@@ -330,148 +180,11 @@ public class Search implements
.sectionId(sectionId)
.limit(limit)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/hubs/search/voice");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
PerformVoiceSearchRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"performVoiceSearch",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"performVoiceSearch",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"performVoiceSearch",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"performVoiceSearch",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
PerformVoiceSearchResponse.Builder _resBuilder =
PerformVoiceSearchResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
PerformVoiceSearchResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
PerformVoiceSearchBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<PerformVoiceSearchBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
PerformVoiceSearchUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<PerformVoiceSearchUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<PerformVoiceSearchRequest, PerformVoiceSearchResponse> operation
= new PerformVoiceSearch.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Search Results
*
@@ -480,7 +193,7 @@ public class Search implements
* @return The call builder
*/
public GetSearchResultsRequestBuilder getSearchResults() {
return new GetSearchResultsRequestBuilder(this);
return new GetSearchResultsRequestBuilder(sdkConfiguration);
}
/**
@@ -492,162 +205,15 @@ public class Search implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetSearchResultsResponse getSearchResults(
String query) throws Exception {
public GetSearchResultsResponse getSearchResults(String query) throws Exception {
GetSearchResultsRequest request =
GetSearchResultsRequest
.builder()
.query(query)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/search");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetSearchResultsRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSearchResults",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getSearchResults",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSearchResults",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSearchResults",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetSearchResultsResponse.Builder _resBuilder =
GetSearchResultsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetSearchResultsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSearchResultsResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSearchResultsResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSearchResultsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSearchResultsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSearchResultsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSearchResultsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetSearchResultsRequest, GetSearchResultsResponse> operation
= new GetSearchResults.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,61 +3,49 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetSessionHistoryBadRequest;
import dev.plexapi.sdk.models.errors.GetSessionHistoryUnauthorized;
import dev.plexapi.sdk.models.errors.GetSessionsBadRequest;
import dev.plexapi.sdk.models.errors.GetSessionsUnauthorized;
import dev.plexapi.sdk.models.errors.GetTranscodeSessionsBadRequest;
import dev.plexapi.sdk.models.errors.GetTranscodeSessionsUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import dev.plexapi.sdk.models.errors.StopTranscodeSessionBadRequest;
import dev.plexapi.sdk.models.errors.StopTranscodeSessionUnauthorized;
import static dev.plexapi.sdk.operations.Operations.RequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetSessionHistoryRequest;
import dev.plexapi.sdk.models.operations.GetSessionHistoryRequestBuilder;
import dev.plexapi.sdk.models.operations.GetSessionHistoryResponse;
import dev.plexapi.sdk.models.operations.GetSessionHistoryResponseBody;
import dev.plexapi.sdk.models.operations.GetSessionsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetSessionsResponse;
import dev.plexapi.sdk.models.operations.GetSessionsResponseBody;
import dev.plexapi.sdk.models.operations.GetTranscodeSessionsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetTranscodeSessionsResponse;
import dev.plexapi.sdk.models.operations.GetTranscodeSessionsResponseBody;
import dev.plexapi.sdk.models.operations.QueryParamFilter;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetSessionHistory;
import dev.plexapi.sdk.operations.GetSessions;
import dev.plexapi.sdk.operations.GetTranscodeSessions;
import dev.plexapi.sdk.operations.StopTranscodeSession;
import java.lang.Exception;
import java.lang.Long;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* API Calls that perform search operations with Plex Media Server Sessions
*/
public class Sessions implements
MethodCallGetSessions,
MethodCallGetSessionHistory,
MethodCallGetTranscodeSessions,
MethodCallStopTranscodeSession {
public class Sessions {
private final SDKConfiguration sdkConfiguration;
private final AsyncSessions asyncSDK;
Sessions(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncSessions(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncSessions async() {
return asyncSDK;
}
/**
* Get Active Sessions
@@ -67,7 +55,7 @@ public class Sessions implements
* @return The call builder
*/
public GetSessionsRequestBuilder getSessions() {
return new GetSessionsRequestBuilder(this);
return new GetSessionsRequestBuilder(sdkConfiguration);
}
/**
@@ -79,153 +67,11 @@ public class Sessions implements
* @throws Exception if the API call fails
*/
public GetSessionsResponse getSessionsDirect() throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/status/sessions");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSessions",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getSessions",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSessions",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSessions",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetSessionsResponse.Builder _resBuilder =
GetSessionsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetSessionsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSessionsResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSessionsResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSessionsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSessionsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSessionsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSessionsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestlessOperation<GetSessionsResponse> operation
= new GetSessions.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest());
}
/**
* Get Session History
*
@@ -234,7 +80,7 @@ public class Sessions implements
* @return The call builder
*/
public GetSessionHistoryRequestBuilder getSessionHistory() {
return new GetSessionHistoryRequestBuilder(this);
return new GetSessionHistoryRequestBuilder(sdkConfiguration);
}
/**
@@ -246,9 +92,10 @@ 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());
return getSessionHistory(Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty());
}
/**
* Get Session History
*
@@ -267,10 +114,8 @@ public class Sessions implements
* @throws Exception if the API call fails
*/
public GetSessionHistoryResponse getSessionHistory(
Optional<String> sort,
Optional<Long> accountId,
Optional<? extends QueryParamFilter> filter,
Optional<Long> librarySectionID) throws Exception {
Optional<String> sort, Optional<Long> accountId,
Optional<? extends QueryParamFilter> filter, Optional<Long> librarySectionID) throws Exception {
GetSessionHistoryRequest request =
GetSessionHistoryRequest
.builder()
@@ -279,159 +124,11 @@ public class Sessions implements
.filter(filter)
.librarySectionID(librarySectionID)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/status/sessions/history/all");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetSessionHistoryRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSessionHistory",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getSessionHistory",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSessionHistory",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getSessionHistory",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetSessionHistoryResponse.Builder _resBuilder =
GetSessionHistoryResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetSessionHistoryResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSessionHistoryResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSessionHistoryResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSessionHistoryBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSessionHistoryBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetSessionHistoryUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetSessionHistoryUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetSessionHistoryRequest, GetSessionHistoryResponse> operation
= new GetSessionHistory.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Transcode Sessions
*
@@ -440,7 +137,7 @@ public class Sessions implements
* @return The call builder
*/
public GetTranscodeSessionsRequestBuilder getTranscodeSessions() {
return new GetTranscodeSessionsRequestBuilder(this);
return new GetTranscodeSessionsRequestBuilder(sdkConfiguration);
}
/**
@@ -452,153 +149,11 @@ public class Sessions implements
* @throws Exception if the API call fails
*/
public GetTranscodeSessionsResponse getTranscodeSessionsDirect() throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/transcode/sessions");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTranscodeSessions",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getTranscodeSessions",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTranscodeSessions",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTranscodeSessions",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetTranscodeSessionsResponse.Builder _resBuilder =
GetTranscodeSessionsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetTranscodeSessionsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTranscodeSessionsResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTranscodeSessionsResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTranscodeSessionsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTranscodeSessionsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTranscodeSessionsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTranscodeSessionsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestlessOperation<GetTranscodeSessionsResponse> operation
= new GetTranscodeSessions.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest());
}
/**
* Stop a Transcode Session
*
@@ -607,7 +162,7 @@ public class Sessions implements
* @return The call builder
*/
public StopTranscodeSessionRequestBuilder stopTranscodeSession() {
return new StopTranscodeSessionRequestBuilder(this);
return new StopTranscodeSessionRequestBuilder(sdkConfiguration);
}
/**
@@ -619,148 +174,15 @@ public class Sessions implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StopTranscodeSessionResponse stopTranscodeSession(
String sessionKey) throws Exception {
public StopTranscodeSessionResponse stopTranscodeSession(String sessionKey) throws Exception {
StopTranscodeSessionRequest request =
StopTranscodeSessionRequest
.builder()
.sessionKey(sessionKey)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
StopTranscodeSessionRequest.class,
_baseUrl,
"/transcode/sessions/{sessionKey}",
request, null);
HTTPRequest _req = new HTTPRequest(_url, "DELETE");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopTranscodeSession",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"stopTranscodeSession",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopTranscodeSession",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"stopTranscodeSession",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
StopTranscodeSessionResponse.Builder _resBuilder =
StopTranscodeSessionResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
StopTranscodeSessionResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "204")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StopTranscodeSessionBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StopTranscodeSessionBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StopTranscodeSessionUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StopTranscodeSessionUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<StopTranscodeSessionRequest, StopTranscodeSessionResponse> operation
= new StopTranscodeSession.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -3,56 +3,44 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetBandwidthStatisticsBadRequest;
import dev.plexapi.sdk.models.errors.GetBandwidthStatisticsUnauthorized;
import dev.plexapi.sdk.models.errors.GetResourcesStatisticsBadRequest;
import dev.plexapi.sdk.models.errors.GetResourcesStatisticsUnauthorized;
import dev.plexapi.sdk.models.errors.GetStatisticsBadRequest;
import dev.plexapi.sdk.models.errors.GetStatisticsUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsRequest;
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsResponse;
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsResponseBody;
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsRequest;
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsRequestBuilder;
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsResponse;
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsResponseBody;
import dev.plexapi.sdk.models.operations.GetStatisticsRequest;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetBandwidthStatistics;
import dev.plexapi.sdk.operations.GetResourcesStatistics;
import dev.plexapi.sdk.operations.GetStatistics;
import java.lang.Exception;
import java.lang.Long;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* API Calls that perform operations with Plex Media Server Statistics
*/
public class Statistics implements
MethodCallGetStatistics,
MethodCallGetResourcesStatistics,
MethodCallGetBandwidthStatistics {
public class Statistics {
private final SDKConfiguration sdkConfiguration;
private final AsyncStatistics asyncSDK;
Statistics(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncStatistics(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncStatistics async() {
return asyncSDK;
}
/**
* Get Media Statistics
@@ -62,7 +50,7 @@ public class Statistics implements
* @return The call builder
*/
public GetStatisticsRequestBuilder getStatistics() {
return new GetStatisticsRequestBuilder(this);
return new GetStatisticsRequestBuilder(sdkConfiguration);
}
/**
@@ -76,7 +64,7 @@ public class Statistics implements
public GetStatisticsResponse getStatisticsDirect() throws Exception {
return getStatistics(Optional.empty());
}
/**
* Get Media Statistics
*
@@ -88,166 +76,17 @@ public class Statistics implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetStatisticsResponse getStatistics(
Optional<Long> timespan) throws Exception {
public GetStatisticsResponse getStatistics(Optional<Long> timespan) throws Exception {
GetStatisticsRequest request =
GetStatisticsRequest
.builder()
.timespan(timespan)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/statistics/media");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetStatisticsRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getStatistics",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getStatistics",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getStatistics",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getStatistics",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetStatisticsResponse.Builder _resBuilder =
GetStatisticsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetStatisticsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetStatisticsResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetStatisticsResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetStatisticsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetStatisticsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetStatisticsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetStatisticsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetStatisticsRequest, GetStatisticsResponse> operation
= new GetStatistics.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Resources Statistics
*
@@ -256,7 +95,7 @@ public class Statistics implements
* @return The call builder
*/
public GetResourcesStatisticsRequestBuilder getResourcesStatistics() {
return new GetResourcesStatisticsRequestBuilder(this);
return new GetResourcesStatisticsRequestBuilder(sdkConfiguration);
}
/**
@@ -270,7 +109,7 @@ public class Statistics implements
public GetResourcesStatisticsResponse getResourcesStatisticsDirect() throws Exception {
return getResourcesStatistics(Optional.empty());
}
/**
* Get Resources Statistics
*
@@ -282,166 +121,17 @@ public class Statistics implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetResourcesStatisticsResponse getResourcesStatistics(
Optional<Long> timespan) throws Exception {
public GetResourcesStatisticsResponse getResourcesStatistics(Optional<Long> timespan) throws Exception {
GetResourcesStatisticsRequest request =
GetResourcesStatisticsRequest
.builder()
.timespan(timespan)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/statistics/resources");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetResourcesStatisticsRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getResourcesStatistics",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getResourcesStatistics",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getResourcesStatistics",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getResourcesStatistics",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetResourcesStatisticsResponse.Builder _resBuilder =
GetResourcesStatisticsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetResourcesStatisticsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetResourcesStatisticsResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetResourcesStatisticsResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetResourcesStatisticsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetResourcesStatisticsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetResourcesStatisticsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetResourcesStatisticsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetResourcesStatisticsRequest, GetResourcesStatisticsResponse> operation
= new GetResourcesStatistics.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Get Bandwidth Statistics
*
@@ -450,7 +140,7 @@ public class Statistics implements
* @return The call builder
*/
public GetBandwidthStatisticsRequestBuilder getBandwidthStatistics() {
return new GetBandwidthStatisticsRequestBuilder(this);
return new GetBandwidthStatisticsRequestBuilder(sdkConfiguration);
}
/**
@@ -464,7 +154,7 @@ public class Statistics implements
public GetBandwidthStatisticsResponse getBandwidthStatisticsDirect() throws Exception {
return getBandwidthStatistics(Optional.empty());
}
/**
* Get Bandwidth Statistics
*
@@ -476,162 +166,15 @@ public class Statistics implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetBandwidthStatisticsResponse getBandwidthStatistics(
Optional<Long> timespan) throws Exception {
public GetBandwidthStatisticsResponse getBandwidthStatistics(Optional<Long> timespan) throws Exception {
GetBandwidthStatisticsRequest request =
GetBandwidthStatisticsRequest
.builder()
.timespan(timespan)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/statistics/bandwidth");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetBandwidthStatisticsRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getBandwidthStatistics",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getBandwidthStatistics",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getBandwidthStatistics",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getBandwidthStatistics",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetBandwidthStatisticsResponse.Builder _resBuilder =
GetBandwidthStatisticsResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetBandwidthStatisticsResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetBandwidthStatisticsResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetBandwidthStatisticsResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetBandwidthStatisticsBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetBandwidthStatisticsBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetBandwidthStatisticsUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetBandwidthStatisticsUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<GetBandwidthStatisticsRequest, GetBandwidthStatisticsResponse> operation
= new GetBandwidthStatistics.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -3,14 +3,9 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.ApplyUpdatesBadRequest;
import dev.plexapi.sdk.models.errors.ApplyUpdatesUnauthorized;
import dev.plexapi.sdk.models.errors.CheckForUpdatesBadRequest;
import dev.plexapi.sdk.models.errors.CheckForUpdatesUnauthorized;
import dev.plexapi.sdk.models.errors.GetUpdateStatusBadRequest;
import dev.plexapi.sdk.models.errors.GetUpdateStatusUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestlessOperation;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.ApplyUpdatesRequest;
import dev.plexapi.sdk.models.operations.ApplyUpdatesRequestBuilder;
import dev.plexapi.sdk.models.operations.ApplyUpdatesResponse;
@@ -20,39 +15,35 @@ import dev.plexapi.sdk.models.operations.CheckForUpdatesResponse;
import dev.plexapi.sdk.models.operations.Download;
import dev.plexapi.sdk.models.operations.GetUpdateStatusRequestBuilder;
import dev.plexapi.sdk.models.operations.GetUpdateStatusResponse;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.ApplyUpdates;
import dev.plexapi.sdk.operations.CheckForUpdates;
import dev.plexapi.sdk.operations.GetUpdateStatus;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* This describes the API for searching and applying updates to the Plex Media Server.
* Updates to the status can be observed via the Event API.
*/
public class Updater implements
MethodCallGetUpdateStatus,
MethodCallCheckForUpdates,
MethodCallApplyUpdates {
public class Updater {
private final SDKConfiguration sdkConfiguration;
private final AsyncUpdater asyncSDK;
Updater(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncUpdater(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncUpdater async() {
return asyncSDK;
}
/**
* Querying status of updates
@@ -62,7 +53,7 @@ public class Updater implements
* @return The call builder
*/
public GetUpdateStatusRequestBuilder getUpdateStatus() {
return new GetUpdateStatusRequestBuilder(this);
return new GetUpdateStatusRequestBuilder(sdkConfiguration);
}
/**
@@ -74,153 +65,11 @@ public class Updater implements
* @throws Exception if the API call fails
*/
public GetUpdateStatusResponse getUpdateStatusDirect() throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/updater/status");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getUpdateStatus",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getUpdateStatus",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getUpdateStatus",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getUpdateStatus",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetUpdateStatusResponse.Builder _resBuilder =
GetUpdateStatusResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetUpdateStatusResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetUpdateStatusResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetUpdateStatusResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetUpdateStatusBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetUpdateStatusBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetUpdateStatusUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetUpdateStatusUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestlessOperation<GetUpdateStatusResponse> operation
= new GetUpdateStatus.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest());
}
/**
* Checking for updates
*
@@ -229,7 +78,7 @@ public class Updater implements
* @return The call builder
*/
public CheckForUpdatesRequestBuilder checkForUpdates() {
return new CheckForUpdatesRequestBuilder(this);
return new CheckForUpdatesRequestBuilder(sdkConfiguration);
}
/**
@@ -243,7 +92,7 @@ public class Updater implements
public CheckForUpdatesResponse checkForUpdatesDirect() throws Exception {
return checkForUpdates(Optional.empty());
}
/**
* Checking for updates
*
@@ -253,155 +102,17 @@ public class Updater implements
* @return The response from the API call
* @throws Exception if the API call fails
*/
public CheckForUpdatesResponse checkForUpdates(
Optional<? extends Download> download) throws Exception {
public CheckForUpdatesResponse checkForUpdates(Optional<? extends Download> download) throws Exception {
CheckForUpdatesRequest request =
CheckForUpdatesRequest
.builder()
.download(download)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/updater/check");
HTTPRequest _req = new HTTPRequest(_url, "PUT");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
CheckForUpdatesRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"checkForUpdates",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"checkForUpdates",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"checkForUpdates",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"checkForUpdates",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
CheckForUpdatesResponse.Builder _resBuilder =
CheckForUpdatesResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
CheckForUpdatesResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
CheckForUpdatesBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<CheckForUpdatesBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
CheckForUpdatesUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<CheckForUpdatesUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<CheckForUpdatesRequest, CheckForUpdatesResponse> operation
= new CheckForUpdates.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Apply Updates
*
@@ -410,7 +121,7 @@ public class Updater implements
* @return The call builder
*/
public ApplyUpdatesRequestBuilder applyUpdates() {
return new ApplyUpdatesRequestBuilder(this);
return new ApplyUpdatesRequestBuilder(sdkConfiguration);
}
/**
@@ -424,7 +135,7 @@ public class Updater implements
public ApplyUpdatesResponse applyUpdatesDirect() throws Exception {
return applyUpdates(Optional.empty(), Optional.empty());
}
/**
* Apply Updates
*
@@ -435,153 +146,16 @@ public class Updater implements
* @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) throws Exception {
public ApplyUpdatesResponse applyUpdates(Optional<? extends Tonight> tonight, Optional<? extends Skip> skip) throws Exception {
ApplyUpdatesRequest request =
ApplyUpdatesRequest
.builder()
.tonight(tonight)
.skip(skip)
.build();
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/updater/apply");
HTTPRequest _req = new HTTPRequest(_url, "PUT");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
ApplyUpdatesRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"applyUpdates",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"applyUpdates",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"applyUpdates",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"applyUpdates",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
ApplyUpdatesResponse.Builder _resBuilder =
ApplyUpdatesResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
ApplyUpdatesResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
ApplyUpdatesBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<ApplyUpdatesBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
ApplyUpdatesUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<ApplyUpdatesUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "500", "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
RequestOperation<ApplyUpdatesRequest, ApplyUpdatesResponse> operation
= new ApplyUpdates.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -3,45 +3,34 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetUsersBadRequest;
import dev.plexapi.sdk.models.errors.GetUsersUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetUsersRequest;
import dev.plexapi.sdk.models.operations.GetUsersRequestBuilder;
import dev.plexapi.sdk.models.operations.GetUsersResponse;
import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*;
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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetUsers;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
public class Users implements
MethodCallGetUsers {
/**
* GET_USERS_SERVERS contains the list of server urls available to the SDK.
*/
public static final String[] GET_USERS_SERVERS = {
"https://plex.tv/api",
};
public class Users {
private final SDKConfiguration sdkConfiguration;
private final AsyncUsers asyncSDK;
Users(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncUsers(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncUsers async() {
return asyncSDK;
}
/**
* Get list of all connected users
@@ -51,7 +40,7 @@ public class Users implements
* @return The call builder
*/
public GetUsersRequestBuilder getUsers() {
return new GetUsersRequestBuilder(this);
return new GetUsersRequestBuilder(sdkConfiguration);
}
/**
@@ -59,169 +48,28 @@ public class Users implements
*
* <p>Get list of all users that are friends and have library access with the provided Plex authentication token
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetUsersResponse getUsers(
GetUsersRequest request) throws Exception {
public GetUsersResponse getUsers(GetUsersRequest request) throws Exception {
return getUsers(request, Optional.empty());
}
/**
* Get list of all connected users
*
* <p>Get list of all users that are friends and have library access with the provided Plex authentication token
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @param serverURL Overrides the server URL.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetUsersResponse getUsers(
GetUsersRequest request,
Optional<String> serverURL) throws Exception {
final String _baseUrl;
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
} else {
_baseUrl = Utils.templateUrl(GET_USERS_SERVERS[0], new HashMap<String, String>());
}
String _url = Utils.generateURL(
_baseUrl,
"/users");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/xml")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addHeaders(Utils.getHeadersFromMetadata(request, null));
Optional<SecuritySource> _hookSecuritySource = Optional.empty();
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-users",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"get-users",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-users",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-users",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetUsersResponse.Builder _resBuilder =
GetUsersResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetUsersResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/xml")) {
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetUsersBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetUsersBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetUsersUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetUsersUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public GetUsersResponse getUsers(GetUsersRequest request, Optional<String> serverURL) throws Exception {
RequestOperation<GetUsersRequest, GetUsersResponse> operation
= new GetUsers.Sync(sdkConfiguration, serverURL);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -3,46 +3,38 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetTimelineBadRequest;
import dev.plexapi.sdk.models.errors.GetTimelineUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import dev.plexapi.sdk.models.errors.StartUniversalTranscodeBadRequest;
import dev.plexapi.sdk.models.errors.StartUniversalTranscodeUnauthorized;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetTimelineRequest;
import dev.plexapi.sdk.models.operations.GetTimelineRequestBuilder;
import dev.plexapi.sdk.models.operations.GetTimelineResponse;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetTimeline;
import dev.plexapi.sdk.operations.StartUniversalTranscode;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Optional;
/**
* API Calls that perform operations with Plex Media Server Videos
*/
public class Video implements
MethodCallGetTimeline,
MethodCallStartUniversalTranscode {
public class Video {
private final SDKConfiguration sdkConfiguration;
private final AsyncVideo asyncSDK;
Video(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncVideo(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncVideo async() {
return asyncSDK;
}
/**
* Get the timeline for a media item
@@ -52,7 +44,7 @@ public class Video implements
* @return The call builder
*/
public GetTimelineRequestBuilder getTimeline() {
return new GetTimelineRequestBuilder(this);
return new GetTimelineRequestBuilder(sdkConfiguration);
}
/**
@@ -60,153 +52,16 @@ public class Video implements
*
* <p>Get the timeline for a media item
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetTimelineResponse getTimeline(
GetTimelineRequest request) throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/:/timeline");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetTimelineRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTimeline",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"getTimeline",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTimeline",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"getTimeline",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetTimelineResponse.Builder _resBuilder =
GetTimelineResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetTimelineResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTimelineBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTimelineBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetTimelineUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetTimelineUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public GetTimelineResponse getTimeline(GetTimelineRequest request) throws Exception {
RequestOperation<GetTimelineRequest, GetTimelineResponse> operation
= new GetTimeline.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
/**
* Start Universal Transcode
*
@@ -215,7 +70,7 @@ public class Video implements
* @return The call builder
*/
public StartUniversalTranscodeRequestBuilder startUniversalTranscode() {
return new StartUniversalTranscodeRequestBuilder(this);
return new StartUniversalTranscodeRequestBuilder(sdkConfiguration);
}
/**
@@ -223,149 +78,14 @@ public class Video implements
*
* <p>Begin a Universal Transcode Session
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public StartUniversalTranscodeResponse startUniversalTranscode(
StartUniversalTranscodeRequest request) throws Exception {
String _baseUrl = Utils.templateUrl(
this.sdkConfiguration.serverUrl(), this.sdkConfiguration.getServerVariableDefaults());
String _url = Utils.generateURL(
_baseUrl,
"/video/:/transcode/universal/start.mpd");
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
StartUniversalTranscodeRequest.class,
request,
null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"startUniversalTranscode",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"startUniversalTranscode",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"startUniversalTranscode",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"startUniversalTranscode",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
StartUniversalTranscodeResponse.Builder _resBuilder =
StartUniversalTranscodeResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
StartUniversalTranscodeResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
// no content
return _res;
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StartUniversalTranscodeBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StartUniversalTranscodeBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
StartUniversalTranscodeUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<StartUniversalTranscodeUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public StartUniversalTranscodeResponse startUniversalTranscode(StartUniversalTranscodeRequest request) throws Exception {
RequestOperation<StartUniversalTranscodeRequest, StartUniversalTranscodeResponse> operation
= new StartUniversalTranscode.Sync(sdkConfiguration);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -3,52 +3,36 @@
*/
package dev.plexapi.sdk;
import com.fasterxml.jackson.core.type.TypeReference;
import dev.plexapi.sdk.models.errors.GetWatchListBadRequest;
import dev.plexapi.sdk.models.errors.GetWatchListUnauthorized;
import dev.plexapi.sdk.models.errors.SDKError;
import static dev.plexapi.sdk.operations.Operations.RequestOperation;
import dev.plexapi.sdk.models.operations.GetWatchListRequest;
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.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.Utils;
import java.io.InputStream;
import dev.plexapi.sdk.operations.GetWatchList;
import java.lang.Exception;
import java.lang.String;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.util.HashMap;
import java.util.List;
import java.util.Optional;
/**
* API Calls that perform operations with Plex Media Server Watchlists
*/
public class Watchlist implements
MethodCallGetWatchList {
/**
* GET_WATCH_LIST_SERVERS contains the list of server urls available to the SDK.
*/
public static final String[] GET_WATCH_LIST_SERVERS = {
/**
* The plex metadata provider server
*/
"https://metadata.provider.plex.tv",
};
public class Watchlist {
private final SDKConfiguration sdkConfiguration;
private final AsyncWatchlist asyncSDK;
Watchlist(SDKConfiguration sdkConfiguration) {
this.sdkConfiguration = sdkConfiguration;
this.asyncSDK = new AsyncWatchlist(this, sdkConfiguration);
}
/**
* Switches to the async SDK.
*
* @return The async SDK
*/
public AsyncWatchlist async() {
return asyncSDK;
}
/**
* Get User Watchlist
@@ -58,7 +42,7 @@ public class Watchlist implements
* @return The call builder
*/
public GetWatchListRequestBuilder getWatchList() {
return new GetWatchListRequestBuilder(this);
return new GetWatchListRequestBuilder(sdkConfiguration);
}
/**
@@ -66,183 +50,28 @@ public class Watchlist implements
*
* <p>Get User Watchlist
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetWatchListResponse getWatchList(
GetWatchListRequest request) throws Exception {
public GetWatchListResponse getWatchList(GetWatchListRequest request) throws Exception {
return getWatchList(request, Optional.empty());
}
/**
* Get User Watchlist
*
* <p>Get User Watchlist
*
* @param request The request object containing all of the parameters for the API call.
* @param request The request object containing all the parameters for the API call.
* @param serverURL Overrides the server URL.
* @return The response from the API call
* @throws Exception if the API call fails
*/
public GetWatchListResponse getWatchList(
GetWatchListRequest request,
Optional<String> serverURL) throws Exception {
final String _baseUrl;
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
_baseUrl = serverURL.get();
} else {
_baseUrl = Utils.templateUrl(GET_WATCH_LIST_SERVERS[0], new HashMap<String, String>());
}
String _url = Utils.generateURL(
GetWatchListRequest.class,
_baseUrl,
"/library/sections/watchlist/{filter}",
request, null);
HTTPRequest _req = new HTTPRequest(_url, "GET");
_req.addHeader("Accept", "application/json")
.addHeader("user-agent",
SDKConfiguration.USER_AGENT);
_req.addQueryParams(Utils.getQueryParams(
GetWatchListRequest.class,
request,
null));
_req.addHeaders(Utils.getHeadersFromMetadata(request, null));
Optional<SecuritySource> _hookSecuritySource = Optional.of(this.sdkConfiguration.securitySource());
Utils.configureSecurity(_req,
this.sdkConfiguration.securitySource().getSecurity());
HTTPClient _client = this.sdkConfiguration.client();
HttpRequest _r =
sdkConfiguration.hooks()
.beforeRequest(
new BeforeRequestContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-watch-list",
Optional.of(List.of()),
_hookSecuritySource),
_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(
this.sdkConfiguration,
_baseUrl,
"get-watch-list",
Optional.of(List.of()),
_hookSecuritySource),
Optional.of(_httpRes),
Optional.empty());
} else {
_httpRes = sdkConfiguration.hooks()
.afterSuccess(
new AfterSuccessContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-watch-list",
Optional.of(List.of()),
_hookSecuritySource),
_httpRes);
}
} catch (Exception _e) {
_httpRes = sdkConfiguration.hooks()
.afterError(
new AfterErrorContextImpl(
this.sdkConfiguration,
_baseUrl,
"get-watch-list",
Optional.of(List.of()),
_hookSecuritySource),
Optional.empty(),
Optional.of(_e));
}
String _contentType = _httpRes
.headers()
.firstValue("Content-Type")
.orElse("application/octet-stream");
GetWatchListResponse.Builder _resBuilder =
GetWatchListResponse
.builder()
.contentType(_contentType)
.statusCode(_httpRes.statusCode())
.rawResponse(_httpRes);
GetWatchListResponse _res = _resBuilder.build();
if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetWatchListResponseBody _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetWatchListResponseBody>() {});
_res.withObject(Optional.ofNullable(_out));
return _res;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetWatchListBadRequest _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetWatchListBadRequest>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) {
if (Utils.contentTypeMatches(_contentType, "application/json")) {
GetWatchListUnauthorized _out = Utils.mapper().readValue(
Utils.toUtf8AndClose(_httpRes.body()),
new TypeReference<GetWatchListUnauthorized>() {});
_out.withRawResponse(Optional.ofNullable(_httpRes));
throw _out;
} else {
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected content-type received: " + _contentType,
Utils.extractByteArrayFromBody(_httpRes));
}
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) {
// no content
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"API error occurred",
Utils.extractByteArrayFromBody(_httpRes));
}
throw new SDKError(
_httpRes,
_httpRes.statusCode(),
"Unexpected status code received: " + _httpRes.statusCode(),
Utils.extractByteArrayFromBody(_httpRes));
public GetWatchListResponse getWatchList(GetWatchListRequest request, Optional<String> serverURL) throws Exception {
RequestOperation<GetWatchListRequest, GetWatchListResponse> operation
= new GetWatchList.Sync(sdkConfiguration, serverURL);
return operation.handleResponse(operation.doRequest(request));
}
}

View File

@@ -1,11 +1,7 @@
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
package dev.plexapi.sdk.hooks;
//
// This file is written once by speakeasy code generation and
// This file is written once by speakeasy code generation and
// thereafter will not be overwritten by speakeasy updates. As a
// consequence any customization of this class will be preserved.
//
@@ -16,11 +12,31 @@ public final class SDKHooks {
// prevent instantiation
}
public static final void initialize(dev.plexapi.sdk.utils.Hooks hooks) {
// register hooks here
public static void initialize(dev.plexapi.sdk.utils.Hooks hooks) {
// register synchronous hooks here
// hooks.registerBeforeRequest(...);
// hooks.registerAfterSuccess(...);
// hooks.registerAfterError(...);
// for more information see
// https://www.speakeasy.com/docs/additional-features/sdk-hooks
}
public static void initialize(dev.plexapi.sdk.utils.AsyncHooks asyncHooks) {
// register async hooks here
// asyncHooks.registerBeforeRequest(...);
// asyncHooks.registerAfterSuccess(...);
// asyncHooks.registerAfterError(...);
// NOTE: If you have existing synchronous hooks, you can adapt them using HookAdapters:
// asyncHooks.registerAfterError(dev.plexapi.sdk.utils.HookAdapters.adapt(mySyncHook));
// PERFORMANCE TIP: For better performance, implement async hooks directly using
// non-blocking I/O (NIO) APIs instead of adapting synchronous hooks, as adapters
// offload execution to the ForkJoinPool which can introduce overhead.
// for more information see
// https://www.speakeasy.com/docs/additional-features/sdk-hooks
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
public AddPlaylistContentsBadRequest(
@JsonProperty("errors") Optional<? extends List<AddPlaylistContentsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public AddPlaylistContentsBadRequest withErrors(List<AddPlaylistContentsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
return this;
}
public AddPlaylistContentsBadRequest withErrors(Optional<? extends List<AddPlaylistContentsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
}
AddPlaylistContentsBadRequest other = (AddPlaylistContentsBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<AddPlaylistContentsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<AddPlaylistContentsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class AddPlaylistContentsBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public AddPlaylistContentsBadRequest build() {
return new AddPlaylistContentsBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class AddPlaylistContentsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class AddPlaylistContentsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public AddPlaylistContentsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class AddPlaylistContentsErrors {
return this;
}
public AddPlaylistContentsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class AddPlaylistContentsErrors {
return this;
}
public AddPlaylistContentsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class AddPlaylistContentsErrors {
return this;
}
public AddPlaylistContentsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class AddPlaylistContentsErrors {
}
AddPlaylistContentsErrors other = (AddPlaylistContentsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class AddPlaylistContentsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class AddPlaylistContentsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class AddPlaylistContentsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class AddPlaylistContentsErrors {
this.status = status;
return this;
}
public AddPlaylistContentsErrors build() {
return new AddPlaylistContentsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class AddPlaylistContentsPlaylistsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class AddPlaylistContentsPlaylistsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public AddPlaylistContentsPlaylistsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class AddPlaylistContentsPlaylistsErrors {
return this;
}
public AddPlaylistContentsPlaylistsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class AddPlaylistContentsPlaylistsErrors {
return this;
}
public AddPlaylistContentsPlaylistsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class AddPlaylistContentsPlaylistsErrors {
return this;
}
public AddPlaylistContentsPlaylistsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class AddPlaylistContentsPlaylistsErrors {
}
AddPlaylistContentsPlaylistsErrors other = (AddPlaylistContentsPlaylistsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class AddPlaylistContentsPlaylistsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class AddPlaylistContentsPlaylistsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class AddPlaylistContentsPlaylistsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class AddPlaylistContentsPlaylistsErrors {
this.status = status;
return this;
}
public AddPlaylistContentsPlaylistsErrors build() {
return new AddPlaylistContentsPlaylistsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
public AddPlaylistContentsUnauthorized(
@JsonProperty("errors") Optional<? extends List<AddPlaylistContentsPlaylistsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public AddPlaylistContentsUnauthorized withErrors(List<AddPlaylistContentsPlaylistsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
return this;
}
public AddPlaylistContentsUnauthorized withErrors(Optional<? extends List<AddPlaylistContentsPlaylistsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
}
AddPlaylistContentsUnauthorized other = (AddPlaylistContentsUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<AddPlaylistContentsPlaylistsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<AddPlaylistContentsPlaylistsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class AddPlaylistContentsUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public AddPlaylistContentsUnauthorized build() {
return new AddPlaylistContentsUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
public ApplyUpdatesBadRequest(
@JsonProperty("errors") Optional<? extends List<ApplyUpdatesErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public ApplyUpdatesBadRequest withErrors(List<ApplyUpdatesErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
return this;
}
public ApplyUpdatesBadRequest withErrors(Optional<? extends List<ApplyUpdatesErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
}
ApplyUpdatesBadRequest other = (ApplyUpdatesBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<ApplyUpdatesErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<ApplyUpdatesErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class ApplyUpdatesBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public ApplyUpdatesBadRequest build() {
return new ApplyUpdatesBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class ApplyUpdatesErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class ApplyUpdatesErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public ApplyUpdatesErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class ApplyUpdatesErrors {
return this;
}
public ApplyUpdatesErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class ApplyUpdatesErrors {
return this;
}
public ApplyUpdatesErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class ApplyUpdatesErrors {
return this;
}
public ApplyUpdatesErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class ApplyUpdatesErrors {
}
ApplyUpdatesErrors other = (ApplyUpdatesErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class ApplyUpdatesErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class ApplyUpdatesErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class ApplyUpdatesErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class ApplyUpdatesErrors {
this.status = status;
return this;
}
public ApplyUpdatesErrors build() {
return new ApplyUpdatesErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
public ApplyUpdatesUnauthorized(
@JsonProperty("errors") Optional<? extends List<ApplyUpdatesUpdaterErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public ApplyUpdatesUnauthorized withErrors(List<ApplyUpdatesUpdaterErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
return this;
}
public ApplyUpdatesUnauthorized withErrors(Optional<? extends List<ApplyUpdatesUpdaterErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
}
ApplyUpdatesUnauthorized other = (ApplyUpdatesUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<ApplyUpdatesUpdaterErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<ApplyUpdatesUpdaterErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class ApplyUpdatesUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public ApplyUpdatesUnauthorized build() {
return new ApplyUpdatesUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class ApplyUpdatesUpdaterErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class ApplyUpdatesUpdaterErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public ApplyUpdatesUpdaterErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class ApplyUpdatesUpdaterErrors {
return this;
}
public ApplyUpdatesUpdaterErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class ApplyUpdatesUpdaterErrors {
return this;
}
public ApplyUpdatesUpdaterErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class ApplyUpdatesUpdaterErrors {
return this;
}
public ApplyUpdatesUpdaterErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class ApplyUpdatesUpdaterErrors {
}
ApplyUpdatesUpdaterErrors other = (ApplyUpdatesUpdaterErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class ApplyUpdatesUpdaterErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class ApplyUpdatesUpdaterErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class ApplyUpdatesUpdaterErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class ApplyUpdatesUpdaterErrors {
this.status = status;
return this;
}
public ApplyUpdatesUpdaterErrors build() {
return new ApplyUpdatesUpdaterErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class CancelServerActivitiesActivitiesErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class CancelServerActivitiesActivitiesErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CancelServerActivitiesActivitiesErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class CancelServerActivitiesActivitiesErrors {
return this;
}
public CancelServerActivitiesActivitiesErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class CancelServerActivitiesActivitiesErrors {
return this;
}
public CancelServerActivitiesActivitiesErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class CancelServerActivitiesActivitiesErrors {
return this;
}
public CancelServerActivitiesActivitiesErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class CancelServerActivitiesActivitiesErrors {
}
CancelServerActivitiesActivitiesErrors other = (CancelServerActivitiesActivitiesErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class CancelServerActivitiesActivitiesErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class CancelServerActivitiesActivitiesErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class CancelServerActivitiesActivitiesErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class CancelServerActivitiesActivitiesErrors {
this.status = status;
return this;
}
public CancelServerActivitiesActivitiesErrors build() {
return new CancelServerActivitiesActivitiesErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
public CancelServerActivitiesBadRequest(
@JsonProperty("errors") Optional<? extends List<CancelServerActivitiesErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CancelServerActivitiesBadRequest withErrors(List<CancelServerActivitiesErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
return this;
}
public CancelServerActivitiesBadRequest withErrors(Optional<? extends List<CancelServerActivitiesErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
}
CancelServerActivitiesBadRequest other = (CancelServerActivitiesBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<CancelServerActivitiesErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<CancelServerActivitiesErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class CancelServerActivitiesBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public CancelServerActivitiesBadRequest build() {
return new CancelServerActivitiesBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class CancelServerActivitiesErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class CancelServerActivitiesErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CancelServerActivitiesErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class CancelServerActivitiesErrors {
return this;
}
public CancelServerActivitiesErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class CancelServerActivitiesErrors {
return this;
}
public CancelServerActivitiesErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class CancelServerActivitiesErrors {
return this;
}
public CancelServerActivitiesErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class CancelServerActivitiesErrors {
}
CancelServerActivitiesErrors other = (CancelServerActivitiesErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class CancelServerActivitiesErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class CancelServerActivitiesErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class CancelServerActivitiesErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class CancelServerActivitiesErrors {
this.status = status;
return this;
}
public CancelServerActivitiesErrors build() {
return new CancelServerActivitiesErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
public CancelServerActivitiesUnauthorized(
@JsonProperty("errors") Optional<? extends List<CancelServerActivitiesActivitiesErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CancelServerActivitiesUnauthorized withErrors(List<CancelServerActivitiesActivitiesErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
return this;
}
public CancelServerActivitiesUnauthorized withErrors(Optional<? extends List<CancelServerActivitiesActivitiesErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
}
CancelServerActivitiesUnauthorized other = (CancelServerActivitiesUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<CancelServerActivitiesActivitiesErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<CancelServerActivitiesActivitiesErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class CancelServerActivitiesUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public CancelServerActivitiesUnauthorized build() {
return new CancelServerActivitiesUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
public CheckForUpdatesBadRequest(
@JsonProperty("errors") Optional<? extends List<CheckForUpdatesErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CheckForUpdatesBadRequest withErrors(List<CheckForUpdatesErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
return this;
}
public CheckForUpdatesBadRequest withErrors(Optional<? extends List<CheckForUpdatesErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
}
CheckForUpdatesBadRequest other = (CheckForUpdatesBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<CheckForUpdatesErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<CheckForUpdatesErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class CheckForUpdatesBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public CheckForUpdatesBadRequest build() {
return new CheckForUpdatesBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class CheckForUpdatesErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class CheckForUpdatesErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CheckForUpdatesErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class CheckForUpdatesErrors {
return this;
}
public CheckForUpdatesErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class CheckForUpdatesErrors {
return this;
}
public CheckForUpdatesErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class CheckForUpdatesErrors {
return this;
}
public CheckForUpdatesErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class CheckForUpdatesErrors {
}
CheckForUpdatesErrors other = (CheckForUpdatesErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class CheckForUpdatesErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class CheckForUpdatesErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class CheckForUpdatesErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class CheckForUpdatesErrors {
this.status = status;
return this;
}
public CheckForUpdatesErrors build() {
return new CheckForUpdatesErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
public CheckForUpdatesUnauthorized(
@JsonProperty("errors") Optional<? extends List<CheckForUpdatesUpdaterErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CheckForUpdatesUnauthorized withErrors(List<CheckForUpdatesUpdaterErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
return this;
}
public CheckForUpdatesUnauthorized withErrors(Optional<? extends List<CheckForUpdatesUpdaterErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
}
CheckForUpdatesUnauthorized other = (CheckForUpdatesUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<CheckForUpdatesUpdaterErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<CheckForUpdatesUpdaterErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class CheckForUpdatesUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public CheckForUpdatesUnauthorized build() {
return new CheckForUpdatesUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class CheckForUpdatesUpdaterErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class CheckForUpdatesUpdaterErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CheckForUpdatesUpdaterErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class CheckForUpdatesUpdaterErrors {
return this;
}
public CheckForUpdatesUpdaterErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class CheckForUpdatesUpdaterErrors {
return this;
}
public CheckForUpdatesUpdaterErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class CheckForUpdatesUpdaterErrors {
return this;
}
public CheckForUpdatesUpdaterErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class CheckForUpdatesUpdaterErrors {
}
CheckForUpdatesUpdaterErrors other = (CheckForUpdatesUpdaterErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class CheckForUpdatesUpdaterErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class CheckForUpdatesUpdaterErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class CheckForUpdatesUpdaterErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class CheckForUpdatesUpdaterErrors {
this.status = status;
return this;
}
public CheckForUpdatesUpdaterErrors build() {
return new CheckForUpdatesUpdaterErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
public ClearPlaylistContentsBadRequest(
@JsonProperty("errors") Optional<? extends List<ClearPlaylistContentsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public ClearPlaylistContentsBadRequest withErrors(List<ClearPlaylistContentsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
return this;
}
public ClearPlaylistContentsBadRequest withErrors(Optional<? extends List<ClearPlaylistContentsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
}
ClearPlaylistContentsBadRequest other = (ClearPlaylistContentsBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<ClearPlaylistContentsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<ClearPlaylistContentsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class ClearPlaylistContentsBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public ClearPlaylistContentsBadRequest build() {
return new ClearPlaylistContentsBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class ClearPlaylistContentsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class ClearPlaylistContentsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public ClearPlaylistContentsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class ClearPlaylistContentsErrors {
return this;
}
public ClearPlaylistContentsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class ClearPlaylistContentsErrors {
return this;
}
public ClearPlaylistContentsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class ClearPlaylistContentsErrors {
return this;
}
public ClearPlaylistContentsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class ClearPlaylistContentsErrors {
}
ClearPlaylistContentsErrors other = (ClearPlaylistContentsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class ClearPlaylistContentsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class ClearPlaylistContentsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class ClearPlaylistContentsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class ClearPlaylistContentsErrors {
this.status = status;
return this;
}
public ClearPlaylistContentsErrors build() {
return new ClearPlaylistContentsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class ClearPlaylistContentsPlaylistsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class ClearPlaylistContentsPlaylistsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public ClearPlaylistContentsPlaylistsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class ClearPlaylistContentsPlaylistsErrors {
return this;
}
public ClearPlaylistContentsPlaylistsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class ClearPlaylistContentsPlaylistsErrors {
return this;
}
public ClearPlaylistContentsPlaylistsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class ClearPlaylistContentsPlaylistsErrors {
return this;
}
public ClearPlaylistContentsPlaylistsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class ClearPlaylistContentsPlaylistsErrors {
}
ClearPlaylistContentsPlaylistsErrors other = (ClearPlaylistContentsPlaylistsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class ClearPlaylistContentsPlaylistsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class ClearPlaylistContentsPlaylistsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class ClearPlaylistContentsPlaylistsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class ClearPlaylistContentsPlaylistsErrors {
this.status = status;
return this;
}
public ClearPlaylistContentsPlaylistsErrors build() {
return new ClearPlaylistContentsPlaylistsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
public ClearPlaylistContentsUnauthorized(
@JsonProperty("errors") Optional<? extends List<ClearPlaylistContentsPlaylistsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public ClearPlaylistContentsUnauthorized withErrors(List<ClearPlaylistContentsPlaylistsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
return this;
}
public ClearPlaylistContentsUnauthorized withErrors(Optional<? extends List<ClearPlaylistContentsPlaylistsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
}
ClearPlaylistContentsUnauthorized other = (ClearPlaylistContentsUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<ClearPlaylistContentsPlaylistsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<ClearPlaylistContentsPlaylistsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class ClearPlaylistContentsUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public ClearPlaylistContentsUnauthorized build() {
return new ClearPlaylistContentsUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class CreatePlaylistBadRequest extends RuntimeException {
public CreatePlaylistBadRequest(
@JsonProperty("errors") Optional<? extends List<CreatePlaylistErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class CreatePlaylistBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CreatePlaylistBadRequest withErrors(List<CreatePlaylistErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class CreatePlaylistBadRequest extends RuntimeException {
return this;
}
public CreatePlaylistBadRequest withErrors(Optional<? extends List<CreatePlaylistErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class CreatePlaylistBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class CreatePlaylistBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class CreatePlaylistBadRequest extends RuntimeException {
}
CreatePlaylistBadRequest other = (CreatePlaylistBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class CreatePlaylistBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<CreatePlaylistErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<CreatePlaylistErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class CreatePlaylistBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class CreatePlaylistBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public CreatePlaylistBadRequest build() {
return new CreatePlaylistBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class CreatePlaylistErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class CreatePlaylistErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CreatePlaylistErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class CreatePlaylistErrors {
return this;
}
public CreatePlaylistErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class CreatePlaylistErrors {
return this;
}
public CreatePlaylistErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class CreatePlaylistErrors {
return this;
}
public CreatePlaylistErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class CreatePlaylistErrors {
}
CreatePlaylistErrors other = (CreatePlaylistErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class CreatePlaylistErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class CreatePlaylistErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class CreatePlaylistErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class CreatePlaylistErrors {
this.status = status;
return this;
}
public CreatePlaylistErrors build() {
return new CreatePlaylistErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class CreatePlaylistPlaylistsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class CreatePlaylistPlaylistsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CreatePlaylistPlaylistsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class CreatePlaylistPlaylistsErrors {
return this;
}
public CreatePlaylistPlaylistsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class CreatePlaylistPlaylistsErrors {
return this;
}
public CreatePlaylistPlaylistsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class CreatePlaylistPlaylistsErrors {
return this;
}
public CreatePlaylistPlaylistsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class CreatePlaylistPlaylistsErrors {
}
CreatePlaylistPlaylistsErrors other = (CreatePlaylistPlaylistsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class CreatePlaylistPlaylistsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class CreatePlaylistPlaylistsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class CreatePlaylistPlaylistsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class CreatePlaylistPlaylistsErrors {
this.status = status;
return this;
}
public CreatePlaylistPlaylistsErrors build() {
return new CreatePlaylistPlaylistsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
public CreatePlaylistUnauthorized(
@JsonProperty("errors") Optional<? extends List<CreatePlaylistPlaylistsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public CreatePlaylistUnauthorized withErrors(List<CreatePlaylistPlaylistsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
return this;
}
public CreatePlaylistUnauthorized withErrors(Optional<? extends List<CreatePlaylistPlaylistsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
}
CreatePlaylistUnauthorized other = (CreatePlaylistUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<CreatePlaylistPlaylistsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<CreatePlaylistPlaylistsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class CreatePlaylistUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public CreatePlaylistUnauthorized build() {
return new CreatePlaylistUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class DeleteLibraryBadRequest extends RuntimeException {
public DeleteLibraryBadRequest(
@JsonProperty("errors") Optional<? extends List<DeleteLibraryErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class DeleteLibraryBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public DeleteLibraryBadRequest withErrors(List<DeleteLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class DeleteLibraryBadRequest extends RuntimeException {
return this;
}
public DeleteLibraryBadRequest withErrors(Optional<? extends List<DeleteLibraryErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class DeleteLibraryBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class DeleteLibraryBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class DeleteLibraryBadRequest extends RuntimeException {
}
DeleteLibraryBadRequest other = (DeleteLibraryBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class DeleteLibraryBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<DeleteLibraryErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<DeleteLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class DeleteLibraryBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class DeleteLibraryBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public DeleteLibraryBadRequest build() {
return new DeleteLibraryBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class DeleteLibraryErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class DeleteLibraryErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public DeleteLibraryErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class DeleteLibraryErrors {
return this;
}
public DeleteLibraryErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class DeleteLibraryErrors {
return this;
}
public DeleteLibraryErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class DeleteLibraryErrors {
return this;
}
public DeleteLibraryErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class DeleteLibraryErrors {
}
DeleteLibraryErrors other = (DeleteLibraryErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class DeleteLibraryErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class DeleteLibraryErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class DeleteLibraryErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class DeleteLibraryErrors {
this.status = status;
return this;
}
public DeleteLibraryErrors build() {
return new DeleteLibraryErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class DeleteLibraryLibraryErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class DeleteLibraryLibraryErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public DeleteLibraryLibraryErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class DeleteLibraryLibraryErrors {
return this;
}
public DeleteLibraryLibraryErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class DeleteLibraryLibraryErrors {
return this;
}
public DeleteLibraryLibraryErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class DeleteLibraryLibraryErrors {
return this;
}
public DeleteLibraryLibraryErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class DeleteLibraryLibraryErrors {
}
DeleteLibraryLibraryErrors other = (DeleteLibraryLibraryErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class DeleteLibraryLibraryErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class DeleteLibraryLibraryErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class DeleteLibraryLibraryErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class DeleteLibraryLibraryErrors {
this.status = status;
return this;
}
public DeleteLibraryLibraryErrors build() {
return new DeleteLibraryLibraryErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
public DeleteLibraryUnauthorized(
@JsonProperty("errors") Optional<? extends List<DeleteLibraryLibraryErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public DeleteLibraryUnauthorized withErrors(List<DeleteLibraryLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
return this;
}
public DeleteLibraryUnauthorized withErrors(Optional<? extends List<DeleteLibraryLibraryErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
}
DeleteLibraryUnauthorized other = (DeleteLibraryUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<DeleteLibraryLibraryErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<DeleteLibraryLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class DeleteLibraryUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public DeleteLibraryUnauthorized build() {
return new DeleteLibraryUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class DeletePlaylistBadRequest extends RuntimeException {
public DeletePlaylistBadRequest(
@JsonProperty("errors") Optional<? extends List<DeletePlaylistErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class DeletePlaylistBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public DeletePlaylistBadRequest withErrors(List<DeletePlaylistErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class DeletePlaylistBadRequest extends RuntimeException {
return this;
}
public DeletePlaylistBadRequest withErrors(Optional<? extends List<DeletePlaylistErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class DeletePlaylistBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class DeletePlaylistBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class DeletePlaylistBadRequest extends RuntimeException {
}
DeletePlaylistBadRequest other = (DeletePlaylistBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class DeletePlaylistBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<DeletePlaylistErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<DeletePlaylistErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class DeletePlaylistBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class DeletePlaylistBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public DeletePlaylistBadRequest build() {
return new DeletePlaylistBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class DeletePlaylistErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class DeletePlaylistErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public DeletePlaylistErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class DeletePlaylistErrors {
return this;
}
public DeletePlaylistErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class DeletePlaylistErrors {
return this;
}
public DeletePlaylistErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class DeletePlaylistErrors {
return this;
}
public DeletePlaylistErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class DeletePlaylistErrors {
}
DeletePlaylistErrors other = (DeletePlaylistErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class DeletePlaylistErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class DeletePlaylistErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class DeletePlaylistErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class DeletePlaylistErrors {
this.status = status;
return this;
}
public DeletePlaylistErrors build() {
return new DeletePlaylistErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class DeletePlaylistPlaylistsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class DeletePlaylistPlaylistsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public DeletePlaylistPlaylistsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class DeletePlaylistPlaylistsErrors {
return this;
}
public DeletePlaylistPlaylistsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class DeletePlaylistPlaylistsErrors {
return this;
}
public DeletePlaylistPlaylistsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class DeletePlaylistPlaylistsErrors {
return this;
}
public DeletePlaylistPlaylistsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class DeletePlaylistPlaylistsErrors {
}
DeletePlaylistPlaylistsErrors other = (DeletePlaylistPlaylistsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class DeletePlaylistPlaylistsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class DeletePlaylistPlaylistsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class DeletePlaylistPlaylistsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class DeletePlaylistPlaylistsErrors {
this.status = status;
return this;
}
public DeletePlaylistPlaylistsErrors build() {
return new DeletePlaylistPlaylistsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
public DeletePlaylistUnauthorized(
@JsonProperty("errors") Optional<? extends List<DeletePlaylistPlaylistsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public DeletePlaylistUnauthorized withErrors(List<DeletePlaylistPlaylistsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
return this;
}
public DeletePlaylistUnauthorized withErrors(Optional<? extends List<DeletePlaylistPlaylistsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
}
DeletePlaylistUnauthorized other = (DeletePlaylistUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<DeletePlaylistPlaylistsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<DeletePlaylistPlaylistsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class DeletePlaylistUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public DeletePlaylistUnauthorized build() {
return new DeletePlaylistUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
public EnablePaperTrailBadRequest(
@JsonProperty("errors") Optional<? extends List<EnablePaperTrailErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public EnablePaperTrailBadRequest withErrors(List<EnablePaperTrailErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
return this;
}
public EnablePaperTrailBadRequest withErrors(Optional<? extends List<EnablePaperTrailErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
}
EnablePaperTrailBadRequest other = (EnablePaperTrailBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<EnablePaperTrailErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<EnablePaperTrailErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class EnablePaperTrailBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public EnablePaperTrailBadRequest build() {
return new EnablePaperTrailBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class EnablePaperTrailErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class EnablePaperTrailErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public EnablePaperTrailErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class EnablePaperTrailErrors {
return this;
}
public EnablePaperTrailErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class EnablePaperTrailErrors {
return this;
}
public EnablePaperTrailErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class EnablePaperTrailErrors {
return this;
}
public EnablePaperTrailErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class EnablePaperTrailErrors {
}
EnablePaperTrailErrors other = (EnablePaperTrailErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class EnablePaperTrailErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class EnablePaperTrailErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class EnablePaperTrailErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class EnablePaperTrailErrors {
this.status = status;
return this;
}
public EnablePaperTrailErrors build() {
return new EnablePaperTrailErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class EnablePaperTrailLogErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class EnablePaperTrailLogErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public EnablePaperTrailLogErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class EnablePaperTrailLogErrors {
return this;
}
public EnablePaperTrailLogErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class EnablePaperTrailLogErrors {
return this;
}
public EnablePaperTrailLogErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class EnablePaperTrailLogErrors {
return this;
}
public EnablePaperTrailLogErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class EnablePaperTrailLogErrors {
}
EnablePaperTrailLogErrors other = (EnablePaperTrailLogErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class EnablePaperTrailLogErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class EnablePaperTrailLogErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class EnablePaperTrailLogErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class EnablePaperTrailLogErrors {
this.status = status;
return this;
}
public EnablePaperTrailLogErrors build() {
return new EnablePaperTrailLogErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
public EnablePaperTrailUnauthorized(
@JsonProperty("errors") Optional<? extends List<EnablePaperTrailLogErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public EnablePaperTrailUnauthorized withErrors(List<EnablePaperTrailLogErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
return this;
}
public EnablePaperTrailUnauthorized withErrors(Optional<? extends List<EnablePaperTrailLogErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
}
EnablePaperTrailUnauthorized other = (EnablePaperTrailUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<EnablePaperTrailLogErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<EnablePaperTrailLogErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class EnablePaperTrailUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public EnablePaperTrailUnauthorized build() {
return new EnablePaperTrailUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class Errors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class Errors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public Errors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class Errors {
return this;
}
public Errors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class Errors {
return this;
}
public Errors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class Errors {
return this;
}
public Errors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class Errors {
}
Errors other = (Errors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class Errors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class Errors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class Errors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class Errors {
this.status = status;
return this;
}
public Errors build() {
return new Errors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
public GetActorsLibraryBadRequest(
@JsonProperty("errors") Optional<? extends List<GetActorsLibraryErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetActorsLibraryBadRequest withErrors(List<GetActorsLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
return this;
}
public GetActorsLibraryBadRequest withErrors(Optional<? extends List<GetActorsLibraryErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
}
GetActorsLibraryBadRequest other = (GetActorsLibraryBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetActorsLibraryErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetActorsLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetActorsLibraryBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetActorsLibraryBadRequest build() {
return new GetActorsLibraryBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetActorsLibraryErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetActorsLibraryErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetActorsLibraryErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetActorsLibraryErrors {
return this;
}
public GetActorsLibraryErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetActorsLibraryErrors {
return this;
}
public GetActorsLibraryErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetActorsLibraryErrors {
return this;
}
public GetActorsLibraryErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetActorsLibraryErrors {
}
GetActorsLibraryErrors other = (GetActorsLibraryErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetActorsLibraryErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetActorsLibraryErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetActorsLibraryErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetActorsLibraryErrors {
this.status = status;
return this;
}
public GetActorsLibraryErrors build() {
return new GetActorsLibraryErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetActorsLibraryLibraryErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetActorsLibraryLibraryErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetActorsLibraryLibraryErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetActorsLibraryLibraryErrors {
return this;
}
public GetActorsLibraryLibraryErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetActorsLibraryLibraryErrors {
return this;
}
public GetActorsLibraryLibraryErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetActorsLibraryLibraryErrors {
return this;
}
public GetActorsLibraryLibraryErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetActorsLibraryLibraryErrors {
}
GetActorsLibraryLibraryErrors other = (GetActorsLibraryLibraryErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetActorsLibraryLibraryErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetActorsLibraryLibraryErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetActorsLibraryLibraryErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetActorsLibraryLibraryErrors {
this.status = status;
return this;
}
public GetActorsLibraryLibraryErrors build() {
return new GetActorsLibraryLibraryErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
public GetActorsLibraryUnauthorized(
@JsonProperty("errors") Optional<? extends List<GetActorsLibraryLibraryErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetActorsLibraryUnauthorized withErrors(List<GetActorsLibraryLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
return this;
}
public GetActorsLibraryUnauthorized withErrors(Optional<? extends List<GetActorsLibraryLibraryErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
}
GetActorsLibraryUnauthorized other = (GetActorsLibraryUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetActorsLibraryLibraryErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetActorsLibraryLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetActorsLibraryUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetActorsLibraryUnauthorized build() {
return new GetActorsLibraryUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
public GetAllLibrariesBadRequest(
@JsonProperty("errors") Optional<? extends List<GetAllLibrariesErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetAllLibrariesBadRequest withErrors(List<GetAllLibrariesErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
return this;
}
public GetAllLibrariesBadRequest withErrors(Optional<? extends List<GetAllLibrariesErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
}
GetAllLibrariesBadRequest other = (GetAllLibrariesBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetAllLibrariesErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetAllLibrariesErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetAllLibrariesBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetAllLibrariesBadRequest build() {
return new GetAllLibrariesBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetAllLibrariesErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetAllLibrariesErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetAllLibrariesErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetAllLibrariesErrors {
return this;
}
public GetAllLibrariesErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetAllLibrariesErrors {
return this;
}
public GetAllLibrariesErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetAllLibrariesErrors {
return this;
}
public GetAllLibrariesErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetAllLibrariesErrors {
}
GetAllLibrariesErrors other = (GetAllLibrariesErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetAllLibrariesErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetAllLibrariesErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetAllLibrariesErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetAllLibrariesErrors {
this.status = status;
return this;
}
public GetAllLibrariesErrors build() {
return new GetAllLibrariesErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetAllLibrariesLibraryErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetAllLibrariesLibraryErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetAllLibrariesLibraryErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetAllLibrariesLibraryErrors {
return this;
}
public GetAllLibrariesLibraryErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetAllLibrariesLibraryErrors {
return this;
}
public GetAllLibrariesLibraryErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetAllLibrariesLibraryErrors {
return this;
}
public GetAllLibrariesLibraryErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetAllLibrariesLibraryErrors {
}
GetAllLibrariesLibraryErrors other = (GetAllLibrariesLibraryErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetAllLibrariesLibraryErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetAllLibrariesLibraryErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetAllLibrariesLibraryErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetAllLibrariesLibraryErrors {
this.status = status;
return this;
}
public GetAllLibrariesLibraryErrors build() {
return new GetAllLibrariesLibraryErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
public GetAllLibrariesUnauthorized(
@JsonProperty("errors") Optional<? extends List<GetAllLibrariesLibraryErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetAllLibrariesUnauthorized withErrors(List<GetAllLibrariesLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
return this;
}
public GetAllLibrariesUnauthorized withErrors(Optional<? extends List<GetAllLibrariesLibraryErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
}
GetAllLibrariesUnauthorized other = (GetAllLibrariesUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetAllLibrariesLibraryErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetAllLibrariesLibraryErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetAllLibrariesUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetAllLibrariesUnauthorized build() {
return new GetAllLibrariesUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
public GetAvailableClientsBadRequest(
@JsonProperty("errors") Optional<? extends List<GetAvailableClientsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetAvailableClientsBadRequest withErrors(List<GetAvailableClientsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
return this;
}
public GetAvailableClientsBadRequest withErrors(Optional<? extends List<GetAvailableClientsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
}
GetAvailableClientsBadRequest other = (GetAvailableClientsBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetAvailableClientsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetAvailableClientsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetAvailableClientsBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetAvailableClientsBadRequest build() {
return new GetAvailableClientsBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetAvailableClientsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetAvailableClientsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetAvailableClientsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetAvailableClientsErrors {
return this;
}
public GetAvailableClientsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetAvailableClientsErrors {
return this;
}
public GetAvailableClientsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetAvailableClientsErrors {
return this;
}
public GetAvailableClientsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetAvailableClientsErrors {
}
GetAvailableClientsErrors other = (GetAvailableClientsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetAvailableClientsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetAvailableClientsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetAvailableClientsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetAvailableClientsErrors {
this.status = status;
return this;
}
public GetAvailableClientsErrors build() {
return new GetAvailableClientsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetAvailableClientsServerErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetAvailableClientsServerErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetAvailableClientsServerErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetAvailableClientsServerErrors {
return this;
}
public GetAvailableClientsServerErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetAvailableClientsServerErrors {
return this;
}
public GetAvailableClientsServerErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetAvailableClientsServerErrors {
return this;
}
public GetAvailableClientsServerErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetAvailableClientsServerErrors {
}
GetAvailableClientsServerErrors other = (GetAvailableClientsServerErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetAvailableClientsServerErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetAvailableClientsServerErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetAvailableClientsServerErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetAvailableClientsServerErrors {
this.status = status;
return this;
}
public GetAvailableClientsServerErrors build() {
return new GetAvailableClientsServerErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
public GetAvailableClientsUnauthorized(
@JsonProperty("errors") Optional<? extends List<GetAvailableClientsServerErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetAvailableClientsUnauthorized withErrors(List<GetAvailableClientsServerErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
return this;
}
public GetAvailableClientsUnauthorized withErrors(Optional<? extends List<GetAvailableClientsServerErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
}
GetAvailableClientsUnauthorized other = (GetAvailableClientsUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetAvailableClientsServerErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetAvailableClientsServerErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetAvailableClientsUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetAvailableClientsUnauthorized build() {
return new GetAvailableClientsUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
public GetBandwidthStatisticsBadRequest(
@JsonProperty("errors") Optional<? extends List<GetBandwidthStatisticsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetBandwidthStatisticsBadRequest withErrors(List<GetBandwidthStatisticsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
return this;
}
public GetBandwidthStatisticsBadRequest withErrors(Optional<? extends List<GetBandwidthStatisticsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
}
GetBandwidthStatisticsBadRequest other = (GetBandwidthStatisticsBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetBandwidthStatisticsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetBandwidthStatisticsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetBandwidthStatisticsBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetBandwidthStatisticsBadRequest build() {
return new GetBandwidthStatisticsBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetBandwidthStatisticsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetBandwidthStatisticsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetBandwidthStatisticsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetBandwidthStatisticsErrors {
return this;
}
public GetBandwidthStatisticsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetBandwidthStatisticsErrors {
return this;
}
public GetBandwidthStatisticsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetBandwidthStatisticsErrors {
return this;
}
public GetBandwidthStatisticsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetBandwidthStatisticsErrors {
}
GetBandwidthStatisticsErrors other = (GetBandwidthStatisticsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetBandwidthStatisticsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetBandwidthStatisticsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetBandwidthStatisticsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetBandwidthStatisticsErrors {
this.status = status;
return this;
}
public GetBandwidthStatisticsErrors build() {
return new GetBandwidthStatisticsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetBandwidthStatisticsStatisticsErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetBandwidthStatisticsStatisticsErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetBandwidthStatisticsStatisticsErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetBandwidthStatisticsStatisticsErrors {
return this;
}
public GetBandwidthStatisticsStatisticsErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetBandwidthStatisticsStatisticsErrors {
return this;
}
public GetBandwidthStatisticsStatisticsErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetBandwidthStatisticsStatisticsErrors {
return this;
}
public GetBandwidthStatisticsStatisticsErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetBandwidthStatisticsStatisticsErrors {
}
GetBandwidthStatisticsStatisticsErrors other = (GetBandwidthStatisticsStatisticsErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetBandwidthStatisticsStatisticsErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetBandwidthStatisticsStatisticsErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetBandwidthStatisticsStatisticsErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetBandwidthStatisticsStatisticsErrors {
this.status = status;
return this;
}
public GetBandwidthStatisticsStatisticsErrors build() {
return new GetBandwidthStatisticsStatisticsErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
public GetBandwidthStatisticsUnauthorized(
@JsonProperty("errors") Optional<? extends List<GetBandwidthStatisticsStatisticsErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetBandwidthStatisticsUnauthorized withErrors(List<GetBandwidthStatisticsStatisticsErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
return this;
}
public GetBandwidthStatisticsUnauthorized withErrors(Optional<? extends List<GetBandwidthStatisticsStatisticsErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
}
GetBandwidthStatisticsUnauthorized other = (GetBandwidthStatisticsUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetBandwidthStatisticsStatisticsErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetBandwidthStatisticsStatisticsErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetBandwidthStatisticsUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetBandwidthStatisticsUnauthorized build() {
return new GetBandwidthStatisticsUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetBannerImageBadRequest extends RuntimeException {
public GetBannerImageBadRequest(
@JsonProperty("errors") Optional<? extends List<GetBannerImageErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetBannerImageBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetBannerImageBadRequest withErrors(List<GetBannerImageErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetBannerImageBadRequest extends RuntimeException {
return this;
}
public GetBannerImageBadRequest withErrors(Optional<? extends List<GetBannerImageErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetBannerImageBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetBannerImageBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetBannerImageBadRequest extends RuntimeException {
}
GetBannerImageBadRequest other = (GetBannerImageBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetBannerImageBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetBannerImageErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetBannerImageErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetBannerImageBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetBannerImageBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetBannerImageBadRequest build() {
return new GetBannerImageBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetBannerImageErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetBannerImageErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetBannerImageErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetBannerImageErrors {
return this;
}
public GetBannerImageErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetBannerImageErrors {
return this;
}
public GetBannerImageErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetBannerImageErrors {
return this;
}
public GetBannerImageErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetBannerImageErrors {
}
GetBannerImageErrors other = (GetBannerImageErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetBannerImageErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetBannerImageErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetBannerImageErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetBannerImageErrors {
this.status = status;
return this;
}
public GetBannerImageErrors build() {
return new GetBannerImageErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetBannerImageMediaErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetBannerImageMediaErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetBannerImageMediaErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetBannerImageMediaErrors {
return this;
}
public GetBannerImageMediaErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetBannerImageMediaErrors {
return this;
}
public GetBannerImageMediaErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetBannerImageMediaErrors {
return this;
}
public GetBannerImageMediaErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetBannerImageMediaErrors {
}
GetBannerImageMediaErrors other = (GetBannerImageMediaErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetBannerImageMediaErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetBannerImageMediaErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetBannerImageMediaErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetBannerImageMediaErrors {
this.status = status;
return this;
}
public GetBannerImageMediaErrors build() {
return new GetBannerImageMediaErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetBannerImageUnauthorized extends RuntimeException {
public GetBannerImageUnauthorized(
@JsonProperty("errors") Optional<? extends List<GetBannerImageMediaErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetBannerImageUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetBannerImageUnauthorized withErrors(List<GetBannerImageMediaErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetBannerImageUnauthorized extends RuntimeException {
return this;
}
public GetBannerImageUnauthorized withErrors(Optional<? extends List<GetBannerImageMediaErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetBannerImageUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetBannerImageUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetBannerImageUnauthorized extends RuntimeException {
}
GetBannerImageUnauthorized other = (GetBannerImageUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetBannerImageUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetBannerImageMediaErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetBannerImageMediaErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetBannerImageUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetBannerImageUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetBannerImageUnauthorized build() {
return new GetBannerImageUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetButlerTasksBadRequest extends RuntimeException {
public GetButlerTasksBadRequest(
@JsonProperty("errors") Optional<? extends List<GetButlerTasksErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetButlerTasksBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetButlerTasksBadRequest withErrors(List<GetButlerTasksErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetButlerTasksBadRequest extends RuntimeException {
return this;
}
public GetButlerTasksBadRequest withErrors(Optional<? extends List<GetButlerTasksErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetButlerTasksBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetButlerTasksBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetButlerTasksBadRequest extends RuntimeException {
}
GetButlerTasksBadRequest other = (GetButlerTasksBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetButlerTasksBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetButlerTasksErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetButlerTasksErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetButlerTasksBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetButlerTasksBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetButlerTasksBadRequest build() {
return new GetButlerTasksBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetButlerTasksButlerErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetButlerTasksButlerErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetButlerTasksButlerErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetButlerTasksButlerErrors {
return this;
}
public GetButlerTasksButlerErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetButlerTasksButlerErrors {
return this;
}
public GetButlerTasksButlerErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetButlerTasksButlerErrors {
return this;
}
public GetButlerTasksButlerErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetButlerTasksButlerErrors {
}
GetButlerTasksButlerErrors other = (GetButlerTasksButlerErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetButlerTasksButlerErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetButlerTasksButlerErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetButlerTasksButlerErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetButlerTasksButlerErrors {
this.status = status;
return this;
}
public GetButlerTasksButlerErrors build() {
return new GetButlerTasksButlerErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -12,19 +12,21 @@ import dev.plexapi.sdk.utils.Utils;
import java.lang.Integer;
import java.lang.Override;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
public class GetButlerTasksErrors {
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("code")
private Optional<Integer> code;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("message")
private Optional<String> message;
@JsonInclude(Include.NON_ABSENT)
@JsonProperty("status")
private Optional<Integer> status;
@@ -61,9 +63,10 @@ public class GetButlerTasksErrors {
return status;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetButlerTasksErrors withCode(int code) {
Utils.checkNotNull(code, "code");
@@ -71,6 +74,7 @@ public class GetButlerTasksErrors {
return this;
}
public GetButlerTasksErrors withCode(Optional<Integer> code) {
Utils.checkNotNull(code, "code");
this.code = code;
@@ -83,6 +87,7 @@ public class GetButlerTasksErrors {
return this;
}
public GetButlerTasksErrors withMessage(Optional<String> message) {
Utils.checkNotNull(message, "message");
this.message = message;
@@ -95,13 +100,13 @@ public class GetButlerTasksErrors {
return this;
}
public GetButlerTasksErrors withStatus(Optional<Integer> status) {
Utils.checkNotNull(status, "status");
this.status = status;
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,17 +117,15 @@ public class GetButlerTasksErrors {
}
GetButlerTasksErrors other = (GetButlerTasksErrors) o;
return
Objects.deepEquals(this.code, other.code) &&
Objects.deepEquals(this.message, other.message) &&
Objects.deepEquals(this.status, other.status);
Utils.enhancedDeepEquals(this.code, other.code) &&
Utils.enhancedDeepEquals(this.message, other.message) &&
Utils.enhancedDeepEquals(this.status, other.status);
}
@Override
public int hashCode() {
return Objects.hash(
code,
message,
status);
return Utils.enhancedHash(
code, message, status);
}
@Override
@@ -132,19 +135,21 @@ public class GetButlerTasksErrors {
"message", message,
"status", status);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<Integer> code = Optional.empty();
private Optional<String> message = Optional.empty();
private Optional<Integer> status = Optional.empty();
private Builder() {
// force use of static builder() method
}
public Builder code(int code) {
Utils.checkNotNull(code, "code");
this.code = Optional.ofNullable(code);
@@ -157,6 +162,7 @@ public class GetButlerTasksErrors {
return this;
}
public Builder message(String message) {
Utils.checkNotNull(message, "message");
this.message = Optional.ofNullable(message);
@@ -169,6 +175,7 @@ public class GetButlerTasksErrors {
return this;
}
public Builder status(int status) {
Utils.checkNotNull(status, "status");
this.status = Optional.ofNullable(status);
@@ -180,12 +187,12 @@ public class GetButlerTasksErrors {
this.status = status;
return this;
}
public GetButlerTasksErrors build() {
return new GetButlerTasksErrors(
code,
message,
status);
code, message, status);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
public GetButlerTasksUnauthorized(
@JsonProperty("errors") Optional<? extends List<GetButlerTasksButlerErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetButlerTasksUnauthorized withErrors(List<GetButlerTasksButlerErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
return this;
}
public GetButlerTasksUnauthorized withErrors(Optional<? extends List<GetButlerTasksButlerErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
}
GetButlerTasksUnauthorized other = (GetButlerTasksUnauthorized) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetButlerTasksButlerErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetButlerTasksButlerErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetButlerTasksUnauthorized extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetButlerTasksUnauthorized build() {
return new GetButlerTasksUnauthorized(
errors,
rawResponse);
errors, rawResponse);
}
}
}

View File

@@ -16,7 +16,6 @@ import java.lang.String;
import java.lang.SuppressWarnings;
import java.net.http.HttpResponse;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
/**
@@ -42,6 +41,7 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
public GetCompanionsDataBadRequest(
@JsonProperty("errors") Optional<? extends List<GetCompanionsDataErrors>> errors,
@JsonProperty("RawResponse") Optional<? extends HttpResponse<InputStream>> rawResponse) {
super("API error occurred");
Utils.checkNotNull(errors, "errors");
Utils.checkNotNull(rawResponse, "rawResponse");
this.errors = errors;
@@ -67,9 +67,10 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
return (Optional<HttpResponse<InputStream>>) rawResponse;
}
public final static Builder builder() {
public static Builder builder() {
return new Builder();
}
}
public GetCompanionsDataBadRequest withErrors(List<GetCompanionsDataErrors> errors) {
Utils.checkNotNull(errors, "errors");
@@ -77,6 +78,7 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
return this;
}
public GetCompanionsDataBadRequest withErrors(Optional<? extends List<GetCompanionsDataErrors>> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = errors;
@@ -92,6 +94,7 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -101,7 +104,6 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
return this;
}
@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
@@ -112,15 +114,14 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
}
GetCompanionsDataBadRequest other = (GetCompanionsDataBadRequest) o;
return
Objects.deepEquals(this.errors, other.errors) &&
Objects.deepEquals(this.rawResponse, other.rawResponse);
Utils.enhancedDeepEquals(this.errors, other.errors) &&
Utils.enhancedDeepEquals(this.rawResponse, other.rawResponse);
}
@Override
public int hashCode() {
return Objects.hash(
errors,
rawResponse);
return Utils.enhancedHash(
errors, rawResponse);
}
@Override
@@ -129,17 +130,19 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
"errors", errors,
"rawResponse", rawResponse);
}
@SuppressWarnings("UnusedReturnValue")
public final static class Builder {
private Optional<? extends List<GetCompanionsDataErrors>> errors = Optional.empty();
private Optional<? extends HttpResponse<InputStream>> rawResponse;
private Builder() {
// force use of static builder() method
}
public Builder errors(List<GetCompanionsDataErrors> errors) {
Utils.checkNotNull(errors, "errors");
this.errors = Optional.ofNullable(errors);
@@ -152,6 +155,7 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
return this;
}
/**
* Raw HTTP response; suitable for custom response parsing
*/
@@ -169,12 +173,13 @@ public class GetCompanionsDataBadRequest extends RuntimeException {
this.rawResponse = rawResponse;
return this;
}
public GetCompanionsDataBadRequest build() {
return new GetCompanionsDataBadRequest(
errors,
rawResponse);
errors, rawResponse);
}
}
}

Some files were not shown because too many files have changed in this diff Show More