](../../models/operations/IncludeDetails.md) | :heavy_minus_sign: | Whether or not to include details for a section (types, filters, and sorts).
Only exists for backwards compatibility, media providers other than the server libraries have it on always.
| |
+| `sectionKey` | *int* | :heavy_check_mark: | The unique key of the Plex library.
Note: This is unique in the context of the Plex server.
| 9518 |
### Response
diff --git a/docs/sdks/log/README.md b/docs/sdks/log/README.md
index cb3be6b2..056cd329 100644
--- a/docs/sdks/log/README.md
+++ b/docs/sdks/log/README.md
@@ -50,11 +50,11 @@ public class Application {
### Parameters
-| Parameter | Type | Required | Description | Example |
-| ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- |
-| `level` | [Level](../../models/operations/Level.md) | :heavy_check_mark: | An integer log level to write to the PMS log with.
0: Error
1: Warning
2: Info
3: Debug
4: Verbose
| |
-| `message` | *String* | :heavy_check_mark: | The text of the message to write to the log. | Test log message |
-| `source` | *String* | :heavy_check_mark: | a string indicating the source of the message. | Postman |
+| Parameter | Type | Required | Description | Example |
+| --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
+| `level` | [Level](../../models/operations/Level.md) | :heavy_check_mark: | An integer log level to write to the PMS log with.
0: Error
1: Warning
2: Info
3: Debug
4: Verbose
| |
+| `message` | *String* | :heavy_check_mark: | The text of the message to write to the log. | Test log message |
+| `source` | *String* | :heavy_check_mark: | a string indicating the source of the message. | Postman |
### Response
@@ -70,13 +70,13 @@ public class Application {
## logMultiLine
-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'.
+This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
+It accepts a text/plain request body, where each line represents a distinct log entry.
+Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'.
-Log entries are separated by a newline character (`\n`).
-Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
-This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.
+Log entries are separated by a newline character (`\n`).
+Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
+This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.
The 'level' parameter specifies the log entry's severity or importance, with the following integer values:
- `0`: Error - Critical issues that require immediate attention.
diff --git a/docs/sdks/playlists/README.md b/docs/sdks/playlists/README.md
index 3664d7ed..6917ff15 100644
--- a/docs/sdks/playlists/README.md
+++ b/docs/sdks/playlists/README.md
@@ -3,9 +3,9 @@
## Overview
-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").
+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.
+Retrieving a playlist, or its items, will trigger a refresh of its metadata.
This may cause the duration and number of items to change.
@@ -499,11 +499,11 @@ public class Application {
### Parameters
-| Parameter | Type | Required | Description | Example |
-| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| `path` | *String* | :heavy_check_mark: | 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.
| /home/barkley/playlist.m3u |
-| `force` | [QueryParamForce](../../models/operations/QueryParamForce.md) | :heavy_check_mark: | 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.
| |
-| `sectionID` | *long* | :heavy_check_mark: | Possibly the section ID to upload the playlist to, we are not certain. | 1 |
+| Parameter | Type | Required | Description | Example |
+| ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `path` | *String* | :heavy_check_mark: | 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.
| /home/barkley/playlist.m3u |
+| `force` | [QueryParamForce](../../models/operations/QueryParamForce.md) | :heavy_check_mark: | 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.
| |
+| `sectionID` | *long* | :heavy_check_mark: | Possibly the section ID to upload the playlist to, we are not certain. | 1 |
### Response
diff --git a/gradle.properties b/gradle.properties
index 9565c579..cb356533 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,3 +1,3 @@
groupId=dev.plexapi
artifactId=plexapi
-version=0.15.0
\ No newline at end of file
+version=0.16.0
\ No newline at end of file
diff --git a/src/main/java/dev/plexapi/sdk/Library.java b/src/main/java/dev/plexapi/sdk/Library.java
index d4c344c5..c55276d2 100644
--- a/src/main/java/dev/plexapi/sdk/Library.java
+++ b/src/main/java/dev/plexapi/sdk/Library.java
@@ -700,14 +700,14 @@ public class Library implements
*
* ## Library Details Endpoint
*
- *
This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself.
+ *
This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself.
*
*
The details include:
*
*
### Directories
* Organized into three categories:
*
- *
- **Primary Directories**:
+ *
- **Primary Directories**:
* - Used in some clients for quick access to media subsets (e.g., "All", "On Deck").
* - Most can be replicated via media queries.
* - Customizable by users.
@@ -749,14 +749,14 @@ public class Library implements
*
*
## Library Details Endpoint
*
- *
This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself.
+ *
This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself.
*
*
The details include:
*
*
### Directories
* Organized into three categories:
*
- *
- **Primary Directories**:
+ *
- **Primary Directories**:
* - Used in some clients for quick access to media subsets (e.g., "All", "On Deck").
* - Most can be replicated via media queries.
* - Customizable by users.
@@ -803,14 +803,14 @@ public class Library implements
*
*
## Library Details Endpoint
*
- *
This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself.
+ *
This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself.
*
*
The details include:
*
*
### Directories
* Organized into three categories:
*
- *
- **Primary Directories**:
+ *
- **Primary Directories**:
* - Used in some clients for quick access to media subsets (e.g., "All", "On Deck").
* - Most can be replicated via media queries.
* - Customizable by users.
@@ -841,7 +841,7 @@ public class Library implements
*
*
> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered.
*
- * @param includeDetails Whether or not to include details for a section (types, filters, and sorts).
+ * @param includeDetails Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*
* @param sectionKey The unique key of the Plex library.
diff --git a/src/main/java/dev/plexapi/sdk/Log.java b/src/main/java/dev/plexapi/sdk/Log.java
index c6f97ed0..6292cd92 100644
--- a/src/main/java/dev/plexapi/sdk/Log.java
+++ b/src/main/java/dev/plexapi/sdk/Log.java
@@ -68,11 +68,11 @@ public class Log implements
*
*
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
+ * @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.
@@ -232,13 +232,13 @@ public class Log implements
/**
* Logging a multi-line message
*
- *
This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
- * It accepts a text/plain request body, where each line represents a distinct log entry.
- * Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'.
+ *
This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
+ * It accepts a text/plain request body, where each line represents a distinct log entry.
+ * Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'.
*
- *
Log entries are separated by a newline character (`\n`).
- * Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
- * This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.
+ *
Log entries are separated by a newline character (`\n`).
+ * Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
+ * This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.
*
*
The 'level' parameter specifies the log entry's severity or importance, with the following integer values:
* - `0`: Error - Critical issues that require immediate attention.
@@ -263,13 +263,13 @@ public class Log implements
/**
* Logging a multi-line message
*
- *
This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
- * It accepts a text/plain request body, where each line represents a distinct log entry.
- * Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'.
+ *
This endpoint allows for the batch addition of log entries to the main Plex Media Server log.
+ * It accepts a text/plain request body, where each line represents a distinct log entry.
+ * Each log entry consists of URL-encoded key-value pairs, specifying log attributes such as 'level', 'message', and 'source'.
*
- *
Log entries are separated by a newline character (`\n`).
- * Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
- * This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.
+ *
Log entries are separated by a newline character (`\n`).
+ * Each entry's parameters should be URL-encoded to ensure accurate parsing and handling of special characters.
+ * This method is efficient for logging multiple entries in a single API call, reducing the overhead of multiple individual requests.
*
*
The 'level' parameter specifies the log entry's severity or importance, with the following integer values:
* - `0`: Error - Critical issues that require immediate attention.
diff --git a/src/main/java/dev/plexapi/sdk/Playlists.java b/src/main/java/dev/plexapi/sdk/Playlists.java
index 18f48e1c..fe2f3200 100644
--- a/src/main/java/dev/plexapi/sdk/Playlists.java
+++ b/src/main/java/dev/plexapi/sdk/Playlists.java
@@ -76,9 +76,9 @@ import java.util.List;
import java.util.Optional;
/**
- * 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").
+ * 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.
+ * 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 Playlists implements
@@ -1562,16 +1562,16 @@ public class Playlists implements
*
*
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.
+ * @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.
+ * @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.
diff --git a/src/main/java/dev/plexapi/sdk/PlexAPI.java b/src/main/java/dev/plexapi/sdk/PlexAPI.java
index f67e2225..7ece0143 100644
--- a/src/main/java/dev/plexapi/sdk/PlexAPI.java
+++ b/src/main/java/dev/plexapi/sdk/PlexAPI.java
@@ -52,7 +52,7 @@ public class PlexAPI {
/**
* The full address of your Plex Server
*/
- "{protocol}://{ip}:{port}",
+ "https://10.10.10.47:32400",
};
/**
@@ -117,9 +117,9 @@ public class PlexAPI {
private final Log 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").
+ * 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.
+ * 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 Playlists playlists;
@@ -231,9 +231,9 @@ public class PlexAPI {
}
/**
- * 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").
+ * 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.
+ * 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 Playlists playlists() {
diff --git a/src/main/java/dev/plexapi/sdk/SDKConfiguration.java b/src/main/java/dev/plexapi/sdk/SDKConfiguration.java
index d88ed5b3..732274d2 100644
--- a/src/main/java/dev/plexapi/sdk/SDKConfiguration.java
+++ b/src/main/java/dev/plexapi/sdk/SDKConfiguration.java
@@ -42,8 +42,8 @@ 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.15.0";
- public static final String GEN_VERSION = "2.570.4";
+ public static final String SDK_VERSION = "0.16.0";
+ public static final String GEN_VERSION = "2.585.2";
private static final String BASE_PACKAGE = "dev.plexapi.sdk";
public static final String USER_AGENT =
String.format("speakeasy-sdk/%s %s %s %s %s",
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/CreatePlaylistQueryParamType.java b/src/main/java/dev/plexapi/sdk/models/operations/CreatePlaylistQueryParamType.java
index 909e915c..d17c7797 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/CreatePlaylistQueryParamType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/CreatePlaylistQueryParamType.java
@@ -3,39 +3,186 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ *
Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* CreatePlaylistQueryParamType
*
*
type of playlist to create
*/
-public enum CreatePlaylistQueryParamType {
- AUDIO("audio"),
- VIDEO("video"),
- PHOTO("photo");
+@JsonDeserialize(using = CreatePlaylistQueryParamType._Deserializer.class)
+@JsonSerialize(using = CreatePlaylistQueryParamType._Serializer.class)
+public class CreatePlaylistQueryParamType {
+
+ public static final CreatePlaylistQueryParamType AUDIO = new CreatePlaylistQueryParamType("audio");
+ public static final CreatePlaylistQueryParamType VIDEO = new CreatePlaylistQueryParamType("video");
+ public static final CreatePlaylistQueryParamType PHOTO = new CreatePlaylistQueryParamType("photo");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private CreatePlaylistQueryParamType(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a CreatePlaylistQueryParamType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as CreatePlaylistQueryParamType
+ */
+ public static CreatePlaylistQueryParamType of(String value) {
+ synchronized (CreatePlaylistQueryParamType.class) {
+ return values.computeIfAbsent(value, v -> new CreatePlaylistQueryParamType(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (CreatePlaylistQueryParamType o: CreatePlaylistQueryParamType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ CreatePlaylistQueryParamType other = (CreatePlaylistQueryParamType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "CreatePlaylistQueryParamType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static CreatePlaylistQueryParamType[] values() {
+ synchronized (CreatePlaylistQueryParamType.class) {
+ return values.values().toArray(new CreatePlaylistQueryParamType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("audio", AUDIO);
+ map.put("video", VIDEO);
+ map.put("photo", PHOTO);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("audio", CreatePlaylistQueryParamTypeEnum.AUDIO);
+ map.put("video", CreatePlaylistQueryParamTypeEnum.VIDEO);
+ map.put("photo", CreatePlaylistQueryParamTypeEnum.PHOTO);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(CreatePlaylistQueryParamType.class);
+ }
+
+ @Override
+ public void serialize(CreatePlaylistQueryParamType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(CreatePlaylistQueryParamType.class);
+ }
+
+ @Override
+ public CreatePlaylistQueryParamType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return CreatePlaylistQueryParamType.of(v);
+ }
+ }
+
+ public enum CreatePlaylistQueryParamTypeEnum {
+
+ AUDIO("audio"),
+ VIDEO("video"),
+ PHOTO("photo"),;
+
+ private final String value;
+
+ private CreatePlaylistQueryParamTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/EnableCreditsMarkerGeneration.java b/src/main/java/dev/plexapi/sdk/models/operations/EnableCreditsMarkerGeneration.java
index 6c359454..58415c0c 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/EnableCreditsMarkerGeneration.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/EnableCreditsMarkerGeneration.java
@@ -3,38 +3,182 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* EnableCreditsMarkerGeneration
*
*
Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).
*/
-public enum EnableCreditsMarkerGeneration {
- LibraryDefault("-1"),
- Disabled("0");
+@JsonDeserialize(using = EnableCreditsMarkerGeneration._Deserializer.class)
+@JsonSerialize(using = EnableCreditsMarkerGeneration._Serializer.class)
+public class EnableCreditsMarkerGeneration {
+
+ public static final EnableCreditsMarkerGeneration LibraryDefault = new EnableCreditsMarkerGeneration("-1");
+ public static final EnableCreditsMarkerGeneration Disabled = new EnableCreditsMarkerGeneration("0");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private EnableCreditsMarkerGeneration(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a EnableCreditsMarkerGeneration with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as EnableCreditsMarkerGeneration
+ */
+ public static EnableCreditsMarkerGeneration of(String value) {
+ synchronized (EnableCreditsMarkerGeneration.class) {
+ return values.computeIfAbsent(value, v -> new EnableCreditsMarkerGeneration(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (EnableCreditsMarkerGeneration o: EnableCreditsMarkerGeneration.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ EnableCreditsMarkerGeneration other = (EnableCreditsMarkerGeneration) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "EnableCreditsMarkerGeneration [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static EnableCreditsMarkerGeneration[] values() {
+ synchronized (EnableCreditsMarkerGeneration.class) {
+ return values.values().toArray(new EnableCreditsMarkerGeneration[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("-1", LibraryDefault);
+ map.put("0", Disabled);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("-1", EnableCreditsMarkerGenerationEnum.LibraryDefault);
+ map.put("0", EnableCreditsMarkerGenerationEnum.Disabled);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(EnableCreditsMarkerGeneration.class);
+ }
+
+ @Override
+ public void serialize(EnableCreditsMarkerGeneration value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(EnableCreditsMarkerGeneration.class);
+ }
+
+ @Override
+ public EnableCreditsMarkerGeneration deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return EnableCreditsMarkerGeneration.of(v);
+ }
+ }
+
+ public enum EnableCreditsMarkerGenerationEnum {
+
+ LibraryDefault("-1"),
+ Disabled("0"),;
+
+ private final String value;
+
+ private EnableCreditsMarkerGenerationEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/EpisodeSort.java b/src/main/java/dev/plexapi/sdk/models/operations/EpisodeSort.java
index 2750a027..ccaa0cfa 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/EpisodeSort.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/EpisodeSort.java
@@ -3,39 +3,186 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* EpisodeSort
*
*
Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first).
*/
-public enum EpisodeSort {
- LibraryDefault("-1"),
- OldestFirst("0"),
- NewestFirst("1");
+@JsonDeserialize(using = EpisodeSort._Deserializer.class)
+@JsonSerialize(using = EpisodeSort._Serializer.class)
+public class EpisodeSort {
+
+ public static final EpisodeSort LibraryDefault = new EpisodeSort("-1");
+ public static final EpisodeSort OldestFirst = new EpisodeSort("0");
+ public static final EpisodeSort NewestFirst = new EpisodeSort("1");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private EpisodeSort(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a EpisodeSort with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as EpisodeSort
+ */
+ public static EpisodeSort of(String value) {
+ synchronized (EpisodeSort.class) {
+ return values.computeIfAbsent(value, v -> new EpisodeSort(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (EpisodeSort o: EpisodeSort.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ EpisodeSort other = (EpisodeSort) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "EpisodeSort [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static EpisodeSort[] values() {
+ synchronized (EpisodeSort.class) {
+ return values.values().toArray(new EpisodeSort[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("-1", LibraryDefault);
+ map.put("0", OldestFirst);
+ map.put("1", NewestFirst);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("-1", EpisodeSortEnum.LibraryDefault);
+ map.put("0", EpisodeSortEnum.OldestFirst);
+ map.put("1", EpisodeSortEnum.NewestFirst);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(EpisodeSort.class);
+ }
+
+ @Override
+ public void serialize(EpisodeSort value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(EpisodeSort.class);
+ }
+
+ @Override
+ public EpisodeSort deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return EpisodeSort.of(v);
+ }
+ }
+
+ public enum EpisodeSortEnum {
+
+ LibraryDefault("-1"),
+ OldestFirst("0"),
+ NewestFirst("1"),;
+
+ private final String value;
+
+ private EpisodeSortEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/Filter.java b/src/main/java/dev/plexapi/sdk/models/operations/Filter.java
index 542457ba..deae2593 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/Filter.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/Filter.java
@@ -3,39 +3,186 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* Filter
*
*
Filter
*/
-public enum Filter {
- ALL("all"),
- AVAILABLE("available"),
- RELEASED("released");
+@JsonDeserialize(using = Filter._Deserializer.class)
+@JsonSerialize(using = Filter._Serializer.class)
+public class Filter {
+
+ public static final Filter ALL = new Filter("all");
+ public static final Filter AVAILABLE = new Filter("available");
+ public static final Filter RELEASED = new Filter("released");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private Filter(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a Filter with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as Filter
+ */
+ public static Filter of(String value) {
+ synchronized (Filter.class) {
+ return values.computeIfAbsent(value, v -> new Filter(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (Filter o: Filter.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Filter other = (Filter) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "Filter [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static Filter[] values() {
+ synchronized (Filter.class) {
+ return values.values().toArray(new Filter[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("all", ALL);
+ map.put("available", AVAILABLE);
+ map.put("released", RELEASED);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("all", FilterEnum.ALL);
+ map.put("available", FilterEnum.AVAILABLE);
+ map.put("released", FilterEnum.RELEASED);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(Filter.class);
+ }
+
+ @Override
+ public void serialize(Filter value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(Filter.class);
+ }
+
+ @Override
+ public Filter deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return Filter.of(v);
+ }
+ }
+
+ public enum FilterEnum {
+
+ ALL("all"),
+ AVAILABLE("available"),
+ RELEASED("released"),;
+
+ private final String value;
+
+ private FilterEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/FlattenSeasons.java b/src/main/java/dev/plexapi/sdk/models/operations/FlattenSeasons.java
index bef98759..4455a045 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/FlattenSeasons.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/FlattenSeasons.java
@@ -3,39 +3,186 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* FlattenSeasons
*
*
Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).
*/
-public enum FlattenSeasons {
- LibraryDefault("-1"),
- Hide("0"),
- Show("1");
+@JsonDeserialize(using = FlattenSeasons._Deserializer.class)
+@JsonSerialize(using = FlattenSeasons._Serializer.class)
+public class FlattenSeasons {
+
+ public static final FlattenSeasons LibraryDefault = new FlattenSeasons("-1");
+ public static final FlattenSeasons Hide = new FlattenSeasons("0");
+ public static final FlattenSeasons Show = new FlattenSeasons("1");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private FlattenSeasons(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a FlattenSeasons with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as FlattenSeasons
+ */
+ public static FlattenSeasons of(String value) {
+ synchronized (FlattenSeasons.class) {
+ return values.computeIfAbsent(value, v -> new FlattenSeasons(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (FlattenSeasons o: FlattenSeasons.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ FlattenSeasons other = (FlattenSeasons) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "FlattenSeasons [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static FlattenSeasons[] values() {
+ synchronized (FlattenSeasons.class) {
+ return values.values().toArray(new FlattenSeasons[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("-1", LibraryDefault);
+ map.put("0", Hide);
+ map.put("1", Show);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("-1", FlattenSeasonsEnum.LibraryDefault);
+ map.put("0", FlattenSeasonsEnum.Hide);
+ map.put("1", FlattenSeasonsEnum.Show);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(FlattenSeasons.class);
+ }
+
+ @Override
+ public void serialize(FlattenSeasons value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(FlattenSeasons.class);
+ }
+
+ @Override
+ public FlattenSeasons deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return FlattenSeasons.of(v);
+ }
+ }
+
+ public enum FlattenSeasonsEnum {
+
+ LibraryDefault("-1"),
+ Hide("0"),
+ Show("1"),;
+
+ private final String value;
+
+ private FlattenSeasonsEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetActorsLibraryQueryParamType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetActorsLibraryQueryParamType.java
index 14bf645d..5433ebe1 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetActorsLibraryQueryParamType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetActorsLibraryQueryParamType.java
@@ -3,10 +3,45 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Long;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetActorsLibraryQueryParamType
*
@@ -17,33 +52,159 @@ import java.util.Optional;
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*/
-public enum GetActorsLibraryQueryParamType {
- Movie(1L),
- TvShow(2L),
- Season(3L),
- Episode(4L),
- Audio(8L),
- Album(9L),
- Track(10L);
+@JsonDeserialize(using = GetActorsLibraryQueryParamType._Deserializer.class)
+@JsonSerialize(using = GetActorsLibraryQueryParamType._Serializer.class)
+public class GetActorsLibraryQueryParamType {
+
+ public static final GetActorsLibraryQueryParamType Movie = new GetActorsLibraryQueryParamType(1L);
+ public static final GetActorsLibraryQueryParamType TvShow = new GetActorsLibraryQueryParamType(2L);
+ public static final GetActorsLibraryQueryParamType Season = new GetActorsLibraryQueryParamType(3L);
+ public static final GetActorsLibraryQueryParamType Episode = new GetActorsLibraryQueryParamType(4L);
+ public static final GetActorsLibraryQueryParamType Audio = new GetActorsLibraryQueryParamType(8L);
+ public static final GetActorsLibraryQueryParamType Album = new GetActorsLibraryQueryParamType(9L);
+ public static final GetActorsLibraryQueryParamType Track = new GetActorsLibraryQueryParamType(10L);
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final long value;
private GetActorsLibraryQueryParamType(long value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetActorsLibraryQueryParamType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetActorsLibraryQueryParamType
+ */
+ public static GetActorsLibraryQueryParamType of(long value) {
+ synchronized (GetActorsLibraryQueryParamType.class) {
+ return values.computeIfAbsent(value, v -> new GetActorsLibraryQueryParamType(v));
+ }
+ }
+
public long value() {
return value;
}
-
- public static Optional fromValue(long value) {
- for (GetActorsLibraryQueryParamType o: GetActorsLibraryQueryParamType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetActorsLibraryQueryParamType other = (GetActorsLibraryQueryParamType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetActorsLibraryQueryParamType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetActorsLibraryQueryParamType[] values() {
+ synchronized (GetActorsLibraryQueryParamType.class) {
+ return values.values().toArray(new GetActorsLibraryQueryParamType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put(1L, Movie);
+ map.put(2L, TvShow);
+ map.put(3L, Season);
+ map.put(4L, Episode);
+ map.put(8L, Audio);
+ map.put(9L, Album);
+ map.put(10L, Track);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put(1L, GetActorsLibraryQueryParamTypeEnum.Movie);
+ map.put(2L, GetActorsLibraryQueryParamTypeEnum.TvShow);
+ map.put(3L, GetActorsLibraryQueryParamTypeEnum.Season);
+ map.put(4L, GetActorsLibraryQueryParamTypeEnum.Episode);
+ map.put(8L, GetActorsLibraryQueryParamTypeEnum.Audio);
+ map.put(9L, GetActorsLibraryQueryParamTypeEnum.Album);
+ map.put(10L, GetActorsLibraryQueryParamTypeEnum.Track);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetActorsLibraryQueryParamType.class);
+ }
+
+ @Override
+ public void serialize(GetActorsLibraryQueryParamType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetActorsLibraryQueryParamType.class);
+ }
+
+ @Override
+ public GetActorsLibraryQueryParamType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ long v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetActorsLibraryQueryParamType.of(v);
+ }
+ }
+
+ public enum GetActorsLibraryQueryParamTypeEnum {
+
+ Movie(1L),
+ TvShow(2L),
+ Season(3L),
+ Episode(4L),
+ Audio(8L),
+ Album(9L),
+ Track(10L),;
+
+ private final long value;
+
+ private GetActorsLibraryQueryParamTypeEnum(long value) {
+ this.value = value;
+ }
+
+ public long value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetAllLibrariesType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetAllLibrariesType.java
index 5ddf6e00..33183c9f 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetAllLibrariesType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetAllLibrariesType.java
@@ -3,42 +3,198 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetAllLibrariesType
*
*
The library type
*/
-public enum GetAllLibrariesType {
- Movie("movie"),
- TvShow("show"),
- Season("season"),
- Episode("episode"),
- Artist("artist"),
- Album("album");
+@JsonDeserialize(using = GetAllLibrariesType._Deserializer.class)
+@JsonSerialize(using = GetAllLibrariesType._Serializer.class)
+public class GetAllLibrariesType {
+
+ public static final GetAllLibrariesType Movie = new GetAllLibrariesType("movie");
+ public static final GetAllLibrariesType TvShow = new GetAllLibrariesType("show");
+ public static final GetAllLibrariesType Season = new GetAllLibrariesType("season");
+ public static final GetAllLibrariesType Episode = new GetAllLibrariesType("episode");
+ public static final GetAllLibrariesType Artist = new GetAllLibrariesType("artist");
+ public static final GetAllLibrariesType Album = new GetAllLibrariesType("album");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetAllLibrariesType(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetAllLibrariesType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetAllLibrariesType
+ */
+ public static GetAllLibrariesType of(String value) {
+ synchronized (GetAllLibrariesType.class) {
+ return values.computeIfAbsent(value, v -> new GetAllLibrariesType(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetAllLibrariesType o: GetAllLibrariesType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetAllLibrariesType other = (GetAllLibrariesType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetAllLibrariesType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetAllLibrariesType[] values() {
+ synchronized (GetAllLibrariesType.class) {
+ return values.values().toArray(new GetAllLibrariesType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("movie", Movie);
+ map.put("show", TvShow);
+ map.put("season", Season);
+ map.put("episode", Episode);
+ map.put("artist", Artist);
+ map.put("album", Album);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("movie", GetAllLibrariesTypeEnum.Movie);
+ map.put("show", GetAllLibrariesTypeEnum.TvShow);
+ map.put("season", GetAllLibrariesTypeEnum.Season);
+ map.put("episode", GetAllLibrariesTypeEnum.Episode);
+ map.put("artist", GetAllLibrariesTypeEnum.Artist);
+ map.put("album", GetAllLibrariesTypeEnum.Album);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetAllLibrariesType.class);
+ }
+
+ @Override
+ public void serialize(GetAllLibrariesType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetAllLibrariesType.class);
+ }
+
+ @Override
+ public GetAllLibrariesType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetAllLibrariesType.of(v);
+ }
+ }
+
+ public enum GetAllLibrariesTypeEnum {
+
+ Movie("movie"),
+ TvShow("show"),
+ Season("season"),
+ Episode("episode"),
+ Artist("artist"),
+ Album("album"),;
+
+ private final String value;
+
+ private GetAllLibrariesTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryLibraryResponseType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryLibraryResponseType.java
index ae7fb8a2..a65d0c1e 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryLibraryResponseType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryLibraryResponseType.java
@@ -3,35 +3,185 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-public enum GetAllMediaLibraryLibraryResponseType {
- COVER_POSTER("coverPoster"),
- BACKGROUND("background"),
- SNAPSHOT("snapshot"),
- CLEAR_LOGO("clearLogo");
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
+@JsonDeserialize(using = GetAllMediaLibraryLibraryResponseType._Deserializer.class)
+@JsonSerialize(using = GetAllMediaLibraryLibraryResponseType._Serializer.class)
+public class GetAllMediaLibraryLibraryResponseType {
+
+ public static final GetAllMediaLibraryLibraryResponseType COVER_POSTER = new GetAllMediaLibraryLibraryResponseType("coverPoster");
+ public static final GetAllMediaLibraryLibraryResponseType BACKGROUND = new GetAllMediaLibraryLibraryResponseType("background");
+ public static final GetAllMediaLibraryLibraryResponseType SNAPSHOT = new GetAllMediaLibraryLibraryResponseType("snapshot");
+ public static final GetAllMediaLibraryLibraryResponseType CLEAR_LOGO = new GetAllMediaLibraryLibraryResponseType("clearLogo");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetAllMediaLibraryLibraryResponseType(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetAllMediaLibraryLibraryResponseType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetAllMediaLibraryLibraryResponseType
+ */
+ public static GetAllMediaLibraryLibraryResponseType of(String value) {
+ synchronized (GetAllMediaLibraryLibraryResponseType.class) {
+ return values.computeIfAbsent(value, v -> new GetAllMediaLibraryLibraryResponseType(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetAllMediaLibraryLibraryResponseType o: GetAllMediaLibraryLibraryResponseType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetAllMediaLibraryLibraryResponseType other = (GetAllMediaLibraryLibraryResponseType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetAllMediaLibraryLibraryResponseType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetAllMediaLibraryLibraryResponseType[] values() {
+ synchronized (GetAllMediaLibraryLibraryResponseType.class) {
+ return values.values().toArray(new GetAllMediaLibraryLibraryResponseType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("coverPoster", COVER_POSTER);
+ map.put("background", BACKGROUND);
+ map.put("snapshot", SNAPSHOT);
+ map.put("clearLogo", CLEAR_LOGO);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("coverPoster", GetAllMediaLibraryLibraryResponseTypeEnum.COVER_POSTER);
+ map.put("background", GetAllMediaLibraryLibraryResponseTypeEnum.BACKGROUND);
+ map.put("snapshot", GetAllMediaLibraryLibraryResponseTypeEnum.SNAPSHOT);
+ map.put("clearLogo", GetAllMediaLibraryLibraryResponseTypeEnum.CLEAR_LOGO);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetAllMediaLibraryLibraryResponseType.class);
+ }
+
+ @Override
+ public void serialize(GetAllMediaLibraryLibraryResponseType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetAllMediaLibraryLibraryResponseType.class);
+ }
+
+ @Override
+ public GetAllMediaLibraryLibraryResponseType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetAllMediaLibraryLibraryResponseType.of(v);
+ }
+ }
+
+ public enum GetAllMediaLibraryLibraryResponseTypeEnum {
+
+ COVER_POSTER("coverPoster"),
+ BACKGROUND("background"),
+ SNAPSHOT("snapshot"),
+ CLEAR_LOGO("clearLogo"),;
+
+ private final String value;
+
+ private GetAllMediaLibraryLibraryResponseTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryLibraryType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryLibraryType.java
index 0309d7c1..fdfc8175 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryLibraryType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryLibraryType.java
@@ -3,42 +3,198 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetAllMediaLibraryLibraryType
*
*
The type of media content
*/
-public enum GetAllMediaLibraryLibraryType {
- Movie("movie"),
- TvShow("show"),
- Season("season"),
- Episode("episode"),
- Artist("artist"),
- Album("album");
+@JsonDeserialize(using = GetAllMediaLibraryLibraryType._Deserializer.class)
+@JsonSerialize(using = GetAllMediaLibraryLibraryType._Serializer.class)
+public class GetAllMediaLibraryLibraryType {
+
+ public static final GetAllMediaLibraryLibraryType Movie = new GetAllMediaLibraryLibraryType("movie");
+ public static final GetAllMediaLibraryLibraryType TvShow = new GetAllMediaLibraryLibraryType("show");
+ public static final GetAllMediaLibraryLibraryType Season = new GetAllMediaLibraryLibraryType("season");
+ public static final GetAllMediaLibraryLibraryType Episode = new GetAllMediaLibraryLibraryType("episode");
+ public static final GetAllMediaLibraryLibraryType Artist = new GetAllMediaLibraryLibraryType("artist");
+ public static final GetAllMediaLibraryLibraryType Album = new GetAllMediaLibraryLibraryType("album");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetAllMediaLibraryLibraryType(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetAllMediaLibraryLibraryType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetAllMediaLibraryLibraryType
+ */
+ public static GetAllMediaLibraryLibraryType of(String value) {
+ synchronized (GetAllMediaLibraryLibraryType.class) {
+ return values.computeIfAbsent(value, v -> new GetAllMediaLibraryLibraryType(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetAllMediaLibraryLibraryType o: GetAllMediaLibraryLibraryType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetAllMediaLibraryLibraryType other = (GetAllMediaLibraryLibraryType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetAllMediaLibraryLibraryType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetAllMediaLibraryLibraryType[] values() {
+ synchronized (GetAllMediaLibraryLibraryType.class) {
+ return values.values().toArray(new GetAllMediaLibraryLibraryType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("movie", Movie);
+ map.put("show", TvShow);
+ map.put("season", Season);
+ map.put("episode", Episode);
+ map.put("artist", Artist);
+ map.put("album", Album);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("movie", GetAllMediaLibraryLibraryTypeEnum.Movie);
+ map.put("show", GetAllMediaLibraryLibraryTypeEnum.TvShow);
+ map.put("season", GetAllMediaLibraryLibraryTypeEnum.Season);
+ map.put("episode", GetAllMediaLibraryLibraryTypeEnum.Episode);
+ map.put("artist", GetAllMediaLibraryLibraryTypeEnum.Artist);
+ map.put("album", GetAllMediaLibraryLibraryTypeEnum.Album);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetAllMediaLibraryLibraryType.class);
+ }
+
+ @Override
+ public void serialize(GetAllMediaLibraryLibraryType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetAllMediaLibraryLibraryType.class);
+ }
+
+ @Override
+ public GetAllMediaLibraryLibraryType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetAllMediaLibraryLibraryType.of(v);
+ }
+ }
+
+ public enum GetAllMediaLibraryLibraryTypeEnum {
+
+ Movie("movie"),
+ TvShow("show"),
+ Season("season"),
+ Episode("episode"),
+ Artist("artist"),
+ Album("album"),;
+
+ private final String value;
+
+ private GetAllMediaLibraryLibraryTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryQueryParamType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryQueryParamType.java
index 7df8a84c..8f19ecc7 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryQueryParamType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetAllMediaLibraryQueryParamType.java
@@ -3,10 +3,45 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Long;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetAllMediaLibraryQueryParamType
*
@@ -17,33 +52,159 @@ import java.util.Optional;
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*/
-public enum GetAllMediaLibraryQueryParamType {
- Movie(1L),
- TvShow(2L),
- Season(3L),
- Episode(4L),
- Audio(8L),
- Album(9L),
- Track(10L);
+@JsonDeserialize(using = GetAllMediaLibraryQueryParamType._Deserializer.class)
+@JsonSerialize(using = GetAllMediaLibraryQueryParamType._Serializer.class)
+public class GetAllMediaLibraryQueryParamType {
+
+ public static final GetAllMediaLibraryQueryParamType Movie = new GetAllMediaLibraryQueryParamType(1L);
+ public static final GetAllMediaLibraryQueryParamType TvShow = new GetAllMediaLibraryQueryParamType(2L);
+ public static final GetAllMediaLibraryQueryParamType Season = new GetAllMediaLibraryQueryParamType(3L);
+ public static final GetAllMediaLibraryQueryParamType Episode = new GetAllMediaLibraryQueryParamType(4L);
+ public static final GetAllMediaLibraryQueryParamType Audio = new GetAllMediaLibraryQueryParamType(8L);
+ public static final GetAllMediaLibraryQueryParamType Album = new GetAllMediaLibraryQueryParamType(9L);
+ public static final GetAllMediaLibraryQueryParamType Track = new GetAllMediaLibraryQueryParamType(10L);
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final long value;
private GetAllMediaLibraryQueryParamType(long value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetAllMediaLibraryQueryParamType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetAllMediaLibraryQueryParamType
+ */
+ public static GetAllMediaLibraryQueryParamType of(long value) {
+ synchronized (GetAllMediaLibraryQueryParamType.class) {
+ return values.computeIfAbsent(value, v -> new GetAllMediaLibraryQueryParamType(v));
+ }
+ }
+
public long value() {
return value;
}
-
- public static Optional fromValue(long value) {
- for (GetAllMediaLibraryQueryParamType o: GetAllMediaLibraryQueryParamType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetAllMediaLibraryQueryParamType other = (GetAllMediaLibraryQueryParamType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetAllMediaLibraryQueryParamType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetAllMediaLibraryQueryParamType[] values() {
+ synchronized (GetAllMediaLibraryQueryParamType.class) {
+ return values.values().toArray(new GetAllMediaLibraryQueryParamType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put(1L, Movie);
+ map.put(2L, TvShow);
+ map.put(3L, Season);
+ map.put(4L, Episode);
+ map.put(8L, Audio);
+ map.put(9L, Album);
+ map.put(10L, Track);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put(1L, GetAllMediaLibraryQueryParamTypeEnum.Movie);
+ map.put(2L, GetAllMediaLibraryQueryParamTypeEnum.TvShow);
+ map.put(3L, GetAllMediaLibraryQueryParamTypeEnum.Season);
+ map.put(4L, GetAllMediaLibraryQueryParamTypeEnum.Episode);
+ map.put(8L, GetAllMediaLibraryQueryParamTypeEnum.Audio);
+ map.put(9L, GetAllMediaLibraryQueryParamTypeEnum.Album);
+ map.put(10L, GetAllMediaLibraryQueryParamTypeEnum.Track);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetAllMediaLibraryQueryParamType.class);
+ }
+
+ @Override
+ public void serialize(GetAllMediaLibraryQueryParamType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetAllMediaLibraryQueryParamType.class);
+ }
+
+ @Override
+ public GetAllMediaLibraryQueryParamType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ long v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetAllMediaLibraryQueryParamType.of(v);
+ }
+ }
+
+ public enum GetAllMediaLibraryQueryParamTypeEnum {
+
+ Movie(1L),
+ TvShow(2L),
+ Season(3L),
+ Episode(4L),
+ Audio(8L),
+ Album(9L),
+ Track(10L),;
+
+ private final long value;
+
+ private GetAllMediaLibraryQueryParamTypeEnum(long value) {
+ this.value = value;
+ }
+
+ public long value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetCountriesLibraryQueryParamType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetCountriesLibraryQueryParamType.java
index 6f0e7ca5..903f2f19 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetCountriesLibraryQueryParamType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetCountriesLibraryQueryParamType.java
@@ -3,10 +3,45 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Long;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetCountriesLibraryQueryParamType
*
@@ -17,33 +52,159 @@ import java.util.Optional;
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*/
-public enum GetCountriesLibraryQueryParamType {
- Movie(1L),
- TvShow(2L),
- Season(3L),
- Episode(4L),
- Audio(8L),
- Album(9L),
- Track(10L);
+@JsonDeserialize(using = GetCountriesLibraryQueryParamType._Deserializer.class)
+@JsonSerialize(using = GetCountriesLibraryQueryParamType._Serializer.class)
+public class GetCountriesLibraryQueryParamType {
+
+ public static final GetCountriesLibraryQueryParamType Movie = new GetCountriesLibraryQueryParamType(1L);
+ public static final GetCountriesLibraryQueryParamType TvShow = new GetCountriesLibraryQueryParamType(2L);
+ public static final GetCountriesLibraryQueryParamType Season = new GetCountriesLibraryQueryParamType(3L);
+ public static final GetCountriesLibraryQueryParamType Episode = new GetCountriesLibraryQueryParamType(4L);
+ public static final GetCountriesLibraryQueryParamType Audio = new GetCountriesLibraryQueryParamType(8L);
+ public static final GetCountriesLibraryQueryParamType Album = new GetCountriesLibraryQueryParamType(9L);
+ public static final GetCountriesLibraryQueryParamType Track = new GetCountriesLibraryQueryParamType(10L);
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final long value;
private GetCountriesLibraryQueryParamType(long value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetCountriesLibraryQueryParamType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetCountriesLibraryQueryParamType
+ */
+ public static GetCountriesLibraryQueryParamType of(long value) {
+ synchronized (GetCountriesLibraryQueryParamType.class) {
+ return values.computeIfAbsent(value, v -> new GetCountriesLibraryQueryParamType(v));
+ }
+ }
+
public long value() {
return value;
}
-
- public static Optional fromValue(long value) {
- for (GetCountriesLibraryQueryParamType o: GetCountriesLibraryQueryParamType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetCountriesLibraryQueryParamType other = (GetCountriesLibraryQueryParamType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetCountriesLibraryQueryParamType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetCountriesLibraryQueryParamType[] values() {
+ synchronized (GetCountriesLibraryQueryParamType.class) {
+ return values.values().toArray(new GetCountriesLibraryQueryParamType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put(1L, Movie);
+ map.put(2L, TvShow);
+ map.put(3L, Season);
+ map.put(4L, Episode);
+ map.put(8L, Audio);
+ map.put(9L, Album);
+ map.put(10L, Track);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put(1L, GetCountriesLibraryQueryParamTypeEnum.Movie);
+ map.put(2L, GetCountriesLibraryQueryParamTypeEnum.TvShow);
+ map.put(3L, GetCountriesLibraryQueryParamTypeEnum.Season);
+ map.put(4L, GetCountriesLibraryQueryParamTypeEnum.Episode);
+ map.put(8L, GetCountriesLibraryQueryParamTypeEnum.Audio);
+ map.put(9L, GetCountriesLibraryQueryParamTypeEnum.Album);
+ map.put(10L, GetCountriesLibraryQueryParamTypeEnum.Track);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetCountriesLibraryQueryParamType.class);
+ }
+
+ @Override
+ public void serialize(GetCountriesLibraryQueryParamType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetCountriesLibraryQueryParamType.class);
+ }
+
+ @Override
+ public GetCountriesLibraryQueryParamType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ long v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetCountriesLibraryQueryParamType.of(v);
+ }
+ }
+
+ public enum GetCountriesLibraryQueryParamTypeEnum {
+
+ Movie(1L),
+ TvShow(2L),
+ Season(3L),
+ Episode(4L),
+ Audio(8L),
+ Album(9L),
+ Track(10L),;
+
+ private final long value;
+
+ private GetCountriesLibraryQueryParamTypeEnum(long value) {
+ this.value = value;
+ }
+
+ public long value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetGenresLibraryQueryParamType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetGenresLibraryQueryParamType.java
index 9a0ba8ff..d1266e78 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetGenresLibraryQueryParamType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetGenresLibraryQueryParamType.java
@@ -3,10 +3,45 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Long;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetGenresLibraryQueryParamType
*
@@ -17,33 +52,159 @@ import java.util.Optional;
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*/
-public enum GetGenresLibraryQueryParamType {
- Movie(1L),
- TvShow(2L),
- Season(3L),
- Episode(4L),
- Audio(8L),
- Album(9L),
- Track(10L);
+@JsonDeserialize(using = GetGenresLibraryQueryParamType._Deserializer.class)
+@JsonSerialize(using = GetGenresLibraryQueryParamType._Serializer.class)
+public class GetGenresLibraryQueryParamType {
+
+ public static final GetGenresLibraryQueryParamType Movie = new GetGenresLibraryQueryParamType(1L);
+ public static final GetGenresLibraryQueryParamType TvShow = new GetGenresLibraryQueryParamType(2L);
+ public static final GetGenresLibraryQueryParamType Season = new GetGenresLibraryQueryParamType(3L);
+ public static final GetGenresLibraryQueryParamType Episode = new GetGenresLibraryQueryParamType(4L);
+ public static final GetGenresLibraryQueryParamType Audio = new GetGenresLibraryQueryParamType(8L);
+ public static final GetGenresLibraryQueryParamType Album = new GetGenresLibraryQueryParamType(9L);
+ public static final GetGenresLibraryQueryParamType Track = new GetGenresLibraryQueryParamType(10L);
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final long value;
private GetGenresLibraryQueryParamType(long value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetGenresLibraryQueryParamType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetGenresLibraryQueryParamType
+ */
+ public static GetGenresLibraryQueryParamType of(long value) {
+ synchronized (GetGenresLibraryQueryParamType.class) {
+ return values.computeIfAbsent(value, v -> new GetGenresLibraryQueryParamType(v));
+ }
+ }
+
public long value() {
return value;
}
-
- public static Optional fromValue(long value) {
- for (GetGenresLibraryQueryParamType o: GetGenresLibraryQueryParamType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetGenresLibraryQueryParamType other = (GetGenresLibraryQueryParamType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetGenresLibraryQueryParamType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetGenresLibraryQueryParamType[] values() {
+ synchronized (GetGenresLibraryQueryParamType.class) {
+ return values.values().toArray(new GetGenresLibraryQueryParamType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put(1L, Movie);
+ map.put(2L, TvShow);
+ map.put(3L, Season);
+ map.put(4L, Episode);
+ map.put(8L, Audio);
+ map.put(9L, Album);
+ map.put(10L, Track);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put(1L, GetGenresLibraryQueryParamTypeEnum.Movie);
+ map.put(2L, GetGenresLibraryQueryParamTypeEnum.TvShow);
+ map.put(3L, GetGenresLibraryQueryParamTypeEnum.Season);
+ map.put(4L, GetGenresLibraryQueryParamTypeEnum.Episode);
+ map.put(8L, GetGenresLibraryQueryParamTypeEnum.Audio);
+ map.put(9L, GetGenresLibraryQueryParamTypeEnum.Album);
+ map.put(10L, GetGenresLibraryQueryParamTypeEnum.Track);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetGenresLibraryQueryParamType.class);
+ }
+
+ @Override
+ public void serialize(GetGenresLibraryQueryParamType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetGenresLibraryQueryParamType.class);
+ }
+
+ @Override
+ public GetGenresLibraryQueryParamType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ long v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetGenresLibraryQueryParamType.of(v);
+ }
+ }
+
+ public enum GetGenresLibraryQueryParamTypeEnum {
+
+ Movie(1L),
+ TvShow(2L),
+ Season(3L),
+ Episode(4L),
+ Audio(8L),
+ Album(9L),
+ Track(10L),;
+
+ private final long value;
+
+ private GetGenresLibraryQueryParamTypeEnum(long value) {
+ this.value = value;
+ }
+
+ public long value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryDetailsRequest.java b/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryDetailsRequest.java
index 03c659f4..5ef68fba 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryDetailsRequest.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryDetailsRequest.java
@@ -19,7 +19,7 @@ import java.util.Optional;
public class GetLibraryDetailsRequest {
/**
- * Whether or not to include details for a section (types, filters, and sorts).
+ * Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*/
@SpeakeasyMetadata("queryParam:style=form,explode=true,name=includeDetails")
@@ -48,7 +48,7 @@ public class GetLibraryDetailsRequest {
}
/**
- * Whether or not to include details for a section (types, filters, and sorts).
+ * Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*/
@SuppressWarnings("unchecked")
@@ -71,7 +71,7 @@ public class GetLibraryDetailsRequest {
}
/**
- * Whether or not to include details for a section (types, filters, and sorts).
+ * Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*/
public GetLibraryDetailsRequest withIncludeDetails(IncludeDetails includeDetails) {
@@ -81,7 +81,7 @@ public class GetLibraryDetailsRequest {
}
/**
- * Whether or not to include details for a section (types, filters, and sorts).
+ * Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*/
public GetLibraryDetailsRequest withIncludeDetails(Optional extends IncludeDetails> includeDetails) {
@@ -140,7 +140,7 @@ public class GetLibraryDetailsRequest {
}
/**
- * Whether or not to include details for a section (types, filters, and sorts).
+ * Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*/
public Builder includeDetails(IncludeDetails includeDetails) {
@@ -150,7 +150,7 @@ public class GetLibraryDetailsRequest {
}
/**
- * Whether or not to include details for a section (types, filters, and sorts).
+ * Whether or not to include details for a section (types, filters, and sorts).
* Only exists for backwards compatibility, media providers other than the server libraries have it on always.
*/
public Builder includeDetails(Optional extends IncludeDetails> includeDetails) {
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsLibraryResponse200Type.java b/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsLibraryResponse200Type.java
index e9f34383..23e40950 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsLibraryResponse200Type.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsLibraryResponse200Type.java
@@ -3,35 +3,185 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-public enum GetLibraryItemsLibraryResponse200Type {
- COVER_POSTER("coverPoster"),
- BACKGROUND("background"),
- SNAPSHOT("snapshot"),
- CLEAR_LOGO("clearLogo");
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
+@JsonDeserialize(using = GetLibraryItemsLibraryResponse200Type._Deserializer.class)
+@JsonSerialize(using = GetLibraryItemsLibraryResponse200Type._Serializer.class)
+public class GetLibraryItemsLibraryResponse200Type {
+
+ public static final GetLibraryItemsLibraryResponse200Type COVER_POSTER = new GetLibraryItemsLibraryResponse200Type("coverPoster");
+ public static final GetLibraryItemsLibraryResponse200Type BACKGROUND = new GetLibraryItemsLibraryResponse200Type("background");
+ public static final GetLibraryItemsLibraryResponse200Type SNAPSHOT = new GetLibraryItemsLibraryResponse200Type("snapshot");
+ public static final GetLibraryItemsLibraryResponse200Type CLEAR_LOGO = new GetLibraryItemsLibraryResponse200Type("clearLogo");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetLibraryItemsLibraryResponse200Type(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetLibraryItemsLibraryResponse200Type with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetLibraryItemsLibraryResponse200Type
+ */
+ public static GetLibraryItemsLibraryResponse200Type of(String value) {
+ synchronized (GetLibraryItemsLibraryResponse200Type.class) {
+ return values.computeIfAbsent(value, v -> new GetLibraryItemsLibraryResponse200Type(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetLibraryItemsLibraryResponse200Type o: GetLibraryItemsLibraryResponse200Type.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetLibraryItemsLibraryResponse200Type other = (GetLibraryItemsLibraryResponse200Type) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetLibraryItemsLibraryResponse200Type [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetLibraryItemsLibraryResponse200Type[] values() {
+ synchronized (GetLibraryItemsLibraryResponse200Type.class) {
+ return values.values().toArray(new GetLibraryItemsLibraryResponse200Type[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("coverPoster", COVER_POSTER);
+ map.put("background", BACKGROUND);
+ map.put("snapshot", SNAPSHOT);
+ map.put("clearLogo", CLEAR_LOGO);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("coverPoster", GetLibraryItemsLibraryResponse200TypeEnum.COVER_POSTER);
+ map.put("background", GetLibraryItemsLibraryResponse200TypeEnum.BACKGROUND);
+ map.put("snapshot", GetLibraryItemsLibraryResponse200TypeEnum.SNAPSHOT);
+ map.put("clearLogo", GetLibraryItemsLibraryResponse200TypeEnum.CLEAR_LOGO);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetLibraryItemsLibraryResponse200Type.class);
+ }
+
+ @Override
+ public void serialize(GetLibraryItemsLibraryResponse200Type value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetLibraryItemsLibraryResponse200Type.class);
+ }
+
+ @Override
+ public GetLibraryItemsLibraryResponse200Type deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetLibraryItemsLibraryResponse200Type.of(v);
+ }
+ }
+
+ public enum GetLibraryItemsLibraryResponse200TypeEnum {
+
+ COVER_POSTER("coverPoster"),
+ BACKGROUND("background"),
+ SNAPSHOT("snapshot"),
+ CLEAR_LOGO("clearLogo"),;
+
+ private final String value;
+
+ private GetLibraryItemsLibraryResponse200TypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsLibraryType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsLibraryType.java
index aad13d0f..ed0339aa 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsLibraryType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsLibraryType.java
@@ -3,42 +3,198 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetLibraryItemsLibraryType
*
*
The type of media content
*/
-public enum GetLibraryItemsLibraryType {
- Movie("movie"),
- TvShow("show"),
- Season("season"),
- Episode("episode"),
- Artist("artist"),
- Album("album");
+@JsonDeserialize(using = GetLibraryItemsLibraryType._Deserializer.class)
+@JsonSerialize(using = GetLibraryItemsLibraryType._Serializer.class)
+public class GetLibraryItemsLibraryType {
+
+ public static final GetLibraryItemsLibraryType Movie = new GetLibraryItemsLibraryType("movie");
+ public static final GetLibraryItemsLibraryType TvShow = new GetLibraryItemsLibraryType("show");
+ public static final GetLibraryItemsLibraryType Season = new GetLibraryItemsLibraryType("season");
+ public static final GetLibraryItemsLibraryType Episode = new GetLibraryItemsLibraryType("episode");
+ public static final GetLibraryItemsLibraryType Artist = new GetLibraryItemsLibraryType("artist");
+ public static final GetLibraryItemsLibraryType Album = new GetLibraryItemsLibraryType("album");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetLibraryItemsLibraryType(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetLibraryItemsLibraryType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetLibraryItemsLibraryType
+ */
+ public static GetLibraryItemsLibraryType of(String value) {
+ synchronized (GetLibraryItemsLibraryType.class) {
+ return values.computeIfAbsent(value, v -> new GetLibraryItemsLibraryType(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetLibraryItemsLibraryType o: GetLibraryItemsLibraryType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetLibraryItemsLibraryType other = (GetLibraryItemsLibraryType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetLibraryItemsLibraryType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetLibraryItemsLibraryType[] values() {
+ synchronized (GetLibraryItemsLibraryType.class) {
+ return values.values().toArray(new GetLibraryItemsLibraryType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("movie", Movie);
+ map.put("show", TvShow);
+ map.put("season", Season);
+ map.put("episode", Episode);
+ map.put("artist", Artist);
+ map.put("album", Album);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("movie", GetLibraryItemsLibraryTypeEnum.Movie);
+ map.put("show", GetLibraryItemsLibraryTypeEnum.TvShow);
+ map.put("season", GetLibraryItemsLibraryTypeEnum.Season);
+ map.put("episode", GetLibraryItemsLibraryTypeEnum.Episode);
+ map.put("artist", GetLibraryItemsLibraryTypeEnum.Artist);
+ map.put("album", GetLibraryItemsLibraryTypeEnum.Album);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetLibraryItemsLibraryType.class);
+ }
+
+ @Override
+ public void serialize(GetLibraryItemsLibraryType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetLibraryItemsLibraryType.class);
+ }
+
+ @Override
+ public GetLibraryItemsLibraryType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetLibraryItemsLibraryType.of(v);
+ }
+ }
+
+ public enum GetLibraryItemsLibraryTypeEnum {
+
+ Movie("movie"),
+ TvShow("show"),
+ Season("season"),
+ Episode("episode"),
+ Artist("artist"),
+ Album("album"),;
+
+ private final String value;
+
+ private GetLibraryItemsLibraryTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsQueryParamType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsQueryParamType.java
index 9d9b18c5..ee8aba7b 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsQueryParamType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetLibraryItemsQueryParamType.java
@@ -3,10 +3,45 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Long;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetLibraryItemsQueryParamType
*
@@ -17,33 +52,159 @@ import java.util.Optional;
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*/
-public enum GetLibraryItemsQueryParamType {
- Movie(1L),
- TvShow(2L),
- Season(3L),
- Episode(4L),
- Audio(8L),
- Album(9L),
- Track(10L);
+@JsonDeserialize(using = GetLibraryItemsQueryParamType._Deserializer.class)
+@JsonSerialize(using = GetLibraryItemsQueryParamType._Serializer.class)
+public class GetLibraryItemsQueryParamType {
+
+ public static final GetLibraryItemsQueryParamType Movie = new GetLibraryItemsQueryParamType(1L);
+ public static final GetLibraryItemsQueryParamType TvShow = new GetLibraryItemsQueryParamType(2L);
+ public static final GetLibraryItemsQueryParamType Season = new GetLibraryItemsQueryParamType(3L);
+ public static final GetLibraryItemsQueryParamType Episode = new GetLibraryItemsQueryParamType(4L);
+ public static final GetLibraryItemsQueryParamType Audio = new GetLibraryItemsQueryParamType(8L);
+ public static final GetLibraryItemsQueryParamType Album = new GetLibraryItemsQueryParamType(9L);
+ public static final GetLibraryItemsQueryParamType Track = new GetLibraryItemsQueryParamType(10L);
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final long value;
private GetLibraryItemsQueryParamType(long value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetLibraryItemsQueryParamType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetLibraryItemsQueryParamType
+ */
+ public static GetLibraryItemsQueryParamType of(long value) {
+ synchronized (GetLibraryItemsQueryParamType.class) {
+ return values.computeIfAbsent(value, v -> new GetLibraryItemsQueryParamType(v));
+ }
+ }
+
public long value() {
return value;
}
-
- public static Optional fromValue(long value) {
- for (GetLibraryItemsQueryParamType o: GetLibraryItemsQueryParamType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetLibraryItemsQueryParamType other = (GetLibraryItemsQueryParamType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetLibraryItemsQueryParamType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetLibraryItemsQueryParamType[] values() {
+ synchronized (GetLibraryItemsQueryParamType.class) {
+ return values.values().toArray(new GetLibraryItemsQueryParamType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put(1L, Movie);
+ map.put(2L, TvShow);
+ map.put(3L, Season);
+ map.put(4L, Episode);
+ map.put(8L, Audio);
+ map.put(9L, Album);
+ map.put(10L, Track);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put(1L, GetLibraryItemsQueryParamTypeEnum.Movie);
+ map.put(2L, GetLibraryItemsQueryParamTypeEnum.TvShow);
+ map.put(3L, GetLibraryItemsQueryParamTypeEnum.Season);
+ map.put(4L, GetLibraryItemsQueryParamTypeEnum.Episode);
+ map.put(8L, GetLibraryItemsQueryParamTypeEnum.Audio);
+ map.put(9L, GetLibraryItemsQueryParamTypeEnum.Album);
+ map.put(10L, GetLibraryItemsQueryParamTypeEnum.Track);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetLibraryItemsQueryParamType.class);
+ }
+
+ @Override
+ public void serialize(GetLibraryItemsQueryParamType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetLibraryItemsQueryParamType.class);
+ }
+
+ @Override
+ public GetLibraryItemsQueryParamType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ long v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetLibraryItemsQueryParamType.of(v);
+ }
+ }
+
+ public enum GetLibraryItemsQueryParamTypeEnum {
+
+ Movie(1L),
+ TvShow(2L),
+ Season(3L),
+ Episode(4L),
+ Audio(8L),
+ Album(9L),
+ Track(10L),;
+
+ private final long value;
+
+ private GetLibraryItemsQueryParamTypeEnum(long value) {
+ this.value = value;
+ }
+
+ public long value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetPlaylistContentsQueryParamType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetPlaylistContentsQueryParamType.java
index e6a09667..ecc81d30 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetPlaylistContentsQueryParamType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetPlaylistContentsQueryParamType.java
@@ -3,10 +3,45 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Long;
+import java.lang.Override;
+import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetPlaylistContentsQueryParamType
*
@@ -17,33 +52,159 @@ import java.util.Optional;
* 4 = episode
* E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries
*/
-public enum GetPlaylistContentsQueryParamType {
- Movie(1L),
- TvShow(2L),
- Season(3L),
- Episode(4L),
- Audio(8L),
- Album(9L),
- Track(10L);
+@JsonDeserialize(using = GetPlaylistContentsQueryParamType._Deserializer.class)
+@JsonSerialize(using = GetPlaylistContentsQueryParamType._Serializer.class)
+public class GetPlaylistContentsQueryParamType {
+
+ public static final GetPlaylistContentsQueryParamType Movie = new GetPlaylistContentsQueryParamType(1L);
+ public static final GetPlaylistContentsQueryParamType TvShow = new GetPlaylistContentsQueryParamType(2L);
+ public static final GetPlaylistContentsQueryParamType Season = new GetPlaylistContentsQueryParamType(3L);
+ public static final GetPlaylistContentsQueryParamType Episode = new GetPlaylistContentsQueryParamType(4L);
+ public static final GetPlaylistContentsQueryParamType Audio = new GetPlaylistContentsQueryParamType(8L);
+ public static final GetPlaylistContentsQueryParamType Album = new GetPlaylistContentsQueryParamType(9L);
+ public static final GetPlaylistContentsQueryParamType Track = new GetPlaylistContentsQueryParamType(10L);
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final long value;
private GetPlaylistContentsQueryParamType(long value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetPlaylistContentsQueryParamType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetPlaylistContentsQueryParamType
+ */
+ public static GetPlaylistContentsQueryParamType of(long value) {
+ synchronized (GetPlaylistContentsQueryParamType.class) {
+ return values.computeIfAbsent(value, v -> new GetPlaylistContentsQueryParamType(v));
+ }
+ }
+
public long value() {
return value;
}
-
- public static Optional fromValue(long value) {
- for (GetPlaylistContentsQueryParamType o: GetPlaylistContentsQueryParamType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetPlaylistContentsQueryParamType other = (GetPlaylistContentsQueryParamType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetPlaylistContentsQueryParamType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetPlaylistContentsQueryParamType[] values() {
+ synchronized (GetPlaylistContentsQueryParamType.class) {
+ return values.values().toArray(new GetPlaylistContentsQueryParamType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put(1L, Movie);
+ map.put(2L, TvShow);
+ map.put(3L, Season);
+ map.put(4L, Episode);
+ map.put(8L, Audio);
+ map.put(9L, Album);
+ map.put(10L, Track);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put(1L, GetPlaylistContentsQueryParamTypeEnum.Movie);
+ map.put(2L, GetPlaylistContentsQueryParamTypeEnum.TvShow);
+ map.put(3L, GetPlaylistContentsQueryParamTypeEnum.Season);
+ map.put(4L, GetPlaylistContentsQueryParamTypeEnum.Episode);
+ map.put(8L, GetPlaylistContentsQueryParamTypeEnum.Audio);
+ map.put(9L, GetPlaylistContentsQueryParamTypeEnum.Album);
+ map.put(10L, GetPlaylistContentsQueryParamTypeEnum.Track);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetPlaylistContentsQueryParamType.class);
+ }
+
+ @Override
+ public void serialize(GetPlaylistContentsQueryParamType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetPlaylistContentsQueryParamType.class);
+ }
+
+ @Override
+ public GetPlaylistContentsQueryParamType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ long v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetPlaylistContentsQueryParamType.of(v);
+ }
+ }
+
+ public enum GetPlaylistContentsQueryParamTypeEnum {
+
+ Movie(1L),
+ TvShow(2L),
+ Season(3L),
+ Episode(4L),
+ Audio(8L),
+ Album(9L),
+ Track(10L),;
+
+ private final long value;
+
+ private GetPlaylistContentsQueryParamTypeEnum(long value) {
+ this.value = value;
+ }
+
+ public long value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetRecentlyAddedHubsResponseType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetRecentlyAddedHubsResponseType.java
index 0307a65b..2798b5ba 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetRecentlyAddedHubsResponseType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetRecentlyAddedHubsResponseType.java
@@ -3,35 +3,185 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
-public enum GetRecentlyAddedHubsResponseType {
- COVER_POSTER("coverPoster"),
- BACKGROUND("background"),
- SNAPSHOT("snapshot"),
- CLEAR_LOGO("clearLogo");
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
+@JsonDeserialize(using = GetRecentlyAddedHubsResponseType._Deserializer.class)
+@JsonSerialize(using = GetRecentlyAddedHubsResponseType._Serializer.class)
+public class GetRecentlyAddedHubsResponseType {
+
+ public static final GetRecentlyAddedHubsResponseType COVER_POSTER = new GetRecentlyAddedHubsResponseType("coverPoster");
+ public static final GetRecentlyAddedHubsResponseType BACKGROUND = new GetRecentlyAddedHubsResponseType("background");
+ public static final GetRecentlyAddedHubsResponseType SNAPSHOT = new GetRecentlyAddedHubsResponseType("snapshot");
+ public static final GetRecentlyAddedHubsResponseType CLEAR_LOGO = new GetRecentlyAddedHubsResponseType("clearLogo");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetRecentlyAddedHubsResponseType(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetRecentlyAddedHubsResponseType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetRecentlyAddedHubsResponseType
+ */
+ public static GetRecentlyAddedHubsResponseType of(String value) {
+ synchronized (GetRecentlyAddedHubsResponseType.class) {
+ return values.computeIfAbsent(value, v -> new GetRecentlyAddedHubsResponseType(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetRecentlyAddedHubsResponseType o: GetRecentlyAddedHubsResponseType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetRecentlyAddedHubsResponseType other = (GetRecentlyAddedHubsResponseType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetRecentlyAddedHubsResponseType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetRecentlyAddedHubsResponseType[] values() {
+ synchronized (GetRecentlyAddedHubsResponseType.class) {
+ return values.values().toArray(new GetRecentlyAddedHubsResponseType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("coverPoster", COVER_POSTER);
+ map.put("background", BACKGROUND);
+ map.put("snapshot", SNAPSHOT);
+ map.put("clearLogo", CLEAR_LOGO);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("coverPoster", GetRecentlyAddedHubsResponseTypeEnum.COVER_POSTER);
+ map.put("background", GetRecentlyAddedHubsResponseTypeEnum.BACKGROUND);
+ map.put("snapshot", GetRecentlyAddedHubsResponseTypeEnum.SNAPSHOT);
+ map.put("clearLogo", GetRecentlyAddedHubsResponseTypeEnum.CLEAR_LOGO);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetRecentlyAddedHubsResponseType.class);
+ }
+
+ @Override
+ public void serialize(GetRecentlyAddedHubsResponseType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetRecentlyAddedHubsResponseType.class);
+ }
+
+ @Override
+ public GetRecentlyAddedHubsResponseType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetRecentlyAddedHubsResponseType.of(v);
+ }
+ }
+
+ public enum GetRecentlyAddedHubsResponseTypeEnum {
+
+ COVER_POSTER("coverPoster"),
+ BACKGROUND("background"),
+ SNAPSHOT("snapshot"),
+ CLEAR_LOGO("clearLogo"),;
+
+ private final String value;
+
+ private GetRecentlyAddedHubsResponseTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetRecentlyAddedHubsType.java b/src/main/java/dev/plexapi/sdk/models/operations/GetRecentlyAddedHubsType.java
index dfeda47a..98817966 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetRecentlyAddedHubsType.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetRecentlyAddedHubsType.java
@@ -3,42 +3,198 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetRecentlyAddedHubsType
*
*
The type of media content
*/
-public enum GetRecentlyAddedHubsType {
- Movie("movie"),
- TvShow("show"),
- Season("season"),
- Episode("episode"),
- Artist("artist"),
- Album("album");
+@JsonDeserialize(using = GetRecentlyAddedHubsType._Deserializer.class)
+@JsonSerialize(using = GetRecentlyAddedHubsType._Serializer.class)
+public class GetRecentlyAddedHubsType {
+
+ public static final GetRecentlyAddedHubsType Movie = new GetRecentlyAddedHubsType("movie");
+ public static final GetRecentlyAddedHubsType TvShow = new GetRecentlyAddedHubsType("show");
+ public static final GetRecentlyAddedHubsType Season = new GetRecentlyAddedHubsType("season");
+ public static final GetRecentlyAddedHubsType Episode = new GetRecentlyAddedHubsType("episode");
+ public static final GetRecentlyAddedHubsType Artist = new GetRecentlyAddedHubsType("artist");
+ public static final GetRecentlyAddedHubsType Album = new GetRecentlyAddedHubsType("album");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetRecentlyAddedHubsType(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetRecentlyAddedHubsType with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetRecentlyAddedHubsType
+ */
+ public static GetRecentlyAddedHubsType of(String value) {
+ synchronized (GetRecentlyAddedHubsType.class) {
+ return values.computeIfAbsent(value, v -> new GetRecentlyAddedHubsType(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetRecentlyAddedHubsType o: GetRecentlyAddedHubsType.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetRecentlyAddedHubsType other = (GetRecentlyAddedHubsType) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetRecentlyAddedHubsType [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetRecentlyAddedHubsType[] values() {
+ synchronized (GetRecentlyAddedHubsType.class) {
+ return values.values().toArray(new GetRecentlyAddedHubsType[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("movie", Movie);
+ map.put("show", TvShow);
+ map.put("season", Season);
+ map.put("episode", Episode);
+ map.put("artist", Artist);
+ map.put("album", Album);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("movie", GetRecentlyAddedHubsTypeEnum.Movie);
+ map.put("show", GetRecentlyAddedHubsTypeEnum.TvShow);
+ map.put("season", GetRecentlyAddedHubsTypeEnum.Season);
+ map.put("episode", GetRecentlyAddedHubsTypeEnum.Episode);
+ map.put("artist", GetRecentlyAddedHubsTypeEnum.Artist);
+ map.put("album", GetRecentlyAddedHubsTypeEnum.Album);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetRecentlyAddedHubsType.class);
+ }
+
+ @Override
+ public void serialize(GetRecentlyAddedHubsType value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetRecentlyAddedHubsType.class);
+ }
+
+ @Override
+ public GetRecentlyAddedHubsType deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetRecentlyAddedHubsType.of(v);
+ }
+ }
+
+ public enum GetRecentlyAddedHubsTypeEnum {
+
+ Movie("movie"),
+ TvShow("show"),
+ Season("season"),
+ Episode("episode"),
+ Artist("artist"),
+ Album("album"),;
+
+ private final String value;
+
+ private GetRecentlyAddedHubsTypeEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesEnableCreditsMarkerGeneration.java b/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesEnableCreditsMarkerGeneration.java
index 674af54d..c7ec8ab2 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesEnableCreditsMarkerGeneration.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesEnableCreditsMarkerGeneration.java
@@ -3,38 +3,182 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetSearchAllLibrariesEnableCreditsMarkerGeneration
*
*
Setting that indicates if credits markers detection is enabled. (-1 = Library default, 0 = Disabled).
*/
-public enum GetSearchAllLibrariesEnableCreditsMarkerGeneration {
- LibraryDefault("-1"),
- Disabled("0");
+@JsonDeserialize(using = GetSearchAllLibrariesEnableCreditsMarkerGeneration._Deserializer.class)
+@JsonSerialize(using = GetSearchAllLibrariesEnableCreditsMarkerGeneration._Serializer.class)
+public class GetSearchAllLibrariesEnableCreditsMarkerGeneration {
+
+ public static final GetSearchAllLibrariesEnableCreditsMarkerGeneration LibraryDefault = new GetSearchAllLibrariesEnableCreditsMarkerGeneration("-1");
+ public static final GetSearchAllLibrariesEnableCreditsMarkerGeneration Disabled = new GetSearchAllLibrariesEnableCreditsMarkerGeneration("0");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetSearchAllLibrariesEnableCreditsMarkerGeneration(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetSearchAllLibrariesEnableCreditsMarkerGeneration with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetSearchAllLibrariesEnableCreditsMarkerGeneration
+ */
+ public static GetSearchAllLibrariesEnableCreditsMarkerGeneration of(String value) {
+ synchronized (GetSearchAllLibrariesEnableCreditsMarkerGeneration.class) {
+ return values.computeIfAbsent(value, v -> new GetSearchAllLibrariesEnableCreditsMarkerGeneration(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetSearchAllLibrariesEnableCreditsMarkerGeneration o: GetSearchAllLibrariesEnableCreditsMarkerGeneration.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetSearchAllLibrariesEnableCreditsMarkerGeneration other = (GetSearchAllLibrariesEnableCreditsMarkerGeneration) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetSearchAllLibrariesEnableCreditsMarkerGeneration [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetSearchAllLibrariesEnableCreditsMarkerGeneration[] values() {
+ synchronized (GetSearchAllLibrariesEnableCreditsMarkerGeneration.class) {
+ return values.values().toArray(new GetSearchAllLibrariesEnableCreditsMarkerGeneration[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("-1", LibraryDefault);
+ map.put("0", Disabled);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("-1", GetSearchAllLibrariesEnableCreditsMarkerGenerationEnum.LibraryDefault);
+ map.put("0", GetSearchAllLibrariesEnableCreditsMarkerGenerationEnum.Disabled);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetSearchAllLibrariesEnableCreditsMarkerGeneration.class);
+ }
+
+ @Override
+ public void serialize(GetSearchAllLibrariesEnableCreditsMarkerGeneration value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetSearchAllLibrariesEnableCreditsMarkerGeneration.class);
+ }
+
+ @Override
+ public GetSearchAllLibrariesEnableCreditsMarkerGeneration deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetSearchAllLibrariesEnableCreditsMarkerGeneration.of(v);
+ }
+ }
+
+ public enum GetSearchAllLibrariesEnableCreditsMarkerGenerationEnum {
+
+ LibraryDefault("-1"),
+ Disabled("0"),;
+
+ private final String value;
+
+ private GetSearchAllLibrariesEnableCreditsMarkerGenerationEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesEpisodeSort.java b/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesEpisodeSort.java
index 7959b3cb..33f947f0 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesEpisodeSort.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesEpisodeSort.java
@@ -3,39 +3,186 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetSearchAllLibrariesEpisodeSort
*
*
Setting that indicates how episodes are sorted for the show. (-1 = Library default, 0 = Oldest first, 1 = Newest first).
*/
-public enum GetSearchAllLibrariesEpisodeSort {
- LibraryDefault("-1"),
- OldestFirst("0"),
- NewestFirst("1");
+@JsonDeserialize(using = GetSearchAllLibrariesEpisodeSort._Deserializer.class)
+@JsonSerialize(using = GetSearchAllLibrariesEpisodeSort._Serializer.class)
+public class GetSearchAllLibrariesEpisodeSort {
+
+ public static final GetSearchAllLibrariesEpisodeSort LibraryDefault = new GetSearchAllLibrariesEpisodeSort("-1");
+ public static final GetSearchAllLibrariesEpisodeSort OldestFirst = new GetSearchAllLibrariesEpisodeSort("0");
+ public static final GetSearchAllLibrariesEpisodeSort NewestFirst = new GetSearchAllLibrariesEpisodeSort("1");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetSearchAllLibrariesEpisodeSort(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetSearchAllLibrariesEpisodeSort with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetSearchAllLibrariesEpisodeSort
+ */
+ public static GetSearchAllLibrariesEpisodeSort of(String value) {
+ synchronized (GetSearchAllLibrariesEpisodeSort.class) {
+ return values.computeIfAbsent(value, v -> new GetSearchAllLibrariesEpisodeSort(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetSearchAllLibrariesEpisodeSort o: GetSearchAllLibrariesEpisodeSort.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetSearchAllLibrariesEpisodeSort other = (GetSearchAllLibrariesEpisodeSort) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetSearchAllLibrariesEpisodeSort [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetSearchAllLibrariesEpisodeSort[] values() {
+ synchronized (GetSearchAllLibrariesEpisodeSort.class) {
+ return values.values().toArray(new GetSearchAllLibrariesEpisodeSort[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("-1", LibraryDefault);
+ map.put("0", OldestFirst);
+ map.put("1", NewestFirst);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("-1", GetSearchAllLibrariesEpisodeSortEnum.LibraryDefault);
+ map.put("0", GetSearchAllLibrariesEpisodeSortEnum.OldestFirst);
+ map.put("1", GetSearchAllLibrariesEpisodeSortEnum.NewestFirst);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetSearchAllLibrariesEpisodeSort.class);
+ }
+
+ @Override
+ public void serialize(GetSearchAllLibrariesEpisodeSort value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer {
+
+ protected _Deserializer() {
+ super(GetSearchAllLibrariesEpisodeSort.class);
+ }
+
+ @Override
+ public GetSearchAllLibrariesEpisodeSort deserialize(JsonParser p, DeserializationContext ctxt)
+ throws IOException, JacksonException {
+ String v = p.readValueAs(new TypeReference() {});
+ // use the factory method to ensure we get singletons
+ return GetSearchAllLibrariesEpisodeSort.of(v);
+ }
+ }
+
+ public enum GetSearchAllLibrariesEpisodeSortEnum {
+
+ LibraryDefault("-1"),
+ OldestFirst("0"),
+ NewestFirst("1"),;
+
+ private final String value;
+
+ private GetSearchAllLibrariesEpisodeSortEnum(String value) {
+ this.value = value;
+ }
+
+ public String value() {
+ return value;
}
- return Optional.empty();
}
}
diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesFlattenSeasons.java b/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesFlattenSeasons.java
index 0ca5935a..d3752616 100644
--- a/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesFlattenSeasons.java
+++ b/src/main/java/dev/plexapi/sdk/models/operations/GetSearchAllLibrariesFlattenSeasons.java
@@ -3,39 +3,186 @@
*/
package dev.plexapi.sdk.models.operations;
-import com.fasterxml.jackson.annotation.JsonValue;
+import com.fasterxml.jackson.core.JacksonException;
+import com.fasterxml.jackson.core.JsonGenerator;
+import com.fasterxml.jackson.core.JsonParser;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationContext;
+import com.fasterxml.jackson.databind.SerializerProvider;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
+import com.fasterxml.jackson.databind.ser.std.StdSerializer;
+import java.io.IOException;
+import java.lang.Override;
import java.lang.String;
+import java.lang.SuppressWarnings;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
import java.util.Objects;
import java.util.Optional;
+/**
+ * Wrapper class for an "open" enum. "Open" enums are those that are expected
+ * to evolve (particularly with the addition of enum members over time). If an
+ * open enum is used then the appearance of unexpected enum values (say in a
+ * response from an updated an API) will not bring about a runtime error thus
+ * ensuring that non-updated client versions can continue to work without error.
+ *
+ *
Note that instances are immutable and are singletons (an internal thread-safe
+ * cache is maintained to ensure that). As a consequence instances created with the
+ * same value will satisfy reference equality (via {@code ==}).
+ *
+ *
This class is intended to emulate an enum (in terms of common usage and with
+ * reference equality) but with the ability to carry unknown values. Unfortunately
+ * Java does not permit the use of an instance in a switch expression but you can
+ * use the {@code asEnum()} method (after dealing with the `Optional` appropriately).
+ *
+ */
/**
* GetSearchAllLibrariesFlattenSeasons
*
*
Setting that indicates if seasons are set to hidden for the show. (-1 = Library default, 0 = Hide, 1 = Show).
*/
-public enum GetSearchAllLibrariesFlattenSeasons {
- LibraryDefault("-1"),
- Hide("0"),
- Show("1");
+@JsonDeserialize(using = GetSearchAllLibrariesFlattenSeasons._Deserializer.class)
+@JsonSerialize(using = GetSearchAllLibrariesFlattenSeasons._Serializer.class)
+public class GetSearchAllLibrariesFlattenSeasons {
+
+ public static final GetSearchAllLibrariesFlattenSeasons LibraryDefault = new GetSearchAllLibrariesFlattenSeasons("-1");
+ public static final GetSearchAllLibrariesFlattenSeasons Hide = new GetSearchAllLibrariesFlattenSeasons("0");
+ public static final GetSearchAllLibrariesFlattenSeasons Show = new GetSearchAllLibrariesFlattenSeasons("1");
+
+ // This map will grow whenever a Color gets created with a new
+ // unrecognized value (a potential memory leak if the user is not
+ // careful). Keep this field lower case to avoid clashing with
+ // generated member names which will always be upper cased (Java
+ // convention)
+ private static final Map values = createValuesMap();
+ private static final Map enums = createEnumsMap();
- @JsonValue
private final String value;
private GetSearchAllLibrariesFlattenSeasons(String value) {
this.value = value;
}
-
+
+ /**
+ * Returns a GetSearchAllLibrariesFlattenSeasons with the given value. For a specific value the
+ * returned object will always be a singleton so reference equality
+ * is satisfied when the values are the same.
+ *
+ * @param value value to be wrapped as GetSearchAllLibrariesFlattenSeasons
+ */
+ public static GetSearchAllLibrariesFlattenSeasons of(String value) {
+ synchronized (GetSearchAllLibrariesFlattenSeasons.class) {
+ return values.computeIfAbsent(value, v -> new GetSearchAllLibrariesFlattenSeasons(v));
+ }
+ }
+
public String value() {
return value;
}
-
- public static Optional fromValue(String value) {
- for (GetSearchAllLibrariesFlattenSeasons o: GetSearchAllLibrariesFlattenSeasons.values()) {
- if (Objects.deepEquals(o.value, value)) {
- return Optional.of(o);
- }
+
+ public Optional asEnum() {
+ return Optional.ofNullable(enums.getOrDefault(value, null));
+ }
+
+ public boolean isKnown() {
+ return asEnum().isPresent();
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(value);
+ }
+
+ @Override
+ public boolean equals(java.lang.Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ GetSearchAllLibrariesFlattenSeasons other = (GetSearchAllLibrariesFlattenSeasons) obj;
+ return Objects.equals(value, other.value);
+ }
+
+ @Override
+ public String toString() {
+ return "GetSearchAllLibrariesFlattenSeasons [value=" + value + "]";
+ }
+
+ // return an array just like an enum
+ public static GetSearchAllLibrariesFlattenSeasons[] values() {
+ synchronized (GetSearchAllLibrariesFlattenSeasons.class) {
+ return values.values().toArray(new GetSearchAllLibrariesFlattenSeasons[] {});
+ }
+ }
+
+ private static final Map createValuesMap() {
+ Map map = new LinkedHashMap<>();
+ map.put("-1", LibraryDefault);
+ map.put("0", Hide);
+ map.put("1", Show);
+ return map;
+ }
+
+ private static final Map createEnumsMap() {
+ Map map = new HashMap<>();
+ map.put("-1", GetSearchAllLibrariesFlattenSeasonsEnum.LibraryDefault);
+ map.put("0", GetSearchAllLibrariesFlattenSeasonsEnum.Hide);
+ map.put("1", GetSearchAllLibrariesFlattenSeasonsEnum.Show);
+ return map;
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Serializer extends StdSerializer {
+
+ protected _Serializer() {
+ super(GetSearchAllLibrariesFlattenSeasons.class);
+ }
+
+ @Override
+ public void serialize(GetSearchAllLibrariesFlattenSeasons value, JsonGenerator g, SerializerProvider provider)
+ throws IOException, JsonProcessingException {
+ g.writeObject(value.value);
+ }
+ }
+
+ @SuppressWarnings("serial")
+ public static final class _Deserializer extends StdDeserializer