mirror of
https://github.com/LukeHagar/plexjava.git
synced 2025-12-06 12:37:47 +00:00
SDK update generated by liblab
This commit is contained in:
22
.devcontainer/devcontainer.json
Normal file
22
.devcontainer/devcontainer.json
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
||||||
|
// README at: https://github.com/devcontainers/templates/tree/main/src/java
|
||||||
|
{
|
||||||
|
"name": "Java SDK",
|
||||||
|
"image": "mcr.microsoft.com/devcontainers/java:1-17-bullseye",
|
||||||
|
"features": {
|
||||||
|
"ghcr.io/devcontainers/features/java:1": {
|
||||||
|
"version": "none",
|
||||||
|
"installMaven": "true",
|
||||||
|
"installGradle": "false"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postCreateCommand": "mvn install && mvn -f examples/pom.xml install",
|
||||||
|
"customizations": {
|
||||||
|
"codespaces": {
|
||||||
|
"openFiles": [
|
||||||
|
"examples/src/main/java/com/plexsdk/examples/Main.java",
|
||||||
|
"README.md"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
.env.example
Normal file
2
.env.example
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
PLEXSDK_API_KEY=
|
||||||
|
PLEXSDK_API_KEY_HEADER=
|
||||||
24
.gitignore
vendored
Normal file
24
.gitignore
vendored
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
replay_pid*
|
||||||
19
LICENSE
Normal file
19
LICENSE
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
Copyright (c) 2023
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||||
|
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||||
|
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
|
||||||
|
OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
133
README.md
133
README.md
@@ -1 +1,132 @@
|
|||||||
# plexjava
|
|
||||||
|
|
||||||
|
# PlexSDK Java SDK 0.0.1
|
||||||
|
A Java SDK for PlexSDK.
|
||||||
|
|
||||||
|
An Open API Spec for interacting with Plex.tv and Plex Servers
|
||||||
|
|
||||||
|
- API version: 0.0.1
|
||||||
|
- SDK version: 0.0.1
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
- [Requirements](#requirements)
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Dependencies](#dependencies)
|
||||||
|
- [Authentication](#authentication)
|
||||||
|
- [API Key](#api-key)
|
||||||
|
- [API Endpoint Services](#api-endpoint-services)
|
||||||
|
- [API Models](#api-models)
|
||||||
|
- [Testing](#testing)
|
||||||
|
- [Configuration](#configuration)
|
||||||
|
- [Sample Usage](#sample-usage)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
- Java 8
|
||||||
|
- Maven
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
If you use Maven, place the following within the <dependencies> tag in your pom.xml file:
|
||||||
|
|
||||||
|
```XML
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.plexsdk</groupId>
|
||||||
|
<artifactId>plex-sdk</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
|
If you use Gradle, paste the next line inside the dependencies block of your build.gradle file:
|
||||||
|
|
||||||
|
```Gradle
|
||||||
|
implementation group: "com.plexsdk", name: "PlexSDK", version: "0.0.1"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Authentication
|
||||||
|
|
||||||
|
To see whether an endpoint needs a specific type of authentication check the endpoint's documentation.
|
||||||
|
|
||||||
|
### API Key
|
||||||
|
The PlexSDK API uses API keys as a form of authentication.
|
||||||
|
An API key is a unique identifier used to authenticate a user, developer, or calling program to an API.
|
||||||
|
|
||||||
|
The API key can be set for the SDK through:
|
||||||
|
|
||||||
|
```Java
|
||||||
|
PlexSDK sdk = new PlexSDK("YOUR_API_KEY", "YOUR_API_KEY_HEADER");
|
||||||
|
```
|
||||||
|
|
||||||
|
## API Endpoint Services
|
||||||
|
|
||||||
|
All URIs are relative to {protocol}://{ip}:{port}.
|
||||||
|
|
||||||
|
Click the service name for a full list of the service methods.
|
||||||
|
|
||||||
|
| Service |
|
||||||
|
| :------ |
|
||||||
|
|[ServerService](src/main/java/com/plexsdk/services/README.md#serverservice)|
|
||||||
|
|[MediaService](src/main/java/com/plexsdk/services/README.md#mediaservice)|
|
||||||
|
|[ActivitiesService](src/main/java/com/plexsdk/services/README.md#activitiesservice)|
|
||||||
|
|[ButlerService](src/main/java/com/plexsdk/services/README.md#butlerservice)|
|
||||||
|
|[HubsService](src/main/java/com/plexsdk/services/README.md#hubsservice)|
|
||||||
|
|[SearchService](src/main/java/com/plexsdk/services/README.md#searchservice)|
|
||||||
|
|[LibraryService](src/main/java/com/plexsdk/services/README.md#libraryservice)|
|
||||||
|
|[LogService](src/main/java/com/plexsdk/services/README.md#logservice)|
|
||||||
|
|[PlaylistsService](src/main/java/com/plexsdk/services/README.md#playlistsservice)|
|
||||||
|
|[SecurityService](src/main/java/com/plexsdk/services/README.md#securityservice)|
|
||||||
|
|[SessionsService](src/main/java/com/plexsdk/services/README.md#sessionsservice)|
|
||||||
|
|[UpdaterService](src/main/java/com/plexsdk/services/README.md#updaterservice)|
|
||||||
|
|[VideoService](src/main/java/com/plexsdk/services/README.md#videoservice)|
|
||||||
|
|
||||||
|
## API Models
|
||||||
|
[A list documenting all API models for this SDK](src/main/java/com/plexsdk//models/README.md#plexsdk-models).
|
||||||
|
|
||||||
|
## Testing
|
||||||
|
|
||||||
|
Unit tests aren't available yet. When they are, you'll be able to run them with this command:
|
||||||
|
|
||||||
|
```Bash
|
||||||
|
mvn clean test
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
Your SDK may require some configuration changes.
|
||||||
|
|
||||||
|
|
||||||
|
This API is configured to use a security token for authorization. You should edit `examples/src/main/java/com/plexsdk/examples/Main.java` and paste your own tokens in place of `PLEXSDK_API_KEY` & `PLEXSDK_API_KEY_HEADER`.
|
||||||
|
|
||||||
|
|
||||||
|
## Sample Usage
|
||||||
|
|
||||||
|
```Java
|
||||||
|
package com.plexsdk.examples;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.PlexSDK;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
PlexSDK client = new PlexSDK(System.getenv("PLEXSDK_API_KEY"), System.getenv("PLEXSDK_API_KEY_HEADER"));
|
||||||
|
try {
|
||||||
|
Object response = client.serverService.getServerCapabilities();
|
||||||
|
System.out.println(response);
|
||||||
|
} catch(ApiException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
Inside this directory is `examples/src/main/java/com/plexsdk/examples/Main.java`. It's a simple, "hello, world" level program to demonstate this SDK. Run `install.sh` to prepare the SDK for use.
|
||||||
|
|
||||||
|
To see what other functions this SDK is capable of, look inside `src/main/java/com/plexsdk/http/*Client.java`.
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
License: MIT. See license in LICENSE.
|
||||||
|
|
||||||
|
|||||||
32
examples/pom.xml
Normal file
32
examples/pom.xml
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.plexsdk</groupId>
|
||||||
|
<artifactId>examples</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>8</maven.compiler.target>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.9.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.14.0-rc1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.plexsdk</groupId>
|
||||||
|
<artifactId>PlexSDK</artifactId>
|
||||||
|
<version>0.0.1</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
||||||
20
examples/src/main/java/com/plexsdk/examples/Main.java
Normal file
20
examples/src/main/java/com/plexsdk/examples/Main.java
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
package com.plexsdk.examples;
|
||||||
|
|
||||||
|
import com.plexsdk.PlexSDK;
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
|
||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
PlexSDK client = new PlexSDK(
|
||||||
|
System.getenv("PLEXSDK_API_KEY"),
|
||||||
|
System.getenv("PLEXSDK_API_KEY_HEADER")
|
||||||
|
);
|
||||||
|
try {
|
||||||
|
Object response = client.serverService.getServerCapabilities();
|
||||||
|
System.out.println(response);
|
||||||
|
} catch (ApiException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
install.sh
Normal file
1
install.sh
Normal file
@@ -0,0 +1 @@
|
|||||||
|
mvn install
|
||||||
254
pom.xml
Normal file
254
pom.xml
Normal file
@@ -0,0 +1,254 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>
|
||||||
|
com.plexsdk
|
||||||
|
</groupId>
|
||||||
|
<artifactId>
|
||||||
|
plex-sdk
|
||||||
|
</artifactId>
|
||||||
|
<version>
|
||||||
|
0.0.1
|
||||||
|
</version>
|
||||||
|
|
||||||
|
<!-- See https://central.sonatype.org/publish/requirements/#project-name-description-and-url -->
|
||||||
|
<name>${project.groupId}:${project.artifactId}</name>
|
||||||
|
<description>A Java SDK for PlexSDK.</description>
|
||||||
|
<url><!-- Eg. https://liblab.com/ -->
|
||||||
|
</url>
|
||||||
|
|
||||||
|
<!-- See https://central.sonatype.org/publish/requirements/#scm-information -->
|
||||||
|
<scm>
|
||||||
|
<connection><!-- Eg. scm:git:git://github.com/username/repo.git -->
|
||||||
|
</connection>
|
||||||
|
<developerConnection><!-- Eg. scm:git:ssh://github.com:username/repo.git -->
|
||||||
|
</developerConnection>
|
||||||
|
<url><!-- Eg. http://github.com/username/repo/tree/main -->
|
||||||
|
</url>
|
||||||
|
</scm>
|
||||||
|
|
||||||
|
<!-- See https://central.sonatype.org/publish/requirements/#developer-information -->
|
||||||
|
<developers>
|
||||||
|
<developer>
|
||||||
|
<name>Liblab</name>
|
||||||
|
<email>contact@liblab.com</email>
|
||||||
|
<organization>Liblab</organization>
|
||||||
|
<organizationUrl>https://liblab.com/</organizationUrl>
|
||||||
|
</developer>
|
||||||
|
</developers>
|
||||||
|
|
||||||
|
<licenses>
|
||||||
|
<license>
|
||||||
|
<name>
|
||||||
|
MIT
|
||||||
|
</name>
|
||||||
|
<url>
|
||||||
|
https://opensource.org/licenses/MIT
|
||||||
|
</url>
|
||||||
|
</license>
|
||||||
|
</licenses>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.30</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.13.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-api</artifactId>
|
||||||
|
<version>5.7.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.junit.jupiter</groupId>
|
||||||
|
<artifactId>junit-jupiter-engine</artifactId>
|
||||||
|
<version>5.7.2</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.fasterxml.jackson.core</groupId>
|
||||||
|
<artifactId>jackson-databind</artifactId>
|
||||||
|
<version>2.14.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.squareup.okhttp3</groupId>
|
||||||
|
<artifactId>okhttp</artifactId>
|
||||||
|
<version>4.9.1</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<distributionManagement>
|
||||||
|
<snapshotRepository>
|
||||||
|
<id>ossrh</id>
|
||||||
|
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
</snapshotRepository>
|
||||||
|
<repository>
|
||||||
|
<id>ossrh</id>
|
||||||
|
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||||
|
</repository>
|
||||||
|
</distributionManagement>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>release-sign-artifacts</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>performRelease</name>
|
||||||
|
<value>true</value>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<!-- Maven deployment, see https://central.sonatype.org/publish/publish-maven -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.sonatype.plugins</groupId>
|
||||||
|
<artifactId>nexus-staging-maven-plugin</artifactId>
|
||||||
|
<version>1.6.13</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<serverId>ossrh</serverId>
|
||||||
|
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
|
||||||
|
<autoReleaseAfterClose>true</autoReleaseAfterClose>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
<version>3.2.1</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-sources</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar-no-fork</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>3.5.0</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>attach-javadocs</id>
|
||||||
|
<goals>
|
||||||
|
<goal>jar</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<version>1.5</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent
|
||||||
|
pom) -->
|
||||||
|
<plugins>
|
||||||
|
<!-- clean lifecycle, see
|
||||||
|
https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-clean-plugin</artifactId>
|
||||||
|
<version>3.1.0</version>
|
||||||
|
</plugin>
|
||||||
|
<!-- default lifecycle, jar packaging: see
|
||||||
|
https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.8.0</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>2.22.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>2.22.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>3.0.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-install-plugin</artifactId>
|
||||||
|
<version>2.5.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-deploy-plugin</artifactId>
|
||||||
|
<version>2.8.2</version>
|
||||||
|
</plugin>
|
||||||
|
<!-- site lifecycle, see
|
||||||
|
https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
|
<version>3.7.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
|
<version>3.0.0</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-pmd-plugin</artifactId>
|
||||||
|
<version>3.19.0</version>
|
||||||
|
<configuration>
|
||||||
|
<rulesets>
|
||||||
|
<ruleset>/category/java/bestpractices.xml</ruleset>
|
||||||
|
<ruleset>/category/java/codestyle.xml</ruleset>
|
||||||
|
<ruleset>/category/java/design.xml</ruleset>
|
||||||
|
<ruleset>/category/java/performance.xml</ruleset>
|
||||||
|
</rulesets>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
<reporting>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-pmd-plugin</artifactId>
|
||||||
|
<version>3.19.0</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
</project>
|
||||||
8
src/main/java/com/plexsdk/Configuration.java
Normal file
8
src/main/java/com/plexsdk/Configuration.java
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
package com.plexsdk;
|
||||||
|
|
||||||
|
public class Configuration {
|
||||||
|
|
||||||
|
public static final String USER_AGENT = "liblab/0.1.25 PlexSDK/0.0.1 java/1.8";
|
||||||
|
|
||||||
|
public static final String DEFAULT_API_KEY_HEADER = "X-Plex-Token";
|
||||||
|
}
|
||||||
14
src/main/java/com/plexsdk/Environment.java
Normal file
14
src/main/java/com/plexsdk/Environment.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.plexsdk;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum Environment {
|
||||||
|
DEFAULT("{protocol}://{ip}:{port}");
|
||||||
|
|
||||||
|
private final String url;
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return this.url;
|
||||||
|
}
|
||||||
|
}
|
||||||
85
src/main/java/com/plexsdk/PlexSDK.java
Normal file
85
src/main/java/com/plexsdk/PlexSDK.java
Normal file
@@ -0,0 +1,85 @@
|
|||||||
|
package com.plexsdk;
|
||||||
|
|
||||||
|
import com.plexsdk.Environment;
|
||||||
|
import com.plexsdk.http.interceptors.ApiKeyInterceptor;
|
||||||
|
import com.plexsdk.http.interceptors.DefaultHeadersInterceptor;
|
||||||
|
import com.plexsdk.http.interceptors.RetryInterceptor;
|
||||||
|
import com.plexsdk.services.*;
|
||||||
|
import java.util.Map;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
|
||||||
|
public class PlexSDK {
|
||||||
|
|
||||||
|
public ActivitiesService activitiesService;
|
||||||
|
public ButlerService butlerService;
|
||||||
|
public HubsService hubsService;
|
||||||
|
public LibraryService libraryService;
|
||||||
|
public LogService logService;
|
||||||
|
public MediaService mediaService;
|
||||||
|
public PlaylistsService playlistsService;
|
||||||
|
public SearchService searchService;
|
||||||
|
public SecurityService securityService;
|
||||||
|
public ServerService serverService;
|
||||||
|
public SessionsService sessionsService;
|
||||||
|
public UpdaterService updaterService;
|
||||||
|
public VideoService videoService;
|
||||||
|
|
||||||
|
private final ApiKeyInterceptor apiKeyInterceptor = new ApiKeyInterceptor();
|
||||||
|
|
||||||
|
public PlexSDK() {
|
||||||
|
final String serverUrl = Environment.DEFAULT.getUrl();
|
||||||
|
final OkHttpClient httpClient = new OkHttpClient.Builder()
|
||||||
|
.addInterceptor(new DefaultHeadersInterceptor())
|
||||||
|
.addInterceptor(new RetryInterceptor())
|
||||||
|
.addInterceptor(apiKeyInterceptor)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
this.activitiesService = new ActivitiesService(httpClient, serverUrl);
|
||||||
|
this.butlerService = new ButlerService(httpClient, serverUrl);
|
||||||
|
this.hubsService = new HubsService(httpClient, serverUrl);
|
||||||
|
this.libraryService = new LibraryService(httpClient, serverUrl);
|
||||||
|
this.logService = new LogService(httpClient, serverUrl);
|
||||||
|
this.mediaService = new MediaService(httpClient, serverUrl);
|
||||||
|
this.playlistsService = new PlaylistsService(httpClient, serverUrl);
|
||||||
|
this.searchService = new SearchService(httpClient, serverUrl);
|
||||||
|
this.securityService = new SecurityService(httpClient, serverUrl);
|
||||||
|
this.serverService = new ServerService(httpClient, serverUrl);
|
||||||
|
this.sessionsService = new SessionsService(httpClient, serverUrl);
|
||||||
|
this.updaterService = new UpdaterService(httpClient, serverUrl);
|
||||||
|
this.videoService = new VideoService(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlexSDK(String apiKey) {
|
||||||
|
this(apiKey, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlexSDK(String apiKey, String apiKeyHeader) {
|
||||||
|
this();
|
||||||
|
setApiKey(apiKey);
|
||||||
|
setApiKeyHeader(apiKeyHeader);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseUrl(String url) {
|
||||||
|
this.activitiesService.setBaseUrl(url);
|
||||||
|
this.butlerService.setBaseUrl(url);
|
||||||
|
this.hubsService.setBaseUrl(url);
|
||||||
|
this.libraryService.setBaseUrl(url);
|
||||||
|
this.logService.setBaseUrl(url);
|
||||||
|
this.mediaService.setBaseUrl(url);
|
||||||
|
this.playlistsService.setBaseUrl(url);
|
||||||
|
this.searchService.setBaseUrl(url);
|
||||||
|
this.securityService.setBaseUrl(url);
|
||||||
|
this.serverService.setBaseUrl(url);
|
||||||
|
this.sessionsService.setBaseUrl(url);
|
||||||
|
this.updaterService.setBaseUrl(url);
|
||||||
|
this.videoService.setBaseUrl(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKey(String apiKey) {
|
||||||
|
this.apiKeyInterceptor.setApiKey(apiKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setApiKeyHeader(String apiKeyHeader) {
|
||||||
|
this.apiKeyInterceptor.setApiKeyHeader(apiKeyHeader);
|
||||||
|
}
|
||||||
|
}
|
||||||
59
src/main/java/com/plexsdk/exceptions/ApiException.java
Normal file
59
src/main/java/com/plexsdk/exceptions/ApiException.java
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
package com.plexsdk.exceptions;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the base class for all exceptions that represent an error response from the server.
|
||||||
|
*/
|
||||||
|
public class ApiException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final Map<Integer, String> ERROR_MAP = Collections.unmodifiableMap(
|
||||||
|
new HashMap<Integer, String>() {
|
||||||
|
{
|
||||||
|
put(401, "Unauthorized");
|
||||||
|
put(403, "Forbidden");
|
||||||
|
put(404, "Not Found");
|
||||||
|
put(405, "Method Not Allowed");
|
||||||
|
put(406, "Not Acceptable");
|
||||||
|
put(409, "Conflict");
|
||||||
|
put(410, "Gone");
|
||||||
|
put(500, "Internal Server Error");
|
||||||
|
put(502, "Bad Gateway");
|
||||||
|
put(503, "Service Unavailable");
|
||||||
|
put(504, "Gateway Timeout");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
private final int statusCode;
|
||||||
|
|
||||||
|
public ApiException(int code) {
|
||||||
|
super(getExceptionMessage(code));
|
||||||
|
this.statusCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message) {
|
||||||
|
super(message);
|
||||||
|
this.statusCode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(String message, Throwable t) {
|
||||||
|
super(message, t);
|
||||||
|
this.statusCode = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ApiException(int code, String message) {
|
||||||
|
super(message);
|
||||||
|
this.statusCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatusCode() {
|
||||||
|
return this.statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static String getExceptionMessage(int code) {
|
||||||
|
return ERROR_MAP.getOrDefault(code, "Unknown Error");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.plexsdk.exceptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Thrown to indicate that a service method has been passed an illegal or inappropriate argument.
|
||||||
|
* For example, if a required argument is being passed as null.
|
||||||
|
*/
|
||||||
|
public class ArgumentCannotBeNullException extends RuntimeException {
|
||||||
|
|
||||||
|
private static final String ARGUMENT_NAME_MESSAGE_FORMAT = "Required argument %s cannot be null.";
|
||||||
|
private static final String DEFAULT_MESSAGE = "Required argument cannot be null.";
|
||||||
|
|
||||||
|
public ArgumentCannotBeNullException() {
|
||||||
|
super(DEFAULT_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArgumentCannotBeNullException(String argumentName) {
|
||||||
|
super(String.format(ARGUMENT_NAME_MESSAGE_FORMAT, argumentName));
|
||||||
|
}
|
||||||
|
}
|
||||||
1
src/main/java/com/plexsdk/hooks/CustomHook.java
Normal file
1
src/main/java/com/plexsdk/hooks/CustomHook.java
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
26
src/main/java/com/plexsdk/hooks/model/Hook.java
Normal file
26
src/main/java/com/plexsdk/hooks/model/Hook.java
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
package com.plexsdk.hooks.model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liblab Hook interface
|
||||||
|
*/
|
||||||
|
public interface Hook {
|
||||||
|
/**
|
||||||
|
* Is called before the request is made to the API
|
||||||
|
* @param request the request about to be made by the SDK
|
||||||
|
*/
|
||||||
|
void beforeRequest(Request request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is called after the response has returned
|
||||||
|
* @param request the request that was made by the SDK
|
||||||
|
* @param response the response coming back from the API the SDK has called
|
||||||
|
*/
|
||||||
|
void afterResponse(Request request, Response response);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is called when an error occurs in the SDK
|
||||||
|
* @param request the request that was made by the SDK
|
||||||
|
* @param exception The Exception thrown
|
||||||
|
*/
|
||||||
|
void onError(Request request, Exception exception);
|
||||||
|
}
|
||||||
96
src/main/java/com/plexsdk/hooks/model/Request.java
Normal file
96
src/main/java/com/plexsdk/hooks/model/Request.java
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
package com.plexsdk.hooks.model;
|
||||||
|
|
||||||
|
import com.plexsdk.http.ModelConverter;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liblab's representation of a request
|
||||||
|
*/
|
||||||
|
public class Request {
|
||||||
|
|
||||||
|
private String method;
|
||||||
|
private String url;
|
||||||
|
private String body;
|
||||||
|
private Map<String, String> headers;
|
||||||
|
|
||||||
|
public Request(String method, String url, String body, Map<String, String> headers) {
|
||||||
|
this.method = method;
|
||||||
|
this.url = url;
|
||||||
|
this.body = body;
|
||||||
|
this.headers = headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMethod() {
|
||||||
|
return method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMethod(String method) {
|
||||||
|
this.method = method;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getHeaders() {
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaders(Map<String, String> headers) {
|
||||||
|
this.headers = headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Request toHookRequest(okhttp3.Request request) {
|
||||||
|
Map<String, String> hookHeaders = request
|
||||||
|
.headers()
|
||||||
|
.toMultimap()
|
||||||
|
.entrySet()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().get(0)));
|
||||||
|
return new Request(
|
||||||
|
request.method(),
|
||||||
|
request.url().toString(),
|
||||||
|
request.body() != null ? Objects.requireNonNull(request.body()).toString() : "",
|
||||||
|
hookHeaders
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static okhttp3.Request toOkHttpRequest(Request hookRequest) {
|
||||||
|
Headers.Builder headersBuilder = new Headers.Builder();
|
||||||
|
hookRequest.getHeaders().forEach(headersBuilder::add);
|
||||||
|
|
||||||
|
if (hookRequest.getBody() != null && !hookRequest.getBody().isEmpty()) {
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(hookRequest.getBody())),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
return new okhttp3.Request.Builder()
|
||||||
|
.method(hookRequest.getMethod(), requestBody)
|
||||||
|
.headers(headersBuilder.build())
|
||||||
|
.url(hookRequest.url)
|
||||||
|
.build();
|
||||||
|
} else {
|
||||||
|
return new okhttp3.Request.Builder()
|
||||||
|
.method(hookRequest.getMethod(), null)
|
||||||
|
.headers(headersBuilder.build())
|
||||||
|
.url(hookRequest.url)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
60
src/main/java/com/plexsdk/hooks/model/Response.java
Normal file
60
src/main/java/com/plexsdk/hooks/model/Response.java
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
package com.plexsdk.hooks.model;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Liblab's representation of a response
|
||||||
|
*/
|
||||||
|
public class Response {
|
||||||
|
|
||||||
|
private int statusCode;
|
||||||
|
private String body;
|
||||||
|
private Map<String, String> headers;
|
||||||
|
|
||||||
|
public Response(int statusCode, String body, Map<String, String> headers) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
this.body = body;
|
||||||
|
this.headers = headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStatusCode() {
|
||||||
|
return statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatusCode(int statusCode) {
|
||||||
|
this.statusCode = statusCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getBody() {
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBody(String body) {
|
||||||
|
this.body = body;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getHeaders() {
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHeaders(Map<String, String> headers) {
|
||||||
|
this.headers = headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Response toHookResponse(okhttp3.Response response) {
|
||||||
|
Map<String, String> responseHeaders = response
|
||||||
|
.headers()
|
||||||
|
.toMultimap()
|
||||||
|
.entrySet()
|
||||||
|
.stream()
|
||||||
|
.collect(Collectors.toMap(Map.Entry::getKey, entry -> entry.getValue().get(0)));
|
||||||
|
|
||||||
|
return new Response(
|
||||||
|
response.code(),
|
||||||
|
response.body() != null ? Objects.requireNonNull(response.body()).toString() : null,
|
||||||
|
responseHeaders
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
10
src/main/java/com/plexsdk/http/ActivitiesClient.java
Normal file
10
src/main/java/com/plexsdk/http/ActivitiesClient.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ActivitiesClient {
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetServerActivitiesResponse> getServerActivities()
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> cancelServerActivities(String activityUUID) throws ApiException;
|
||||||
|
}
|
||||||
13
src/main/java/com/plexsdk/http/ButlerClient.java
Normal file
13
src/main/java/com/plexsdk/http/ButlerClient.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ButlerClient {
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetButlerTasksResponse> getButlerTasks()
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> startAllTasks() throws ApiException;
|
||||||
|
ResponseWithHeaders<String> stopAllTasks() throws ApiException;
|
||||||
|
ResponseWithHeaders<String> startTask(String taskName) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> stopTask(String taskName) throws ApiException;
|
||||||
|
}
|
||||||
10
src/main/java/com/plexsdk/http/HubsClient.java
Normal file
10
src/main/java/com/plexsdk/http/HubsClient.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface HubsClient {
|
||||||
|
ResponseWithHeaders<String> getGlobalHubs(Float count, Float onlyTransient) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getLibraryHubs(Float sectionId, Float count, Float onlyTransient)
|
||||||
|
throws ApiException;
|
||||||
|
}
|
||||||
23
src/main/java/com/plexsdk/http/LibraryClient.java
Normal file
23
src/main/java/com/plexsdk/http/LibraryClient.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface LibraryClient {
|
||||||
|
ResponseWithHeaders<String> getFileHash(String url, Float type) throws ApiException;
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetRecentlyAddedResponse> getRecentlyAdded()
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getLibraries() throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getLibrary(Float sectionId, Float includeDetails) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> deleteLibrary(Float sectionId) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getLibraryItems(Float sectionId, Float type, String filter)
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> refreshLibrary(Float sectionId) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getLatestLibraryItems(Float sectionId, Float type, String filter)
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getCommonLibraryItems(Float sectionId, Float type, String filter)
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getMetadata(Float ratingKey) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getMetadataChildren(Float ratingKey) throws ApiException;
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetOnDeckResponse> getOnDeck() throws ApiException;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/http/LogClient.java
Normal file
11
src/main/java/com/plexsdk/http/LogClient.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface LogClient {
|
||||||
|
ResponseWithHeaders<String> logLine(Float level, String message, String source)
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> logMultiLine() throws ApiException;
|
||||||
|
ResponseWithHeaders<String> enablePaperTrail() throws ApiException;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/http/MediaClient.java
Normal file
11
src/main/java/com/plexsdk/http/MediaClient.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface MediaClient {
|
||||||
|
ResponseWithHeaders<String> markPlayed(Float key) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> markUnplayed(Float key) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> updatePlayProgress(String key, Float time, String state)
|
||||||
|
throws ApiException;
|
||||||
|
}
|
||||||
74
src/main/java/com/plexsdk/http/ModelConverter.java
Normal file
74
src/main/java/com/plexsdk/http/ModelConverter.java
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import okhttp3.Response;
|
||||||
|
import okhttp3.ResponseBody;
|
||||||
|
|
||||||
|
public final class ModelConverter {
|
||||||
|
|
||||||
|
private static final ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
static {
|
||||||
|
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||||
|
mapper.configure(DeserializationFeature.FAIL_ON_INVALID_SUBTYPE, false);
|
||||||
|
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
|
||||||
|
mapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
|
||||||
|
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||||
|
mapper.enable(DeserializationFeature.READ_ENUMS_USING_TO_STRING);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ModelConverter() {}
|
||||||
|
|
||||||
|
public static <T> T convert(final Response response, final Class<T> clazz) {
|
||||||
|
final ResponseBody body = response.body();
|
||||||
|
try {
|
||||||
|
return mapper.readValue(body.string(), clazz);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T convert(final String response, final Class<T> clazz) {
|
||||||
|
try {
|
||||||
|
return mapper.readValue(response, clazz);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T convert(Response response, TypeReference<T> typeReference) {
|
||||||
|
try {
|
||||||
|
return convert(response.body().string(), typeReference);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static <T> T convert(String response, TypeReference<T> typeReference) {
|
||||||
|
try {
|
||||||
|
return mapper.readValue(response, typeReference);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String modelToJson(final Object model) {
|
||||||
|
try {
|
||||||
|
return mapper.writeValueAsString(model);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
23
src/main/java/com/plexsdk/http/PlaylistsClient.java
Normal file
23
src/main/java/com/plexsdk/http/PlaylistsClient.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface PlaylistsClient {
|
||||||
|
ResponseWithHeaders<String> createPlaylist(
|
||||||
|
String title,
|
||||||
|
String type,
|
||||||
|
Float smart,
|
||||||
|
String uri,
|
||||||
|
Float playQueueID
|
||||||
|
) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getPlaylists(String playlistType, Float smart) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getPlaylist(Float playlistID) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> updatePlaylist(Float playlistID) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> deletePlaylist(Float playlistID) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getPlaylistContents(Float playlistID, Float type) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> addPlaylistContents(Float playlistID, String uri, Float playQueueID)
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> clearPlaylistContents(Float playlistID) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> uploadPlaylist(String path, Float force) throws ApiException;
|
||||||
|
}
|
||||||
22
src/main/java/com/plexsdk/http/ResponseWithHeaders.java
Normal file
22
src/main/java/com/plexsdk/http/ResponseWithHeaders.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import okhttp3.Headers;
|
||||||
|
|
||||||
|
public class ResponseWithHeaders<T> {
|
||||||
|
|
||||||
|
private T data;
|
||||||
|
private Headers headers;
|
||||||
|
|
||||||
|
public ResponseWithHeaders(T data, Headers headers) {
|
||||||
|
this.data = data;
|
||||||
|
this.headers = headers;
|
||||||
|
}
|
||||||
|
|
||||||
|
public T getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Headers getHeaders() {
|
||||||
|
return headers;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/main/java/com/plexsdk/http/SearchClient.java
Normal file
13
src/main/java/com/plexsdk/http/SearchClient.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SearchClient {
|
||||||
|
ResponseWithHeaders<String> performSearch(String query, Float sectionId, Float limit)
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> performVoiceSearch(String query, Float sectionId, Float limit)
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetSearchResultsResponse> getSearchResults(String query)
|
||||||
|
throws ApiException;
|
||||||
|
}
|
||||||
9
src/main/java/com/plexsdk/http/SecurityClient.java
Normal file
9
src/main/java/com/plexsdk/http/SecurityClient.java
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SecurityClient {
|
||||||
|
ResponseWithHeaders<String> getTransientToken(String type, String scope) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getSourceConnectionInformation(String source) throws ApiException;
|
||||||
|
}
|
||||||
28
src/main/java/com/plexsdk/http/ServerClient.java
Normal file
28
src/main/java/com/plexsdk/http/ServerClient.java
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface ServerClient {
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetServerCapabilitiesResponse> getServerCapabilities()
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getServerPreferences() throws ApiException;
|
||||||
|
ResponseWithHeaders<
|
||||||
|
java.util.List<com.plexsdk.models.GetAvailableClientsResponse>
|
||||||
|
> getAvailableClients() throws ApiException;
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetDevicesResponse> getDevices() throws ApiException;
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetServerIdentityResponse> getServerIdentity()
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetMyPlexAccountResponse> getMyPlexAccount()
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getResizedPhoto(
|
||||||
|
Float width,
|
||||||
|
Float height,
|
||||||
|
Integer opacity,
|
||||||
|
Float blur,
|
||||||
|
Float minSize,
|
||||||
|
Float upscale,
|
||||||
|
String url
|
||||||
|
) throws ApiException;
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetServerListResponse> getServerList() throws ApiException;
|
||||||
|
}
|
||||||
12
src/main/java/com/plexsdk/http/SessionsClient.java
Normal file
12
src/main/java/com/plexsdk/http/SessionsClient.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface SessionsClient {
|
||||||
|
ResponseWithHeaders<String> getSessions() throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getSessionHistory() throws ApiException;
|
||||||
|
ResponseWithHeaders<com.plexsdk.models.GetTranscodeSessionsResponse> getTranscodeSessions()
|
||||||
|
throws ApiException;
|
||||||
|
ResponseWithHeaders<String> stopTranscodeSession(String sessionKey) throws ApiException;
|
||||||
|
}
|
||||||
10
src/main/java/com/plexsdk/http/UpdaterClient.java
Normal file
10
src/main/java/com/plexsdk/http/UpdaterClient.java
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface UpdaterClient {
|
||||||
|
ResponseWithHeaders<String> getUpdateStatus() throws ApiException;
|
||||||
|
ResponseWithHeaders<String> checkForUpdates(String download) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> applyUpdates(String tonight, String skip) throws ApiException;
|
||||||
|
}
|
||||||
37
src/main/java/com/plexsdk/http/VideoClient.java
Normal file
37
src/main/java/com/plexsdk/http/VideoClient.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface VideoClient {
|
||||||
|
ResponseWithHeaders<String> startUniversalTranscode(
|
||||||
|
Float hasMDE,
|
||||||
|
String path,
|
||||||
|
Float mediaIndex,
|
||||||
|
Float partIndex,
|
||||||
|
String protocol,
|
||||||
|
Float fastSeek,
|
||||||
|
Float directPlay,
|
||||||
|
Float directStream,
|
||||||
|
Float subtitleSize,
|
||||||
|
String subtites,
|
||||||
|
Float audioBoost,
|
||||||
|
String location,
|
||||||
|
Float mediaBufferSize,
|
||||||
|
String session,
|
||||||
|
Float addDebugOverlay,
|
||||||
|
Float autoAdjustQuality
|
||||||
|
) throws ApiException;
|
||||||
|
ResponseWithHeaders<String> getTimeline(
|
||||||
|
Float ratingKey,
|
||||||
|
String key,
|
||||||
|
String state,
|
||||||
|
Float hasMDE,
|
||||||
|
Float time,
|
||||||
|
Float duration,
|
||||||
|
String context,
|
||||||
|
Float playQueueItemID,
|
||||||
|
Float playBackTime,
|
||||||
|
Float row
|
||||||
|
) throws ApiException;
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.plexsdk.http.interceptors;
|
||||||
|
|
||||||
|
import com.plexsdk.Configuration;
|
||||||
|
import java.io.IOException;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class ApiKeyInterceptor implements Interceptor {
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String apiKey;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private String apiKeyHeader;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response intercept(Chain chain) throws IOException {
|
||||||
|
return chain.proceed(addApiKeyToRequest(chain.request()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Request addApiKeyToRequest(Request request) {
|
||||||
|
return this.apiKey != null && !this.apiKey.isEmpty()
|
||||||
|
? request.newBuilder().addHeader(resolveHeader(), this.apiKey).build()
|
||||||
|
: request;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String resolveHeader() {
|
||||||
|
return this.apiKeyHeader != null && !this.apiKeyHeader.isEmpty()
|
||||||
|
? this.apiKeyHeader
|
||||||
|
: Configuration.DEFAULT_API_KEY_HEADER;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.plexsdk.http.interceptors;
|
||||||
|
|
||||||
|
import com.plexsdk.Configuration;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Request.Builder;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class DefaultHeadersInterceptor implements Interceptor {
|
||||||
|
|
||||||
|
private final Map<String, String> defaultHeaders = new HashMap<>();
|
||||||
|
|
||||||
|
public DefaultHeadersInterceptor() {
|
||||||
|
defaultHeaders.put("User-Agent", Configuration.USER_AGENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response intercept(Chain chain) throws IOException {
|
||||||
|
return chain.proceed(addDefaultHeadersToRequest(chain.request()));
|
||||||
|
}
|
||||||
|
|
||||||
|
private Request addDefaultHeadersToRequest(Request request) {
|
||||||
|
if (defaultHeaders.isEmpty()) {
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
Builder requestBuilder = request.newBuilder();
|
||||||
|
|
||||||
|
defaultHeaders.forEach(requestBuilder::addHeader);
|
||||||
|
|
||||||
|
return requestBuilder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.plexsdk.http.interceptors;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.stream.IntStream;
|
||||||
|
import okhttp3.Interceptor;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class RetryInterceptor implements Interceptor {
|
||||||
|
|
||||||
|
private static final int MAX_RETRIES = 3;
|
||||||
|
private static final double RETRY_DELAY = 150;
|
||||||
|
private static final int[] RETRYABLE_CODES = { 500, 503, 504 };
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response intercept(Chain chain) throws IOException {
|
||||||
|
// Try the request and if it fails use exponential backoff to retry
|
||||||
|
Request request = chain.request();
|
||||||
|
Response response = chain.proceed(request);
|
||||||
|
int tryCount = 1;
|
||||||
|
while (!response.isSuccessful() && isRetryable(response) && tryCount - 1 < MAX_RETRIES) {
|
||||||
|
try {
|
||||||
|
Thread.sleep((long) Math.pow(RETRY_DELAY, tryCount - 1));
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
response.close();
|
||||||
|
response = chain.proceed(request);
|
||||||
|
tryCount++;
|
||||||
|
}
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isRetryable(Response response) {
|
||||||
|
final int statusCode = response.code();
|
||||||
|
return IntStream.of(RETRYABLE_CODES).anyMatch(x -> x == statusCode);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.plexsdk.http.util;
|
||||||
|
|
||||||
|
import static com.plexsdk.http.ModelConverter.modelToJson;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides static methods to convert values (object, array, boxed types) into string representation for http url.
|
||||||
|
* Usually used for converting objects to be http url friendly (e.g. query or header parameters)
|
||||||
|
*/
|
||||||
|
public class HttpArgumentConverter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts any value (object, array, primitive) into a string representation.
|
||||||
|
*
|
||||||
|
* @param value The value (object, array or primitive) to be converted.
|
||||||
|
* @return A string representation of the input value in a format that can be used as url query or header parameter value.
|
||||||
|
*/
|
||||||
|
public static String toStringArgument(final Object value) {
|
||||||
|
if (value == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (
|
||||||
|
value instanceof String ||
|
||||||
|
value instanceof Number ||
|
||||||
|
value instanceof Boolean ||
|
||||||
|
value instanceof Enum<?>
|
||||||
|
) {
|
||||||
|
return String.valueOf(value);
|
||||||
|
}
|
||||||
|
if (value instanceof List<?>) {
|
||||||
|
List<?> list = (List<?>) value;
|
||||||
|
return list
|
||||||
|
.stream()
|
||||||
|
.map(HttpArgumentConverter::toStringArgument)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
}
|
||||||
|
|
||||||
|
return modelToJson(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
83
src/main/java/com/plexsdk/http/util/HttpHeaders.java
Normal file
83
src/main/java/com/plexsdk/http/util/HttpHeaders.java
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package com.plexsdk.http.util;
|
||||||
|
|
||||||
|
import static com.plexsdk.http.util.HttpArgumentConverter.toStringArgument;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ArgumentCannotBeNullException;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* HttpHeaders represents a utility class for building HTTP headers.
|
||||||
|
*/
|
||||||
|
public class HttpHeaders {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private constructor to prevent direct instantiation of the class.
|
||||||
|
*/
|
||||||
|
private HttpHeaders() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of the HttpHeaders.Builder.
|
||||||
|
*
|
||||||
|
* @return A new instance of HttpHeaders.Builder.
|
||||||
|
*/
|
||||||
|
public static Builder builder() {
|
||||||
|
return new Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builder class for constructing HTTP headers.
|
||||||
|
*/
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private final Headers.Builder headersBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new instance of the Builder.
|
||||||
|
*/
|
||||||
|
private Builder() {
|
||||||
|
this.headersBuilder = new Headers.Builder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a required header with the specified name and value to the headers' builder.
|
||||||
|
*
|
||||||
|
* @param name The name of the header.
|
||||||
|
* @param value The value of the header.
|
||||||
|
* @return The current Builder instance.
|
||||||
|
* @throws ArgumentCannotBeNullException If the value is null.
|
||||||
|
*/
|
||||||
|
public Builder addRequiredHeader(String name, Object value)
|
||||||
|
throws ArgumentCannotBeNullException {
|
||||||
|
if (value == null) {
|
||||||
|
throw new ArgumentCannotBeNullException(name);
|
||||||
|
}
|
||||||
|
this.headersBuilder.add(name, toStringArgument(value));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an optional header with the specified name and value to the headers' builder.
|
||||||
|
*
|
||||||
|
* @param name The name of the header.
|
||||||
|
* @param value The value of the header.
|
||||||
|
* @return The current Builder instance.
|
||||||
|
*/
|
||||||
|
public Builder addOptionalHeader(String name, Object value) {
|
||||||
|
if (value != null) {
|
||||||
|
this.headersBuilder.add(name, toStringArgument(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the headers using the configured values in the builder.
|
||||||
|
*
|
||||||
|
* @return The constructed Headers object.
|
||||||
|
*/
|
||||||
|
public Headers build() {
|
||||||
|
return this.headersBuilder.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
102
src/main/java/com/plexsdk/http/util/HttpUrl.java
Normal file
102
src/main/java/com/plexsdk/http/util/HttpUrl.java
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
package com.plexsdk.http.util;
|
||||||
|
|
||||||
|
import static com.plexsdk.http.util.HttpArgumentConverter.toStringArgument;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ArgumentCannotBeNullException;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The HttpUrl class provides a convenient way to construct HTTP URLs with query parameters and path parameters.
|
||||||
|
*/
|
||||||
|
public class HttpUrl {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Private constructor to prevent direct instantiation of the class.
|
||||||
|
*/
|
||||||
|
private HttpUrl() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new instance of the Builder class to start constructing an HTTP URL.
|
||||||
|
*
|
||||||
|
* @param url The base URL for the HTTP request.
|
||||||
|
* @return A new instance of the Builder class.
|
||||||
|
*/
|
||||||
|
public static Builder builder(String url) {
|
||||||
|
return new Builder(url);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Builder class provides methods to add query parameters and path parameters to an HTTP URL.
|
||||||
|
*/
|
||||||
|
public static class Builder {
|
||||||
|
|
||||||
|
private final okhttp3.HttpUrl.Builder httpUrlBuilder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new Builder instance with the specified base URL.
|
||||||
|
*
|
||||||
|
* @param url The base URL for the HTTP request.
|
||||||
|
*/
|
||||||
|
private Builder(String url) {
|
||||||
|
this.httpUrlBuilder = Objects.requireNonNull(okhttp3.HttpUrl.parse(url)).newBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a required query parameter to the HTTP URL.
|
||||||
|
*
|
||||||
|
* @param name The name of the query parameter.
|
||||||
|
* @param value The value of the query parameter.
|
||||||
|
* @return The Builder instance.
|
||||||
|
* @throws ArgumentCannotBeNullException If the value is null.
|
||||||
|
*/
|
||||||
|
public Builder addRequiredQueryParameter(String name, Object value)
|
||||||
|
throws ArgumentCannotBeNullException {
|
||||||
|
if (value == null) {
|
||||||
|
throw new ArgumentCannotBeNullException(name);
|
||||||
|
}
|
||||||
|
this.httpUrlBuilder.addQueryParameter(name, toStringArgument(value));
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an optional query parameter to the HTTP URL.
|
||||||
|
*
|
||||||
|
* @param name The name of the query parameter.
|
||||||
|
* @param value The value of the query parameter.
|
||||||
|
* @return The Builder instance.
|
||||||
|
*/
|
||||||
|
public Builder addOptionalQueryParameter(String name, Object value) {
|
||||||
|
if (value != null) {
|
||||||
|
this.httpUrlBuilder.addQueryParameter(name, toStringArgument(value));
|
||||||
|
}
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a path parameter to the HTTP URL.
|
||||||
|
*
|
||||||
|
* @param value The value of the path parameter.
|
||||||
|
* @return The Builder instance.
|
||||||
|
* @throws ArgumentCannotBeNullException If the value is null.
|
||||||
|
*/
|
||||||
|
public Builder addPathParameter(String value) throws ArgumentCannotBeNullException {
|
||||||
|
if (value == null || value.isEmpty()) {
|
||||||
|
throw new ArgumentCannotBeNullException();
|
||||||
|
}
|
||||||
|
this.httpUrlBuilder.addPathSegment(value);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds the final HTTP URL.
|
||||||
|
*
|
||||||
|
* @return The constructed HTTP URL as a string.
|
||||||
|
*/
|
||||||
|
public String build() {
|
||||||
|
return this.httpUrlBuilder.build().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
77
src/main/java/com/plexsdk/models/BaseModel.java
Normal file
77
src/main/java/com/plexsdk/models/BaseModel.java
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import com.plexsdk.http.ModelConverter;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
public abstract class BaseModel {
|
||||||
|
|
||||||
|
public abstract static class Builder {
|
||||||
|
|
||||||
|
protected static enum ValidationType {
|
||||||
|
ALL_OF,
|
||||||
|
ANY_OF,
|
||||||
|
ONE_OF,
|
||||||
|
NONE,
|
||||||
|
}
|
||||||
|
|
||||||
|
private final ValidationType _validationType;
|
||||||
|
|
||||||
|
protected Builder(ValidationType validationType) {
|
||||||
|
this._validationType = validationType;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected abstract Set<String> getNonNullInstanceFieldNames();
|
||||||
|
|
||||||
|
protected abstract Set<Set<String>> getRequiredFieldsGroups();
|
||||||
|
|
||||||
|
protected boolean isValidAllOf() {
|
||||||
|
// Check if all of the required field groups are a subset of the non-null, non-static fields.
|
||||||
|
return getNonNullInstanceFieldNames()
|
||||||
|
.containsAll(
|
||||||
|
getRequiredFieldsGroups().stream().flatMap(Collection::stream).collect(Collectors.toSet())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isValidAnyOf() {
|
||||||
|
// Check if any of the required field groups are a subset of the non-null, non-static fields.
|
||||||
|
return getRequiredFieldsGroups()
|
||||||
|
.stream()
|
||||||
|
.anyMatch(group -> getNonNullInstanceFieldNames().containsAll(group));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isValidOneOf() {
|
||||||
|
// Check if the set of non-null fields match one of the required field groups.
|
||||||
|
return getRequiredFieldsGroups().contains(getNonNullInstanceFieldNames());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String validate() {
|
||||||
|
if (getRequiredFieldsGroups().isEmpty()) {
|
||||||
|
// Nothing to validate since there are no required fields groups.
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (this._validationType) {
|
||||||
|
case ALL_OF:
|
||||||
|
return !isValidAllOf() ? "Object fails AllOf validation." : null;
|
||||||
|
case ANY_OF:
|
||||||
|
return !isValidAnyOf() ? "Object fails AnyOf validation." : null;
|
||||||
|
case ONE_OF:
|
||||||
|
return !isValidOneOf() ? "Object fails OneOf validation." : null;
|
||||||
|
case NONE:
|
||||||
|
default:
|
||||||
|
return !isValidOneOf() ? "Object fails required fields validation." : null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BaseModel() {}
|
||||||
|
|
||||||
|
protected BaseModel(Builder builder) {}
|
||||||
|
|
||||||
|
public String toJson() {
|
||||||
|
return ModelConverter.modelToJson(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/Download.java
Normal file
11
src/main/java/com/plexsdk/models/Download.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Download {
|
||||||
|
V1("1");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/Force.java
Normal file
11
src/main/java/com/plexsdk/models/Force.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Force {
|
||||||
|
V1(1);
|
||||||
|
|
||||||
|
public final Float label;
|
||||||
|
}
|
||||||
332
src/main/java/com/plexsdk/models/GetButlerTasksResponse.java
Normal file
332
src/main/java/com/plexsdk/models/GetButlerTasksResponse.java
Normal file
@@ -0,0 +1,332 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetButlerTasksResponse.Builder.class
|
||||||
|
)
|
||||||
|
public class GetButlerTasksResponse extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetButlerTasksResponse.ButlerTasks.Builder.class
|
||||||
|
)
|
||||||
|
public static class ButlerTasks extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetButlerTasksResponse.ButlerTasks.ButlerTask.Builder.class
|
||||||
|
)
|
||||||
|
public static class ButlerTask extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("description")
|
||||||
|
private java.lang.String description;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("enabled")
|
||||||
|
private java.lang.Boolean enabled;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("interval")
|
||||||
|
private java.lang.Double interval;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("name")
|
||||||
|
private java.lang.String name;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("scheduleRandomized")
|
||||||
|
private java.lang.Boolean scheduleRandomized;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("title")
|
||||||
|
private java.lang.String title;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetButlerTasksResponse.ButlerTasks.ButlerTask build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetButlerTasksResponse.ButlerTasks.ButlerTask buildWithoutValidation() {
|
||||||
|
return new GetButlerTasksResponse.ButlerTasks.ButlerTask(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("description")
|
||||||
|
private final java.lang.String description;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("enabled")
|
||||||
|
private final java.lang.Boolean enabled;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("interval")
|
||||||
|
private final java.lang.Double interval;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("name")
|
||||||
|
private final java.lang.String name;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("scheduleRandomized")
|
||||||
|
private final java.lang.Boolean scheduleRandomized;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("title")
|
||||||
|
private final java.lang.String title;
|
||||||
|
|
||||||
|
ButlerTask(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.description = builder.getDescription();
|
||||||
|
this.enabled = builder.getEnabled();
|
||||||
|
this.interval = builder.getInterval();
|
||||||
|
this.name = builder.getName();
|
||||||
|
this.scheduleRandomized = builder.getScheduleRandomized();
|
||||||
|
this.title = builder.getTitle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("ButlerTask")
|
||||||
|
private java.util.List<GetButlerTasksResponse.ButlerTasks.ButlerTask> butlerTask;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetButlerTasksResponse.ButlerTasks build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetButlerTasksResponse.ButlerTasks buildWithoutValidation() {
|
||||||
|
return new GetButlerTasksResponse.ButlerTasks(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("ButlerTask")
|
||||||
|
private final java.util.List<GetButlerTasksResponse.ButlerTasks.ButlerTask> butlerTask;
|
||||||
|
|
||||||
|
ButlerTasks(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.butlerTask = builder.getButlerTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group -> java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet()))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("ButlerTasks")
|
||||||
|
private GetButlerTasksResponse.ButlerTasks butlerTasks;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetButlerTasksResponse build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetButlerTasksResponse buildWithoutValidation() {
|
||||||
|
return new GetButlerTasksResponse(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.stream(this.getClass().getDeclaredFields())
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("ButlerTasks")
|
||||||
|
private final GetButlerTasksResponse.ButlerTasks butlerTasks;
|
||||||
|
|
||||||
|
GetButlerTasksResponse(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.butlerTasks = builder.getButlerTasks();
|
||||||
|
}
|
||||||
|
}
|
||||||
339
src/main/java/com/plexsdk/models/GetDevicesResponse.java
Normal file
339
src/main/java/com/plexsdk/models/GetDevicesResponse.java
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetDevicesResponse.Builder.class
|
||||||
|
)
|
||||||
|
public class GetDevicesResponse extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetDevicesResponse.MediaContainer.Builder.class
|
||||||
|
)
|
||||||
|
public static class MediaContainer extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetDevicesResponse.MediaContainer.Device.Builder.class
|
||||||
|
)
|
||||||
|
public static class Device extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("clientIdentifier")
|
||||||
|
private java.lang.String clientIdentifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("createdAt")
|
||||||
|
private java.lang.Double createdAt;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("id")
|
||||||
|
private java.lang.Double id;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("name")
|
||||||
|
private java.lang.String name;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("platform")
|
||||||
|
private java.lang.String platform;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetDevicesResponse.MediaContainer.Device build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetDevicesResponse.MediaContainer.Device buildWithoutValidation() {
|
||||||
|
return new GetDevicesResponse.MediaContainer.Device(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("clientIdentifier")
|
||||||
|
private final java.lang.String clientIdentifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("createdAt")
|
||||||
|
private final java.lang.Double createdAt;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("id")
|
||||||
|
private final java.lang.Double id;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("name")
|
||||||
|
private final java.lang.String name;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("platform")
|
||||||
|
private final java.lang.String platform;
|
||||||
|
|
||||||
|
Device(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.clientIdentifier = builder.getClientIdentifier();
|
||||||
|
this.createdAt = builder.getCreatedAt();
|
||||||
|
this.id = builder.getId();
|
||||||
|
this.name = builder.getName();
|
||||||
|
this.platform = builder.getPlatform();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Device")
|
||||||
|
private java.util.List<GetDevicesResponse.MediaContainer.Device> device;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("identifier")
|
||||||
|
private java.lang.String identifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private java.lang.Double size;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetDevicesResponse.MediaContainer build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetDevicesResponse.MediaContainer buildWithoutValidation() {
|
||||||
|
return new GetDevicesResponse.MediaContainer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Device")
|
||||||
|
private final java.util.List<GetDevicesResponse.MediaContainer.Device> device;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("identifier")
|
||||||
|
private final java.lang.String identifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private final java.lang.Double size;
|
||||||
|
|
||||||
|
MediaContainer(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.device = builder.getDevice();
|
||||||
|
this.identifier = builder.getIdentifier();
|
||||||
|
this.size = builder.getSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group -> java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet()))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private GetDevicesResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetDevicesResponse build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetDevicesResponse buildWithoutValidation() {
|
||||||
|
return new GetDevicesResponse(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.stream(this.getClass().getDeclaredFields())
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private final GetDevicesResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
GetDevicesResponse(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.mediaContainer = builder.getMediaContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
274
src/main/java/com/plexsdk/models/GetMyPlexAccountResponse.java
Normal file
274
src/main/java/com/plexsdk/models/GetMyPlexAccountResponse.java
Normal file
@@ -0,0 +1,274 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetMyPlexAccountResponse.Builder.class
|
||||||
|
)
|
||||||
|
public class GetMyPlexAccountResponse extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetMyPlexAccountResponse.MyPlex.Builder.class
|
||||||
|
)
|
||||||
|
public static class MyPlex extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("authToken")
|
||||||
|
private java.lang.String authToken;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("mappingError")
|
||||||
|
private java.lang.String mappingError;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("mappingState")
|
||||||
|
private java.lang.String mappingState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("privateAddress")
|
||||||
|
private java.lang.String privateAddress;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("privatePort")
|
||||||
|
private java.lang.Double privatePort;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("publicAddress")
|
||||||
|
private java.lang.String publicAddress;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("publicPort")
|
||||||
|
private java.lang.Double publicPort;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("signInState")
|
||||||
|
private java.lang.String signInState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("subscriptionActive")
|
||||||
|
private java.lang.Boolean subscriptionActive;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("subscriptionFeatures")
|
||||||
|
private java.lang.String subscriptionFeatures;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("subscriptionState")
|
||||||
|
private java.lang.String subscriptionState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("username")
|
||||||
|
private java.lang.String username;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetMyPlexAccountResponse.MyPlex build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetMyPlexAccountResponse.MyPlex buildWithoutValidation() {
|
||||||
|
return new GetMyPlexAccountResponse.MyPlex(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("authToken")
|
||||||
|
private final java.lang.String authToken;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("mappingError")
|
||||||
|
private final java.lang.String mappingError;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("mappingState")
|
||||||
|
private final java.lang.String mappingState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("privateAddress")
|
||||||
|
private final java.lang.String privateAddress;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("privatePort")
|
||||||
|
private final java.lang.Double privatePort;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("publicAddress")
|
||||||
|
private final java.lang.String publicAddress;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("publicPort")
|
||||||
|
private final java.lang.Double publicPort;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("signInState")
|
||||||
|
private final java.lang.String signInState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("subscriptionActive")
|
||||||
|
private final java.lang.Boolean subscriptionActive;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("subscriptionFeatures")
|
||||||
|
private final java.lang.String subscriptionFeatures;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("subscriptionState")
|
||||||
|
private final java.lang.String subscriptionState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("username")
|
||||||
|
private final java.lang.String username;
|
||||||
|
|
||||||
|
MyPlex(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.authToken = builder.getAuthToken();
|
||||||
|
this.mappingError = builder.getMappingError();
|
||||||
|
this.mappingState = builder.getMappingState();
|
||||||
|
this.privateAddress = builder.getPrivateAddress();
|
||||||
|
this.privatePort = builder.getPrivatePort();
|
||||||
|
this.publicAddress = builder.getPublicAddress();
|
||||||
|
this.publicPort = builder.getPublicPort();
|
||||||
|
this.signInState = builder.getSignInState();
|
||||||
|
this.subscriptionActive = builder.getSubscriptionActive();
|
||||||
|
this.subscriptionFeatures = builder.getSubscriptionFeatures();
|
||||||
|
this.subscriptionState = builder.getSubscriptionState();
|
||||||
|
this.username = builder.getUsername();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group -> java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet()))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MyPlex")
|
||||||
|
private GetMyPlexAccountResponse.MyPlex myPlex;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetMyPlexAccountResponse build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetMyPlexAccountResponse buildWithoutValidation() {
|
||||||
|
return new GetMyPlexAccountResponse(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.stream(this.getClass().getDeclaredFields())
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MyPlex")
|
||||||
|
private final GetMyPlexAccountResponse.MyPlex myPlex;
|
||||||
|
|
||||||
|
GetMyPlexAccountResponse(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.myPlex = builder.getMyPlex();
|
||||||
|
}
|
||||||
|
}
|
||||||
1289
src/main/java/com/plexsdk/models/GetOnDeckResponse.java
Normal file
1289
src/main/java/com/plexsdk/models/GetOnDeckResponse.java
Normal file
File diff suppressed because it is too large
Load Diff
1430
src/main/java/com/plexsdk/models/GetRecentlyAddedResponse.java
Normal file
1430
src/main/java/com/plexsdk/models/GetRecentlyAddedResponse.java
Normal file
File diff suppressed because it is too large
Load Diff
1530
src/main/java/com/plexsdk/models/GetSearchResultsResponse.java
Normal file
1530
src/main/java/com/plexsdk/models/GetSearchResultsResponse.java
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,453 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerActivitiesResponse.Builder.class
|
||||||
|
)
|
||||||
|
public class GetServerActivitiesResponse extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerActivitiesResponse.MediaContainer.Builder.class
|
||||||
|
)
|
||||||
|
public static class MediaContainer extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerActivitiesResponse.MediaContainer.Activity.Builder.class
|
||||||
|
)
|
||||||
|
public static class Activity extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerActivitiesResponse.MediaContainer.Activity.Context.Builder.class
|
||||||
|
)
|
||||||
|
public static class Context extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("librarySectionID")
|
||||||
|
private java.lang.String librarySectionId;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerActivitiesResponse.MediaContainer.Activity.Context build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerActivitiesResponse.MediaContainer.Activity.Context buildWithoutValidation() {
|
||||||
|
return new GetServerActivitiesResponse.MediaContainer.Activity.Context(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("librarySectionID")
|
||||||
|
private final java.lang.String librarySectionId;
|
||||||
|
|
||||||
|
Context(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.librarySectionId = builder.getLibrarySectionId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("cancellable")
|
||||||
|
private java.lang.Boolean cancellable;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Context")
|
||||||
|
private GetServerActivitiesResponse.MediaContainer.Activity.Context context;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("progress")
|
||||||
|
private java.lang.Double progress;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("subtitle")
|
||||||
|
private java.lang.String subtitle;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("title")
|
||||||
|
private java.lang.String title;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("type")
|
||||||
|
private java.lang.String type;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("userID")
|
||||||
|
private java.lang.Double userId;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("uuid")
|
||||||
|
private java.lang.String uuid;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerActivitiesResponse.MediaContainer.Activity build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerActivitiesResponse.MediaContainer.Activity buildWithoutValidation() {
|
||||||
|
return new GetServerActivitiesResponse.MediaContainer.Activity(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("cancellable")
|
||||||
|
private final java.lang.Boolean cancellable;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Context")
|
||||||
|
private final GetServerActivitiesResponse.MediaContainer.Activity.Context context;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("progress")
|
||||||
|
private final java.lang.Double progress;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("subtitle")
|
||||||
|
private final java.lang.String subtitle;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("title")
|
||||||
|
private final java.lang.String title;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("type")
|
||||||
|
private final java.lang.String type;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("userID")
|
||||||
|
private final java.lang.Double userId;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("uuid")
|
||||||
|
private final java.lang.String uuid;
|
||||||
|
|
||||||
|
Activity(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.cancellable = builder.getCancellable();
|
||||||
|
this.context = builder.getContext();
|
||||||
|
this.progress = builder.getProgress();
|
||||||
|
this.subtitle = builder.getSubtitle();
|
||||||
|
this.title = builder.getTitle();
|
||||||
|
this.type = builder.getType();
|
||||||
|
this.userId = builder.getUserId();
|
||||||
|
this.uuid = builder.getUuid();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Activity")
|
||||||
|
private java.util.List<GetServerActivitiesResponse.MediaContainer.Activity> activity;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private java.lang.Double size;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerActivitiesResponse.MediaContainer build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerActivitiesResponse.MediaContainer buildWithoutValidation() {
|
||||||
|
return new GetServerActivitiesResponse.MediaContainer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Activity")
|
||||||
|
private final java.util.List<GetServerActivitiesResponse.MediaContainer.Activity> activity;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private final java.lang.Double size;
|
||||||
|
|
||||||
|
MediaContainer(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.activity = builder.getActivity();
|
||||||
|
this.size = builder.getSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group -> java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet()))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private GetServerActivitiesResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerActivitiesResponse build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerActivitiesResponse buildWithoutValidation() {
|
||||||
|
return new GetServerActivitiesResponse(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.stream(this.getClass().getDeclaredFields())
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private final GetServerActivitiesResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
GetServerActivitiesResponse(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.mediaContainer = builder.getMediaContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,661 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerCapabilitiesResponse.Builder.class
|
||||||
|
)
|
||||||
|
public class GetServerCapabilitiesResponse extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerCapabilitiesResponse.MediaContainer.Builder.class
|
||||||
|
)
|
||||||
|
public static class MediaContainer extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerCapabilitiesResponse.MediaContainer.Directory.Builder.class
|
||||||
|
)
|
||||||
|
public static class Directory extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("count")
|
||||||
|
private java.lang.Double count;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("key")
|
||||||
|
private java.lang.String key;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("title")
|
||||||
|
private java.lang.String title;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerCapabilitiesResponse.MediaContainer.Directory build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerCapabilitiesResponse.MediaContainer.Directory buildWithoutValidation() {
|
||||||
|
return new GetServerCapabilitiesResponse.MediaContainer.Directory(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("count")
|
||||||
|
private final java.lang.Double count;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("key")
|
||||||
|
private final java.lang.String key;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("title")
|
||||||
|
private final java.lang.String title;
|
||||||
|
|
||||||
|
Directory(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.count = builder.getCount();
|
||||||
|
this.key = builder.getKey();
|
||||||
|
this.title = builder.getTitle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowCameraUpload")
|
||||||
|
private java.lang.Boolean allowCameraUpload;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowChannelAccess")
|
||||||
|
private java.lang.Boolean allowChannelAccess;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowMediaDeletion")
|
||||||
|
private java.lang.Boolean allowMediaDeletion;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowSharing")
|
||||||
|
private java.lang.Boolean allowSharing;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowSync")
|
||||||
|
private java.lang.Boolean allowSync;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowTuners")
|
||||||
|
private java.lang.Boolean allowTuners;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("backgroundProcessing")
|
||||||
|
private java.lang.Boolean backgroundProcessing;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("certificate")
|
||||||
|
private java.lang.Boolean certificate;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("companionProxy")
|
||||||
|
private java.lang.Boolean companionProxy;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("countryCode")
|
||||||
|
private java.lang.String countryCode;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("diagnostics")
|
||||||
|
private java.lang.String diagnostics;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Directory")
|
||||||
|
private java.util.List<GetServerCapabilitiesResponse.MediaContainer.Directory> directory;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("eventStream")
|
||||||
|
private java.lang.Boolean eventStream;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("friendlyName")
|
||||||
|
private java.lang.String friendlyName;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("hubSearch")
|
||||||
|
private java.lang.Boolean hubSearch;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("itemClusters")
|
||||||
|
private java.lang.Boolean itemClusters;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("livetv")
|
||||||
|
private java.lang.Double livetv;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("machineIdentifier")
|
||||||
|
private java.lang.String machineIdentifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("mediaProviders")
|
||||||
|
private java.lang.Boolean mediaProviders;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("multiuser")
|
||||||
|
private java.lang.Boolean multiuser;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("musicAnalysis")
|
||||||
|
private java.lang.Double musicAnalysis;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlex")
|
||||||
|
private java.lang.Boolean myPlex;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlexMappingState")
|
||||||
|
private java.lang.String myPlexMappingState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlexSigninState")
|
||||||
|
private java.lang.String myPlexSigninState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlexSubscription")
|
||||||
|
private java.lang.Boolean myPlexSubscription;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlexUsername")
|
||||||
|
private java.lang.String myPlexUsername;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("offlineTranscode")
|
||||||
|
private java.lang.Double offlineTranscode;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("ownerFeatures")
|
||||||
|
private java.lang.String ownerFeatures;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("photoAutoTag")
|
||||||
|
private java.lang.Boolean photoAutoTag;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("platform")
|
||||||
|
private java.lang.String platform;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("platformVersion")
|
||||||
|
private java.lang.String platformVersion;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("pluginHost")
|
||||||
|
private java.lang.Boolean pluginHost;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("pushNotifications")
|
||||||
|
private java.lang.Boolean pushNotifications;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("readOnlyLibraries")
|
||||||
|
private java.lang.Boolean readOnlyLibraries;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private java.lang.Double size;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("streamingBrainABRVersion")
|
||||||
|
private java.lang.Double streamingBrainAbrversion;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("streamingBrainVersion")
|
||||||
|
private java.lang.Double streamingBrainVersion;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("sync")
|
||||||
|
private java.lang.Boolean sync;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderActiveVideoSessions")
|
||||||
|
private java.lang.Double transcoderActiveVideoSessions;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderAudio")
|
||||||
|
private java.lang.Boolean transcoderAudio;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderLyrics")
|
||||||
|
private java.lang.Boolean transcoderLyrics;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderPhoto")
|
||||||
|
private java.lang.Boolean transcoderPhoto;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderSubtitles")
|
||||||
|
private java.lang.Boolean transcoderSubtitles;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderVideo")
|
||||||
|
private java.lang.Boolean transcoderVideo;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderVideoBitrates")
|
||||||
|
private java.lang.String transcoderVideoBitrates;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderVideoQualities")
|
||||||
|
private java.lang.String transcoderVideoQualities;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderVideoResolutions")
|
||||||
|
private java.lang.String transcoderVideoResolutions;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("updatedAt")
|
||||||
|
private java.lang.Double updatedAt;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("updater")
|
||||||
|
private java.lang.Boolean updater;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("version")
|
||||||
|
private java.lang.String version;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("voiceSearch")
|
||||||
|
private java.lang.Boolean voiceSearch;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerCapabilitiesResponse.MediaContainer build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerCapabilitiesResponse.MediaContainer buildWithoutValidation() {
|
||||||
|
return new GetServerCapabilitiesResponse.MediaContainer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowCameraUpload")
|
||||||
|
private final java.lang.Boolean allowCameraUpload;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowChannelAccess")
|
||||||
|
private final java.lang.Boolean allowChannelAccess;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowMediaDeletion")
|
||||||
|
private final java.lang.Boolean allowMediaDeletion;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowSharing")
|
||||||
|
private final java.lang.Boolean allowSharing;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowSync")
|
||||||
|
private final java.lang.Boolean allowSync;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("allowTuners")
|
||||||
|
private final java.lang.Boolean allowTuners;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("backgroundProcessing")
|
||||||
|
private final java.lang.Boolean backgroundProcessing;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("certificate")
|
||||||
|
private final java.lang.Boolean certificate;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("companionProxy")
|
||||||
|
private final java.lang.Boolean companionProxy;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("countryCode")
|
||||||
|
private final java.lang.String countryCode;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("diagnostics")
|
||||||
|
private final java.lang.String diagnostics;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Directory")
|
||||||
|
private final java.util.List<GetServerCapabilitiesResponse.MediaContainer.Directory> directory;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("eventStream")
|
||||||
|
private final java.lang.Boolean eventStream;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("friendlyName")
|
||||||
|
private final java.lang.String friendlyName;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("hubSearch")
|
||||||
|
private final java.lang.Boolean hubSearch;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("itemClusters")
|
||||||
|
private final java.lang.Boolean itemClusters;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("livetv")
|
||||||
|
private final java.lang.Double livetv;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("machineIdentifier")
|
||||||
|
private final java.lang.String machineIdentifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("mediaProviders")
|
||||||
|
private final java.lang.Boolean mediaProviders;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("multiuser")
|
||||||
|
private final java.lang.Boolean multiuser;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("musicAnalysis")
|
||||||
|
private final java.lang.Double musicAnalysis;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlex")
|
||||||
|
private final java.lang.Boolean myPlex;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlexMappingState")
|
||||||
|
private final java.lang.String myPlexMappingState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlexSigninState")
|
||||||
|
private final java.lang.String myPlexSigninState;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlexSubscription")
|
||||||
|
private final java.lang.Boolean myPlexSubscription;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("myPlexUsername")
|
||||||
|
private final java.lang.String myPlexUsername;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("offlineTranscode")
|
||||||
|
private final java.lang.Double offlineTranscode;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("ownerFeatures")
|
||||||
|
private final java.lang.String ownerFeatures;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("photoAutoTag")
|
||||||
|
private final java.lang.Boolean photoAutoTag;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("platform")
|
||||||
|
private final java.lang.String platform;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("platformVersion")
|
||||||
|
private final java.lang.String platformVersion;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("pluginHost")
|
||||||
|
private final java.lang.Boolean pluginHost;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("pushNotifications")
|
||||||
|
private final java.lang.Boolean pushNotifications;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("readOnlyLibraries")
|
||||||
|
private final java.lang.Boolean readOnlyLibraries;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private final java.lang.Double size;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("streamingBrainABRVersion")
|
||||||
|
private final java.lang.Double streamingBrainAbrversion;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("streamingBrainVersion")
|
||||||
|
private final java.lang.Double streamingBrainVersion;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("sync")
|
||||||
|
private final java.lang.Boolean sync;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderActiveVideoSessions")
|
||||||
|
private final java.lang.Double transcoderActiveVideoSessions;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderAudio")
|
||||||
|
private final java.lang.Boolean transcoderAudio;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderLyrics")
|
||||||
|
private final java.lang.Boolean transcoderLyrics;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderPhoto")
|
||||||
|
private final java.lang.Boolean transcoderPhoto;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderSubtitles")
|
||||||
|
private final java.lang.Boolean transcoderSubtitles;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderVideo")
|
||||||
|
private final java.lang.Boolean transcoderVideo;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderVideoBitrates")
|
||||||
|
private final java.lang.String transcoderVideoBitrates;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderVideoQualities")
|
||||||
|
private final java.lang.String transcoderVideoQualities;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcoderVideoResolutions")
|
||||||
|
private final java.lang.String transcoderVideoResolutions;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("updatedAt")
|
||||||
|
private final java.lang.Double updatedAt;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("updater")
|
||||||
|
private final java.lang.Boolean updater;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("version")
|
||||||
|
private final java.lang.String version;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("voiceSearch")
|
||||||
|
private final java.lang.Boolean voiceSearch;
|
||||||
|
|
||||||
|
MediaContainer(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.allowCameraUpload = builder.getAllowCameraUpload();
|
||||||
|
this.allowChannelAccess = builder.getAllowChannelAccess();
|
||||||
|
this.allowMediaDeletion = builder.getAllowMediaDeletion();
|
||||||
|
this.allowSharing = builder.getAllowSharing();
|
||||||
|
this.allowSync = builder.getAllowSync();
|
||||||
|
this.allowTuners = builder.getAllowTuners();
|
||||||
|
this.backgroundProcessing = builder.getBackgroundProcessing();
|
||||||
|
this.certificate = builder.getCertificate();
|
||||||
|
this.companionProxy = builder.getCompanionProxy();
|
||||||
|
this.countryCode = builder.getCountryCode();
|
||||||
|
this.diagnostics = builder.getDiagnostics();
|
||||||
|
this.directory = builder.getDirectory();
|
||||||
|
this.eventStream = builder.getEventStream();
|
||||||
|
this.friendlyName = builder.getFriendlyName();
|
||||||
|
this.hubSearch = builder.getHubSearch();
|
||||||
|
this.itemClusters = builder.getItemClusters();
|
||||||
|
this.livetv = builder.getLivetv();
|
||||||
|
this.machineIdentifier = builder.getMachineIdentifier();
|
||||||
|
this.mediaProviders = builder.getMediaProviders();
|
||||||
|
this.multiuser = builder.getMultiuser();
|
||||||
|
this.musicAnalysis = builder.getMusicAnalysis();
|
||||||
|
this.myPlex = builder.getMyPlex();
|
||||||
|
this.myPlexMappingState = builder.getMyPlexMappingState();
|
||||||
|
this.myPlexSigninState = builder.getMyPlexSigninState();
|
||||||
|
this.myPlexSubscription = builder.getMyPlexSubscription();
|
||||||
|
this.myPlexUsername = builder.getMyPlexUsername();
|
||||||
|
this.offlineTranscode = builder.getOfflineTranscode();
|
||||||
|
this.ownerFeatures = builder.getOwnerFeatures();
|
||||||
|
this.photoAutoTag = builder.getPhotoAutoTag();
|
||||||
|
this.platform = builder.getPlatform();
|
||||||
|
this.platformVersion = builder.getPlatformVersion();
|
||||||
|
this.pluginHost = builder.getPluginHost();
|
||||||
|
this.pushNotifications = builder.getPushNotifications();
|
||||||
|
this.readOnlyLibraries = builder.getReadOnlyLibraries();
|
||||||
|
this.size = builder.getSize();
|
||||||
|
this.streamingBrainAbrversion = builder.getStreamingBrainAbrversion();
|
||||||
|
this.streamingBrainVersion = builder.getStreamingBrainVersion();
|
||||||
|
this.sync = builder.getSync();
|
||||||
|
this.transcoderActiveVideoSessions = builder.getTranscoderActiveVideoSessions();
|
||||||
|
this.transcoderAudio = builder.getTranscoderAudio();
|
||||||
|
this.transcoderLyrics = builder.getTranscoderLyrics();
|
||||||
|
this.transcoderPhoto = builder.getTranscoderPhoto();
|
||||||
|
this.transcoderSubtitles = builder.getTranscoderSubtitles();
|
||||||
|
this.transcoderVideo = builder.getTranscoderVideo();
|
||||||
|
this.transcoderVideoBitrates = builder.getTranscoderVideoBitrates();
|
||||||
|
this.transcoderVideoQualities = builder.getTranscoderVideoQualities();
|
||||||
|
this.transcoderVideoResolutions = builder.getTranscoderVideoResolutions();
|
||||||
|
this.updatedAt = builder.getUpdatedAt();
|
||||||
|
this.updater = builder.getUpdater();
|
||||||
|
this.version = builder.getVersion();
|
||||||
|
this.voiceSearch = builder.getVoiceSearch();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group -> java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet()))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private GetServerCapabilitiesResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerCapabilitiesResponse build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerCapabilitiesResponse buildWithoutValidation() {
|
||||||
|
return new GetServerCapabilitiesResponse(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.stream(this.getClass().getDeclaredFields())
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private final GetServerCapabilitiesResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
GetServerCapabilitiesResponse(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.mediaContainer = builder.getMediaContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
218
src/main/java/com/plexsdk/models/GetServerIdentityResponse.java
Normal file
218
src/main/java/com/plexsdk/models/GetServerIdentityResponse.java
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerIdentityResponse.Builder.class
|
||||||
|
)
|
||||||
|
public class GetServerIdentityResponse extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerIdentityResponse.MediaContainer.Builder.class
|
||||||
|
)
|
||||||
|
public static class MediaContainer extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("claimed")
|
||||||
|
private java.lang.Boolean claimed;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("machineIdentifier")
|
||||||
|
private java.lang.String machineIdentifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private java.lang.Double size;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("version")
|
||||||
|
private java.lang.String version;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerIdentityResponse.MediaContainer build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerIdentityResponse.MediaContainer buildWithoutValidation() {
|
||||||
|
return new GetServerIdentityResponse.MediaContainer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("claimed")
|
||||||
|
private final java.lang.Boolean claimed;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("machineIdentifier")
|
||||||
|
private final java.lang.String machineIdentifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private final java.lang.Double size;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("version")
|
||||||
|
private final java.lang.String version;
|
||||||
|
|
||||||
|
MediaContainer(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.claimed = builder.getClaimed();
|
||||||
|
this.machineIdentifier = builder.getMachineIdentifier();
|
||||||
|
this.size = builder.getSize();
|
||||||
|
this.version = builder.getVersion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group -> java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet()))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private GetServerIdentityResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerIdentityResponse build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerIdentityResponse buildWithoutValidation() {
|
||||||
|
return new GetServerIdentityResponse(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.stream(this.getClass().getDeclaredFields())
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private final GetServerIdentityResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
GetServerIdentityResponse(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.mediaContainer = builder.getMediaContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
339
src/main/java/com/plexsdk/models/GetServerListResponse.java
Normal file
339
src/main/java/com/plexsdk/models/GetServerListResponse.java
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerListResponse.Builder.class
|
||||||
|
)
|
||||||
|
public class GetServerListResponse extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerListResponse.MediaContainer.Builder.class
|
||||||
|
)
|
||||||
|
public static class MediaContainer extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetServerListResponse.MediaContainer.Server.Builder.class
|
||||||
|
)
|
||||||
|
public static class Server extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("address")
|
||||||
|
private java.lang.String address;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("host")
|
||||||
|
private java.lang.String host;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("machineIdentifier")
|
||||||
|
private java.lang.String machineIdentifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("name")
|
||||||
|
private java.lang.String name;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("port")
|
||||||
|
private java.lang.Double port;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("version")
|
||||||
|
private java.lang.String version;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerListResponse.MediaContainer.Server build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerListResponse.MediaContainer.Server buildWithoutValidation() {
|
||||||
|
return new GetServerListResponse.MediaContainer.Server(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("address")
|
||||||
|
private final java.lang.String address;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("host")
|
||||||
|
private final java.lang.String host;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("machineIdentifier")
|
||||||
|
private final java.lang.String machineIdentifier;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("name")
|
||||||
|
private final java.lang.String name;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("port")
|
||||||
|
private final java.lang.Double port;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("version")
|
||||||
|
private final java.lang.String version;
|
||||||
|
|
||||||
|
Server(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.address = builder.getAddress();
|
||||||
|
this.host = builder.getHost();
|
||||||
|
this.machineIdentifier = builder.getMachineIdentifier();
|
||||||
|
this.name = builder.getName();
|
||||||
|
this.port = builder.getPort();
|
||||||
|
this.version = builder.getVersion();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Server")
|
||||||
|
private java.util.List<GetServerListResponse.MediaContainer.Server> server;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private java.lang.Double size;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerListResponse.MediaContainer build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerListResponse.MediaContainer buildWithoutValidation() {
|
||||||
|
return new GetServerListResponse.MediaContainer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("Server")
|
||||||
|
private final java.util.List<GetServerListResponse.MediaContainer.Server> server;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private final java.lang.Double size;
|
||||||
|
|
||||||
|
MediaContainer(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.server = builder.getServer();
|
||||||
|
this.size = builder.getSize();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group -> java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet()))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private GetServerListResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerListResponse build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetServerListResponse buildWithoutValidation() {
|
||||||
|
return new GetServerListResponse(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.stream(this.getClass().getDeclaredFields())
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private final GetServerListResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
GetServerListResponse(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.mediaContainer = builder.getMediaContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,455 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetTranscodeSessionsResponse.Builder.class
|
||||||
|
)
|
||||||
|
public class GetTranscodeSessionsResponse extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetTranscodeSessionsResponse.MediaContainer.Builder.class
|
||||||
|
)
|
||||||
|
public static class MediaContainer extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.EqualsAndHashCode(callSuper = false)
|
||||||
|
@lombok.ToString
|
||||||
|
@com.fasterxml.jackson.annotation.JsonInclude(
|
||||||
|
com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL
|
||||||
|
)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonDeserialize(
|
||||||
|
builder = GetTranscodeSessionsResponse.MediaContainer.TranscodeSession.Builder.class
|
||||||
|
)
|
||||||
|
public static class TranscodeSession extends com.plexsdk.models.BaseModel {
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("audioChannels")
|
||||||
|
private java.lang.Double audioChannels;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("audioCodec")
|
||||||
|
private java.lang.String audioCodec;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("audioDecision")
|
||||||
|
private java.lang.String audioDecision;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("complete")
|
||||||
|
private java.lang.Boolean complete;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("container")
|
||||||
|
private java.lang.String container;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("context")
|
||||||
|
private java.lang.String context;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("duration")
|
||||||
|
private java.lang.Double duration;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("error")
|
||||||
|
private java.lang.Boolean error;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("key")
|
||||||
|
private java.lang.String key;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("maxOffsetAvailable")
|
||||||
|
private java.lang.Double maxOffsetAvailable;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("minOffsetAvailable")
|
||||||
|
private java.lang.Double minOffsetAvailable;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("progress")
|
||||||
|
private java.lang.Double progress;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("protocol")
|
||||||
|
private java.lang.String protocol;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private java.lang.Double size;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("sourceAudioCodec")
|
||||||
|
private java.lang.String sourceAudioCodec;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("sourceVideoCodec")
|
||||||
|
private java.lang.String sourceVideoCodec;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("speed")
|
||||||
|
private java.lang.Double speed;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("throttled")
|
||||||
|
private java.lang.Boolean throttled;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("timeStamp")
|
||||||
|
private java.lang.Double timeStamp;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcodeHwRequested")
|
||||||
|
private java.lang.Boolean transcodeHwRequested;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("videoCodec")
|
||||||
|
private java.lang.String videoCodec;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("videoDecision")
|
||||||
|
private java.lang.String videoDecision;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetTranscodeSessionsResponse.MediaContainer.TranscodeSession build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetTranscodeSessionsResponse.MediaContainer.TranscodeSession buildWithoutValidation() {
|
||||||
|
return new GetTranscodeSessionsResponse.MediaContainer.TranscodeSession(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("audioChannels")
|
||||||
|
private final java.lang.Double audioChannels;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("audioCodec")
|
||||||
|
private final java.lang.String audioCodec;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("audioDecision")
|
||||||
|
private final java.lang.String audioDecision;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("complete")
|
||||||
|
private final java.lang.Boolean complete;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("container")
|
||||||
|
private final java.lang.String container;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("context")
|
||||||
|
private final java.lang.String context;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("duration")
|
||||||
|
private final java.lang.Double duration;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("error")
|
||||||
|
private final java.lang.Boolean error;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("key")
|
||||||
|
private final java.lang.String key;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("maxOffsetAvailable")
|
||||||
|
private final java.lang.Double maxOffsetAvailable;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("minOffsetAvailable")
|
||||||
|
private final java.lang.Double minOffsetAvailable;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("progress")
|
||||||
|
private final java.lang.Double progress;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("protocol")
|
||||||
|
private final java.lang.String protocol;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private final java.lang.Double size;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("sourceAudioCodec")
|
||||||
|
private final java.lang.String sourceAudioCodec;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("sourceVideoCodec")
|
||||||
|
private final java.lang.String sourceVideoCodec;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("speed")
|
||||||
|
private final java.lang.Double speed;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("throttled")
|
||||||
|
private final java.lang.Boolean throttled;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("timeStamp")
|
||||||
|
private final java.lang.Double timeStamp;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("transcodeHwRequested")
|
||||||
|
private final java.lang.Boolean transcodeHwRequested;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("videoCodec")
|
||||||
|
private final java.lang.String videoCodec;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("videoDecision")
|
||||||
|
private final java.lang.String videoDecision;
|
||||||
|
|
||||||
|
TranscodeSession(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.audioChannels = builder.getAudioChannels();
|
||||||
|
this.audioCodec = builder.getAudioCodec();
|
||||||
|
this.audioDecision = builder.getAudioDecision();
|
||||||
|
this.complete = builder.getComplete();
|
||||||
|
this.container = builder.getContainer();
|
||||||
|
this.context = builder.getContext();
|
||||||
|
this.duration = builder.getDuration();
|
||||||
|
this.error = builder.getError();
|
||||||
|
this.key = builder.getKey();
|
||||||
|
this.maxOffsetAvailable = builder.getMaxOffsetAvailable();
|
||||||
|
this.minOffsetAvailable = builder.getMinOffsetAvailable();
|
||||||
|
this.progress = builder.getProgress();
|
||||||
|
this.protocol = builder.getProtocol();
|
||||||
|
this.size = builder.getSize();
|
||||||
|
this.sourceAudioCodec = builder.getSourceAudioCodec();
|
||||||
|
this.sourceVideoCodec = builder.getSourceVideoCodec();
|
||||||
|
this.speed = builder.getSpeed();
|
||||||
|
this.throttled = builder.getThrottled();
|
||||||
|
this.timeStamp = builder.getTimeStamp();
|
||||||
|
this.transcodeHwRequested = builder.getTranscodeHwRequested();
|
||||||
|
this.videoCodec = builder.getVideoCodec();
|
||||||
|
this.videoDecision = builder.getVideoDecision();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group ->
|
||||||
|
java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet())
|
||||||
|
)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private java.lang.Double size;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("TranscodeSession")
|
||||||
|
private java.util.List<
|
||||||
|
GetTranscodeSessionsResponse.MediaContainer.TranscodeSession
|
||||||
|
> transcodeSession;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetTranscodeSessionsResponse.MediaContainer build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetTranscodeSessionsResponse.MediaContainer buildWithoutValidation() {
|
||||||
|
return new GetTranscodeSessionsResponse.MediaContainer(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.asList(this.getClass().getDeclaredFields())
|
||||||
|
.stream()
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) &&
|
||||||
|
field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("size")
|
||||||
|
private final java.lang.Double size;
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("TranscodeSession")
|
||||||
|
private final java.util.List<
|
||||||
|
GetTranscodeSessionsResponse.MediaContainer.TranscodeSession
|
||||||
|
> transcodeSession;
|
||||||
|
|
||||||
|
MediaContainer(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.size = builder.getSize();
|
||||||
|
this.transcodeSession = builder.getTranscodeSession();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@lombok.Getter
|
||||||
|
@lombok.Setter
|
||||||
|
@lombok.experimental.Accessors(chain = true)
|
||||||
|
@com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder(
|
||||||
|
buildMethodName = "buildWithoutValidation",
|
||||||
|
withPrefix = "set"
|
||||||
|
)
|
||||||
|
public static class Builder extends com.plexsdk.models.BaseModel.Builder {
|
||||||
|
|
||||||
|
static final java.util.Set<java.util.Set<String>> REQUIRED_FIELDS_GROUPS;
|
||||||
|
|
||||||
|
static {
|
||||||
|
java.lang.String[][] requiredFieldsGroups = new java.lang.String[][] {};
|
||||||
|
|
||||||
|
REQUIRED_FIELDS_GROUPS =
|
||||||
|
java.util.Arrays
|
||||||
|
.stream(requiredFieldsGroups)
|
||||||
|
.map(group -> java.util.Arrays.stream(group).collect(java.util.stream.Collectors.toSet()))
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private GetTranscodeSessionsResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
public Builder() {
|
||||||
|
super(ValidationType.ALL_OF);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Builder(BaseModel.Builder.ValidationType validationType) {
|
||||||
|
super(validationType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetTranscodeSessionsResponse build() {
|
||||||
|
String validateMsg = validate();
|
||||||
|
|
||||||
|
if (validateMsg != null) {
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(validateMsg);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildWithoutValidation();
|
||||||
|
}
|
||||||
|
|
||||||
|
public GetTranscodeSessionsResponse buildWithoutValidation() {
|
||||||
|
return new GetTranscodeSessionsResponse(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
// Introspect the class to get a list of all declared fields.
|
||||||
|
return java.util.Arrays
|
||||||
|
.stream(this.getClass().getDeclaredFields())
|
||||||
|
.filter(field -> {
|
||||||
|
try {
|
||||||
|
// Filter fields that are non-static and have values that are not null.
|
||||||
|
return (
|
||||||
|
!java.lang.reflect.Modifier.isStatic(field.getModifiers()) && field.get(this) != null
|
||||||
|
);
|
||||||
|
} catch (IllegalArgumentException | IllegalAccessException e) {
|
||||||
|
// This should never happen...
|
||||||
|
|
||||||
|
throw new com.plexsdk.exceptions.ApiException(
|
||||||
|
"Unexpected exception thrown while accessing instance fields.",
|
||||||
|
e
|
||||||
|
);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.map(java.lang.reflect.Field::getName)
|
||||||
|
.collect(java.util.stream.Collectors.toSet());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected java.util.Set<java.util.Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return REQUIRED_FIELDS_GROUPS;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@com.fasterxml.jackson.annotation.JsonProperty("MediaContainer")
|
||||||
|
private final GetTranscodeSessionsResponse.MediaContainer mediaContainer;
|
||||||
|
|
||||||
|
GetTranscodeSessionsResponse(Builder builder) {
|
||||||
|
super(builder);
|
||||||
|
this.mediaContainer = builder.getMediaContainer();
|
||||||
|
}
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/IncludeDetails.java
Normal file
11
src/main/java/com/plexsdk/models/IncludeDetails.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum IncludeDetails {
|
||||||
|
V1(1);
|
||||||
|
|
||||||
|
public final Float label;
|
||||||
|
}
|
||||||
14
src/main/java/com/plexsdk/models/Level.java
Normal file
14
src/main/java/com/plexsdk/models/Level.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Level {
|
||||||
|
V1(1),
|
||||||
|
V2(2),
|
||||||
|
V3(3),
|
||||||
|
V4(4);
|
||||||
|
|
||||||
|
public final Float label;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/MinSize.java
Normal file
11
src/main/java/com/plexsdk/models/MinSize.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum MinSize {
|
||||||
|
V1(1);
|
||||||
|
|
||||||
|
public final Float label;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/OnlyTransient.java
Normal file
11
src/main/java/com/plexsdk/models/OnlyTransient.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum OnlyTransient {
|
||||||
|
V1(1);
|
||||||
|
|
||||||
|
public final Float label;
|
||||||
|
}
|
||||||
13
src/main/java/com/plexsdk/models/PlaylistType.java
Normal file
13
src/main/java/com/plexsdk/models/PlaylistType.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum PlaylistType {
|
||||||
|
AUDIO("audio"),
|
||||||
|
VIDEO("video"),
|
||||||
|
PHOTO("photo");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
90
src/main/java/com/plexsdk/models/README.md
Normal file
90
src/main/java/com/plexsdk/models/README.md
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# PlexSDK Models
|
||||||
|
|
||||||
|
A list of all models.
|
||||||
|
- [Level](#level)
|
||||||
|
- [Upscale](#upscale)
|
||||||
|
- [Type](#type)
|
||||||
|
- [Smart](#smart)
|
||||||
|
- [Force](#force)
|
||||||
|
- [SecurityType](#securitytype)
|
||||||
|
- [Scope](#scope)
|
||||||
|
- [Download](#download)
|
||||||
|
- [Tonight](#tonight)
|
||||||
|
- [Skip](#skip)
|
||||||
|
- [State](#state)
|
||||||
|
- [GetServerCapabilitiesResponse](#getservercapabilitiesresponse)
|
||||||
|
- [GetServerActivitiesResponse](#getserveractivitiesresponse)
|
||||||
|
- [GetButlerTasksResponse](#getbutlertasksresponse)
|
||||||
|
- [GetAvailableClientsResponse](#getavailableclientsresponse)
|
||||||
|
- [GetDevicesResponse](#getdevicesresponse)
|
||||||
|
- [GetServerIdentityResponse](#getserveridentityresponse)
|
||||||
|
- [GetRecentlyAddedResponse](#getrecentlyaddedresponse)
|
||||||
|
- [GetOnDeckResponse](#getondeckresponse)
|
||||||
|
- [GetMyPlexAccountResponse](#getmyplexaccountresponse)
|
||||||
|
- [GetSearchResultsResponse](#getsearchresultsresponse)
|
||||||
|
- [GetServerListResponse](#getserverlistresponse)
|
||||||
|
- [GetTranscodeSessionsResponse](#gettranscodesessionsresponse)
|
||||||
|
- [TaskName](#taskname)
|
||||||
|
- [OnlyTransient](#onlytransient)
|
||||||
|
- [IncludeDetails](#includedetails)
|
||||||
|
- [MinSize](#minsize)
|
||||||
|
- [PlaylistType](#playlisttype)
|
||||||
|
|
||||||
|
## Level
|
||||||
|
|
||||||
|
## Upscale
|
||||||
|
|
||||||
|
## Type
|
||||||
|
|
||||||
|
## Smart
|
||||||
|
|
||||||
|
## Force
|
||||||
|
|
||||||
|
## SecurityType
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
## Download
|
||||||
|
|
||||||
|
## Tonight
|
||||||
|
|
||||||
|
## Skip
|
||||||
|
|
||||||
|
## State
|
||||||
|
|
||||||
|
## GetServerCapabilitiesResponse
|
||||||
|
|
||||||
|
## GetServerActivitiesResponse
|
||||||
|
|
||||||
|
## GetButlerTasksResponse
|
||||||
|
|
||||||
|
## GetAvailableClientsResponse
|
||||||
|
|
||||||
|
## GetDevicesResponse
|
||||||
|
|
||||||
|
## GetServerIdentityResponse
|
||||||
|
|
||||||
|
## GetRecentlyAddedResponse
|
||||||
|
|
||||||
|
## GetOnDeckResponse
|
||||||
|
|
||||||
|
## GetMyPlexAccountResponse
|
||||||
|
|
||||||
|
## GetSearchResultsResponse
|
||||||
|
|
||||||
|
## GetServerListResponse
|
||||||
|
|
||||||
|
## GetTranscodeSessionsResponse
|
||||||
|
|
||||||
|
## TaskName
|
||||||
|
|
||||||
|
## OnlyTransient
|
||||||
|
|
||||||
|
## IncludeDetails
|
||||||
|
|
||||||
|
## MinSize
|
||||||
|
|
||||||
|
## PlaylistType
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
src/main/java/com/plexsdk/models/Scope.java
Normal file
11
src/main/java/com/plexsdk/models/Scope.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Scope {
|
||||||
|
ALL("all");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/SecurityType.java
Normal file
11
src/main/java/com/plexsdk/models/SecurityType.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum SecurityType {
|
||||||
|
DELEGATION("delegation");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/Skip.java
Normal file
11
src/main/java/com/plexsdk/models/Skip.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Skip {
|
||||||
|
V1("1");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/Smart.java
Normal file
11
src/main/java/com/plexsdk/models/Smart.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Smart {
|
||||||
|
V1(1);
|
||||||
|
|
||||||
|
public final Float label;
|
||||||
|
}
|
||||||
13
src/main/java/com/plexsdk/models/State.java
Normal file
13
src/main/java/com/plexsdk/models/State.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum State {
|
||||||
|
PLAYING("playing"),
|
||||||
|
PAUSED("paused"),
|
||||||
|
STOPPED("stopped");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
24
src/main/java/com/plexsdk/models/TaskName.java
Normal file
24
src/main/java/com/plexsdk/models/TaskName.java
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum TaskName {
|
||||||
|
BACKUPDATABASE("BackupDatabase"),
|
||||||
|
BUILDGRACENOTECOLLECTIONS("BuildGracenoteCollections"),
|
||||||
|
CHECKFORUPDATES("CheckForUpdates"),
|
||||||
|
CLEANOLDBUNDLES("CleanOldBundles"),
|
||||||
|
CLEANOLDCACHEFILES("CleanOldCacheFiles"),
|
||||||
|
DEEPMEDIAANALYSIS("DeepMediaAnalysis"),
|
||||||
|
GENERATEAUTOTAGS("GenerateAutoTags"),
|
||||||
|
GENERATECHAPTERTHUMBS("GenerateChapterThumbs"),
|
||||||
|
GENERATEMEDIAINDEXFILES("GenerateMediaIndexFiles"),
|
||||||
|
OPTIMIZEDATABASE("OptimizeDatabase"),
|
||||||
|
REFRESHLIBRARIES("RefreshLibraries"),
|
||||||
|
REFRESHLOCALMEDIA("RefreshLocalMedia"),
|
||||||
|
REFRESHPERIODICMETADATA("RefreshPeriodicMetadata"),
|
||||||
|
UPGRADEMEDIAANALYSIS("UpgradeMediaAnalysis");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/Tonight.java
Normal file
11
src/main/java/com/plexsdk/models/Tonight.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Tonight {
|
||||||
|
V1("1");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
13
src/main/java/com/plexsdk/models/Type.java
Normal file
13
src/main/java/com/plexsdk/models/Type.java
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Type {
|
||||||
|
AUDIO("audio"),
|
||||||
|
VIDEO("video"),
|
||||||
|
PHOTO("photo");
|
||||||
|
|
||||||
|
public final String label;
|
||||||
|
}
|
||||||
11
src/main/java/com/plexsdk/models/Upscale.java
Normal file
11
src/main/java/com/plexsdk/models/Upscale.java
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor(access = AccessLevel.PRIVATE)
|
||||||
|
public enum Upscale {
|
||||||
|
V1(1);
|
||||||
|
|
||||||
|
public final Float label;
|
||||||
|
}
|
||||||
68
src/main/java/com/plexsdk/services/ActivitiesService.java
Normal file
68
src/main/java/com/plexsdk/services/ActivitiesService.java
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class ActivitiesService extends BaseService implements ActivitiesClient {
|
||||||
|
|
||||||
|
public ActivitiesService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Server Activities
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetServerActivitiesResponse> getServerActivities()
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("activities").build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetServerActivitiesResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetServerActivitiesResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Cancel Server Activities
|
||||||
|
* @param {String} activityUUID - The UUID of the activity to cancel.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> cancelServerActivities(String activityUUID)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("activities")
|
||||||
|
.addPathParameter(String.valueOf(activityUUID))
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).delete().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
48
src/main/java/com/plexsdk/services/BaseService.java
Normal file
48
src/main/java/com/plexsdk/services/BaseService.java
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.Configuration;
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.ModelConverter;
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.HttpUrl;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class BaseService {
|
||||||
|
|
||||||
|
protected OkHttpClient httpClient;
|
||||||
|
protected String serverUrl;
|
||||||
|
|
||||||
|
public BaseService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
this.httpClient = httpClient;
|
||||||
|
this.serverUrl = serverUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBaseUrl(String serverUrl) {
|
||||||
|
this.serverUrl = serverUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Response execute(Request request) throws ApiException {
|
||||||
|
Response response;
|
||||||
|
try {
|
||||||
|
response = this.httpClient.newCall(request).execute();
|
||||||
|
} catch (IOException e) {
|
||||||
|
ApiException apiException = new ApiException(e.getMessage());
|
||||||
|
|
||||||
|
throw apiException;
|
||||||
|
}
|
||||||
|
if (response.isSuccessful()) {
|
||||||
|
return response;
|
||||||
|
} else {
|
||||||
|
ApiException apiException = new ApiException(response.code());
|
||||||
|
|
||||||
|
throw apiException;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
137
src/main/java/com/plexsdk/services/ButlerService.java
Normal file
137
src/main/java/com/plexsdk/services/ButlerService.java
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class ButlerService extends BaseService implements ButlerClient {
|
||||||
|
|
||||||
|
public ButlerService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Butler tasks
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetButlerTasksResponse> getButlerTasks()
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("butler").build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetButlerTasksResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetButlerTasksResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Start all Butler tasks
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> startAllTasks() throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("butler").build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).post(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Stop all Butler tasks
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> stopAllTasks() throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("butler").build();
|
||||||
|
Request request = new Request.Builder().url(url).delete().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Start a single Butler task
|
||||||
|
* @param {String} taskName - the name of the task to be started.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> startTask(String taskName) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("butler")
|
||||||
|
.addPathParameter(String.valueOf(taskName))
|
||||||
|
.build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).post(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Stop a single Butler task
|
||||||
|
* @param {String} taskName - The name of the task to be started.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> stopTask(String taskName) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("butler")
|
||||||
|
.addPathParameter(String.valueOf(taskName))
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).delete().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
83
src/main/java/com/plexsdk/services/HubsService.java
Normal file
83
src/main/java/com/plexsdk/services/HubsService.java
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class HubsService extends BaseService implements HubsClient {
|
||||||
|
|
||||||
|
public HubsService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Global Hubs
|
||||||
|
* @param {Number} [count] - The number of items to return with each hub.
|
||||||
|
* @param {Number} [onlyTransient] - Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getGlobalHubs(Float count, Float onlyTransient)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("hubs")
|
||||||
|
.addOptionalQueryParameter("count", count)
|
||||||
|
.addOptionalQueryParameter("onlyTransient", onlyTransient)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get library specific hubs
|
||||||
|
* @param {Number} sectionId - the Id of the library to query
|
||||||
|
* @param {Number} [count] - The number of items to return with each hub.
|
||||||
|
* @param {Number} [onlyTransient] - Only return hubs which are "transient", meaning those which are prone to changing after media playback or addition (e.g. On Deck, or Recently Added).
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getLibraryHubs(
|
||||||
|
Float sectionId,
|
||||||
|
Float count,
|
||||||
|
Float onlyTransient
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("hubs")
|
||||||
|
.addPathParameter("sections")
|
||||||
|
.addPathParameter(String.valueOf(sectionId))
|
||||||
|
.addOptionalQueryParameter("count", count)
|
||||||
|
.addOptionalQueryParameter("onlyTransient", onlyTransient)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
349
src/main/java/com/plexsdk/services/LibraryService.java
Normal file
349
src/main/java/com/plexsdk/services/LibraryService.java
Normal file
@@ -0,0 +1,349 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class LibraryService extends BaseService implements LibraryClient {
|
||||||
|
|
||||||
|
public LibraryService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Hash Value
|
||||||
|
* @param {String} url - This is the path to the local file, must be prefixed by `file://`
|
||||||
|
* @param {Number} [type] - Item type
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getFileHash(String url, Float type) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("hashes")
|
||||||
|
.addRequiredQueryParameter("url", url)
|
||||||
|
.addOptionalQueryParameter("type", type)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Recently Added
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetRecentlyAddedResponse> getRecentlyAdded()
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("recentlyAdded")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetRecentlyAddedResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetRecentlyAddedResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get All Libraries
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getLibraries() throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("sections")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Library Details
|
||||||
|
* @param {Number} sectionId - the Id of the library to query
|
||||||
|
* @param {Number} [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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getLibrary(Float sectionId, Float includeDetails)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("sections")
|
||||||
|
.addPathParameter(String.valueOf(sectionId))
|
||||||
|
.addOptionalQueryParameter("includeDetails", includeDetails)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Delete Library Section
|
||||||
|
* @param {Number} sectionId - the Id of the library to query
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> deleteLibrary(Float sectionId) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("sections")
|
||||||
|
.addPathParameter(String.valueOf(sectionId))
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).delete().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Library Items
|
||||||
|
* @param {Number} sectionId - the Id of the library to query
|
||||||
|
* @param {Number} [type] - item type
|
||||||
|
* @param {String} [filter] - the filter parameter
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getLibraryItems(Float sectionId, Float type, String filter)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("sections")
|
||||||
|
.addPathParameter(String.valueOf(sectionId))
|
||||||
|
.addPathParameter("all")
|
||||||
|
.addOptionalQueryParameter("type", type)
|
||||||
|
.addOptionalQueryParameter("filter", filter)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Refresh Library
|
||||||
|
* @param {Number} sectionId - the Id of the library to refresh
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> refreshLibrary(Float sectionId) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("sections")
|
||||||
|
.addPathParameter(String.valueOf(sectionId))
|
||||||
|
.addPathParameter("refresh")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Latest Library Items
|
||||||
|
* @param {Number} sectionId - the Id of the library to query
|
||||||
|
* @param {Number} type - item type
|
||||||
|
* @param {String} [filter] - the filter parameter
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getLatestLibraryItems(
|
||||||
|
Float sectionId,
|
||||||
|
Float type,
|
||||||
|
String filter
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("sections")
|
||||||
|
.addPathParameter(String.valueOf(sectionId))
|
||||||
|
.addPathParameter("latest")
|
||||||
|
.addRequiredQueryParameter("type", type)
|
||||||
|
.addOptionalQueryParameter("filter", filter)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Common Library Items
|
||||||
|
* @param {Number} sectionId - the Id of the library to query
|
||||||
|
* @param {Number} type - item type
|
||||||
|
* @param {String} [filter] - the filter parameter
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getCommonLibraryItems(
|
||||||
|
Float sectionId,
|
||||||
|
Float type,
|
||||||
|
String filter
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("sections")
|
||||||
|
.addPathParameter(String.valueOf(sectionId))
|
||||||
|
.addPathParameter("common")
|
||||||
|
.addRequiredQueryParameter("type", type)
|
||||||
|
.addOptionalQueryParameter("filter", filter)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Items Metadata
|
||||||
|
* @param {Number} ratingKey - the id of the library item to return the children of.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getMetadata(Float ratingKey) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("metadata")
|
||||||
|
.addPathParameter(String.valueOf(ratingKey))
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Items Children
|
||||||
|
* @param {Number} ratingKey - the id of the library item to return the children of.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getMetadataChildren(Float ratingKey) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("metadata")
|
||||||
|
.addPathParameter(String.valueOf(ratingKey))
|
||||||
|
.addPathParameter("children")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get On Deck
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetOnDeckResponse> getOnDeck() throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("library")
|
||||||
|
.addPathParameter("onDeck")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetOnDeckResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<com.plexsdk.models.GetOnDeckResponse>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
104
src/main/java/com/plexsdk/services/LogService.java
Normal file
104
src/main/java/com/plexsdk/services/LogService.java
Normal file
@@ -0,0 +1,104 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class LogService extends BaseService implements LogClient {
|
||||||
|
|
||||||
|
public LogService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Logging a single line message.
|
||||||
|
* @param {Number} level - An integer log level to write to the PMS log with.
|
||||||
|
0: Error
|
||||||
|
1: Warning
|
||||||
|
2: Info
|
||||||
|
3: Debug
|
||||||
|
4: Verbose
|
||||||
|
|
||||||
|
* @param {String} message - The text of the message to write to the log.
|
||||||
|
* @param {String} source - a string indicating the source of the message.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> logLine(Float level, String message, String source)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("log")
|
||||||
|
.addRequiredQueryParameter("level", level)
|
||||||
|
.addRequiredQueryParameter("message", message)
|
||||||
|
.addRequiredQueryParameter("source", source)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Logging a multi-line message
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> logMultiLine() throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("log").build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).post(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Enabling Papertrail
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> enablePaperTrail() throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("log")
|
||||||
|
.addPathParameter("networked")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
107
src/main/java/com/plexsdk/services/MediaService.java
Normal file
107
src/main/java/com/plexsdk/services/MediaService.java
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class MediaService extends BaseService implements MediaClient {
|
||||||
|
|
||||||
|
public MediaService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Mark Media Played
|
||||||
|
* @param {Number} key - The media key to mark as played
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> markPlayed(Float key) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter(":")
|
||||||
|
.addPathParameter("scrobble")
|
||||||
|
.addRequiredQueryParameter("key", key)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Mark Media Unplayed
|
||||||
|
* @param {Number} key - The media key to mark as Unplayed
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> markUnplayed(Float key) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter(":")
|
||||||
|
.addPathParameter("unscrobble")
|
||||||
|
.addRequiredQueryParameter("key", key)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update Media Play Progress
|
||||||
|
* @param {String} key - the media key
|
||||||
|
* @param {Number} time - The time, in milliseconds, used to set the media playback progress.
|
||||||
|
* @param {String} state - The playback state of the media item.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> updatePlayProgress(String key, Float time, String state)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter(":")
|
||||||
|
.addPathParameter("progress")
|
||||||
|
.addRequiredQueryParameter("key", key)
|
||||||
|
.addRequiredQueryParameter("time", time)
|
||||||
|
.addRequiredQueryParameter("state", state)
|
||||||
|
.build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).post(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
298
src/main/java/com/plexsdk/services/PlaylistsService.java
Normal file
298
src/main/java/com/plexsdk/services/PlaylistsService.java
Normal file
@@ -0,0 +1,298 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class PlaylistsService extends BaseService implements PlaylistsClient {
|
||||||
|
|
||||||
|
public PlaylistsService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Create a Playlist
|
||||||
|
* @param {String} title - name of the playlist
|
||||||
|
* @param {String} type - type of playlist to create
|
||||||
|
* @param {Number} smart - whether the playlist is smart or not
|
||||||
|
* @param {String} [uri] - the content URI for the playlist
|
||||||
|
* @param {Number} [playQueueID] - the play queue to copy to a playlist
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> createPlaylist(
|
||||||
|
String title,
|
||||||
|
String type,
|
||||||
|
Float smart,
|
||||||
|
String uri,
|
||||||
|
Float playQueueID
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addRequiredQueryParameter("title", title)
|
||||||
|
.addRequiredQueryParameter("type", type)
|
||||||
|
.addRequiredQueryParameter("smart", smart)
|
||||||
|
.addOptionalQueryParameter("uri", uri)
|
||||||
|
.addOptionalQueryParameter("playQueueID", playQueueID)
|
||||||
|
.build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).post(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get All Playlists
|
||||||
|
* @param {String} [playlistType] - limit to a type of playlist.
|
||||||
|
* @param {Number} [smart] - type of playlists to return (default is all).
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getPlaylists(String playlistType, Float smart)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addPathParameter("all")
|
||||||
|
.addOptionalQueryParameter("playlistType", playlistType)
|
||||||
|
.addOptionalQueryParameter("smart", smart)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Retrieve Playlist
|
||||||
|
* @param {Number} playlistID - the ID of the playlist
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getPlaylist(Float playlistID) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addPathParameter(String.valueOf(playlistID))
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Update a Playlist
|
||||||
|
* @param {Number} playlistID - the ID of the playlist
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> updatePlaylist(Float playlistID) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addPathParameter(String.valueOf(playlistID))
|
||||||
|
.build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).put(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Deletes a Playlist
|
||||||
|
* @param {Number} playlistID - the ID of the playlist
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> deletePlaylist(Float playlistID) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addPathParameter(String.valueOf(playlistID))
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).delete().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Retrieve Playlist Contents
|
||||||
|
* @param {Number} playlistID - the ID of the playlist
|
||||||
|
* @param {Number} type - the metadata type of the item to return
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getPlaylistContents(Float playlistID, Float type)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addPathParameter(String.valueOf(playlistID))
|
||||||
|
.addPathParameter("items")
|
||||||
|
.addRequiredQueryParameter("type", type)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Adding to a Playlist
|
||||||
|
* @param {Number} playlistID - the ID of the playlist
|
||||||
|
* @param {String} uri - the content URI for the playlist
|
||||||
|
* @param {Number} playQueueID - the play queue to add to a playlist
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> addPlaylistContents(
|
||||||
|
Float playlistID,
|
||||||
|
String uri,
|
||||||
|
Float playQueueID
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addPathParameter(String.valueOf(playlistID))
|
||||||
|
.addPathParameter("items")
|
||||||
|
.addRequiredQueryParameter("uri", uri)
|
||||||
|
.addRequiredQueryParameter("playQueueID", playQueueID)
|
||||||
|
.build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).put(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Delete Playlist Contents
|
||||||
|
* @param {Number} playlistID - the ID of the playlist
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> clearPlaylistContents(Float playlistID) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addPathParameter(String.valueOf(playlistID))
|
||||||
|
.addPathParameter("items")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).delete().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Upload Playlist
|
||||||
|
* @param {String} 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 {Number} 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.
|
||||||
|
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> uploadPlaylist(String path, Float force) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("playlists")
|
||||||
|
.addPathParameter("upload")
|
||||||
|
.addRequiredQueryParameter("path", path)
|
||||||
|
.addRequiredQueryParameter("force", force)
|
||||||
|
.build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).post(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
2606
src/main/java/com/plexsdk/services/README.md
Normal file
2606
src/main/java/com/plexsdk/services/README.md
Normal file
File diff suppressed because it is too large
Load Diff
110
src/main/java/com/plexsdk/services/SearchService.java
Normal file
110
src/main/java/com/plexsdk/services/SearchService.java
Normal file
@@ -0,0 +1,110 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class SearchService extends BaseService implements SearchClient {
|
||||||
|
|
||||||
|
public SearchService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Perform a search
|
||||||
|
* @param {String} query - The query term
|
||||||
|
* @param {Number} [sectionId] - This gives context to the search, and can result in re-ordering of search result hubs
|
||||||
|
* @param {Number} [limit] - The number of items to return per hub
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> performSearch(String query, Float sectionId, Float limit)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("hubs")
|
||||||
|
.addPathParameter("search")
|
||||||
|
.addRequiredQueryParameter("query", query)
|
||||||
|
.addOptionalQueryParameter("sectionId", sectionId)
|
||||||
|
.addOptionalQueryParameter("limit", limit)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Perform a voice search
|
||||||
|
* @param {String} query - The query term
|
||||||
|
* @param {Number} [sectionId] - This gives context to the search, and can result in re-ordering of search result hubs
|
||||||
|
* @param {Number} [limit] - The number of items to return per hub
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> performVoiceSearch(String query, Float sectionId, Float limit)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("hubs")
|
||||||
|
.addPathParameter("search")
|
||||||
|
.addPathParameter("voice")
|
||||||
|
.addRequiredQueryParameter("query", query)
|
||||||
|
.addOptionalQueryParameter("sectionId", sectionId)
|
||||||
|
.addOptionalQueryParameter("limit", limit)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Search Results
|
||||||
|
* @param {String} query - The search query string to use
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetSearchResultsResponse> getSearchResults(
|
||||||
|
String query
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("search")
|
||||||
|
.addRequiredQueryParameter("query", query)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetSearchResultsResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetSearchResultsResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
77
src/main/java/com/plexsdk/services/SecurityService.java
Normal file
77
src/main/java/com/plexsdk/services/SecurityService.java
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class SecurityService extends BaseService implements SecurityClient {
|
||||||
|
|
||||||
|
public SecurityService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get a Transient Token.
|
||||||
|
* @param {String} type - `delegation` - This is the only supported `type` parameter.
|
||||||
|
* @param {String} scope - `all` - This is the only supported `scope` parameter.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getTransientToken(String type, String scope)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("security")
|
||||||
|
.addPathParameter("token")
|
||||||
|
.addRequiredQueryParameter("type", type)
|
||||||
|
.addRequiredQueryParameter("scope", scope)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Source Connection Information
|
||||||
|
* @param {String} source - The source identifier with an included prefix.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getSourceConnectionInformation(String source)
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("security")
|
||||||
|
.addPathParameter("resources")
|
||||||
|
.addRequiredQueryParameter("source", source)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
218
src/main/java/com/plexsdk/services/ServerService.java
Normal file
218
src/main/java/com/plexsdk/services/ServerService.java
Normal file
@@ -0,0 +1,218 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class ServerService extends BaseService implements ServerClient {
|
||||||
|
|
||||||
|
public ServerService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Server Capabilities
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<
|
||||||
|
com.plexsdk.models.GetServerCapabilitiesResponse
|
||||||
|
> getServerCapabilities() throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetServerCapabilitiesResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetServerCapabilitiesResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Server Preferences
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getServerPreferences() throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter(":")
|
||||||
|
.addPathParameter("prefs")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Available Clients
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<
|
||||||
|
java.util.List<com.plexsdk.models.GetAvailableClientsResponse>
|
||||||
|
> getAvailableClients() throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("clients").build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<java.util.List<com.plexsdk.models.GetAvailableClientsResponse>>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
java.util.List<com.plexsdk.models.GetAvailableClientsResponse>
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Devices
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetDevicesResponse> getDevices()
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("devices").build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetDevicesResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetDevicesResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Server Identity
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetServerIdentityResponse> getServerIdentity()
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("identity").build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetServerIdentityResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetServerIdentityResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get MyPlex Account
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetMyPlexAccountResponse> getMyPlexAccount()
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("myplex")
|
||||||
|
.addPathParameter("account")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetMyPlexAccountResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetMyPlexAccountResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get a Resized Photo
|
||||||
|
* @param {Number} width - The width for the resized photo
|
||||||
|
* @param {Number} height - The height for the resized photo
|
||||||
|
* @param {Integer} opacity - The opacity for the resized photo
|
||||||
|
* @param {Number} blur - The width for the resized photo
|
||||||
|
* @param {Number} minSize - images are always scaled proportionally. A value of '1' in minSize will make the smaller native dimension the dimension resized against.
|
||||||
|
* @param {Number} upscale - allow images to be resized beyond native dimensions.
|
||||||
|
* @param {String} url - path to image within Plex
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getResizedPhoto(
|
||||||
|
Float width,
|
||||||
|
Float height,
|
||||||
|
Integer opacity,
|
||||||
|
Float blur,
|
||||||
|
Float minSize,
|
||||||
|
Float upscale,
|
||||||
|
String url
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("photo")
|
||||||
|
.addPathParameter(":")
|
||||||
|
.addPathParameter("transcode")
|
||||||
|
.addRequiredQueryParameter("width", width)
|
||||||
|
.addRequiredQueryParameter("height", height)
|
||||||
|
.addRequiredQueryParameter("opacity", opacity)
|
||||||
|
.addRequiredQueryParameter("blur", blur)
|
||||||
|
.addRequiredQueryParameter("minSize", minSize)
|
||||||
|
.addRequiredQueryParameter("upscale", upscale)
|
||||||
|
.addRequiredQueryParameter("url", url)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Server List
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<com.plexsdk.models.GetServerListResponse> getServerList()
|
||||||
|
throws ApiException {
|
||||||
|
String url = HttpUrl.builder(this.serverUrl).addPathParameter("servers").build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetServerListResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetServerListResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
121
src/main/java/com/plexsdk/services/SessionsService.java
Normal file
121
src/main/java/com/plexsdk/services/SessionsService.java
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class SessionsService extends BaseService implements SessionsClient {
|
||||||
|
|
||||||
|
public SessionsService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Active Sessions
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getSessions() throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("status")
|
||||||
|
.addPathParameter("sessions")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Session History
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getSessionHistory() throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("status")
|
||||||
|
.addPathParameter("sessions")
|
||||||
|
.addPathParameter("history")
|
||||||
|
.addPathParameter("all")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get Transcode Sessions
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<
|
||||||
|
com.plexsdk.models.GetTranscodeSessionsResponse
|
||||||
|
> getTranscodeSessions() throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("transcode")
|
||||||
|
.addPathParameter("sessions")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
return new ResponseWithHeaders<com.plexsdk.models.GetTranscodeSessionsResponse>(
|
||||||
|
ModelConverter.convert(
|
||||||
|
response,
|
||||||
|
new com.fasterxml.jackson.core.type.TypeReference<
|
||||||
|
com.plexsdk.models.GetTranscodeSessionsResponse
|
||||||
|
>() {}
|
||||||
|
),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Stop a Transcode Session
|
||||||
|
* @param {String} sessionKey - the Key of the transcode session to stop
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> stopTranscodeSession(String sessionKey) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("transcode")
|
||||||
|
.addPathParameter("sessions")
|
||||||
|
.addPathParameter(String.valueOf(sessionKey))
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).delete().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
106
src/main/java/com/plexsdk/services/UpdaterService.java
Normal file
106
src/main/java/com/plexsdk/services/UpdaterService.java
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class UpdaterService extends BaseService implements UpdaterClient {
|
||||||
|
|
||||||
|
public UpdaterService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Querying status of updates
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getUpdateStatus() throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("updater")
|
||||||
|
.addPathParameter("status")
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Checking for updates
|
||||||
|
* @param {Download} [download] - Indicate that you want to start download any updates found.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> checkForUpdates(String download) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("updater")
|
||||||
|
.addPathParameter("check")
|
||||||
|
.addOptionalQueryParameter("download", download)
|
||||||
|
.build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).put(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Apply Updates
|
||||||
|
* @param {Tonight} [tonight] - Indicate that you want the update to run during the next Butler execution. Omitting this or setting it to false indicates that the update should install
|
||||||
|
* @param {Skip} [skip] - Indicate that the latest version should be marked as skipped. The <Release> entry for this version will have the `state` set to `skipped`.
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> applyUpdates(String tonight, String skip) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("updater")
|
||||||
|
.addPathParameter("apply")
|
||||||
|
.addOptionalQueryParameter("tonight", tonight)
|
||||||
|
.addOptionalQueryParameter("skip", skip)
|
||||||
|
.build();
|
||||||
|
RequestBody requestBody = RequestBody.create(
|
||||||
|
Objects.requireNonNull(ModelConverter.modelToJson(new BaseModel() {})),
|
||||||
|
okhttp3.MediaType.parse("application/json; charset=utf-8")
|
||||||
|
);
|
||||||
|
Request request = new Request.Builder().url(url).put(requestBody).build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
152
src/main/java/com/plexsdk/services/VideoService.java
Normal file
152
src/main/java/com/plexsdk/services/VideoService.java
Normal file
@@ -0,0 +1,152 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import com.plexsdk.exceptions.ApiException;
|
||||||
|
import com.plexsdk.http.*;
|
||||||
|
import com.plexsdk.http.util.HttpHeaders;
|
||||||
|
import com.plexsdk.http.util.HttpUrl;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import okhttp3.Headers;
|
||||||
|
import okhttp3.OkHttpClient;
|
||||||
|
import okhttp3.Request;
|
||||||
|
import okhttp3.RequestBody;
|
||||||
|
import okhttp3.Response;
|
||||||
|
|
||||||
|
public class VideoService extends BaseService implements VideoClient {
|
||||||
|
|
||||||
|
public VideoService(OkHttpClient httpClient, String serverUrl) {
|
||||||
|
super(httpClient, serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Start Universal Transcode
|
||||||
|
* @param {Number} hasMDE - Whether the media item has MDE
|
||||||
|
* @param {String} path - The path to the media item to transcode
|
||||||
|
* @param {Number} mediaIndex - The index of the media item to transcode
|
||||||
|
* @param {Number} partIndex - The index of the part to transcode
|
||||||
|
* @param {String} protocol - The protocol to use for the transcode session
|
||||||
|
* @param {Number} [fastSeek] - Whether to use fast seek or not
|
||||||
|
* @param {Number} [directPlay] - Whether to use direct play or not
|
||||||
|
* @param {Number} [directStream] - Whether to use direct stream or not
|
||||||
|
* @param {Number} [subtitleSize] - The size of the subtitles
|
||||||
|
* @param {String} [subtites] - The subtitles
|
||||||
|
* @param {Number} [audioBoost] - The audio boost
|
||||||
|
* @param {String} [location] - The location of the transcode session
|
||||||
|
* @param {Number} [mediaBufferSize] - The size of the media buffer
|
||||||
|
* @param {String} [session] - The session ID
|
||||||
|
* @param {Number} [addDebugOverlay] - Whether to add a debug overlay or not
|
||||||
|
* @param {Number} [autoAdjustQuality] - Whether to auto adjust quality or not
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> startUniversalTranscode(
|
||||||
|
Float hasMDE,
|
||||||
|
String path,
|
||||||
|
Float mediaIndex,
|
||||||
|
Float partIndex,
|
||||||
|
String protocol,
|
||||||
|
Float fastSeek,
|
||||||
|
Float directPlay,
|
||||||
|
Float directStream,
|
||||||
|
Float subtitleSize,
|
||||||
|
String subtites,
|
||||||
|
Float audioBoost,
|
||||||
|
String location,
|
||||||
|
Float mediaBufferSize,
|
||||||
|
String session,
|
||||||
|
Float addDebugOverlay,
|
||||||
|
Float autoAdjustQuality
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter("video")
|
||||||
|
.addPathParameter(":")
|
||||||
|
.addPathParameter("transcode")
|
||||||
|
.addPathParameter("universal")
|
||||||
|
.addPathParameter("start.mpd")
|
||||||
|
.addRequiredQueryParameter("hasMDE", hasMDE)
|
||||||
|
.addRequiredQueryParameter("path", path)
|
||||||
|
.addRequiredQueryParameter("mediaIndex", mediaIndex)
|
||||||
|
.addRequiredQueryParameter("partIndex", partIndex)
|
||||||
|
.addRequiredQueryParameter("protocol", protocol)
|
||||||
|
.addOptionalQueryParameter("fastSeek", fastSeek)
|
||||||
|
.addOptionalQueryParameter("directPlay", directPlay)
|
||||||
|
.addOptionalQueryParameter("directStream", directStream)
|
||||||
|
.addOptionalQueryParameter("subtitleSize", subtitleSize)
|
||||||
|
.addOptionalQueryParameter("subtites", subtites)
|
||||||
|
.addOptionalQueryParameter("audioBoost", audioBoost)
|
||||||
|
.addOptionalQueryParameter("location", location)
|
||||||
|
.addOptionalQueryParameter("mediaBufferSize", mediaBufferSize)
|
||||||
|
.addOptionalQueryParameter("session", session)
|
||||||
|
.addOptionalQueryParameter("addDebugOverlay", addDebugOverlay)
|
||||||
|
.addOptionalQueryParameter("autoAdjustQuality", autoAdjustQuality)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @summary Get the timeline for a media item
|
||||||
|
* @param {Number} ratingKey - The rating key of the media item
|
||||||
|
* @param {String} key - The key of the media item to get the timeline for
|
||||||
|
* @param {String} state - The state of the media item
|
||||||
|
* @param {Number} hasMDE - Whether the media item has MDE
|
||||||
|
* @param {Number} time - The time of the media item
|
||||||
|
* @param {Number} duration - The duration of the media item
|
||||||
|
* @param {String} context - The context of the media item
|
||||||
|
* @param {Number} playQueueItemID - The play queue item ID of the media item
|
||||||
|
* @param {Number} playBackTime - The playback time of the media item
|
||||||
|
* @param {Number} row - The row of the media item
|
||||||
|
*/
|
||||||
|
public ResponseWithHeaders<String> getTimeline(
|
||||||
|
Float ratingKey,
|
||||||
|
String key,
|
||||||
|
String state,
|
||||||
|
Float hasMDE,
|
||||||
|
Float time,
|
||||||
|
Float duration,
|
||||||
|
String context,
|
||||||
|
Float playQueueItemID,
|
||||||
|
Float playBackTime,
|
||||||
|
Float row
|
||||||
|
) throws ApiException {
|
||||||
|
String url = HttpUrl
|
||||||
|
.builder(this.serverUrl)
|
||||||
|
.addPathParameter(":")
|
||||||
|
.addPathParameter("timeline")
|
||||||
|
.addRequiredQueryParameter("ratingKey", ratingKey)
|
||||||
|
.addRequiredQueryParameter("key", key)
|
||||||
|
.addRequiredQueryParameter("state", state)
|
||||||
|
.addRequiredQueryParameter("hasMDE", hasMDE)
|
||||||
|
.addRequiredQueryParameter("time", time)
|
||||||
|
.addRequiredQueryParameter("duration", duration)
|
||||||
|
.addRequiredQueryParameter("context", context)
|
||||||
|
.addRequiredQueryParameter("playQueueItemID", playQueueItemID)
|
||||||
|
.addRequiredQueryParameter("playBackTime", playBackTime)
|
||||||
|
.addRequiredQueryParameter("row", row)
|
||||||
|
.build();
|
||||||
|
Request request = new Request.Builder().url(url).get().build();
|
||||||
|
Response response = this.execute(request);
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new ResponseWithHeaders<java.lang.String>(
|
||||||
|
response.body().string(),
|
||||||
|
response.headers()
|
||||||
|
);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
src/test/java/com/plexsdk/TestTest.java
Normal file
14
src/test/java/com/plexsdk/TestTest.java
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
package com.plexsdk;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
public class TestTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Tests that JUnit is working")
|
||||||
|
public void test() {
|
||||||
|
assertTrue(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
src/test/java/com/plexsdk/helpers/TestModel.java
Normal file
21
src/test/java/com/plexsdk/helpers/TestModel.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.plexsdk.helpers;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import com.plexsdk.models.BaseModel;
|
||||||
|
|
||||||
|
public class TestModel extends BaseModel {
|
||||||
|
|
||||||
|
public String testString;
|
||||||
|
public int testInt;
|
||||||
|
public boolean testBoolean;
|
||||||
|
|
||||||
|
public TestModel(
|
||||||
|
@JsonProperty("testString") String testString,
|
||||||
|
@JsonProperty("testInt") int testInt,
|
||||||
|
@JsonProperty("testBoolean") boolean testBoolean
|
||||||
|
) {
|
||||||
|
this.testString = testString;
|
||||||
|
this.testInt = testInt;
|
||||||
|
this.testBoolean = testBoolean;
|
||||||
|
}
|
||||||
|
}
|
||||||
39
src/test/java/com/plexsdk/http/ModelConverterTest.java
Normal file
39
src/test/java/com/plexsdk/http/ModelConverterTest.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package com.plexsdk.http;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.helpers.TestModel;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
public class ModelConverterTest {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Testing ModelConverter.modelToJson()")
|
||||||
|
public void testModelToJson() {
|
||||||
|
TestModel testModel = new TestModel("testString", 1, true);
|
||||||
|
String json = ModelConverter.modelToJson(testModel);
|
||||||
|
assertEquals(json, "{\"testString\":\"testString\",\"testInt\":1,\"testBoolean\":true}");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Testing ModelConverter.jsonToModel()")
|
||||||
|
public void testJsonToModel() {
|
||||||
|
String json = "{\"testString\":\"testString\",\"testInt\":1,\"testBoolean\":true}";
|
||||||
|
TestModel testModel = ModelConverter.convert(json, TestModel.class);
|
||||||
|
assertEquals(testModel.testString, "testString");
|
||||||
|
assertEquals(testModel.testInt, 1);
|
||||||
|
assertTrue(testModel.testBoolean);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@DisplayName("Testing ModelConverter.convert() and ModelConverter.modelToJson() are congruent")
|
||||||
|
public void congruency() {
|
||||||
|
TestModel testModel = new TestModel("testString", 1, true);
|
||||||
|
String json = ModelConverter.modelToJson(testModel);
|
||||||
|
TestModel testModel2 = ModelConverter.convert(json, TestModel.class);
|
||||||
|
assertEquals(testModel.testString, testModel2.testString);
|
||||||
|
assertEquals(testModel.testInt, testModel2.testInt);
|
||||||
|
assertTrue(testModel.testBoolean == testModel2.testBoolean);
|
||||||
|
}
|
||||||
|
}
|
||||||
131
src/test/java/com/plexsdk/models/ModelOneOfTests.java
Normal file
131
src/test/java/com/plexsdk/models/ModelOneOfTests.java
Normal file
@@ -0,0 +1,131 @@
|
|||||||
|
package com.plexsdk.models;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import utils.ArrayUtils;
|
||||||
|
|
||||||
|
public class ModelOneOfTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testWithEmptyObject() {
|
||||||
|
BaseModel.Builder builder = new BaseModel.Builder(BaseModel.Builder.ValidationType.ONE_OF) {
|
||||||
|
@Override
|
||||||
|
protected Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
return ArrayUtils.arrayToSet(new java.lang.String[] {});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Set<Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return ArrayUtils.arraysToSets(
|
||||||
|
new java.lang.String[][] { new java.lang.String[] { "foo", "bar", "baz" } }
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.assertEquals("Object fails OneOf validation.", builder.validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testWithEmptyObjectWithNoRequiredFields() {
|
||||||
|
BaseModel.Builder builder = new BaseModel.Builder(BaseModel.Builder.ValidationType.ONE_OF) {
|
||||||
|
@Override
|
||||||
|
protected Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
return ArrayUtils.arrayToSet(new java.lang.String[] {});
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Set<Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return ArrayUtils.arraysToSets(new java.lang.String[][] { new java.lang.String[] {} });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.assertNull(builder.validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testWithNoRequiredFields() {
|
||||||
|
BaseModel.Builder builder = new BaseModel.Builder(BaseModel.Builder.ValidationType.ONE_OF) {
|
||||||
|
@Override
|
||||||
|
protected Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
return ArrayUtils.arrayToSet(new java.lang.String[] { "foo", "bar", "baz" });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Set<Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return ArrayUtils.arraysToSets(new java.lang.String[][] {});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.assertNull(builder.validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testWithRequiredFieldsMatching() {
|
||||||
|
BaseModel.Builder builder = new BaseModel.Builder(BaseModel.Builder.ValidationType.ONE_OF) {
|
||||||
|
@Override
|
||||||
|
protected Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
return ArrayUtils.arrayToSet(new java.lang.String[] { "foo", "bar", "baz" });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Set<Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return ArrayUtils.arraysToSets(
|
||||||
|
new java.lang.String[][] {
|
||||||
|
new String[] { "fizz", "buzz" },
|
||||||
|
new String[] { "foo", "bar", "baz" },
|
||||||
|
new String[] { "fish" },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.assertNull(builder.validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testWithRequiredFieldsNotMatching() {
|
||||||
|
BaseModel.Builder builder = new BaseModel.Builder(BaseModel.Builder.ValidationType.ONE_OF) {
|
||||||
|
@Override
|
||||||
|
protected Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
return ArrayUtils.arrayToSet(new java.lang.String[] { "alpha", "bravo", "charlie" });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Set<Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return ArrayUtils.arraysToSets(
|
||||||
|
new java.lang.String[][] {
|
||||||
|
new String[] { "fizz", "buzz" },
|
||||||
|
new String[] { "foo", "bar", "baz" },
|
||||||
|
new String[] { "fish" },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.assertEquals("Object fails OneOf validation.", builder.validate());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void testWithRequiredFieldsPartiallyMatching() {
|
||||||
|
BaseModel.Builder builder = new BaseModel.Builder(BaseModel.Builder.ValidationType.ONE_OF) {
|
||||||
|
@Override
|
||||||
|
protected Set<String> getNonNullInstanceFieldNames() {
|
||||||
|
return ArrayUtils.arrayToSet(new java.lang.String[] { "foo", "bar", "charlie" });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Set<Set<String>> getRequiredFieldsGroups() {
|
||||||
|
return ArrayUtils.arraysToSets(
|
||||||
|
new java.lang.String[][] {
|
||||||
|
new String[] { "fizz", "buzz" },
|
||||||
|
new String[] { "foo", "bar", "baz" },
|
||||||
|
new String[] { "fish" },
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Assert.assertEquals("Object fails OneOf validation.", builder.validate());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class ActivitiesServiceTest {
|
||||||
|
// @ActivitiesServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Activities is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for getServerActivities
|
||||||
|
|
||||||
|
// TODO: Write tests for cancelServerActivities
|
||||||
|
|
||||||
|
}
|
||||||
12
src/test/java/com/plexsdk/services/BaseServiceTest.java
Normal file
12
src/test/java/com/plexsdk/services/BaseServiceTest.java
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
public class BaseServiceTest {
|
||||||
|
//@BaseServiceTest
|
||||||
|
//@DisplayName("BaseServiceTest that base service is working")
|
||||||
|
//public void test() {}
|
||||||
|
// TODO: Add base service test code here
|
||||||
|
}
|
||||||
25
src/test/java/com/plexsdk/services/ButlerServiceTest.java
Normal file
25
src/test/java/com/plexsdk/services/ButlerServiceTest.java
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class ButlerServiceTest {
|
||||||
|
// @ButlerServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Butler is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for getButlerTasks
|
||||||
|
|
||||||
|
// TODO: Write tests for startAllTasks
|
||||||
|
|
||||||
|
// TODO: Write tests for stopAllTasks
|
||||||
|
|
||||||
|
// TODO: Write tests for startTask
|
||||||
|
|
||||||
|
// TODO: Write tests for stopTask
|
||||||
|
|
||||||
|
}
|
||||||
19
src/test/java/com/plexsdk/services/HubsServiceTest.java
Normal file
19
src/test/java/com/plexsdk/services/HubsServiceTest.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class HubsServiceTest {
|
||||||
|
// @HubsServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Hubs is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for getGlobalHubs
|
||||||
|
|
||||||
|
// TODO: Write tests for getLibraryHubs
|
||||||
|
|
||||||
|
}
|
||||||
39
src/test/java/com/plexsdk/services/LibraryServiceTest.java
Normal file
39
src/test/java/com/plexsdk/services/LibraryServiceTest.java
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class LibraryServiceTest {
|
||||||
|
// @LibraryServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Library is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for getFileHash
|
||||||
|
|
||||||
|
// TODO: Write tests for getRecentlyAdded
|
||||||
|
|
||||||
|
// TODO: Write tests for getLibraries
|
||||||
|
|
||||||
|
// TODO: Write tests for getLibrary
|
||||||
|
|
||||||
|
// TODO: Write tests for deleteLibrary
|
||||||
|
|
||||||
|
// TODO: Write tests for getLibraryItems
|
||||||
|
|
||||||
|
// TODO: Write tests for refreshLibrary
|
||||||
|
|
||||||
|
// TODO: Write tests for getLatestLibraryItems
|
||||||
|
|
||||||
|
// TODO: Write tests for getCommonLibraryItems
|
||||||
|
|
||||||
|
// TODO: Write tests for getMetadata
|
||||||
|
|
||||||
|
// TODO: Write tests for getMetadataChildren
|
||||||
|
|
||||||
|
// TODO: Write tests for getOnDeck
|
||||||
|
|
||||||
|
}
|
||||||
21
src/test/java/com/plexsdk/services/LogServiceTest.java
Normal file
21
src/test/java/com/plexsdk/services/LogServiceTest.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class LogServiceTest {
|
||||||
|
// @LogServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Log is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for logLine
|
||||||
|
|
||||||
|
// TODO: Write tests for logMultiLine
|
||||||
|
|
||||||
|
// TODO: Write tests for enablePaperTrail
|
||||||
|
|
||||||
|
}
|
||||||
21
src/test/java/com/plexsdk/services/MediaServiceTest.java
Normal file
21
src/test/java/com/plexsdk/services/MediaServiceTest.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class MediaServiceTest {
|
||||||
|
// @MediaServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Media is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for markPlayed
|
||||||
|
|
||||||
|
// TODO: Write tests for markUnplayed
|
||||||
|
|
||||||
|
// TODO: Write tests for updatePlayProgress
|
||||||
|
|
||||||
|
}
|
||||||
33
src/test/java/com/plexsdk/services/PlaylistsServiceTest.java
Normal file
33
src/test/java/com/plexsdk/services/PlaylistsServiceTest.java
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class PlaylistsServiceTest {
|
||||||
|
// @PlaylistsServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Playlists is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for createPlaylist
|
||||||
|
|
||||||
|
// TODO: Write tests for getPlaylists
|
||||||
|
|
||||||
|
// TODO: Write tests for getPlaylist
|
||||||
|
|
||||||
|
// TODO: Write tests for updatePlaylist
|
||||||
|
|
||||||
|
// TODO: Write tests for deletePlaylist
|
||||||
|
|
||||||
|
// TODO: Write tests for getPlaylistContents
|
||||||
|
|
||||||
|
// TODO: Write tests for addPlaylistContents
|
||||||
|
|
||||||
|
// TODO: Write tests for clearPlaylistContents
|
||||||
|
|
||||||
|
// TODO: Write tests for uploadPlaylist
|
||||||
|
|
||||||
|
}
|
||||||
21
src/test/java/com/plexsdk/services/SearchServiceTest.java
Normal file
21
src/test/java/com/plexsdk/services/SearchServiceTest.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class SearchServiceTest {
|
||||||
|
// @SearchServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Search is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for performSearch
|
||||||
|
|
||||||
|
// TODO: Write tests for performVoiceSearch
|
||||||
|
|
||||||
|
// TODO: Write tests for getSearchResults
|
||||||
|
|
||||||
|
}
|
||||||
19
src/test/java/com/plexsdk/services/SecurityServiceTest.java
Normal file
19
src/test/java/com/plexsdk/services/SecurityServiceTest.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class SecurityServiceTest {
|
||||||
|
// @SecurityServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Security is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for getTransientToken
|
||||||
|
|
||||||
|
// TODO: Write tests for getSourceConnectionInformation
|
||||||
|
|
||||||
|
}
|
||||||
31
src/test/java/com/plexsdk/services/ServerServiceTest.java
Normal file
31
src/test/java/com/plexsdk/services/ServerServiceTest.java
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class ServerServiceTest {
|
||||||
|
// @ServerServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Server is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for getServerCapabilities
|
||||||
|
|
||||||
|
// TODO: Write tests for getServerPreferences
|
||||||
|
|
||||||
|
// TODO: Write tests for getAvailableClients
|
||||||
|
|
||||||
|
// TODO: Write tests for getDevices
|
||||||
|
|
||||||
|
// TODO: Write tests for getServerIdentity
|
||||||
|
|
||||||
|
// TODO: Write tests for getMyPlexAccount
|
||||||
|
|
||||||
|
// TODO: Write tests for getResizedPhoto
|
||||||
|
|
||||||
|
// TODO: Write tests for getServerList
|
||||||
|
|
||||||
|
}
|
||||||
23
src/test/java/com/plexsdk/services/SessionsServiceTest.java
Normal file
23
src/test/java/com/plexsdk/services/SessionsServiceTest.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class SessionsServiceTest {
|
||||||
|
// @SessionsServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Sessions is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for getSessions
|
||||||
|
|
||||||
|
// TODO: Write tests for getSessionHistory
|
||||||
|
|
||||||
|
// TODO: Write tests for getTranscodeSessions
|
||||||
|
|
||||||
|
// TODO: Write tests for stopTranscodeSession
|
||||||
|
|
||||||
|
}
|
||||||
21
src/test/java/com/plexsdk/services/UpdaterServiceTest.java
Normal file
21
src/test/java/com/plexsdk/services/UpdaterServiceTest.java
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
package com.plexsdk.services;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import com.plexsdk.models.*;
|
||||||
|
import org.junit.jupiter.api.*;
|
||||||
|
|
||||||
|
class UpdaterServiceTest {
|
||||||
|
// @UpdaterServiceTest
|
||||||
|
|
||||||
|
// @DisplayName("Test that Updater is working")
|
||||||
|
|
||||||
|
// public void test() {}
|
||||||
|
|
||||||
|
// TODO: Write tests for getUpdateStatus
|
||||||
|
|
||||||
|
// TODO: Write tests for checkForUpdates
|
||||||
|
|
||||||
|
// TODO: Write tests for applyUpdates
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user