mirror of
https://github.com/LukeHagar/plexjava.git
synced 2025-12-06 04:20:46 +00:00
ci: regenerated with OpenAPI Doc , Speakeasy CLI 1.404.5
This commit is contained in:
@@ -1,19 +1,19 @@
|
||||
lockVersion: 2.0.0
|
||||
id: 1732900d-e173-47c1-a90d-d45182eb35d9
|
||||
management:
|
||||
docChecksum: 5e039359563b41bbe118fc6701ba22dc
|
||||
docChecksum: e7673f3f46e5b0bf495c378378aa7ad6
|
||||
docVersion: 0.0.3
|
||||
speakeasyVersion: 1.402.14
|
||||
generationVersion: 2.422.22
|
||||
releaseVersion: 0.5.0
|
||||
configChecksum: 1e077922ecb4295a2f75526fffe0b239
|
||||
speakeasyVersion: 1.404.5
|
||||
generationVersion: 2.426.2
|
||||
releaseVersion: 0.6.0
|
||||
configChecksum: 3170f0dc35d813b7d5122d31a2dfaf65
|
||||
repoURL: https://github.com/LukeHagar/plexjava.git
|
||||
published: true
|
||||
features:
|
||||
java:
|
||||
additionalDependencies: 0.1.0
|
||||
constsAndDefaults: 0.1.1
|
||||
core: 3.30.2
|
||||
core: 3.30.3
|
||||
deprecations: 2.81.1
|
||||
downloadStreams: 0.1.1
|
||||
enums: 2.81.2
|
||||
@@ -28,6 +28,7 @@ features:
|
||||
nameOverrides: 2.81.3
|
||||
nullables: 0.1.0
|
||||
sdkHooks: 0.1.0
|
||||
tests: 0.1.0
|
||||
generatedFiles:
|
||||
- .gitattributes
|
||||
- CONTRIBUTING.md
|
||||
@@ -1713,6 +1714,22 @@ generatedFiles:
|
||||
- src/main/java/dev/plexapi/sdk/utils/TypedObject.java
|
||||
- src/main/java/dev/plexapi/sdk/utils/Types.java
|
||||
- src/main/java/dev/plexapi/sdk/utils/Utils.java
|
||||
- src/test/java/dev/plexapi/sdk/ActivitiesTests.java
|
||||
- src/test/java/dev/plexapi/sdk/AuthenticationTests.java
|
||||
- src/test/java/dev/plexapi/sdk/ButlerTests.java
|
||||
- src/test/java/dev/plexapi/sdk/HubsTests.java
|
||||
- src/test/java/dev/plexapi/sdk/LibraryTests.java
|
||||
- src/test/java/dev/plexapi/sdk/LogTests.java
|
||||
- src/test/java/dev/plexapi/sdk/MediaTests.java
|
||||
- src/test/java/dev/plexapi/sdk/PlaylistsTests.java
|
||||
- src/test/java/dev/plexapi/sdk/PlexTests.java
|
||||
- src/test/java/dev/plexapi/sdk/SearchTests.java
|
||||
- src/test/java/dev/plexapi/sdk/ServerTests.java
|
||||
- src/test/java/dev/plexapi/sdk/SessionsTests.java
|
||||
- src/test/java/dev/plexapi/sdk/StatisticsTests.java
|
||||
- src/test/java/dev/plexapi/sdk/UpdaterTests.java
|
||||
- src/test/java/dev/plexapi/sdk/VideoTests.java
|
||||
- src/test/java/dev/plexapi/sdk/WatchlistTests.java
|
||||
examples:
|
||||
getServerCapabilities:
|
||||
speakeasy-default-get-server-capabilities:
|
||||
@@ -2045,7 +2062,12 @@ examples:
|
||||
parameters:
|
||||
path:
|
||||
pinID: 408895
|
||||
query: {}
|
||||
query:
|
||||
X-Plex-Client-Identifier: "gcgzw5rz2xovp84b4vha3a40"
|
||||
X-Plex-Product: "Plex Web"
|
||||
X-Plex-Device: "Linux"
|
||||
X-Plex-Version: "4.133.0"
|
||||
X-Plex-Platform: "Chrome"
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"id": 308667304, "code": "7RQZ", "product": "0", "trusted": false, "qr": "https://plex.tv/api/v2/pins/qr/7RQZ", "clientIdentifier": "string", "location": {"code": "VI", "continent_code": "NA", "country": "United States Virgin Islands", "city": "Amsterdam", "european_union_member": true, "time_zone": "America/St_Thomas", "postal_code": 802, "in_privacy_restricted_country": true, "in_privacy_restricted_region": true, "subdivisions": "Saint Thomas", "coordinates": "18.3381, -64.8941"}, "expiresIn": 876, "createdAt": "2024-07-16T17:03:05Z", "expiresAt": "2024-07-16T17:18:05Z", "authToken": null, "newRegistration": null}
|
||||
@@ -2687,7 +2709,7 @@ examples:
|
||||
speakeasy-default-get-token-details:
|
||||
responses:
|
||||
"200":
|
||||
application/json: {"adsConsent": true, "adsConsentReminderAt": "2019-08-24T14:15:22Z", "adsConsentSetAt": "2019-08-24T14:15:22Z", "anonymous": false, "authToken": "CxoUzBTSV5hsxjTpFKaf", "backupCodesCreated": false, "confirmed": false, "country": "US", "email": "username@email.com", "emailOnlyAuth": false, "experimentalFeatures": false, "friendlyName": "friendlyUsername", "entitlements": ["[]"], "guest": false, "hasPassword": true, "home": false, "homeAdmin": false, "homeSize": 1, "id": 13692262, "joinedAt": 1556281940, "locale": null, "mailingListActive": false, "mailingListStatus": "unsubscribed", "maxHomeSize": 15, "pin": "string", "profile": {"autoSelectAudio": true, "defaultAudioLanguage": "ja", "defaultSubtitleLanguage": "en", "autoSelectSubtitle": 1, "defaultSubtitleAccessibility": 1, "defaultSubtitleForced": 1, "watchedIndicator": 1, "mediaReviewsVisibility": 1}, "protected": false, "rememberExpiresAt": 1556281940, "restricted": false, "roles": ["string"], "scrobbleTypes": "", "services": [{"identifier": "metadata-dev", "endpoint": "https://epg.provider.plex.tv", "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", "secret": "string", "status": "online"}], "subscription": {"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}, "subscriptionDescription": "string", "subscriptions": [{"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}], "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", "title": "UsernameTitle", "twoFactorEnabled": false, "username": "Username", "uuid": "dae343c1f45beb4f", "attributionPartner": null}
|
||||
application/json: {"adsConsent": true, "adsConsentReminderAt": "2019-08-24T14:15:22Z", "adsConsentSetAt": "2019-08-24T14:15:22Z", "anonymous": false, "authToken": "CxoUzBTSV5hsxjTpFKaf", "backupCodesCreated": false, "confirmed": false, "country": "US", "email": "username@email.com", "emailOnlyAuth": false, "experimentalFeatures": false, "friendlyName": "friendlyUsername", "entitlements": ["[]"], "guest": false, "hasPassword": true, "home": false, "homeAdmin": false, "homeSize": 1, "id": 13692262, "joinedAt": 1556281940, "locale": null, "mailingListActive": false, "mailingListStatus": "active", "maxHomeSize": 15, "pin": "string", "profile": {"autoSelectAudio": true, "defaultAudioLanguage": "ja", "defaultSubtitleLanguage": "en", "autoSelectSubtitle": 1, "defaultSubtitleAccessibility": 1, "defaultSubtitleForced": 1, "watchedIndicator": 1, "mediaReviewsVisibility": 1}, "protected": false, "rememberExpiresAt": 1556281940, "restricted": false, "roles": ["string"], "scrobbleTypes": "", "services": [{"identifier": "metadata-dev", "endpoint": "https://epg.provider.plex.tv", "token": "DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv", "secret": "string", "status": "online"}], "subscription": {"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}, "subscriptionDescription": "string", "subscriptions": [{"features": ["Android - Dolby Vision"], "active": true, "subscribedAt": "2021-04-12T18:21:12Z", "status": "Inactive", "paymentService": "string", "plan": "string"}], "thumb": "https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101", "title": "UsernameTitle", "twoFactorEnabled": false, "username": "Username", "uuid": "dae343c1f45beb4f", "attributionPartner": null}
|
||||
"400":
|
||||
application/json: {"errors": []}
|
||||
"401":
|
||||
|
||||
@@ -12,7 +12,7 @@ generation:
|
||||
auth:
|
||||
oAuth2ClientCredentialsEnabled: true
|
||||
java:
|
||||
version: 0.5.0
|
||||
version: 0.6.0
|
||||
additionalDependencies: []
|
||||
additionalPlugins: []
|
||||
artifactID: plexapi
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
speakeasyVersion: 1.402.14
|
||||
speakeasyVersion: 1.404.5
|
||||
sources:
|
||||
my-source:
|
||||
sourceNamespace: my-source
|
||||
@@ -8,8 +8,8 @@ sources:
|
||||
- latest
|
||||
plexapi:
|
||||
sourceNamespace: plexapi
|
||||
sourceRevisionDigest: sha256:b7081644a59eca24a22b8009506fcf459bf18b07dce0462b39bc36c40d94862e
|
||||
sourceBlobDigest: sha256:6b822f23afbc630bbc0fc12299316ea03d3671a2c2a81241ad4caa49022b430e
|
||||
sourceRevisionDigest: sha256:276a31ab98595ebaf2b1fac4b4f5c3c1c7b55e0431f9074c89b8fbcb55b52d3f
|
||||
sourceBlobDigest: sha256:2bc9e816db669d609d8a5988ebb629578dc5cbbaff191d260b5c63b7ba1bd59b
|
||||
tags:
|
||||
- latest
|
||||
- main
|
||||
@@ -17,10 +17,10 @@ targets:
|
||||
plexjava:
|
||||
source: plexapi
|
||||
sourceNamespace: plexapi
|
||||
sourceRevisionDigest: sha256:b7081644a59eca24a22b8009506fcf459bf18b07dce0462b39bc36c40d94862e
|
||||
sourceBlobDigest: sha256:6b822f23afbc630bbc0fc12299316ea03d3671a2c2a81241ad4caa49022b430e
|
||||
sourceRevisionDigest: sha256:276a31ab98595ebaf2b1fac4b4f5c3c1c7b55e0431f9074c89b8fbcb55b52d3f
|
||||
sourceBlobDigest: sha256:2bc9e816db669d609d8a5988ebb629578dc5cbbaff191d260b5c63b7ba1bd59b
|
||||
codeSamplesNamespace: code-samples-java-plexjava
|
||||
codeSamplesRevisionDigest: sha256:2b2011bee7f3ca4e29ec8c4fad1295a7c10ae37f6f6da7034d7aa919591f58ca
|
||||
codeSamplesRevisionDigest: sha256:4286e602eb7c7bb7994a5820d46e703830d79724b86399aac3a75e9f2994c975
|
||||
workflow:
|
||||
workflowVersion: 1.0.0
|
||||
speakeasyVersion: latest
|
||||
|
||||
31
README.md
31
README.md
@@ -12,6 +12,31 @@
|
||||
## Summary
|
||||
|
||||
Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server
|
||||
|
||||
# Plex Media Server OpenAPI Specification
|
||||
|
||||
An Open Source OpenAPI Specification for Plex Media Server
|
||||
|
||||
Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)
|
||||
|
||||
## Documentation
|
||||
|
||||
[API Documentation](https://plexapi.dev)
|
||||
|
||||
## SDKs
|
||||
|
||||
The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the respective repository.
|
||||
|
||||
| Language | Repository | Releases | Other |
|
||||
| --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
|
||||
| Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - |
|
||||
| JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - |
|
||||
| Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |
|
||||
| Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - |
|
||||
| Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - |
|
||||
| PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - |
|
||||
| Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - |
|
||||
| C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | -
|
||||
<!-- End Summary [summary] -->
|
||||
|
||||
<!-- Start Table of Contents [toc] -->
|
||||
@@ -37,7 +62,7 @@ The samples below show how a published SDK artifact is used:
|
||||
|
||||
Gradle:
|
||||
```groovy
|
||||
implementation 'dev.plexapi:plexapi:0.5.0'
|
||||
implementation 'dev.plexapi:plexapi:0.6.0'
|
||||
```
|
||||
|
||||
Maven:
|
||||
@@ -45,7 +70,7 @@ Maven:
|
||||
<dependency>
|
||||
<groupId>dev.plexapi</groupId>
|
||||
<artifactId>plexapi</artifactId>
|
||||
<version>0.5.0</version>
|
||||
<version>0.6.0</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
@@ -458,7 +483,7 @@ public class Application {
|
||||
.build();
|
||||
|
||||
GetCompanionsDataResponse res = sdk.plex().getCompanionsData()
|
||||
.serverURL("https://plex.tv/api/v2/")
|
||||
.serverURL("https://plex.tv/api/v2")
|
||||
.call();
|
||||
|
||||
if (res.responseBodies().isPresent()) {
|
||||
|
||||
10
RELEASES.md
10
RELEASES.md
@@ -99,3 +99,13 @@ Based on:
|
||||
- [java v0.5.0] .
|
||||
### Releases
|
||||
- [Maven Central v0.5.0] https://central.sonatype.com/artifact/dev.plexapi/plexapi/0.5.0 - .
|
||||
|
||||
## 2024-09-28 00:25:08
|
||||
### Changes
|
||||
Based on:
|
||||
- OpenAPI Doc
|
||||
- Speakeasy CLI 1.404.5 (2.426.2) https://github.com/speakeasy-api/speakeasy
|
||||
### Generated
|
||||
- [java v0.6.0] .
|
||||
### Releases
|
||||
- [Maven Central v0.6.0] https://central.sonatype.com/artifact/dev.plexapi/plexapi/0.6.0 - .
|
||||
@@ -63,7 +63,7 @@ tasks.withType(Javadoc) {
|
||||
}
|
||||
|
||||
group = "dev.plexapi"
|
||||
version = "0.5.0"
|
||||
version = "0.6.0"
|
||||
|
||||
sourcesJar {
|
||||
archiveBaseName = "plexapi"
|
||||
@@ -101,7 +101,7 @@ publishing {
|
||||
maven(MavenPublication) {
|
||||
groupId = 'dev.plexapi'
|
||||
artifactId = 'plexapi'
|
||||
version = '0.5.0'
|
||||
version = '0.6.0'
|
||||
|
||||
from components.java
|
||||
|
||||
@@ -152,6 +152,9 @@ dependencies {
|
||||
implementation 'org.apache.httpcomponents:httpclient:4.5.14'
|
||||
implementation 'org.apache.httpcomponents:httpmime:4.5.14'
|
||||
implementation 'commons-io:commons-io:2.15.1'
|
||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.10.2'
|
||||
testImplementation 'org.mockito:mockito-core:5.12.0'
|
||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.10.2'
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1790,6 +1790,7 @@ actions:
|
||||
import dev.plexapi.plexapi.PlexAPI;
|
||||
import dev.plexapi.plexapi.models.errors.GetTokenByPinIdBadRequest;
|
||||
import dev.plexapi.plexapi.models.errors.GetTokenByPinIdResponseBody;
|
||||
import dev.plexapi.plexapi.models.operations.GetTokenByPinIdRequest;
|
||||
import dev.plexapi.plexapi.models.operations.GetTokenByPinIdResponse;
|
||||
import java.lang.Exception;
|
||||
|
||||
@@ -1805,8 +1806,12 @@ actions:
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetTokenByPinIdResponse res = sdk.plex().getTokenByPinId()
|
||||
GetTokenByPinIdRequest req = GetTokenByPinIdRequest.builder()
|
||||
.pinID(408895L)
|
||||
.build();
|
||||
|
||||
GetTokenByPinIdResponse res = sdk.plex().getTokenByPinId()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
if (res.authPinContainer().isPresent()) {
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| `protocol` | [Protocol](../../models/operations/Protocol.md) | :heavy_check_mark: | The protocol used for the connection (http, https, etc) |
|
||||
| `address` | *String* | :heavy_check_mark: | The (ip) address or domain name used for the connection |
|
||||
| `port` | *int* | :heavy_check_mark: | The port used for the connection |
|
||||
| `uri` | *String* | :heavy_check_mark: | The full URI of the connection |
|
||||
| `local` | *boolean* | :heavy_check_mark: | If the connection is local address |
|
||||
| `relay` | *boolean* | :heavy_check_mark: | If the connection is relayed through plex.direct |
|
||||
| `iPv6` | *boolean* | :heavy_check_mark: | If the connection is using IPv6 |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------- |
|
||||
| `protocol` | [Protocol](../../models/operations/Protocol.md) | :heavy_check_mark: | The protocol used for the connection (http, https, etc) | http |
|
||||
| `address` | *String* | :heavy_check_mark: | The (ip) address or domain name used for the connection | |
|
||||
| `port` | *int* | :heavy_check_mark: | The port used for the connection | |
|
||||
| `uri` | *String* | :heavy_check_mark: | The full URI of the connection | |
|
||||
| `local` | *boolean* | :heavy_check_mark: | If the connection is local address | |
|
||||
| `relay` | *boolean* | :heavy_check_mark: | If the connection is relayed through plex.direct | |
|
||||
| `iPv6` | *boolean* | :heavy_check_mark: | If the connection is using IPv6 | |
|
||||
@@ -3,6 +3,11 @@
|
||||
|
||||
## Fields
|
||||
|
||||
| Field | Type | Required | Description |
|
||||
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
||||
| `pinID` | *long* | :heavy_check_mark: | The PinID to retrieve an access token for |
|
||||
| Field | Type | Required | Description | Example |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
||||
| `pinID` | *long* | :heavy_check_mark: | The PinID to retrieve an access token for | |
|
||||
| `clientID` | *Optional<String>* | :heavy_minus_sign: | The unique identifier for the client application<br/>This is used to track the client application and its usage<br/>(UUID, serial number, or other number unique per device)<br/> | gcgzw5rz2xovp84b4vha3a40 |
|
||||
| `clientName` | *Optional<String>* | :heavy_minus_sign: | N/A | Plex Web |
|
||||
| `deviceName` | *Optional<String>* | :heavy_minus_sign: | N/A | Linux |
|
||||
| `clientVersion` | *Optional<String>* | :heavy_minus_sign: | N/A | 4.133.0 |
|
||||
| `clientPlatform` | *Optional<String>* | :heavy_minus_sign: | N/A | Chrome |
|
||||
@@ -29,7 +29,7 @@ Logged in user details
|
||||
| `joinedAt` | *long* | :heavy_check_mark: | Unix epoch datetime in seconds | 1556281940 |
|
||||
| `locale` | *Optional<String>* | :heavy_check_mark: | The account locale | |
|
||||
| `mailingListActive` | *Optional<Boolean>* | :heavy_minus_sign: | If you are subscribed to the Plex newsletter | |
|
||||
| `mailingListStatus` | [MailingListStatus](../../models/operations/MailingListStatus.md) | :heavy_check_mark: | Your current mailing list status | |
|
||||
| `mailingListStatus` | [MailingListStatus](../../models/operations/MailingListStatus.md) | :heavy_check_mark: | Your current mailing list status (active or unsubscribed) | active |
|
||||
| `maxHomeSize` | *int* | :heavy_check_mark: | The maximum number of accounts allowed in the Plex Home | 15 |
|
||||
| ~~`pin`~~ | *Optional<String>* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.<br/><br/>[Might be removed] The hashed Plex Home PIN | |
|
||||
| `profile` | [UserProfile](../../models/operations/UserProfile.md) | :heavy_check_mark: | N/A | |
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# MailingListStatus
|
||||
|
||||
Your current mailing list status
|
||||
Your current mailing list status (active or unsubscribed)
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# PostUsersSignInDataMailingListStatus
|
||||
|
||||
Your current mailing list status
|
||||
Your current mailing list status (active or unsubscribed)
|
||||
|
||||
|
||||
## Values
|
||||
|
||||
@@ -29,7 +29,7 @@ Returns the user account data with a valid auth token
|
||||
| `joinedAt` | *long* | :heavy_check_mark: | Unix epoch datetime in seconds | 1556281940 |
|
||||
| `locale` | *Optional<String>* | :heavy_check_mark: | The account locale | |
|
||||
| `mailingListActive` | *Optional<Boolean>* | :heavy_minus_sign: | If you are subscribed to the Plex newsletter | |
|
||||
| `mailingListStatus` | [PostUsersSignInDataMailingListStatus](../../models/operations/PostUsersSignInDataMailingListStatus.md) | :heavy_check_mark: | Your current mailing list status | |
|
||||
| `mailingListStatus` | [PostUsersSignInDataMailingListStatus](../../models/operations/PostUsersSignInDataMailingListStatus.md) | :heavy_check_mark: | Your current mailing list status (active or unsubscribed) | active |
|
||||
| `maxHomeSize` | *int* | :heavy_check_mark: | The maximum number of accounts allowed in the Plex Home | 15 |
|
||||
| ~~`pin`~~ | *Optional<String>* | :heavy_minus_sign: | : warning: ** DEPRECATED **: This will be removed in a future release, please migrate away from it as soon as possible.<br/><br/>[Might be removed] The hashed Plex Home PIN | |
|
||||
| `profile` | [PostUsersSignInDataUserProfile](../../models/operations/PostUsersSignInDataUserProfile.md) | :heavy_check_mark: | N/A | |
|
||||
|
||||
@@ -375,6 +375,7 @@ package hello.world;
|
||||
import dev.plexapi.sdk.PlexAPI;
|
||||
import dev.plexapi.sdk.models.errors.GetTokenByPinIdBadRequest;
|
||||
import dev.plexapi.sdk.models.errors.GetTokenByPinIdResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenByPinIdRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenByPinIdResponse;
|
||||
import java.lang.Exception;
|
||||
|
||||
@@ -390,8 +391,12 @@ public class Application {
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetTokenByPinIdResponse res = sdk.plex().getTokenByPinId()
|
||||
GetTokenByPinIdRequest req = GetTokenByPinIdRequest.builder()
|
||||
.pinID(408895L)
|
||||
.build();
|
||||
|
||||
GetTokenByPinIdResponse res = sdk.plex().getTokenByPinId()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
if (res.authPinContainer().isPresent()) {
|
||||
@@ -404,8 +409,8 @@ public class Application {
|
||||
### Parameters
|
||||
|
||||
| Parameter | Type | Required | Description |
|
||||
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------- | ----------------------------------------- |
|
||||
| `pinID` | *long* | :heavy_check_mark: | The PinID to retrieve an access token for |
|
||||
| --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
||||
| `request` | [GetTokenByPinIdRequest](../../models/operations/GetTokenByPinIdRequest.md) | :heavy_check_mark: | The request object to use for the request. |
|
||||
| `serverURL` | *String* | :heavy_minus_sign: | An optional server URL to use. |
|
||||
|
||||
### Response
|
||||
|
||||
@@ -2,4 +2,27 @@
|
||||
|
||||
## Overview
|
||||
|
||||
Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server
|
||||
# Plex Media Server OpenAPI Specification
|
||||
|
||||
An Open Source OpenAPI Specification for Plex Media Server
|
||||
|
||||
Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)
|
||||
|
||||
## Documentation
|
||||
|
||||
[API Documentation](https://plexapi.dev)
|
||||
|
||||
## SDKs
|
||||
|
||||
The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the respective repository.
|
||||
|
||||
| Language | Repository | Releases | Other |
|
||||
| --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
|
||||
| Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - |
|
||||
| JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - |
|
||||
| Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |
|
||||
| Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - |
|
||||
| Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - |
|
||||
| PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - |
|
||||
| Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - |
|
||||
| C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | -
|
||||
|
||||
@@ -62,14 +62,14 @@ public class Authentication implements
|
||||
* GET_TOKEN_DETAILS_SERVERS contains the list of server urls available to the SDK.
|
||||
*/
|
||||
public static final String[] GET_TOKEN_DETAILS_SERVERS = {
|
||||
"https://plex.tv/api/v2/",
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
|
||||
/**
|
||||
* POST_USERS_SIGN_IN_DATA_SERVERS contains the list of server urls available to the SDK.
|
||||
*/
|
||||
public static final String[] POST_USERS_SIGN_IN_DATA_SERVERS = {
|
||||
"https://plex.tv/api/v2/",
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
|
||||
private final SDKConfiguration sdkConfiguration;
|
||||
|
||||
@@ -79,42 +79,42 @@ public class Plex implements
|
||||
* GET_COMPANIONS_DATA_SERVERS contains the list of server urls available to the SDK.
|
||||
*/
|
||||
public static final String[] GET_COMPANIONS_DATA_SERVERS = {
|
||||
"https://plex.tv/api/v2/",
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
|
||||
/**
|
||||
* GET_USER_FRIENDS_SERVERS contains the list of server urls available to the SDK.
|
||||
*/
|
||||
public static final String[] GET_USER_FRIENDS_SERVERS = {
|
||||
"https://plex.tv/api/v2/",
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
|
||||
/**
|
||||
* GET_GEO_DATA_SERVERS contains the list of server urls available to the SDK.
|
||||
*/
|
||||
public static final String[] GET_GEO_DATA_SERVERS = {
|
||||
"https://plex.tv/api/v2/",
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
|
||||
/**
|
||||
* GET_SERVER_RESOURCES_SERVERS contains the list of server urls available to the SDK.
|
||||
*/
|
||||
public static final String[] GET_SERVER_RESOURCES_SERVERS = {
|
||||
"https://plex.tv/api/v2/",
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
|
||||
/**
|
||||
* GET_PIN_SERVERS contains the list of server urls available to the SDK.
|
||||
*/
|
||||
public static final String[] GET_PIN_SERVERS = {
|
||||
"https://plex.tv/api/v2/",
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
|
||||
/**
|
||||
* GET_TOKEN_BY_PIN_ID_SERVERS contains the list of server urls available to the SDK.
|
||||
*/
|
||||
public static final String[] GET_TOKEN_BY_PIN_ID_SERVERS = {
|
||||
"https://plex.tv/api/v2/",
|
||||
"https://plex.tv/api/v2",
|
||||
};
|
||||
|
||||
private final SDKConfiguration sdkConfiguration;
|
||||
@@ -1096,32 +1096,26 @@ public class Plex implements
|
||||
/**
|
||||
* Get Access Token by PinId
|
||||
* Retrieve an Access Token from Plex.tv after the Pin has been authenticated
|
||||
* @param pinID The PinID to retrieve an access token for
|
||||
* @param request The request object containing all of the parameters for the API call.
|
||||
* @return The response from the API call
|
||||
* @throws Exception if the API call fails
|
||||
*/
|
||||
public GetTokenByPinIdResponse getTokenByPinId(
|
||||
long pinID) throws Exception {
|
||||
return getTokenByPinId(pinID, Optional.empty());
|
||||
GetTokenByPinIdRequest request) throws Exception {
|
||||
return getTokenByPinId(request, Optional.empty());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Access Token by PinId
|
||||
* Retrieve an Access Token from Plex.tv after the Pin has been authenticated
|
||||
* @param pinID The PinID to retrieve an access token for
|
||||
* @param request The request object containing all of the parameters for the API call.
|
||||
* @param serverURL Overrides the server URL.
|
||||
* @return The response from the API call
|
||||
* @throws Exception if the API call fails
|
||||
*/
|
||||
public GetTokenByPinIdResponse getTokenByPinId(
|
||||
long pinID,
|
||||
GetTokenByPinIdRequest request,
|
||||
Optional<String> serverURL) throws Exception {
|
||||
GetTokenByPinIdRequest request =
|
||||
GetTokenByPinIdRequest
|
||||
.builder()
|
||||
.pinID(pinID)
|
||||
.build();
|
||||
|
||||
String _baseUrl = Utils.templateUrl(GET_TOKEN_BY_PIN_ID_SERVERS[0], new HashMap<String, String>());
|
||||
if (serverURL.isPresent() && !serverURL.get().isBlank()) {
|
||||
_baseUrl = serverURL.get();
|
||||
@@ -1137,6 +1131,11 @@ public class Plex implements
|
||||
.addHeader("user-agent",
|
||||
SDKConfiguration.USER_AGENT);
|
||||
|
||||
_req.addQueryParams(Utils.getQueryParams(
|
||||
GetTokenByPinIdRequest.class,
|
||||
request,
|
||||
this.sdkConfiguration.globals));
|
||||
|
||||
HTTPClient _client = this.sdkConfiguration.defaultClient;
|
||||
HttpRequest _r =
|
||||
sdkConfiguration.hooks()
|
||||
|
||||
@@ -16,6 +16,31 @@ import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server
|
||||
* # Plex Media Server OpenAPI Specification
|
||||
*
|
||||
* An Open Source OpenAPI Specification for Plex Media Server
|
||||
*
|
||||
* Automation and SDKs provided by [Speakeasy](https://speakeasyapi.dev/)
|
||||
*
|
||||
* ## Documentation
|
||||
*
|
||||
* [API Documentation](https://plexapi.dev)
|
||||
*
|
||||
* ## SDKs
|
||||
*
|
||||
* The following SDKs are generated from the OpenAPI Specification. They are automatically generated and may not be fully tested. If you find any issues, please open an issue on the respective repository.
|
||||
*
|
||||
* | Language | Repository | Releases | Other |
|
||||
* | --------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------- |
|
||||
* | Python | [GitHub](https://github.com/LukeHagar/plexpy) | [PyPI](https://pypi.org/project/plex-api-client/) | - |
|
||||
* | JavaScript/TypeScript | [GitHub](https://github.com/LukeHagar/plexjs) | [NPM](https://www.npmjs.com/package/@lukehagar/plexjs) \ [JSR](https://jsr.io/@lukehagar/plexjs) | - |
|
||||
* | Go | [GitHub](https://github.com/LukeHagar/plexgo) | [Releases](https://github.com/LukeHagar/plexgo/releases) | [GoDoc](https://pkg.go.dev/github.com/LukeHagar/plexgo) |
|
||||
* | Ruby | [GitHub](https://github.com/LukeHagar/plexruby) | [Releases](https://github.com/LukeHagar/plexruby/releases) | - |
|
||||
* | Swift | [GitHub](https://github.com/LukeHagar/plexswift) | [Releases](https://github.com/LukeHagar/plexswift/releases) | - |
|
||||
* | PHP | [GitHub](https://github.com/LukeHagar/plexphp) | [Releases](https://github.com/LukeHagar/plexphp/releases) | - |
|
||||
* | Java | [GitHub](https://github.com/LukeHagar/plexjava) | [Releases](https://github.com/LukeHagar/plexjava/releases) | - |
|
||||
* | C# | [GitHub](https://github.com/LukeHagar/plexcsharp) | [Releases](https://github.com/LukeHagar/plexcsharp/releases) | -
|
||||
*
|
||||
*/
|
||||
public class PlexAPI {
|
||||
|
||||
|
||||
@@ -36,8 +36,8 @@ class SDKConfiguration {
|
||||
} };
|
||||
private static final String LANGUAGE = "java";
|
||||
public static final String OPENAPI_DOC_VERSION = "0.0.3";
|
||||
public static final String SDK_VERSION = "0.5.0";
|
||||
public static final String GEN_VERSION = "2.422.22";
|
||||
public static final String SDK_VERSION = "0.6.0";
|
||||
public static final String GEN_VERSION = "2.426.2";
|
||||
private static final String BASE_PACKAGE = "dev.plexapi.sdk";
|
||||
public static final String USER_AGENT =
|
||||
String.format("speakeasy-sdk/%s %s %s %s %s",
|
||||
|
||||
@@ -13,6 +13,7 @@ import java.lang.Long;
|
||||
import java.lang.Override;
|
||||
import java.lang.String;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
|
||||
public class GetTokenByPinIdRequest {
|
||||
@@ -23,11 +24,52 @@ public class GetTokenByPinIdRequest {
|
||||
@SpeakeasyMetadata("pathParam:style=simple,explode=false,name=pinID")
|
||||
private long pinID;
|
||||
|
||||
/**
|
||||
* The unique identifier for the client application
|
||||
* This is used to track the client application and its usage
|
||||
* (UUID, serial number, or other number unique per device)
|
||||
*
|
||||
*/
|
||||
@SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Client-Identifier")
|
||||
private Optional<String> clientID;
|
||||
|
||||
@SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Product")
|
||||
private Optional<String> clientName;
|
||||
|
||||
@SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Device")
|
||||
private Optional<String> deviceName;
|
||||
|
||||
@SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Version")
|
||||
private Optional<String> clientVersion;
|
||||
|
||||
@SpeakeasyMetadata("queryParam:style=form,explode=true,name=X-Plex-Platform")
|
||||
private Optional<String> clientPlatform;
|
||||
|
||||
@JsonCreator
|
||||
public GetTokenByPinIdRequest(
|
||||
long pinID) {
|
||||
long pinID,
|
||||
Optional<String> clientID,
|
||||
Optional<String> clientName,
|
||||
Optional<String> deviceName,
|
||||
Optional<String> clientVersion,
|
||||
Optional<String> clientPlatform) {
|
||||
Utils.checkNotNull(pinID, "pinID");
|
||||
Utils.checkNotNull(clientID, "clientID");
|
||||
Utils.checkNotNull(clientName, "clientName");
|
||||
Utils.checkNotNull(deviceName, "deviceName");
|
||||
Utils.checkNotNull(clientVersion, "clientVersion");
|
||||
Utils.checkNotNull(clientPlatform, "clientPlatform");
|
||||
this.pinID = pinID;
|
||||
this.clientID = clientID;
|
||||
this.clientName = clientName;
|
||||
this.deviceName = deviceName;
|
||||
this.clientVersion = clientVersion;
|
||||
this.clientPlatform = clientPlatform;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest(
|
||||
long pinID) {
|
||||
this(pinID, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -38,6 +80,37 @@ public class GetTokenByPinIdRequest {
|
||||
return pinID;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier for the client application
|
||||
* This is used to track the client application and its usage
|
||||
* (UUID, serial number, or other number unique per device)
|
||||
*
|
||||
*/
|
||||
@JsonIgnore
|
||||
public Optional<String> clientID() {
|
||||
return clientID;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Optional<String> clientName() {
|
||||
return clientName;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Optional<String> deviceName() {
|
||||
return deviceName;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Optional<String> clientVersion() {
|
||||
return clientVersion;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Optional<String> clientPlatform() {
|
||||
return clientPlatform;
|
||||
}
|
||||
|
||||
public final static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
@@ -51,6 +124,78 @@ public class GetTokenByPinIdRequest {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier for the client application
|
||||
* This is used to track the client application and its usage
|
||||
* (UUID, serial number, or other number unique per device)
|
||||
*
|
||||
*/
|
||||
public GetTokenByPinIdRequest withClientID(String clientID) {
|
||||
Utils.checkNotNull(clientID, "clientID");
|
||||
this.clientID = Optional.ofNullable(clientID);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier for the client application
|
||||
* This is used to track the client application and its usage
|
||||
* (UUID, serial number, or other number unique per device)
|
||||
*
|
||||
*/
|
||||
public GetTokenByPinIdRequest withClientID(Optional<String> clientID) {
|
||||
Utils.checkNotNull(clientID, "clientID");
|
||||
this.clientID = clientID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest withClientName(String clientName) {
|
||||
Utils.checkNotNull(clientName, "clientName");
|
||||
this.clientName = Optional.ofNullable(clientName);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest withClientName(Optional<String> clientName) {
|
||||
Utils.checkNotNull(clientName, "clientName");
|
||||
this.clientName = clientName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest withDeviceName(String deviceName) {
|
||||
Utils.checkNotNull(deviceName, "deviceName");
|
||||
this.deviceName = Optional.ofNullable(deviceName);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest withDeviceName(Optional<String> deviceName) {
|
||||
Utils.checkNotNull(deviceName, "deviceName");
|
||||
this.deviceName = deviceName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest withClientVersion(String clientVersion) {
|
||||
Utils.checkNotNull(clientVersion, "clientVersion");
|
||||
this.clientVersion = Optional.ofNullable(clientVersion);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest withClientVersion(Optional<String> clientVersion) {
|
||||
Utils.checkNotNull(clientVersion, "clientVersion");
|
||||
this.clientVersion = clientVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest withClientPlatform(String clientPlatform) {
|
||||
Utils.checkNotNull(clientPlatform, "clientPlatform");
|
||||
this.clientPlatform = Optional.ofNullable(clientPlatform);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest withClientPlatform(Optional<String> clientPlatform) {
|
||||
Utils.checkNotNull(clientPlatform, "clientPlatform");
|
||||
this.clientPlatform = clientPlatform;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(java.lang.Object o) {
|
||||
if (this == o) {
|
||||
@@ -61,25 +206,50 @@ public class GetTokenByPinIdRequest {
|
||||
}
|
||||
GetTokenByPinIdRequest other = (GetTokenByPinIdRequest) o;
|
||||
return
|
||||
Objects.deepEquals(this.pinID, other.pinID);
|
||||
Objects.deepEquals(this.pinID, other.pinID) &&
|
||||
Objects.deepEquals(this.clientID, other.clientID) &&
|
||||
Objects.deepEquals(this.clientName, other.clientName) &&
|
||||
Objects.deepEquals(this.deviceName, other.deviceName) &&
|
||||
Objects.deepEquals(this.clientVersion, other.clientVersion) &&
|
||||
Objects.deepEquals(this.clientPlatform, other.clientPlatform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(
|
||||
pinID);
|
||||
pinID,
|
||||
clientID,
|
||||
clientName,
|
||||
deviceName,
|
||||
clientVersion,
|
||||
clientPlatform);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Utils.toString(GetTokenByPinIdRequest.class,
|
||||
"pinID", pinID);
|
||||
"pinID", pinID,
|
||||
"clientID", clientID,
|
||||
"clientName", clientName,
|
||||
"deviceName", deviceName,
|
||||
"clientVersion", clientVersion,
|
||||
"clientPlatform", clientPlatform);
|
||||
}
|
||||
|
||||
public final static class Builder {
|
||||
|
||||
private Long pinID;
|
||||
|
||||
private Optional<String> clientID = Optional.empty();
|
||||
|
||||
private Optional<String> clientName = Optional.empty();
|
||||
|
||||
private Optional<String> deviceName = Optional.empty();
|
||||
|
||||
private Optional<String> clientVersion = Optional.empty();
|
||||
|
||||
private Optional<String> clientPlatform = Optional.empty();
|
||||
|
||||
private Builder() {
|
||||
// force use of static builder() method
|
||||
}
|
||||
@@ -93,9 +263,86 @@ public class GetTokenByPinIdRequest {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier for the client application
|
||||
* This is used to track the client application and its usage
|
||||
* (UUID, serial number, or other number unique per device)
|
||||
*
|
||||
*/
|
||||
public Builder clientID(String clientID) {
|
||||
Utils.checkNotNull(clientID, "clientID");
|
||||
this.clientID = Optional.ofNullable(clientID);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The unique identifier for the client application
|
||||
* This is used to track the client application and its usage
|
||||
* (UUID, serial number, or other number unique per device)
|
||||
*
|
||||
*/
|
||||
public Builder clientID(Optional<String> clientID) {
|
||||
Utils.checkNotNull(clientID, "clientID");
|
||||
this.clientID = clientID;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clientName(String clientName) {
|
||||
Utils.checkNotNull(clientName, "clientName");
|
||||
this.clientName = Optional.ofNullable(clientName);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clientName(Optional<String> clientName) {
|
||||
Utils.checkNotNull(clientName, "clientName");
|
||||
this.clientName = clientName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder deviceName(String deviceName) {
|
||||
Utils.checkNotNull(deviceName, "deviceName");
|
||||
this.deviceName = Optional.ofNullable(deviceName);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder deviceName(Optional<String> deviceName) {
|
||||
Utils.checkNotNull(deviceName, "deviceName");
|
||||
this.deviceName = deviceName;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clientVersion(String clientVersion) {
|
||||
Utils.checkNotNull(clientVersion, "clientVersion");
|
||||
this.clientVersion = Optional.ofNullable(clientVersion);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clientVersion(Optional<String> clientVersion) {
|
||||
Utils.checkNotNull(clientVersion, "clientVersion");
|
||||
this.clientVersion = clientVersion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clientPlatform(String clientPlatform) {
|
||||
Utils.checkNotNull(clientPlatform, "clientPlatform");
|
||||
this.clientPlatform = Optional.ofNullable(clientPlatform);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder clientPlatform(Optional<String> clientPlatform) {
|
||||
Utils.checkNotNull(clientPlatform, "clientPlatform");
|
||||
this.clientPlatform = clientPlatform;
|
||||
return this;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequest build() {
|
||||
return new GetTokenByPinIdRequest(
|
||||
pinID);
|
||||
pinID,
|
||||
clientID,
|
||||
clientName,
|
||||
deviceName,
|
||||
clientVersion,
|
||||
clientPlatform);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
package dev.plexapi.sdk.models.operations;
|
||||
|
||||
import dev.plexapi.sdk.utils.Utils;
|
||||
import java.lang.Long;
|
||||
import java.lang.String;
|
||||
import java.util.Optional;
|
||||
|
||||
public class GetTokenByPinIdRequestBuilder {
|
||||
|
||||
private Long pinID;
|
||||
private GetTokenByPinIdRequest request;
|
||||
private Optional<String> serverURL = Optional.empty();
|
||||
private final SDKMethodInterfaces.MethodCallGetTokenByPinId sdk;
|
||||
|
||||
@@ -19,9 +18,9 @@ public class GetTokenByPinIdRequestBuilder {
|
||||
this.sdk = sdk;
|
||||
}
|
||||
|
||||
public GetTokenByPinIdRequestBuilder pinID(long pinID) {
|
||||
Utils.checkNotNull(pinID, "pinID");
|
||||
this.pinID = pinID;
|
||||
public GetTokenByPinIdRequestBuilder request(GetTokenByPinIdRequest request) {
|
||||
Utils.checkNotNull(request, "request");
|
||||
this.request = request;
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -40,7 +39,7 @@ public class GetTokenByPinIdRequestBuilder {
|
||||
public GetTokenByPinIdResponse call() throws Exception {
|
||||
|
||||
return sdk.getTokenByPinId(
|
||||
pinID,
|
||||
request,
|
||||
serverURL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ public class GetTokenDetailsUserPlexAccount {
|
||||
private Optional<Boolean> mailingListActive;
|
||||
|
||||
/**
|
||||
* Your current mailing list status
|
||||
* Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
@JsonProperty("mailingListStatus")
|
||||
private MailingListStatus mailingListStatus;
|
||||
@@ -617,7 +617,7 @@ public class GetTokenDetailsUserPlexAccount {
|
||||
}
|
||||
|
||||
/**
|
||||
* Your current mailing list status
|
||||
* Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
@JsonIgnore
|
||||
public MailingListStatus mailingListStatus() {
|
||||
@@ -1088,7 +1088,7 @@ public class GetTokenDetailsUserPlexAccount {
|
||||
}
|
||||
|
||||
/**
|
||||
* Your current mailing list status
|
||||
* Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
public GetTokenDetailsUserPlexAccount withMailingListStatus(MailingListStatus mailingListStatus) {
|
||||
Utils.checkNotNull(mailingListStatus, "mailingListStatus");
|
||||
@@ -1869,7 +1869,7 @@ public class GetTokenDetailsUserPlexAccount {
|
||||
}
|
||||
|
||||
/**
|
||||
* Your current mailing list status
|
||||
* Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
public Builder mailingListStatus(MailingListStatus mailingListStatus) {
|
||||
Utils.checkNotNull(mailingListStatus, "mailingListStatus");
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.lang.String;
|
||||
|
||||
/**
|
||||
* MailingListStatus - Your current mailing list status
|
||||
* MailingListStatus - Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
public enum MailingListStatus {
|
||||
ACTIVE("active"),
|
||||
|
||||
@@ -8,7 +8,7 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
import java.lang.String;
|
||||
|
||||
/**
|
||||
* PostUsersSignInDataMailingListStatus - Your current mailing list status
|
||||
* PostUsersSignInDataMailingListStatus - Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
public enum PostUsersSignInDataMailingListStatus {
|
||||
ACTIVE("active"),
|
||||
|
||||
@@ -179,7 +179,7 @@ public class PostUsersSignInDataUserPlexAccount {
|
||||
private Optional<Boolean> mailingListActive;
|
||||
|
||||
/**
|
||||
* Your current mailing list status
|
||||
* Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
@JsonProperty("mailingListStatus")
|
||||
private PostUsersSignInDataMailingListStatus mailingListStatus;
|
||||
@@ -631,7 +631,7 @@ public class PostUsersSignInDataUserPlexAccount {
|
||||
}
|
||||
|
||||
/**
|
||||
* Your current mailing list status
|
||||
* Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
@JsonIgnore
|
||||
public PostUsersSignInDataMailingListStatus mailingListStatus() {
|
||||
@@ -1112,7 +1112,7 @@ public class PostUsersSignInDataUserPlexAccount {
|
||||
}
|
||||
|
||||
/**
|
||||
* Your current mailing list status
|
||||
* Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
public PostUsersSignInDataUserPlexAccount withMailingListStatus(PostUsersSignInDataMailingListStatus mailingListStatus) {
|
||||
Utils.checkNotNull(mailingListStatus, "mailingListStatus");
|
||||
@@ -1915,7 +1915,7 @@ public class PostUsersSignInDataUserPlexAccount {
|
||||
}
|
||||
|
||||
/**
|
||||
* Your current mailing list status
|
||||
* Your current mailing list status (active or unsubscribed)
|
||||
*/
|
||||
public Builder mailingListStatus(PostUsersSignInDataMailingListStatus mailingListStatus) {
|
||||
Utils.checkNotNull(mailingListStatus, "mailingListStatus");
|
||||
|
||||
@@ -183,7 +183,7 @@ public class SDKMethodInterfaces {
|
||||
|
||||
public interface MethodCallGetTokenByPinId {
|
||||
GetTokenByPinIdResponse getTokenByPinId(
|
||||
long pinID,
|
||||
GetTokenByPinIdRequest request,
|
||||
Optional<String> serverURL) throws Exception;
|
||||
}
|
||||
|
||||
|
||||
56
src/test/java/dev/plexapi/sdk/ActivitiesTests.java
Normal file
56
src/test/java/dev/plexapi/sdk/ActivitiesTests.java
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.CancelServerActivitiesResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetServerActivitiesResponse;
|
||||
import java.lang.Exception;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ActivitiesTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testActivities_GetServerActivities() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetServerActivitiesResponse res = sdk.activities().getServerActivities()
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testActivities_CancelServerActivities_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
CancelServerActivitiesResponse res = sdk.activities().cancelServerActivities()
|
||||
.activityUUID("25b71ed5-0f9d-461c-baa7-d404e9e10d3e")
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
441
src/test/java/dev/plexapi/sdk/AuthenticationTests.java
Normal file
441
src/test/java/dev/plexapi/sdk/AuthenticationTests.java
Normal file
@@ -0,0 +1,441 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.AutoSelectSubtitle;
|
||||
import dev.plexapi.sdk.models.operations.Billing;
|
||||
import dev.plexapi.sdk.models.operations.DefaultSubtitleAccessibility;
|
||||
import dev.plexapi.sdk.models.operations.DefaultSubtitleForced;
|
||||
import dev.plexapi.sdk.models.operations.GetSourceConnectionInformationResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenDetailsAuthenticationResponseStatus;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenDetailsAuthenticationStatus;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenDetailsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenDetailsStatus;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenDetailsSubscription;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenDetailsUserPlexAccount;
|
||||
import dev.plexapi.sdk.models.operations.GetTransientTokenQueryParamType;
|
||||
import dev.plexapi.sdk.models.operations.GetTransientTokenResponse;
|
||||
import dev.plexapi.sdk.models.operations.InternalPaymentMethod;
|
||||
import dev.plexapi.sdk.models.operations.MailingListStatus;
|
||||
import dev.plexapi.sdk.models.operations.MediaReviewsVisibility;
|
||||
import dev.plexapi.sdk.models.operations.PastSubscription;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataAuthenticationResponseStatus;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataAuthenticationStatus;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataAuthenticationSubscription;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataAutoSelectSubtitle;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataDefaultSubtitleAccessibility;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataDefaultSubtitleForced;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataMailingListStatus;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataMediaReviewsVisibility;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataRequest;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataRequestBody;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataResponse;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataServices;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataState;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataStatus;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataSubscription;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataUserPlexAccount;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataUserProfile;
|
||||
import dev.plexapi.sdk.models.operations.PostUsersSignInDataWatchedIndicator;
|
||||
import dev.plexapi.sdk.models.operations.Scope;
|
||||
import dev.plexapi.sdk.models.operations.Services;
|
||||
import dev.plexapi.sdk.models.operations.Subscription;
|
||||
import dev.plexapi.sdk.models.operations.Trials;
|
||||
import dev.plexapi.sdk.models.operations.UserProfile;
|
||||
import dev.plexapi.sdk.models.operations.WatchedIndicator;
|
||||
import java.lang.Exception;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class AuthenticationTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testAuthentication_GetTransientToken() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetTransientTokenResponse res = sdk.authentication().getTransientToken()
|
||||
.type(GetTransientTokenQueryParamType.DELEGATION)
|
||||
.scope(Scope.ALL)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testAuthentication_GetSourceConnectionInformation() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSourceConnectionInformationResponse res = sdk.authentication().getSourceConnectionInformation()
|
||||
.source("server://client-identifier")
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testAuthentication_GetTokenDetails() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetTokenDetailsResponse res = sdk.authentication().getTokenDetails()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetTokenDetailsUserPlexAccount.builder()
|
||||
.adsConsent(false)
|
||||
.adsConsentReminderAt(OffsetDateTime.parse("2022-06-24T05:32:09.341Z"))
|
||||
.adsConsentSetAt(OffsetDateTime.parse("2022-05-01T23:18:27.767Z"))
|
||||
.authToken("CxoUzBTSV5hsxjTpFKaf")
|
||||
.country("US")
|
||||
.email("username@email.com")
|
||||
.friendlyName("friendlyUsername")
|
||||
.entitlements(List.of(
|
||||
"[]"))
|
||||
.homeSize(1)
|
||||
.id(13692262)
|
||||
.joinedAt(1556281940L)
|
||||
.locale("sv")
|
||||
.mailingListStatus(MailingListStatus.ACTIVE)
|
||||
.maxHomeSize(15)
|
||||
.profile(UserProfile.builder()
|
||||
.defaultAudioLanguage("ja")
|
||||
.defaultSubtitleLanguage("en")
|
||||
.autoSelectAudio(true)
|
||||
.autoSelectSubtitle(AutoSelectSubtitle.Enable)
|
||||
.defaultSubtitleAccessibility(DefaultSubtitleAccessibility.Enable)
|
||||
.defaultSubtitleForced(DefaultSubtitleForced.Enable)
|
||||
.watchedIndicator(WatchedIndicator.Enable)
|
||||
.mediaReviewsVisibility(MediaReviewsVisibility.Enable)
|
||||
.build())
|
||||
.rememberExpiresAt(1556281940L)
|
||||
.scrobbleTypes("<value>")
|
||||
.services(List.of(
|
||||
Services.builder()
|
||||
.identifier("metadata-dev")
|
||||
.endpoint("https://epg.provider.plex.tv")
|
||||
.token("DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv")
|
||||
.secret("<value>")
|
||||
.status(GetTokenDetailsStatus.ONLINE)
|
||||
.build()))
|
||||
.subscription(Subscription.builder()
|
||||
.active(true)
|
||||
.subscribedAt("2021-04-12T18:21:12Z")
|
||||
.status(GetTokenDetailsAuthenticationStatus.INACTIVE)
|
||||
.build())
|
||||
.subscriptionDescription("<value>")
|
||||
.subscriptions(List.of(
|
||||
GetTokenDetailsSubscription.builder()
|
||||
.active(true)
|
||||
.subscribedAt("2021-04-12T18:21:12Z")
|
||||
.status(GetTokenDetailsAuthenticationResponseStatus.INACTIVE)
|
||||
.build()))
|
||||
.thumb("https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101")
|
||||
.title("UsernameTitle")
|
||||
.username("Username")
|
||||
.uuid("dae343c1f45beb4f")
|
||||
.attributionPartner(Optional.empty())
|
||||
.anonymous(false)
|
||||
.backupCodesCreated(false)
|
||||
.confirmed(false)
|
||||
.emailOnlyAuth(false)
|
||||
.experimentalFeatures(false)
|
||||
.guest(false)
|
||||
.hasPassword(true)
|
||||
.home(false)
|
||||
.homeAdmin(false)
|
||||
.mailingListActive(false)
|
||||
.pin("string")
|
||||
.protected_(false)
|
||||
.restricted(false)
|
||||
.roles(List.of(
|
||||
"string"))
|
||||
.twoFactorEnabled(false)
|
||||
.build(),
|
||||
res.userPlexAccount().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testAuthentication_PostUsersSignInData() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
PostUsersSignInDataRequest req = PostUsersSignInDataRequest.builder()
|
||||
.requestBody(PostUsersSignInDataRequestBody.builder()
|
||||
.login("username@email.com")
|
||||
.password("password123")
|
||||
.verificationCode("123456")
|
||||
.build())
|
||||
.build();
|
||||
|
||||
PostUsersSignInDataResponse res = sdk.authentication().postUsersSignInData()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
PostUsersSignInDataUserPlexAccount.builder()
|
||||
.adsConsent(false)
|
||||
.adsConsentReminderAt(OffsetDateTime.parse("2022-06-01T10:45:51.668Z"))
|
||||
.adsConsentSetAt(OffsetDateTime.parse("2022-08-04T10:54:08.790Z"))
|
||||
.authToken("CxoUzBTSV5hsxjTpFKaf")
|
||||
.country("US")
|
||||
.email("username@email.com")
|
||||
.friendlyName("friendlyUsername")
|
||||
.entitlements(List.of(
|
||||
"[]"))
|
||||
.homeSize(1)
|
||||
.id(13692262)
|
||||
.joinedAt(1556281940L)
|
||||
.locale("ja")
|
||||
.mailingListStatus(PostUsersSignInDataMailingListStatus.ACTIVE)
|
||||
.maxHomeSize(15)
|
||||
.profile(PostUsersSignInDataUserProfile.builder()
|
||||
.defaultAudioLanguage("ja")
|
||||
.defaultSubtitleLanguage("en")
|
||||
.autoSelectAudio(true)
|
||||
.autoSelectSubtitle(PostUsersSignInDataAutoSelectSubtitle.Enable)
|
||||
.defaultSubtitleAccessibility(PostUsersSignInDataDefaultSubtitleAccessibility.Enable)
|
||||
.defaultSubtitleForced(PostUsersSignInDataDefaultSubtitleForced.Enable)
|
||||
.watchedIndicator(PostUsersSignInDataWatchedIndicator.Enable)
|
||||
.mediaReviewsVisibility(PostUsersSignInDataMediaReviewsVisibility.Enable)
|
||||
.build())
|
||||
.rememberExpiresAt(1556281940L)
|
||||
.scrobbleTypes("<value>")
|
||||
.services(List.of(
|
||||
PostUsersSignInDataServices.builder()
|
||||
.identifier("metadata-dev")
|
||||
.endpoint("https://epg.provider.plex.tv")
|
||||
.token("DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv")
|
||||
.secret("<value>")
|
||||
.status(PostUsersSignInDataStatus.ONLINE)
|
||||
.build()))
|
||||
.subscription(PostUsersSignInDataSubscription.builder()
|
||||
.active(true)
|
||||
.subscribedAt("2021-04-12T18:21:12Z")
|
||||
.status(PostUsersSignInDataAuthenticationStatus.INACTIVE)
|
||||
.build())
|
||||
.subscriptionDescription("<value>")
|
||||
.subscriptions(List.of(
|
||||
PostUsersSignInDataAuthenticationSubscription.builder()
|
||||
.active(true)
|
||||
.subscribedAt("2021-04-12T18:21:12Z")
|
||||
.status(PostUsersSignInDataAuthenticationResponseStatus.INACTIVE)
|
||||
.build()))
|
||||
.thumb("https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101")
|
||||
.title("UsernameTitle")
|
||||
.username("Username")
|
||||
.uuid("dae343c1f45beb4f")
|
||||
.attributionPartner(Optional.empty())
|
||||
.pastSubscriptions(List.of(
|
||||
PastSubscription.builder()
|
||||
.id("<id>")
|
||||
.mode("<value>")
|
||||
.renewsAt(1556281940L)
|
||||
.endsAt(1556281940L)
|
||||
.type("plexpass")
|
||||
.transfer("<value>")
|
||||
.state(PostUsersSignInDataState.ENDED)
|
||||
.billing(Billing.builder()
|
||||
.internalPaymentMethod(InternalPaymentMethod.builder()
|
||||
.build())
|
||||
.paymentMethodId(820994L)
|
||||
.build())
|
||||
.canceled(false)
|
||||
.gracePeriod(false)
|
||||
.onHold(false)
|
||||
.canReactivate(false)
|
||||
.canUpgrade(false)
|
||||
.canDowngrade(false)
|
||||
.canConvert(false)
|
||||
.build()))
|
||||
.trials(List.of(
|
||||
Trials.builder()
|
||||
.build()))
|
||||
.anonymous(false)
|
||||
.backupCodesCreated(false)
|
||||
.confirmed(false)
|
||||
.emailOnlyAuth(false)
|
||||
.experimentalFeatures(false)
|
||||
.guest(false)
|
||||
.hasPassword(true)
|
||||
.home(false)
|
||||
.homeAdmin(false)
|
||||
.mailingListActive(false)
|
||||
.pin("string")
|
||||
.protected_(false)
|
||||
.restricted(false)
|
||||
.roles(List.of(
|
||||
"string"))
|
||||
.twoFactorEnabled(false)
|
||||
.build(),
|
||||
res.userPlexAccount().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testAuthentication_PostUsersSignInData_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
PostUsersSignInDataRequest req = PostUsersSignInDataRequest.builder()
|
||||
.requestBody(PostUsersSignInDataRequestBody.builder()
|
||||
.login("username@email.com")
|
||||
.password("password123")
|
||||
.verificationCode("123456")
|
||||
.build())
|
||||
.build();
|
||||
|
||||
PostUsersSignInDataResponse res = sdk.authentication().postUsersSignInData()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
PostUsersSignInDataUserPlexAccount.builder()
|
||||
.adsConsent(false)
|
||||
.adsConsentReminderAt(OffsetDateTime.parse("2022-04-17T10:09:07.050Z"))
|
||||
.adsConsentSetAt(OffsetDateTime.parse("2024-07-07T09:18:10.249Z"))
|
||||
.authToken("CxoUzBTSV5hsxjTpFKaf")
|
||||
.country("US")
|
||||
.email("username@email.com")
|
||||
.friendlyName("friendlyUsername")
|
||||
.entitlements(List.of(
|
||||
"[]"))
|
||||
.homeSize(1)
|
||||
.id(13692262)
|
||||
.joinedAt(1556281940L)
|
||||
.locale("es")
|
||||
.mailingListStatus(PostUsersSignInDataMailingListStatus.ACTIVE)
|
||||
.maxHomeSize(15)
|
||||
.profile(PostUsersSignInDataUserProfile.builder()
|
||||
.defaultAudioLanguage("ja")
|
||||
.defaultSubtitleLanguage("en")
|
||||
.autoSelectAudio(true)
|
||||
.autoSelectSubtitle(PostUsersSignInDataAutoSelectSubtitle.Enable)
|
||||
.defaultSubtitleAccessibility(PostUsersSignInDataDefaultSubtitleAccessibility.Enable)
|
||||
.defaultSubtitleForced(PostUsersSignInDataDefaultSubtitleForced.Enable)
|
||||
.watchedIndicator(PostUsersSignInDataWatchedIndicator.Enable)
|
||||
.mediaReviewsVisibility(PostUsersSignInDataMediaReviewsVisibility.Enable)
|
||||
.build())
|
||||
.rememberExpiresAt(1556281940L)
|
||||
.scrobbleTypes("<value>")
|
||||
.services(List.of(
|
||||
PostUsersSignInDataServices.builder()
|
||||
.identifier("metadata-dev")
|
||||
.endpoint("https://epg.provider.plex.tv")
|
||||
.token("DjoMtqFAGRL1uVtCyF1dKIorTbShJeqv")
|
||||
.secret("<value>")
|
||||
.status(PostUsersSignInDataStatus.ONLINE)
|
||||
.build()))
|
||||
.subscription(PostUsersSignInDataSubscription.builder()
|
||||
.active(true)
|
||||
.subscribedAt("2021-04-12T18:21:12Z")
|
||||
.status(PostUsersSignInDataAuthenticationStatus.INACTIVE)
|
||||
.build())
|
||||
.subscriptionDescription("<value>")
|
||||
.subscriptions(List.of(
|
||||
PostUsersSignInDataAuthenticationSubscription.builder()
|
||||
.active(true)
|
||||
.subscribedAt("2021-04-12T18:21:12Z")
|
||||
.status(PostUsersSignInDataAuthenticationResponseStatus.INACTIVE)
|
||||
.build()))
|
||||
.thumb("https://plex.tv/users/a4f43c1ebfde43a5/avatar?c=8372075101")
|
||||
.title("UsernameTitle")
|
||||
.username("Username")
|
||||
.uuid("dae343c1f45beb4f")
|
||||
.attributionPartner(Optional.empty())
|
||||
.pastSubscriptions(List.of(
|
||||
PastSubscription.builder()
|
||||
.id("<id>")
|
||||
.mode("<value>")
|
||||
.renewsAt(1556281940L)
|
||||
.endsAt(1556281940L)
|
||||
.type("plexpass")
|
||||
.transfer("<value>")
|
||||
.state(PostUsersSignInDataState.ENDED)
|
||||
.billing(Billing.builder()
|
||||
.internalPaymentMethod(InternalPaymentMethod.builder()
|
||||
.build())
|
||||
.paymentMethodId(976460L)
|
||||
.build())
|
||||
.canceled(false)
|
||||
.gracePeriod(false)
|
||||
.onHold(false)
|
||||
.canReactivate(false)
|
||||
.canUpgrade(false)
|
||||
.canDowngrade(false)
|
||||
.canConvert(false)
|
||||
.build()))
|
||||
.trials(List.of(
|
||||
Trials.builder()
|
||||
.build()))
|
||||
.anonymous(false)
|
||||
.backupCodesCreated(false)
|
||||
.confirmed(false)
|
||||
.emailOnlyAuth(false)
|
||||
.experimentalFeatures(false)
|
||||
.guest(false)
|
||||
.hasPassword(true)
|
||||
.home(false)
|
||||
.homeAdmin(false)
|
||||
.mailingListActive(false)
|
||||
.pin("string")
|
||||
.protected_(false)
|
||||
.restricted(false)
|
||||
.roles(List.of(
|
||||
"string"))
|
||||
.twoFactorEnabled(false)
|
||||
.build(),
|
||||
res.userPlexAccount().get());
|
||||
}
|
||||
|
||||
}
|
||||
140
src/test/java/dev/plexapi/sdk/ButlerTests.java
Normal file
140
src/test/java/dev/plexapi/sdk/ButlerTests.java
Normal file
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.ButlerTask;
|
||||
import dev.plexapi.sdk.models.operations.ButlerTasks;
|
||||
import dev.plexapi.sdk.models.operations.GetButlerTasksResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetButlerTasksResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.PathParamTaskName;
|
||||
import dev.plexapi.sdk.models.operations.StartAllTasksResponse;
|
||||
import dev.plexapi.sdk.models.operations.StartTaskResponse;
|
||||
import dev.plexapi.sdk.models.operations.StopAllTasksResponse;
|
||||
import dev.plexapi.sdk.models.operations.StopTaskResponse;
|
||||
import dev.plexapi.sdk.models.operations.TaskName;
|
||||
import java.lang.Exception;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ButlerTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testButler_GetButlerTasks() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetButlerTasksResponse res = sdk.butler().getButlerTasks()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetButlerTasksResponseBody.builder()
|
||||
.butlerTasks(ButlerTasks.builder()
|
||||
.butlerTask(List.of(
|
||||
ButlerTask.builder()
|
||||
.name("BackupDatabase")
|
||||
.interval(3d)
|
||||
.title("Backup Database")
|
||||
.description("Create a backup copy of the server's database in the configured backup directory")
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testButler_StartAllTasks() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
StartAllTasksResponse res = sdk.butler().startAllTasks()
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testButler_StopAllTasks() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
StopAllTasksResponse res = sdk.butler().stopAllTasks()
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testButler_StartTask() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
StartTaskResponse res = sdk.butler().startTask()
|
||||
.taskName(TaskName.GENERATE_CHAPTER_THUMBS)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testButler_StopTask() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
StopTaskResponse res = sdk.butler().stopTask()
|
||||
.taskName(PathParamTaskName.DEEP_MEDIA_ANALYSIS)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
761
src/test/java/dev/plexapi/sdk/HubsTests.java
Normal file
761
src/test/java/dev/plexapi/sdk/HubsTests.java
Normal file
@@ -0,0 +1,761 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.Collection;
|
||||
import dev.plexapi.sdk.models.operations.Country;
|
||||
import dev.plexapi.sdk.models.operations.Director;
|
||||
import dev.plexapi.sdk.models.operations.FlattenSeasons;
|
||||
import dev.plexapi.sdk.models.operations.Genre;
|
||||
import dev.plexapi.sdk.models.operations.GetGlobalHubsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetGlobalHubsMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetGlobalHubsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetGlobalHubsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsCountry;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsDirector;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsGenre;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsHub;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsMedia;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsPart;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsRole;
|
||||
import dev.plexapi.sdk.models.operations.GetLibraryHubsWriter;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedActiveDirection;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedDefaultDirection;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedField;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedFieldType;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedFilter;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedHubsResponseType;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedHubsType;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedImage;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedOperator;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedSort;
|
||||
import dev.plexapi.sdk.models.operations.GetRecentlyAddedType;
|
||||
import dev.plexapi.sdk.models.operations.HasThumbnail;
|
||||
import dev.plexapi.sdk.models.operations.Hub;
|
||||
import dev.plexapi.sdk.models.operations.IncludeMeta;
|
||||
import dev.plexapi.sdk.models.operations.Media;
|
||||
import dev.plexapi.sdk.models.operations.MediaGuid;
|
||||
import dev.plexapi.sdk.models.operations.Meta;
|
||||
import dev.plexapi.sdk.models.operations.MetaDataRating;
|
||||
import dev.plexapi.sdk.models.operations.OnlyTransient;
|
||||
import dev.plexapi.sdk.models.operations.OptimizedForStreaming;
|
||||
import dev.plexapi.sdk.models.operations.Part;
|
||||
import dev.plexapi.sdk.models.operations.QueryParamOnlyTransient;
|
||||
import dev.plexapi.sdk.models.operations.Role;
|
||||
import dev.plexapi.sdk.models.operations.ShowOrdering;
|
||||
import dev.plexapi.sdk.models.operations.Stream;
|
||||
import dev.plexapi.sdk.models.operations.Type;
|
||||
import dev.plexapi.sdk.models.operations.UltraBlurColors;
|
||||
import dev.plexapi.sdk.models.operations.Writer;
|
||||
import java.lang.Exception;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class HubsTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testHubs_GetGlobalHubs() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetGlobalHubsResponse res = sdk.hubs().getGlobalHubs()
|
||||
.count(6399.21d)
|
||||
.onlyTransient(OnlyTransient.ZERO)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetGlobalHubsResponseBody.builder()
|
||||
.mediaContainer(GetGlobalHubsMediaContainer.builder()
|
||||
.size(8)
|
||||
.allowSync(true)
|
||||
.identifier("com.plexapp.plugins.library")
|
||||
.hub(List.of(
|
||||
Hub.builder()
|
||||
.hubKey("/library/metadata/50768,65523,58188,57341,57302,57070")
|
||||
.key("/playlists/all?type=15&sort=lastViewedAt:desc&playlistType=video,audio")
|
||||
.title("Recent Playlists")
|
||||
.type("playlist")
|
||||
.hubIdentifier("home.playlists")
|
||||
.context("hub.home.playlists")
|
||||
.size(6)
|
||||
.more(true)
|
||||
.style("shelf")
|
||||
.promoted(true)
|
||||
.metadata(List.of(
|
||||
GetGlobalHubsMetadata.builder()
|
||||
.ratingKey("57070")
|
||||
.key("/playlists/57070/items")
|
||||
.guid("com.plexapp.agents.none://9fee6c5b-3143-4923-813e-57bd0190056c")
|
||||
.type("playlist")
|
||||
.title("November Movie Day")
|
||||
.titleSort("Tracks")
|
||||
.summary("")
|
||||
.smart(false)
|
||||
.playlistType("video")
|
||||
.composite("/playlists/57070/composite/1668787730")
|
||||
.icon("playlist://image.smart")
|
||||
.viewCount(2)
|
||||
.lastViewedAt(1668787732)
|
||||
.duration(16873000)
|
||||
.leafCount(3)
|
||||
.addedAt(1668779618)
|
||||
.updatedAt(1668787730)
|
||||
.build()))
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testHubs_GetRecentlyAdded() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetRecentlyAddedRequest req = GetRecentlyAddedRequest.builder()
|
||||
.contentDirectoryID(944669L)
|
||||
.type(Type.TvShow)
|
||||
.sectionID(2L)
|
||||
.includeMeta(IncludeMeta.Enable)
|
||||
.xPlexContainerStart(0)
|
||||
.xPlexContainerSize(50)
|
||||
.build();
|
||||
|
||||
GetRecentlyAddedResponse res = sdk.hubs().getRecentlyAdded()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetRecentlyAddedResponseBody.builder()
|
||||
.mediaContainer(GetRecentlyAddedMediaContainer.builder()
|
||||
.size(50d)
|
||||
.identifier("com.plexapp.plugins.library")
|
||||
.meta(Meta.builder()
|
||||
.type(List.of(
|
||||
GetRecentlyAddedType.builder()
|
||||
.key("/library/sections/2/all?type=2")
|
||||
.type("show")
|
||||
.title("TV Shows")
|
||||
.active(false)
|
||||
.filter(List.of(
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build(),
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build(),
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build()))
|
||||
.sort(List.of(
|
||||
GetRecentlyAddedSort.builder()
|
||||
.key("titleSort")
|
||||
.title("Title")
|
||||
.default_("asc")
|
||||
.active(false)
|
||||
.activeDirection(GetRecentlyAddedActiveDirection.Ascending)
|
||||
.defaultDirection(GetRecentlyAddedDefaultDirection.Ascending)
|
||||
.descKey("titleSort:desc")
|
||||
.firstCharacterKey("/library/sections/2/firstCharacter")
|
||||
.build()))
|
||||
.field(List.of(
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build(),
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build(),
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build()))
|
||||
.build(),
|
||||
GetRecentlyAddedType.builder()
|
||||
.key("/library/sections/2/all?type=2")
|
||||
.type("show")
|
||||
.title("TV Shows")
|
||||
.active(false)
|
||||
.filter(List.of(
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build(),
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build(),
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build()))
|
||||
.sort(List.of(
|
||||
GetRecentlyAddedSort.builder()
|
||||
.key("titleSort")
|
||||
.title("Title")
|
||||
.default_("asc")
|
||||
.active(false)
|
||||
.activeDirection(GetRecentlyAddedActiveDirection.Ascending)
|
||||
.defaultDirection(GetRecentlyAddedDefaultDirection.Ascending)
|
||||
.descKey("titleSort:desc")
|
||||
.firstCharacterKey("/library/sections/2/firstCharacter")
|
||||
.build(),
|
||||
GetRecentlyAddedSort.builder()
|
||||
.key("titleSort")
|
||||
.title("Title")
|
||||
.default_("asc")
|
||||
.active(false)
|
||||
.activeDirection(GetRecentlyAddedActiveDirection.Ascending)
|
||||
.defaultDirection(GetRecentlyAddedDefaultDirection.Ascending)
|
||||
.descKey("titleSort:desc")
|
||||
.firstCharacterKey("/library/sections/2/firstCharacter")
|
||||
.build(),
|
||||
GetRecentlyAddedSort.builder()
|
||||
.key("titleSort")
|
||||
.title("Title")
|
||||
.default_("asc")
|
||||
.active(false)
|
||||
.activeDirection(GetRecentlyAddedActiveDirection.Ascending)
|
||||
.defaultDirection(GetRecentlyAddedDefaultDirection.Ascending)
|
||||
.descKey("titleSort:desc")
|
||||
.firstCharacterKey("/library/sections/2/firstCharacter")
|
||||
.build()))
|
||||
.field(List.of(
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build(),
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build(),
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build()))
|
||||
.build(),
|
||||
GetRecentlyAddedType.builder()
|
||||
.key("/library/sections/2/all?type=2")
|
||||
.type("show")
|
||||
.title("TV Shows")
|
||||
.active(false)
|
||||
.filter(List.of(
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build(),
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build(),
|
||||
GetRecentlyAddedFilter.builder()
|
||||
.filter("genre")
|
||||
.filterType("string")
|
||||
.key("/library/sections/2/genre?type=2")
|
||||
.title("Genre")
|
||||
.type("filter")
|
||||
.build()))
|
||||
.sort(List.of(
|
||||
GetRecentlyAddedSort.builder()
|
||||
.key("titleSort")
|
||||
.title("Title")
|
||||
.default_("asc")
|
||||
.active(false)
|
||||
.activeDirection(GetRecentlyAddedActiveDirection.Ascending)
|
||||
.defaultDirection(GetRecentlyAddedDefaultDirection.Ascending)
|
||||
.descKey("titleSort:desc")
|
||||
.firstCharacterKey("/library/sections/2/firstCharacter")
|
||||
.build(),
|
||||
GetRecentlyAddedSort.builder()
|
||||
.key("titleSort")
|
||||
.title("Title")
|
||||
.default_("asc")
|
||||
.active(false)
|
||||
.activeDirection(GetRecentlyAddedActiveDirection.Ascending)
|
||||
.defaultDirection(GetRecentlyAddedDefaultDirection.Ascending)
|
||||
.descKey("titleSort:desc")
|
||||
.firstCharacterKey("/library/sections/2/firstCharacter")
|
||||
.build()))
|
||||
.field(List.of(
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build(),
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build(),
|
||||
GetRecentlyAddedField.builder()
|
||||
.key("show.title")
|
||||
.title("Show Title")
|
||||
.type("string")
|
||||
.subType("rating")
|
||||
.build()))
|
||||
.build()))
|
||||
.fieldType(List.of(
|
||||
GetRecentlyAddedFieldType.builder()
|
||||
.type("tag")
|
||||
.operator(List.of(
|
||||
GetRecentlyAddedOperator.builder()
|
||||
.key("=")
|
||||
.title("is")
|
||||
.build()))
|
||||
.build(),
|
||||
GetRecentlyAddedFieldType.builder()
|
||||
.type("tag")
|
||||
.operator(List.of(
|
||||
GetRecentlyAddedOperator.builder()
|
||||
.key("=")
|
||||
.title("is")
|
||||
.build()))
|
||||
.build(),
|
||||
GetRecentlyAddedFieldType.builder()
|
||||
.type("tag")
|
||||
.operator(List.of(
|
||||
GetRecentlyAddedOperator.builder()
|
||||
.key("=")
|
||||
.title("is")
|
||||
.build()))
|
||||
.build()))
|
||||
.build())
|
||||
.metadata(List.of(
|
||||
GetRecentlyAddedMetadata.builder()
|
||||
.ratingKey("58683")
|
||||
.key("/library/metadata/58683")
|
||||
.guid("plex://movie/5d7768ba96b655001fdc0408")
|
||||
.type(GetRecentlyAddedHubsType.Movie)
|
||||
.title("Avatar: The Way of Water")
|
||||
.summary("Jake Sully lives with his newfound family formed on the extrasolar moon Pandora. Once a familiar threat returns to finish what was previously started, Jake must work with Neytiri and the army of the Na'vi race to protect their home.")
|
||||
.addedAt(1556281940L)
|
||||
.studio("20th Century Studios")
|
||||
.skipChildren(false)
|
||||
.librarySectionID(1L)
|
||||
.librarySectionTitle("Movies")
|
||||
.librarySectionKey("/library/sections/1")
|
||||
.slug("4-for-texas")
|
||||
.contentRating("PG-13")
|
||||
.rating(7.6d)
|
||||
.audienceRating(9.2d)
|
||||
.year(2022)
|
||||
.seasonCount(2022)
|
||||
.tagline("Return to Pandora.")
|
||||
.flattenSeasons(FlattenSeasons.True)
|
||||
.showOrdering(ShowOrdering.Dvd)
|
||||
.thumb("/library/metadata/58683/thumb/1703239236")
|
||||
.art("/library/metadata/58683/art/1703239236")
|
||||
.banner("/library/metadata/58683/banner/1703239236")
|
||||
.duration(11558112)
|
||||
.originallyAvailableAt(LocalDate.parse("2022-12-14T00:00:00Z"))
|
||||
.updatedAt(1556281940L)
|
||||
.audienceRatingImage("rottentomatoes://image.rating.upright")
|
||||
.chapterSource("media")
|
||||
.primaryExtraKey("/library/metadata/58684")
|
||||
.ratingImage("rottentomatoes://image.rating.ripe")
|
||||
.grandparentRatingKey("66")
|
||||
.grandparentGuid("plex://show/5d9c081b170e24001f2a7be4")
|
||||
.grandparentKey("/library/metadata/66")
|
||||
.grandparentTitle("Caprica")
|
||||
.grandparentThumb("/library/metadata/66/thumb/1705716261")
|
||||
.parentSlug("alice-in-borderland-2020")
|
||||
.grandparentSlug("alice-in-borderland-2020")
|
||||
.grandparentArt("/library/metadata/66/art/1705716261")
|
||||
.grandparentTheme("/library/metadata/66/theme/1705716261")
|
||||
.media(List.of(
|
||||
Media.builder()
|
||||
.id(119534)
|
||||
.duration(11558112)
|
||||
.bitrate(25025)
|
||||
.width(3840)
|
||||
.height(2072)
|
||||
.aspectRatio(1.85d)
|
||||
.audioChannels(6)
|
||||
.audioCodec("eac3")
|
||||
.videoCodec("hevc")
|
||||
.videoResolution("4k")
|
||||
.container("mkv")
|
||||
.videoFrameRate("24p")
|
||||
.videoProfile("main 10")
|
||||
.part(List.of(
|
||||
Part.builder()
|
||||
.id(119542)
|
||||
.key("/library/parts/119542/1680457526/file.mkv")
|
||||
.duration(11558112)
|
||||
.file("/movies/Avatar The Way of Water (2022)/Avatar.The.Way.of.Water.2022.2160p.WEB-DL.DDP5.1.Atmos.DV.HDR10.HEVC-CMRG.mkv")
|
||||
.size(36158371307L)
|
||||
.container("mkv")
|
||||
.videoProfile("main 10")
|
||||
.audioProfile("dts")
|
||||
.has64bitOffsets(false)
|
||||
.optimizedForStreaming(false)
|
||||
.indexes("sd")
|
||||
.hasThumbnail(HasThumbnail.True)
|
||||
.stream(List.of(
|
||||
Stream.builder()
|
||||
.id(272796L)
|
||||
.streamType(1L)
|
||||
.codec("h264")
|
||||
.index(0L)
|
||||
.default_(true)
|
||||
.selected(true)
|
||||
.bitrate(6273L)
|
||||
.colorPrimaries("bt709")
|
||||
.colorRange("tv")
|
||||
.colorSpace("bt709")
|
||||
.colorTrc("bt709")
|
||||
.bitDepth(8L)
|
||||
.chromaLocation("left")
|
||||
.streamIdentifier("2")
|
||||
.chromaSubsampling("4:2:0")
|
||||
.codedHeight(1088L)
|
||||
.codedWidth(1920L)
|
||||
.frameRate(29.97d)
|
||||
.hasScalingMatrix(false)
|
||||
.hearingImpaired(false)
|
||||
.closedCaptions(false)
|
||||
.embeddedInVideo("1")
|
||||
.height(1080L)
|
||||
.level(40L)
|
||||
.profile("main")
|
||||
.refFrames(4L)
|
||||
.scanType("progressive")
|
||||
.width(1920L)
|
||||
.displayTitle("1080p (H.264)")
|
||||
.extendedDisplayTitle("1080p (H.264)")
|
||||
.channels(2L)
|
||||
.language("English")
|
||||
.languageTag("en")
|
||||
.languageCode("eng")
|
||||
.audioChannelLayout("stereo")
|
||||
.samplingRate(48000L)
|
||||
.title("English")
|
||||
.canAutoSync(false)
|
||||
.build()))
|
||||
.build()))
|
||||
.audioProfile("dts")
|
||||
.hasVoiceActivity(false)
|
||||
.optimizedForStreaming(OptimizedForStreaming.Enable)
|
||||
.has64bitOffsets(false)
|
||||
.build()))
|
||||
.genre(List.of(
|
||||
Genre.builder()
|
||||
.tag("Adventure")
|
||||
.build()))
|
||||
.country(List.of(
|
||||
Country.builder()
|
||||
.tag("United States of America")
|
||||
.build()))
|
||||
.director(List.of(
|
||||
Director.builder()
|
||||
.tag("James Cameron")
|
||||
.build(),
|
||||
Director.builder()
|
||||
.tag("James Cameron")
|
||||
.build()))
|
||||
.writer(List.of(
|
||||
Writer.builder()
|
||||
.tag("James Cameron")
|
||||
.build()))
|
||||
.collection(List.of(
|
||||
Collection.builder()
|
||||
.tag("Working NL Subs")
|
||||
.build()))
|
||||
.role(List.of(
|
||||
Role.builder()
|
||||
.id(294129L)
|
||||
.filter("actor=294129")
|
||||
.thumb("https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg")
|
||||
.tag("Mike Smith")
|
||||
.tagKey("668e7e7b22bcad9064350c91")
|
||||
.role("Self")
|
||||
.build(),
|
||||
Role.builder()
|
||||
.id(294129L)
|
||||
.filter("actor=294129")
|
||||
.thumb("https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg")
|
||||
.tag("Mike Smith")
|
||||
.tagKey("668e7e7b22bcad9064350c91")
|
||||
.role("Self")
|
||||
.build(),
|
||||
Role.builder()
|
||||
.id(294129L)
|
||||
.filter("actor=294129")
|
||||
.thumb("https://metadata-static.plex.tv/2/people/27b85844536c39f3f9ac943aaad46608.jpg")
|
||||
.tag("Mike Smith")
|
||||
.tagKey("668e7e7b22bcad9064350c91")
|
||||
.role("Self")
|
||||
.build()))
|
||||
.mediaGuid(List.of(
|
||||
MediaGuid.builder()
|
||||
.id("imdb://tt13015952")
|
||||
.build(),
|
||||
MediaGuid.builder()
|
||||
.id("imdb://tt13015952")
|
||||
.build(),
|
||||
MediaGuid.builder()
|
||||
.id("imdb://tt13015952")
|
||||
.build()))
|
||||
.ultraBlurColors(UltraBlurColors.builder()
|
||||
.topLeft("11333b")
|
||||
.topRight("0a232d")
|
||||
.bottomRight("73958")
|
||||
.bottomLeft("1f5066")
|
||||
.build())
|
||||
.metaDataRating(List.of(
|
||||
MetaDataRating.builder()
|
||||
.image("themoviedb://image.rating")
|
||||
.value(3f)
|
||||
.type("audience")
|
||||
.build()))
|
||||
.image(List.of(
|
||||
GetRecentlyAddedImage.builder()
|
||||
.alt("Episode 1")
|
||||
.type(GetRecentlyAddedHubsResponseType.BACKGROUND)
|
||||
.url("/library/metadata/45521/thumb/1644710589")
|
||||
.build(),
|
||||
GetRecentlyAddedImage.builder()
|
||||
.alt("Episode 1")
|
||||
.type(GetRecentlyAddedHubsResponseType.BACKGROUND)
|
||||
.url("/library/metadata/45521/thumb/1644710589")
|
||||
.build(),
|
||||
GetRecentlyAddedImage.builder()
|
||||
.alt("Episode 1")
|
||||
.type(GetRecentlyAddedHubsResponseType.BACKGROUND)
|
||||
.url("/library/metadata/45521/thumb/1644710589")
|
||||
.build()))
|
||||
.titleSort("Whale")
|
||||
.viewCount(1)
|
||||
.lastViewedAt(1682752242)
|
||||
.originalTitle("映画 ブラッククローバー 魔法帝の剣")
|
||||
.viewOffset(5222500)
|
||||
.skipCount(1)
|
||||
.index(1)
|
||||
.theme("/library/metadata/1/theme/1705636920")
|
||||
.leafCount(14)
|
||||
.viewedLeafCount(0)
|
||||
.childCount(1)
|
||||
.hasPremiumExtras("1")
|
||||
.hasPremiumPrimaryExtra("1")
|
||||
.parentRatingKey("66")
|
||||
.parentGuid("plex://show/5d9c081b170e24001f2a7be4")
|
||||
.parentStudio("UCP")
|
||||
.parentKey("/library/metadata/66")
|
||||
.parentTitle("Caprica")
|
||||
.parentIndex(1)
|
||||
.parentYear(2010)
|
||||
.parentThumb("/library/metadata/66/thumb/1705716261")
|
||||
.parentTheme("/library/metadata/66/theme/1705716261")
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testHubs_GetLibraryHubs() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetLibraryHubsResponse res = sdk.hubs().getLibraryHubs()
|
||||
.sectionId(5218.48d)
|
||||
.count(4146.62d)
|
||||
.onlyTransient(QueryParamOnlyTransient.ZERO)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetLibraryHubsResponseBody.builder()
|
||||
.mediaContainer(GetLibraryHubsMediaContainer.builder()
|
||||
.size(7)
|
||||
.allowSync(true)
|
||||
.identifier("com.plexapp.plugins.library")
|
||||
.librarySectionID(1)
|
||||
.librarySectionTitle("Movies")
|
||||
.librarySectionUUID("322a231a-b7f7-49f5-920f-14c61199cd30")
|
||||
.hub(List.of(
|
||||
GetLibraryHubsHub.builder()
|
||||
.key("/library/sections/1/all?sort=lastViewedAt:desc&unwatched=0&viewOffset=0")
|
||||
.title("Recently Played Movies")
|
||||
.type("movie")
|
||||
.hubIdentifier("movie.recentlyviewed.1")
|
||||
.context("hub.movie.recentlyviewed")
|
||||
.size(6)
|
||||
.more(true)
|
||||
.style("shelf")
|
||||
.hubKey("/library/metadata/66485,66098,57249,11449,5858,14944")
|
||||
.metadata(List.of(
|
||||
GetLibraryHubsMetadata.builder()
|
||||
.ratingKey("14944")
|
||||
.key("/library/metadata/14944")
|
||||
.guid("plex://movie/5d77686eeb5d26001f1eb339")
|
||||
.studio("Walt Disney Animation Studios")
|
||||
.type("movie")
|
||||
.title("Tangled")
|
||||
.librarySectionTitle("Movies")
|
||||
.librarySectionID(1)
|
||||
.librarySectionKey("/library/sections/1")
|
||||
.contentRating("PG")
|
||||
.summary("The magically long-haired Rapunzel has spent her entire life in a tower, but now that a runaway thief has stumbled upon her, she is about to discover the world for the first time, and who she really is.")
|
||||
.rating(8.9d)
|
||||
.audienceRating(8.7d)
|
||||
.viewCount(1)
|
||||
.lastViewedAt(1704936047)
|
||||
.year(2010)
|
||||
.tagline("They're taking adventure to new lengths.")
|
||||
.thumb("/library/metadata/14944/thumb/1705739847")
|
||||
.art("/library/metadata/14944/art/1705739847")
|
||||
.duration(6017237)
|
||||
.originallyAvailableAt(LocalDate.parse("2010-11-24T00:00:00Z"))
|
||||
.addedAt(1589412494)
|
||||
.updatedAt(1705739847)
|
||||
.audienceRatingImage("rottentomatoes://image.rating.upright")
|
||||
.primaryExtraKey("/library/metadata/14952")
|
||||
.ratingImage("rottentomatoes://image.rating.ripe")
|
||||
.media(List.of(
|
||||
GetLibraryHubsMedia.builder()
|
||||
.id(38247)
|
||||
.duration(6017237)
|
||||
.bitrate(2051)
|
||||
.width(1920)
|
||||
.height(1080)
|
||||
.aspectRatio(1.78d)
|
||||
.audioChannels(2)
|
||||
.audioCodec("aac")
|
||||
.videoCodec("h264")
|
||||
.videoResolution("1080")
|
||||
.container("mp4")
|
||||
.videoFrameRate("24p")
|
||||
.optimizedForStreaming(1)
|
||||
.audioProfile("lc")
|
||||
.has64bitOffsets(false)
|
||||
.videoProfile("high")
|
||||
.part(List.of(
|
||||
GetLibraryHubsPart.builder()
|
||||
.id(38247)
|
||||
.key("/library/parts/38247/1589412494/file.mp4")
|
||||
.duration(6017237)
|
||||
.file("/movies/Tangled (2010)/Tangled (2010) Bluray-1080p.mp4")
|
||||
.size(1545647447)
|
||||
.audioProfile("lc")
|
||||
.container("mp4")
|
||||
.has64bitOffsets(false)
|
||||
.optimizedForStreaming(true)
|
||||
.videoProfile("high")
|
||||
.build()))
|
||||
.build()))
|
||||
.genre(List.of(
|
||||
GetLibraryHubsGenre.builder()
|
||||
.tag("Animation")
|
||||
.build()))
|
||||
.country(List.of(
|
||||
GetLibraryHubsCountry.builder()
|
||||
.tag("United States of America")
|
||||
.build()))
|
||||
.director(List.of(
|
||||
GetLibraryHubsDirector.builder()
|
||||
.tag("Nathan Greno")
|
||||
.build()))
|
||||
.role(List.of(
|
||||
GetLibraryHubsRole.builder()
|
||||
.tag("Donna Murphy")
|
||||
.build()))
|
||||
.writer(List.of(
|
||||
GetLibraryHubsWriter.builder()
|
||||
.tag("Wilhelm Grimm")
|
||||
.build()))
|
||||
.skipCount(1)
|
||||
.chapterSource("media")
|
||||
.build()))
|
||||
.promoted(true)
|
||||
.random(true)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
}
|
||||
2111
src/test/java/dev/plexapi/sdk/LibraryTests.java
Normal file
2111
src/test/java/dev/plexapi/sdk/LibraryTests.java
Normal file
File diff suppressed because it is too large
Load Diff
85
src/test/java/dev/plexapi/sdk/LogTests.java
Normal file
85
src/test/java/dev/plexapi/sdk/LogTests.java
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.EnablePaperTrailResponse;
|
||||
import dev.plexapi.sdk.models.operations.Level;
|
||||
import dev.plexapi.sdk.models.operations.LogLineResponse;
|
||||
import dev.plexapi.sdk.models.operations.LogMultiLineResponse;
|
||||
import java.lang.Exception;
|
||||
import java.lang.String;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class LogTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testLog_LogLine() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
LogLineResponse res = sdk.log().logLine()
|
||||
.level(Level.ZERO)
|
||||
.message("Test log message")
|
||||
.source("Postman")
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testLog_LogMultiLine() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
String req = "level=4&message=Test%20message%201&source=postman\nlevel=3&message=Test%20message%202&source=postman
|
||||
level=1&message=Test%20message%203&source=postman";
|
||||
|
||||
LogMultiLineResponse res = sdk.log().logMultiLine()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testLog_EnablePaperTrail() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
EnablePaperTrailResponse res = sdk.log().enablePaperTrail()
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
145
src/test/java/dev/plexapi/sdk/MediaTests.java
Normal file
145
src/test/java/dev/plexapi/sdk/MediaTests.java
Normal file
@@ -0,0 +1,145 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.GetBannerImageRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetBannerImageResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetThumbImageRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetThumbImageResponse;
|
||||
import dev.plexapi.sdk.models.operations.MarkPlayedResponse;
|
||||
import dev.plexapi.sdk.models.operations.MarkUnplayedResponse;
|
||||
import dev.plexapi.sdk.models.operations.UpdatePlayProgressResponse;
|
||||
import java.lang.Exception;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class MediaTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testMedia_MarkPlayed() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
MarkPlayedResponse res = sdk.media().markPlayed()
|
||||
.key(59398d)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testMedia_MarkUnplayed() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
MarkUnplayedResponse res = sdk.media().markUnplayed()
|
||||
.key(59398d)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testMedia_UpdatePlayProgress_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
UpdatePlayProgressResponse res = sdk.media().updatePlayProgress()
|
||||
.key("<key>")
|
||||
.time(90000d)
|
||||
.state("played")
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testMedia_GetBannerImage() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetBannerImageRequest req = GetBannerImageRequest.builder()
|
||||
.ratingKey(9518L)
|
||||
.width(396L)
|
||||
.height(396L)
|
||||
.minSize(1L)
|
||||
.upscale(1L)
|
||||
.xPlexToken("CV5xoxjTpFKUzBTShsaf")
|
||||
.build();
|
||||
|
||||
GetBannerImageResponse res = sdk.media().getBannerImage()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testMedia_GetThumbImage() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetThumbImageRequest req = GetThumbImageRequest.builder()
|
||||
.ratingKey(9518L)
|
||||
.width(396L)
|
||||
.height(396L)
|
||||
.minSize(1L)
|
||||
.upscale(1L)
|
||||
.xPlexToken("CV5xoxjTpFKUzBTShsaf")
|
||||
.build();
|
||||
|
||||
GetThumbImageResponse res = sdk.media().getThumbImage()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
451
src/test/java/dev/plexapi/sdk/PlaylistsTests.java
Normal file
451
src/test/java/dev/plexapi/sdk/PlaylistsTests.java
Normal file
@@ -0,0 +1,451 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.AddPlaylistContentsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.AddPlaylistContentsMetadata;
|
||||
import dev.plexapi.sdk.models.operations.AddPlaylistContentsResponse;
|
||||
import dev.plexapi.sdk.models.operations.AddPlaylistContentsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.ClearPlaylistContentsResponse;
|
||||
import dev.plexapi.sdk.models.operations.CreatePlaylistMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.CreatePlaylistMetadata;
|
||||
import dev.plexapi.sdk.models.operations.CreatePlaylistQueryParamType;
|
||||
import dev.plexapi.sdk.models.operations.CreatePlaylistRequest;
|
||||
import dev.plexapi.sdk.models.operations.CreatePlaylistResponse;
|
||||
import dev.plexapi.sdk.models.operations.CreatePlaylistResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.DeletePlaylistResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsCountry;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsDirector;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsGenre;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsMedia;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsPart;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsQueryParamType;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsRole;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistContentsWriter;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistsMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetPlaylistsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.PlaylistType;
|
||||
import dev.plexapi.sdk.models.operations.QueryParamForce;
|
||||
import dev.plexapi.sdk.models.operations.QueryParamSmart;
|
||||
import dev.plexapi.sdk.models.operations.Smart;
|
||||
import dev.plexapi.sdk.models.operations.UpdatePlaylistResponse;
|
||||
import dev.plexapi.sdk.models.operations.UploadPlaylistResponse;
|
||||
import java.lang.Exception;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class PlaylistsTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_CreatePlaylist() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
CreatePlaylistRequest req = CreatePlaylistRequest.builder()
|
||||
.title("<value>")
|
||||
.type(CreatePlaylistQueryParamType.PHOTO)
|
||||
.smart(Smart.ONE)
|
||||
.uri("https://comfortable-eyebrow.info/")
|
||||
.build();
|
||||
|
||||
CreatePlaylistResponse res = sdk.playlists().createPlaylist()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
CreatePlaylistResponseBody.builder()
|
||||
.mediaContainer(CreatePlaylistMediaContainer.builder()
|
||||
.size(7)
|
||||
.metadata(List.of(
|
||||
CreatePlaylistMetadata.builder()
|
||||
.ratingKey("96")
|
||||
.key("/playlists/96/items")
|
||||
.guid("com.plexapp.agents.none://a2f92937-1408-40e2-b022-63a8a9377e55")
|
||||
.type("playlist")
|
||||
.title("A Great Playlist")
|
||||
.summary("What a great playlist")
|
||||
.smart(false)
|
||||
.playlistType("video")
|
||||
.icon("playlist://image.smart")
|
||||
.viewCount(1)
|
||||
.lastViewedAt(1705719589)
|
||||
.leafCount(1)
|
||||
.addedAt(1705719589)
|
||||
.updatedAt(1705724593)
|
||||
.composite("/playlists/96/composite/1705724593")
|
||||
.duration(141000)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_GetPlaylists() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetPlaylistsResponse res = sdk.playlists().getPlaylists()
|
||||
.playlistType(PlaylistType.VIDEO)
|
||||
.smart(QueryParamSmart.ZERO)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetPlaylistsResponseBody.builder()
|
||||
.mediaContainer(GetPlaylistsMediaContainer.builder()
|
||||
.size(4)
|
||||
.metadata(List.of(
|
||||
GetPlaylistsMetadata.builder()
|
||||
.ratingKey("92")
|
||||
.key("/playlists/92/items")
|
||||
.guid("com.plexapp.agents.none://7ca5aaef-58e8-4828-9e21-c009c97f2903")
|
||||
.type("playlist")
|
||||
.title("Static Playlist")
|
||||
.summary("A Great Playlist")
|
||||
.smart(false)
|
||||
.playlistType("video")
|
||||
.composite("/playlists/92/composite/1705716440")
|
||||
.icon("playlist://image.smart")
|
||||
.viewCount(1)
|
||||
.lastViewedAt(1705716298)
|
||||
.duration(7328000)
|
||||
.leafCount(32)
|
||||
.addedAt(1705716298)
|
||||
.updatedAt(1705716440)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_GetPlaylist() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetPlaylistResponse res = sdk.playlists().getPlaylist()
|
||||
.playlistID(9883.74d)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetPlaylistResponseBody.builder()
|
||||
.mediaContainer(GetPlaylistMediaContainer.builder()
|
||||
.size(1)
|
||||
.metadata(List.of(
|
||||
GetPlaylistMetadata.builder()
|
||||
.content("library://x/directory/%2Flibrary%2Fsections%2F1%2Fall%3Ftype%3D1%26push%3D1%26title%3D2%26or%3D1%26title%3DSerenity%26pop%3D1")
|
||||
.ratingKey("95")
|
||||
.key("/playlists/95/items")
|
||||
.guid("com.plexapp.agents.none://87425529-380f-44b8-a689-9a0537e7ec91")
|
||||
.type("playlist")
|
||||
.title("Smart Movie Playlist")
|
||||
.summary("")
|
||||
.smart(true)
|
||||
.playlistType("video")
|
||||
.composite("/playlists/95/composite/1705717387")
|
||||
.icon("playlist://image.smart")
|
||||
.duration(282000)
|
||||
.leafCount(2)
|
||||
.addedAt(1705716493)
|
||||
.updatedAt(1705717387)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_DeletePlaylist() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
DeletePlaylistResponse res = sdk.playlists().deletePlaylist()
|
||||
.playlistID(1020.45d)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_UpdatePlaylist() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
UpdatePlaylistResponse res = sdk.playlists().updatePlaylist()
|
||||
.playlistID(2088.77d)
|
||||
.title("<value>")
|
||||
.summary("<value>")
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_GetPlaylistContents() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetPlaylistContentsResponse res = sdk.playlists().getPlaylistContents()
|
||||
.playlistID(1613.10d)
|
||||
.type(GetPlaylistContentsQueryParamType.TvShow)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetPlaylistContentsResponseBody.builder()
|
||||
.mediaContainer(GetPlaylistContentsMediaContainer.builder()
|
||||
.size(2)
|
||||
.composite("/playlists/95/composite/1705717521")
|
||||
.duration(282)
|
||||
.leafCount(2)
|
||||
.playlistType("video")
|
||||
.ratingKey("95")
|
||||
.smart(true)
|
||||
.title("Smart Movie Playlist")
|
||||
.metadata(List.of(
|
||||
GetPlaylistContentsMetadata.builder()
|
||||
.ratingKey("17")
|
||||
.key("/library/metadata/17")
|
||||
.guid("plex://movie/5d77683f6f4521001ea9dc53")
|
||||
.studio("Universal Pictures")
|
||||
.type("movie")
|
||||
.title("Serenity")
|
||||
.titleSort("Amazing Spider-Man 2")
|
||||
.librarySectionTitle("Movies")
|
||||
.librarySectionID(1)
|
||||
.librarySectionKey("/library/sections/1")
|
||||
.contentRating("PG-13")
|
||||
.summary("Serenity continues the story of the TV series it was based upon (\"Firefly\"). River Tam had a secret - one in which she's not even aware - so dangerous, no one's safe, as an Alliance operative's sent to capture her, and all others are considered irrelevant to his job.")
|
||||
.rating(8.2d)
|
||||
.audienceRating(9.1d)
|
||||
.year(2005)
|
||||
.tagline("They aim to misbehave.")
|
||||
.thumb("/library/metadata/17/thumb/1705637165")
|
||||
.art("/library/metadata/17/art/1705637165")
|
||||
.duration(141416)
|
||||
.originallyAvailableAt(LocalDate.parse("2005-09-29T00:00:00Z"))
|
||||
.addedAt(1705637164)
|
||||
.updatedAt(1705637165)
|
||||
.audienceRatingImage("rottentomatoes://image.rating.upright")
|
||||
.hasPremiumExtras("1")
|
||||
.hasPremiumPrimaryExtra("1")
|
||||
.ratingImage("rottentomatoes://image.rating.ripe")
|
||||
.media(List.of(
|
||||
GetPlaylistContentsMedia.builder()
|
||||
.id(15)
|
||||
.duration(141416)
|
||||
.bitrate(2273)
|
||||
.width(1920)
|
||||
.height(814)
|
||||
.aspectRatio(2.35d)
|
||||
.audioChannels(2)
|
||||
.audioCodec("aac")
|
||||
.videoCodec("h264")
|
||||
.videoResolution("1080")
|
||||
.container("mp4")
|
||||
.videoFrameRate("24p")
|
||||
.optimizedForStreaming(0)
|
||||
.audioProfile("lc")
|
||||
.has64bitOffsets(false)
|
||||
.videoProfile("high")
|
||||
.part(List.of(
|
||||
GetPlaylistContentsPart.builder()
|
||||
.id(15)
|
||||
.key("/library/parts/15/1705637151/file.mp4")
|
||||
.duration(141416)
|
||||
.file("/movies/Serenity (2005)/Serenity (2005).mp4")
|
||||
.size(40271948)
|
||||
.audioProfile("lc")
|
||||
.container("mp4")
|
||||
.has64bitOffsets(false)
|
||||
.optimizedForStreaming(false)
|
||||
.videoProfile("high")
|
||||
.build()))
|
||||
.build()))
|
||||
.genre(List.of(
|
||||
GetPlaylistContentsGenre.builder()
|
||||
.tag("Action")
|
||||
.build()))
|
||||
.country(List.of(
|
||||
GetPlaylistContentsCountry.builder()
|
||||
.tag("United States of America")
|
||||
.build()))
|
||||
.director(List.of(
|
||||
GetPlaylistContentsDirector.builder()
|
||||
.tag("Joss Whedon")
|
||||
.build()))
|
||||
.writer(List.of(
|
||||
GetPlaylistContentsWriter.builder()
|
||||
.tag("Joss Whedon")
|
||||
.build()))
|
||||
.role(List.of(
|
||||
GetPlaylistContentsRole.builder()
|
||||
.tag("Gina Torres")
|
||||
.build()))
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_ClearPlaylistContents() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
ClearPlaylistContentsResponse res = sdk.playlists().clearPlaylistContents()
|
||||
.playlistID(6531.08d)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_AddPlaylistContents() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
AddPlaylistContentsResponse res = sdk.playlists().addPlaylistContents()
|
||||
.playlistID(2532.92d)
|
||||
.uri("server://12345/com.plexapp.plugins.library/library/metadata/1")
|
||||
.playQueueID(123d)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
AddPlaylistContentsResponseBody.builder()
|
||||
.mediaContainer(AddPlaylistContentsMediaContainer.builder()
|
||||
.size(1)
|
||||
.leafCountAdded(1)
|
||||
.leafCountRequested(1)
|
||||
.metadata(List.of(
|
||||
AddPlaylistContentsMetadata.builder()
|
||||
.ratingKey("94")
|
||||
.key("/playlists/94/items")
|
||||
.guid("com.plexapp.agents.none://972e3047-83d6-4848-a000-261f0af26ba2")
|
||||
.type("playlist")
|
||||
.title("A great playlist")
|
||||
.summary("One of my great playlists")
|
||||
.smart(false)
|
||||
.playlistType("video")
|
||||
.composite("/playlists/94/composite/1705800070")
|
||||
.duration(423000)
|
||||
.leafCount(3)
|
||||
.addedAt(1705716458)
|
||||
.updatedAt(1705800070)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlaylists_UploadPlaylist() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
UploadPlaylistResponse res = sdk.playlists().uploadPlaylist()
|
||||
.path("/home/barkley/playlist.m3u")
|
||||
.force(QueryParamForce.ZERO)
|
||||
.sectionID(1L)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
336
src/test/java/dev/plexapi/sdk/PlexTests.java
Normal file
336
src/test/java/dev/plexapi/sdk/PlexTests.java
Normal file
@@ -0,0 +1,336 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.Connections;
|
||||
import dev.plexapi.sdk.models.operations.Friend;
|
||||
import dev.plexapi.sdk.models.operations.GeoData;
|
||||
import dev.plexapi.sdk.models.operations.GetCompanionsDataResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetGeoDataGeoData;
|
||||
import dev.plexapi.sdk.models.operations.GetGeoDataResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetHomeDataResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetHomeDataResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetPinAuthPinContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetPinRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetPinResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetServerResourcesResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenByPinIdAuthPinContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenByPinIdGeoData;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenByPinIdRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetTokenByPinIdResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetUserFriendsResponse;
|
||||
import dev.plexapi.sdk.models.operations.IncludeHttps;
|
||||
import dev.plexapi.sdk.models.operations.IncludeIPv6;
|
||||
import dev.plexapi.sdk.models.operations.IncludeRelay;
|
||||
import dev.plexapi.sdk.models.operations.PlexDevice;
|
||||
import dev.plexapi.sdk.models.operations.Protocol;
|
||||
import dev.plexapi.sdk.models.operations.ResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.SharedServers;
|
||||
import dev.plexapi.sdk.models.operations.SharedSources;
|
||||
import dev.plexapi.sdk.models.operations.Status;
|
||||
import java.lang.Exception;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.openapitools.jackson.nullable.JsonNullable;
|
||||
|
||||
public class PlexTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlex_GetCompanionsData() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetCompanionsDataResponse res = sdk.plex().getCompanionsData()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
List.of(
|
||||
ResponseBody.builder()
|
||||
.identifier("tv.plex.sonos")
|
||||
.baseURL("https://sonos.plex.tv")
|
||||
.title("Sonos")
|
||||
.linkURL("https://sonos.plex.tv/link")
|
||||
.provides("client,player")
|
||||
.token("<value>")
|
||||
.build()),
|
||||
res.responseBodies().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlex_GetUserFriends() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetUserFriendsResponse res = sdk.plex().getUserFriends()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
List.of(
|
||||
Friend.builder()
|
||||
.email("username@email.com")
|
||||
.friendlyName(Optional.empty())
|
||||
.home(false)
|
||||
.id(437587)
|
||||
.sharedServers(List.of(
|
||||
SharedServers.builder()
|
||||
.build()))
|
||||
.sharedSources(List.of(
|
||||
SharedSources.builder()
|
||||
.build()))
|
||||
.status(Status.ACCEPTED)
|
||||
.thumb("https://plex.tv/users/7d1916e0d8f6e76b/avatar?c=1694481578")
|
||||
.title("username123")
|
||||
.username("username123")
|
||||
.uuid("7d1916e0d8f6e76b")
|
||||
.restricted(false)
|
||||
.build()),
|
||||
res.friends().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlex_GetGeoData() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetGeoDataResponse res = sdk.plex().getGeoData()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetGeoDataGeoData.builder()
|
||||
.code("VI")
|
||||
.continentCode("NA")
|
||||
.country("United States Virgin Islands")
|
||||
.city("Amsterdam")
|
||||
.timeZone("America/St_Thomas")
|
||||
.postalCode("802")
|
||||
.subdivisions("Saint Thomas")
|
||||
.coordinates("18.3381, -64.8941")
|
||||
.europeanUnionMember(true)
|
||||
.inPrivacyRestrictedCountry(true)
|
||||
.inPrivacyRestrictedRegion(true)
|
||||
.build(),
|
||||
res.geoData().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlex_GetHomeData() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetHomeDataResponse res = sdk.plex().getHomeData()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetHomeDataResponseBody.builder()
|
||||
.id(1841489d)
|
||||
.name("Blindkitty38's home")
|
||||
.guestUserID(58815432d)
|
||||
.guestUserUUID("f3df4e01bfca0787")
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlex_GetServerResources() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetServerResourcesResponse res = sdk.plex().getServerResources()
|
||||
.includeHttps(IncludeHttps.Enable)
|
||||
.includeRelay(IncludeRelay.Enable)
|
||||
.includeIPv6(IncludeIPv6.Enable)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
List.of(
|
||||
PlexDevice.builder()
|
||||
.name("<value>")
|
||||
.product("Small Wooden Fish")
|
||||
.productVersion("<value>")
|
||||
.platform("<value>")
|
||||
.platformVersion("<value>")
|
||||
.device("Mobile")
|
||||
.clientIdentifier("<value>")
|
||||
.createdAt(OffsetDateTime.parse("2019-06-24T11:38:02Z"))
|
||||
.lastSeenAt(OffsetDateTime.parse("2019-06-24T11:38:02Z"))
|
||||
.provides("<value>")
|
||||
.ownerId(528895L)
|
||||
.sourceTitle("<value>")
|
||||
.publicAddress("<value>")
|
||||
.accessToken("<value>")
|
||||
.owned(false)
|
||||
.home(false)
|
||||
.synced(false)
|
||||
.relay(false)
|
||||
.presence(false)
|
||||
.httpsRequired(false)
|
||||
.publicAddressMatches(false)
|
||||
.dnsRebindingProtection(false)
|
||||
.natLoopbackSupported(false)
|
||||
.connections(List.of(
|
||||
Connections.builder()
|
||||
.protocol(Protocol.HTTP)
|
||||
.address("9000 Station Road")
|
||||
.port(57017)
|
||||
.uri("https://steep-independence.net")
|
||||
.local(false)
|
||||
.relay(false)
|
||||
.iPv6(false)
|
||||
.build()))
|
||||
.build()),
|
||||
res.plexDevices().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlex_GetPin_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetPinRequest req = GetPinRequest.builder()
|
||||
.build();
|
||||
|
||||
GetPinResponse res = sdk.plex().getPin()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetPinAuthPinContainer.builder()
|
||||
.id(308667304L)
|
||||
.code("7RQZ")
|
||||
.product("Tautulli")
|
||||
.qr("https://plex.tv/api/v2/pins/qr/7RQZ")
|
||||
.clientIdentifier("Tautulli")
|
||||
.location(GeoData.builder()
|
||||
.code("VI")
|
||||
.continentCode("NA")
|
||||
.country("United States Virgin Islands")
|
||||
.city("Amsterdam")
|
||||
.timeZone("America/St_Thomas")
|
||||
.postalCode("802")
|
||||
.subdivisions("Saint Thomas")
|
||||
.coordinates("18.3381, -64.8941")
|
||||
.europeanUnionMember(true)
|
||||
.inPrivacyRestrictedCountry(true)
|
||||
.inPrivacyRestrictedRegion(true)
|
||||
.build())
|
||||
.createdAt(OffsetDateTime.parse("2024-07-16T17:03:05Z"))
|
||||
.expiresAt(OffsetDateTime.parse("2024-07-16T17:18:05Z"))
|
||||
.trusted(false)
|
||||
.expiresIn(876L)
|
||||
.authToken(JsonNullable.of(null))
|
||||
.newRegistration(JsonNullable.of(null))
|
||||
.build(),
|
||||
res.authPinContainer().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testPlex_GetTokenByPinId_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetTokenByPinIdRequest req = GetTokenByPinIdRequest.builder()
|
||||
.pinID(118274L)
|
||||
.build();
|
||||
|
||||
GetTokenByPinIdResponse res = sdk.plex().getTokenByPinId()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetTokenByPinIdAuthPinContainer.builder()
|
||||
.id(308667304L)
|
||||
.code("7RQZ")
|
||||
.product("Tautulli")
|
||||
.qr("https://plex.tv/api/v2/pins/qr/7RQZ")
|
||||
.clientIdentifier("Tautulli")
|
||||
.location(GetTokenByPinIdGeoData.builder()
|
||||
.code("VI")
|
||||
.continentCode("NA")
|
||||
.country("United States Virgin Islands")
|
||||
.city("Amsterdam")
|
||||
.timeZone("America/St_Thomas")
|
||||
.postalCode("802")
|
||||
.subdivisions("Saint Thomas")
|
||||
.coordinates("18.3381, -64.8941")
|
||||
.europeanUnionMember(true)
|
||||
.inPrivacyRestrictedCountry(true)
|
||||
.inPrivacyRestrictedRegion(true)
|
||||
.build())
|
||||
.createdAt(OffsetDateTime.parse("2024-07-16T17:03:05Z"))
|
||||
.expiresAt(OffsetDateTime.parse("2024-07-16T17:18:05Z"))
|
||||
.trusted(false)
|
||||
.expiresIn(876L)
|
||||
.authToken(JsonNullable.of(null))
|
||||
.newRegistration(JsonNullable.of(null))
|
||||
.build(),
|
||||
res.authPinContainer().get());
|
||||
}
|
||||
|
||||
}
|
||||
190
src/test/java/dev/plexapi/sdk/SearchTests.java
Normal file
190
src/test/java/dev/plexapi/sdk/SearchTests.java
Normal file
@@ -0,0 +1,190 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsCountry;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsDirector;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsGenre;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsMedia;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsPart;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsRole;
|
||||
import dev.plexapi.sdk.models.operations.GetSearchResultsWriter;
|
||||
import dev.plexapi.sdk.models.operations.PerformSearchResponse;
|
||||
import dev.plexapi.sdk.models.operations.PerformVoiceSearchResponse;
|
||||
import dev.plexapi.sdk.models.operations.Provider;
|
||||
import java.lang.Exception;
|
||||
import java.time.OffsetDateTime;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SearchTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSearch_PerformSearch() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
PerformSearchResponse res = sdk.search().performSearch()
|
||||
.query("dylan")
|
||||
.sectionId(4561.50d)
|
||||
.limit(5d)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSearch_PerformVoiceSearch() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
PerformVoiceSearchResponse res = sdk.search().performVoiceSearch()
|
||||
.query("dead+poop")
|
||||
.sectionId(5684.34d)
|
||||
.limit(5d)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSearch_GetSearchResults() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSearchResultsResponse res = sdk.search().getSearchResults()
|
||||
.query("110")
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetSearchResultsResponseBody.builder()
|
||||
.mediaContainer(GetSearchResultsMediaContainer.builder()
|
||||
.size(26d)
|
||||
.identifier("com.plexapp.plugins.library")
|
||||
.mediaTagPrefix("/system/bundle/media/flags/")
|
||||
.mediaTagVersion(1680021154d)
|
||||
.metadata(List.of(
|
||||
GetSearchResultsMetadata.builder()
|
||||
.librarySectionID(1d)
|
||||
.librarySectionTitle("Movies")
|
||||
.librarySectionUUID("322a231a-b7f7-49f5-920f-14c61199cd30")
|
||||
.sourceTitle("Hera")
|
||||
.ratingKey(10398d)
|
||||
.key("/library/metadata/10398")
|
||||
.guid("plex://movie/5d7768284de0ee001fcc8f52")
|
||||
.studio("Paramount")
|
||||
.type("movie")
|
||||
.title("Mission: Impossible")
|
||||
.contentRating("PG-13")
|
||||
.summary("When Ethan Hunt the leader of a crack espionage team whose perilous operation has gone awry with no explanation discovers that a mole has penetrated the CIA he's surprised to learn that he's the No. 1 suspect. To clear his name Hunt now must ferret out the real double agent and in the process even the score.")
|
||||
.rating(6.6d)
|
||||
.audienceRating(7.1d)
|
||||
.year(1996d)
|
||||
.tagline("Expect the impossible.")
|
||||
.thumb("/library/metadata/10398/thumb/1679505055")
|
||||
.art("/library/metadata/10398/art/1679505055")
|
||||
.duration(6612628d)
|
||||
.originallyAvailableAt(OffsetDateTime.parse("1996-05-22T00:00:00Z"))
|
||||
.addedAt(1589234571d)
|
||||
.updatedAt(1679505055d)
|
||||
.audienceRatingImage("rottentomatoes://image.rating.upright")
|
||||
.chapterSource("media")
|
||||
.primaryExtraKey("/library/metadata/10501")
|
||||
.ratingImage("rottentomatoes://image.rating.ripe")
|
||||
.media(List.of(
|
||||
GetSearchResultsMedia.builder()
|
||||
.id(26610d)
|
||||
.duration(6612628d)
|
||||
.bitrate(4751d)
|
||||
.width(1916d)
|
||||
.height(796d)
|
||||
.aspectRatio(2.35d)
|
||||
.audioChannels(6d)
|
||||
.audioCodec("aac")
|
||||
.videoCodec("hevc")
|
||||
.videoResolution(1080d)
|
||||
.container("mkv")
|
||||
.videoFrameRate("24p")
|
||||
.audioProfile("lc")
|
||||
.videoProfile("main 10")
|
||||
.part(List.of(
|
||||
GetSearchResultsPart.builder()
|
||||
.id(26610d)
|
||||
.key("/library/parts/26610/1589234571/file.mkv")
|
||||
.duration(6612628d)
|
||||
.file("/movies/Mission Impossible (1996)/Mission Impossible (1996) Bluray-1080p.mkv")
|
||||
.size(3926903851d)
|
||||
.audioProfile("lc")
|
||||
.container("mkv")
|
||||
.videoProfile("main 10")
|
||||
.build()))
|
||||
.build()))
|
||||
.genre(List.of(
|
||||
GetSearchResultsGenre.builder()
|
||||
.tag("Action")
|
||||
.build()))
|
||||
.director(List.of(
|
||||
GetSearchResultsDirector.builder()
|
||||
.tag("Brian De Palma")
|
||||
.build()))
|
||||
.writer(List.of(
|
||||
GetSearchResultsWriter.builder()
|
||||
.tag("David Koepp")
|
||||
.build()))
|
||||
.country(List.of(
|
||||
GetSearchResultsCountry.builder()
|
||||
.tag("United States of America")
|
||||
.build()))
|
||||
.role(List.of(
|
||||
GetSearchResultsRole.builder()
|
||||
.tag("Tom Cruise")
|
||||
.build()))
|
||||
.build()))
|
||||
.provider(List.of(
|
||||
Provider.builder()
|
||||
.key("/system/search")
|
||||
.title("Local Network")
|
||||
.type("mixed")
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
}
|
||||
381
src/test/java/dev/plexapi/sdk/ServerTests.java
Normal file
381
src/test/java/dev/plexapi/sdk/ServerTests.java
Normal file
@@ -0,0 +1,381 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.Action;
|
||||
import dev.plexapi.sdk.models.operations.Device;
|
||||
import dev.plexapi.sdk.models.operations.Feature;
|
||||
import dev.plexapi.sdk.models.operations.GetAvailableClientsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetAvailableClientsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetAvailableClientsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetDevicesMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetDevicesResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetDevicesResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetMediaProvidersMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetMediaProvidersResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetMediaProvidersResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetMyPlexAccountResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetMyPlexAccountResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetResizedPhotoRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetResizedPhotoResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetServerCapabilitiesResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetServerIdentityMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetServerIdentityResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetServerIdentityResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetServerListMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetServerListResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetServerListResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetServerListServer;
|
||||
import dev.plexapi.sdk.models.operations.GetServerPreferencesMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetServerPreferencesResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetServerPreferencesResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.MediaProvider;
|
||||
import dev.plexapi.sdk.models.operations.MinSize;
|
||||
import dev.plexapi.sdk.models.operations.MyPlex;
|
||||
import dev.plexapi.sdk.models.operations.Server;
|
||||
import dev.plexapi.sdk.models.operations.Setting;
|
||||
import dev.plexapi.sdk.models.operations.Upscale;
|
||||
import java.lang.Exception;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class ServerTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetServerCapabilities() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities()
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetServerPreferences() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetServerPreferencesResponse res = sdk.server().getServerPreferences()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetServerPreferencesResponseBody.builder()
|
||||
.mediaContainer(GetServerPreferencesMediaContainer.builder()
|
||||
.size(161)
|
||||
.setting(List.of(
|
||||
Setting.builder()
|
||||
.id("EnableDatabaseTrace")
|
||||
.label("")
|
||||
.summary("")
|
||||
.type("bool")
|
||||
.default_(false)
|
||||
.value(false)
|
||||
.hidden(true)
|
||||
.advanced(false)
|
||||
.group("")
|
||||
.enumValues("1:admin only|2:everyone")
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetAvailableClients() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetAvailableClientsResponse res = sdk.server().getAvailableClients()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetAvailableClientsResponseBody.builder()
|
||||
.mediaContainer(GetAvailableClientsMediaContainer.builder()
|
||||
.size(1d)
|
||||
.server(List.of(
|
||||
Server.builder()
|
||||
.name("iPad")
|
||||
.host("10.10.10.102")
|
||||
.address("10.10.10.102")
|
||||
.port(32500d)
|
||||
.machineIdentifier("A2E901F8-E016-43A7-ADFB-EF8CA8A4AC05")
|
||||
.version("8.17")
|
||||
.protocol("plex")
|
||||
.product("Plex for iOS")
|
||||
.deviceClass("tablet")
|
||||
.protocolVersion(2d)
|
||||
.protocolCapabilities("playback,playqueues,timeline,provider-playback")
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetDevices() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetDevicesResponse res = sdk.server().getDevices()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetDevicesResponseBody.builder()
|
||||
.mediaContainer(GetDevicesMediaContainer.builder()
|
||||
.size(151d)
|
||||
.identifier("com.plexapp.system.devices")
|
||||
.device(List.of(
|
||||
Device.builder()
|
||||
.id(1d)
|
||||
.name("iPhone")
|
||||
.platform("iOS")
|
||||
.createdAt(1654131230d)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetServerIdentity() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetServerIdentityResponse res = sdk.server().getServerIdentity()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetServerIdentityResponseBody.builder()
|
||||
.mediaContainer(GetServerIdentityMediaContainer.builder()
|
||||
.size(0d)
|
||||
.machineIdentifier("96f2fe7a78c9dc1f16a16bedbe90f98149be16b4")
|
||||
.version("1.31.3.6868-28fc46b27")
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetMyPlexAccount() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetMyPlexAccountResponse res = sdk.server().getMyPlexAccount()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetMyPlexAccountResponseBody.builder()
|
||||
.myPlex(MyPlex.builder()
|
||||
.authToken("Z5v-PrNASDFpsaCi3CPK7")
|
||||
.username("example.email@mail.com")
|
||||
.mappingState("mapped")
|
||||
.signInState("ok")
|
||||
.publicAddress("140.20.68.140")
|
||||
.publicPort(32400d)
|
||||
.privateAddress("10.10.10.47")
|
||||
.privatePort(32400d)
|
||||
.subscriptionFeatures("federated-auth,hardware_transcoding,home,hwtranscode,item_clusters,kevin-bacon,livetv,loudness,lyrics,music-analysis,music_videos,pass,photo_autotags,photos-v5,photosV6-edit,photosV6-tv-albums,premium_music_metadata,radio,server-manager,session_bandwidth_restrictions,session_kick,shared-radio,sync,trailers,tuner-sharing,type-first,unsupportedtuners,webhooks")
|
||||
.subscriptionState("Active")
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetResizedPhoto() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetResizedPhotoRequest req = GetResizedPhotoRequest.builder()
|
||||
.width(110d)
|
||||
.height(165d)
|
||||
.opacity(100L)
|
||||
.blur(20d)
|
||||
.minSize(MinSize.ONE)
|
||||
.upscale(Upscale.ONE)
|
||||
.url("/library/metadata/49564/thumb/1654258204")
|
||||
.build();
|
||||
|
||||
GetResizedPhotoResponse res = sdk.server().getResizedPhoto()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetMediaProviders() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetMediaProvidersResponse res = sdk.server().getMediaProviders()
|
||||
.xPlexToken("CV5xoxjTpFKUzBTShsaf")
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetMediaProvidersResponseBody.builder()
|
||||
.mediaContainer(GetMediaProvidersMediaContainer.builder()
|
||||
.mediaProvider(List.of(
|
||||
MediaProvider.builder()
|
||||
.feature(List.of(
|
||||
Feature.builder()
|
||||
.type("<value>")
|
||||
.flavor("global")
|
||||
.scrobbleKey("/:/scrobble/new")
|
||||
.unscrobbleKey("/:/unscrobble/new")
|
||||
.action(List.of(
|
||||
Action.builder()
|
||||
.id("addToContinueWatching")
|
||||
.key("/actions/addToContinueWatching")
|
||||
.build()))
|
||||
.build(),
|
||||
Feature.builder()
|
||||
.type("<value>")
|
||||
.flavor("global")
|
||||
.scrobbleKey("/:/scrobble/new")
|
||||
.unscrobbleKey("/:/unscrobble/new")
|
||||
.action(List.of(
|
||||
Action.builder()
|
||||
.id("addToContinueWatching")
|
||||
.key("/actions/addToContinueWatching")
|
||||
.build(),
|
||||
Action.builder()
|
||||
.id("addToContinueWatching")
|
||||
.key("/actions/addToContinueWatching")
|
||||
.build()))
|
||||
.build(),
|
||||
Feature.builder()
|
||||
.type("<value>")
|
||||
.flavor("global")
|
||||
.scrobbleKey("/:/scrobble/new")
|
||||
.unscrobbleKey("/:/unscrobble/new")
|
||||
.action(List.of(
|
||||
Action.builder()
|
||||
.id("addToContinueWatching")
|
||||
.key("/actions/addToContinueWatching")
|
||||
.build(),
|
||||
Action.builder()
|
||||
.id("addToContinueWatching")
|
||||
.key("/actions/addToContinueWatching")
|
||||
.build()))
|
||||
.build()))
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testServer_GetServerList() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetServerListResponse res = sdk.server().getServerList()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetServerListResponseBody.builder()
|
||||
.mediaContainer(GetServerListMediaContainer.builder()
|
||||
.size(1d)
|
||||
.server(List.of(
|
||||
GetServerListServer.builder()
|
||||
.name("Hera")
|
||||
.host("10.10.10.47")
|
||||
.address("10.10.10.47")
|
||||
.port(32400d)
|
||||
.machineIdentifier("96f2fe7a78c9dc1f16a16bedbe90f98149be16b4")
|
||||
.version("1.31.3.6868-28fc46b27")
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
}
|
||||
563
src/test/java/dev/plexapi/sdk/SessionsTests.java
Normal file
563
src/test/java/dev/plexapi/sdk/SessionsTests.java
Normal file
@@ -0,0 +1,563 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.GetSessionHistoryMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionHistoryMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionHistoryResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionHistoryResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionsMedia;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionsMetadata;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionsPart;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionsStream;
|
||||
import dev.plexapi.sdk.models.operations.GetSessionsUser;
|
||||
import dev.plexapi.sdk.models.operations.GetTranscodeSessionsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetTranscodeSessionsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetTranscodeSessionsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.Player;
|
||||
import dev.plexapi.sdk.models.operations.QueryParamFilter;
|
||||
import dev.plexapi.sdk.models.operations.Session;
|
||||
import dev.plexapi.sdk.models.operations.StopTranscodeSessionResponse;
|
||||
import dev.plexapi.sdk.models.operations.TranscodeSession;
|
||||
import java.lang.Exception;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SessionsTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_GetSessions() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSessionsResponse res = sdk.sessions().getSessions()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetSessionsResponseBody.builder()
|
||||
.mediaContainer(GetSessionsMediaContainer.builder()
|
||||
.size(1)
|
||||
.metadata(List.of(
|
||||
GetSessionsMetadata.builder()
|
||||
.addedAt(1705543312)
|
||||
.art("/library/metadata/39904/art/1705310687")
|
||||
.duration(186240)
|
||||
.grandparentArt("/library/metadata/39904/art/1705310687")
|
||||
.grandparentGuid("plex://artist/5d07bbfd403c6402904a6480")
|
||||
.grandparentKey("/library/metadata/39904")
|
||||
.grandparentRatingKey("39904")
|
||||
.grandparentThumb("/library/metadata/39904/thumb/1705310687")
|
||||
.grandparentTitle("Green Day")
|
||||
.guid("plex://track/6535834f71f22f36f71a8e8f")
|
||||
.index(1)
|
||||
.key("/library/metadata/67085")
|
||||
.librarySectionID("3")
|
||||
.librarySectionKey("/library/sections/3")
|
||||
.librarySectionTitle("Music")
|
||||
.musicAnalysisVersion("1")
|
||||
.parentGuid("plex://album/65394d6d472b8ab03ef47f12")
|
||||
.parentIndex(1)
|
||||
.parentKey("/library/metadata/67084")
|
||||
.parentRatingKey("67084")
|
||||
.parentStudio("Reprise Records")
|
||||
.parentThumb("/library/metadata/67084/thumb/1705543314")
|
||||
.parentTitle("Saviors")
|
||||
.parentYear(2024)
|
||||
.ratingCount(45885)
|
||||
.ratingKey("67085")
|
||||
.sessionKey("203")
|
||||
.thumb("/library/metadata/67084/thumb/1705543314")
|
||||
.title("The American Dream Is Killing Me")
|
||||
.titleSort("American Dream Is Killing Me")
|
||||
.type("track")
|
||||
.updatedAt(1705543314)
|
||||
.viewOffset(1000)
|
||||
.media(List.of(
|
||||
GetSessionsMedia.builder()
|
||||
.audioChannels(2)
|
||||
.audioCodec("flac")
|
||||
.bitrate(1014)
|
||||
.container("flac")
|
||||
.duration(186240)
|
||||
.id("130355")
|
||||
.selected(true)
|
||||
.part(List.of(
|
||||
GetSessionsPart.builder()
|
||||
.container("flac")
|
||||
.duration(186240)
|
||||
.file("/music/Green Day/Saviors (2024)/Green Day - Saviors - 01 - The American Dream Is Killing Me.flac")
|
||||
.hasThumbnail("1")
|
||||
.id("130625")
|
||||
.key("/library/parts/130625/1705543268/file.flac")
|
||||
.size(23644000)
|
||||
.decision("directplay")
|
||||
.selected(true)
|
||||
.stream(List.of(
|
||||
GetSessionsStream.builder()
|
||||
.albumGain("-12.94")
|
||||
.albumPeak("1.000000")
|
||||
.albumRange("4.751014")
|
||||
.audioChannelLayout("stereo")
|
||||
.bitDepth(16)
|
||||
.bitrate(1014)
|
||||
.channels(2)
|
||||
.codec("flac")
|
||||
.displayTitle("FLAC (Stereo)")
|
||||
.extendedDisplayTitle("FLAC (Stereo)")
|
||||
.gain("-12.94")
|
||||
.id("352487")
|
||||
.index(0)
|
||||
.loudness("-5.94")
|
||||
.lra("1.74")
|
||||
.peak("1.000000")
|
||||
.samplingRate(44100)
|
||||
.selected(true)
|
||||
.streamType(2)
|
||||
.location("direct")
|
||||
.build()))
|
||||
.build()))
|
||||
.build()))
|
||||
.user(GetSessionsUser.builder()
|
||||
.id("1")
|
||||
.thumb("https://plex.tv/users/844780fc6f8a26b5/avatar?c=1705853661")
|
||||
.title("Blindkitty38")
|
||||
.build())
|
||||
.player(Player.builder()
|
||||
.address("10.10.10.171")
|
||||
.machineIdentifier("3tsdzir85m2onc3qyr255aq1")
|
||||
.model("standalone")
|
||||
.platform("windows")
|
||||
.platformVersion("10.0.22621")
|
||||
.product("Plex for Windows")
|
||||
.profile("Plex Desktop")
|
||||
.remotePublicAddress("68.248.140.20")
|
||||
.state("playing")
|
||||
.title("DESKTOP-BL80MTD")
|
||||
.version("1.85.0.4071-21128b56")
|
||||
.local(true)
|
||||
.relayed(false)
|
||||
.secure(true)
|
||||
.userID(1)
|
||||
.build())
|
||||
.session(Session.builder()
|
||||
.id("93h7e00ncblxncqw9lkfaoxi")
|
||||
.bandwidth(1050)
|
||||
.location("lan")
|
||||
.build())
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_GetSessionHistory_ViewedAtDescending() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSessionHistoryResponse res = sdk.sessions().getSessionHistory()
|
||||
.sort("<value>")
|
||||
.accountId(1L)
|
||||
.filter(QueryParamFilter.builder()
|
||||
.build())
|
||||
.librarySectionID(12L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetSessionHistoryResponseBody.builder()
|
||||
.mediaContainer(GetSessionHistoryMediaContainer.builder()
|
||||
.size(10855)
|
||||
.metadata(List.of(
|
||||
GetSessionHistoryMetadata.builder()
|
||||
.historyKey("/status/sessions/history/1")
|
||||
.key("/library/metadata/32171")
|
||||
.ratingKey("32171")
|
||||
.librarySectionID("2")
|
||||
.parentKey("/library/metadata/32170")
|
||||
.grandparentKey("/library/metadata/32132")
|
||||
.title("The Noise That Blue Makes")
|
||||
.grandparentTitle("Taskmaster")
|
||||
.type("episode")
|
||||
.thumb("/library/metadata/32171/thumb/-1")
|
||||
.parentThumb("/library/metadata/32170/thumb/1654134301")
|
||||
.grandparentThumb("/library/metadata/32132/thumb/1703933346")
|
||||
.grandparentArt("/library/metadata/32132/art/1703933346")
|
||||
.index(1)
|
||||
.parentIndex(13)
|
||||
.originallyAvailableAt(LocalDate.parse("2022-04-14T00:00:00Z"))
|
||||
.viewedAt(1654139223)
|
||||
.accountID(1)
|
||||
.deviceID(5)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_GetSessionHistory_ViewedAtAscending() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSessionHistoryResponse res = sdk.sessions().getSessionHistory()
|
||||
.sort("<value>")
|
||||
.accountId(1L)
|
||||
.filter(QueryParamFilter.builder()
|
||||
.build())
|
||||
.librarySectionID(12L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetSessionHistoryResponseBody.builder()
|
||||
.mediaContainer(GetSessionHistoryMediaContainer.builder()
|
||||
.size(10855)
|
||||
.metadata(List.of(
|
||||
GetSessionHistoryMetadata.builder()
|
||||
.historyKey("/status/sessions/history/1")
|
||||
.key("/library/metadata/32171")
|
||||
.ratingKey("32171")
|
||||
.librarySectionID("2")
|
||||
.parentKey("/library/metadata/32170")
|
||||
.grandparentKey("/library/metadata/32132")
|
||||
.title("The Noise That Blue Makes")
|
||||
.grandparentTitle("Taskmaster")
|
||||
.type("episode")
|
||||
.thumb("/library/metadata/32171/thumb/-1")
|
||||
.parentThumb("/library/metadata/32170/thumb/1654134301")
|
||||
.grandparentThumb("/library/metadata/32132/thumb/1703933346")
|
||||
.grandparentArt("/library/metadata/32132/art/1703933346")
|
||||
.index(1)
|
||||
.parentIndex(13)
|
||||
.originallyAvailableAt(LocalDate.parse("2022-04-14T00:00:00Z"))
|
||||
.viewedAt(1654139223)
|
||||
.accountID(1)
|
||||
.deviceID(5)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_GetSessionHistory_RatingDescending() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSessionHistoryResponse res = sdk.sessions().getSessionHistory()
|
||||
.sort("<value>")
|
||||
.accountId(1L)
|
||||
.filter(QueryParamFilter.builder()
|
||||
.build())
|
||||
.librarySectionID(12L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetSessionHistoryResponseBody.builder()
|
||||
.mediaContainer(GetSessionHistoryMediaContainer.builder()
|
||||
.size(10855)
|
||||
.metadata(List.of(
|
||||
GetSessionHistoryMetadata.builder()
|
||||
.historyKey("/status/sessions/history/1")
|
||||
.key("/library/metadata/32171")
|
||||
.ratingKey("32171")
|
||||
.librarySectionID("2")
|
||||
.parentKey("/library/metadata/32170")
|
||||
.grandparentKey("/library/metadata/32132")
|
||||
.title("The Noise That Blue Makes")
|
||||
.grandparentTitle("Taskmaster")
|
||||
.type("episode")
|
||||
.thumb("/library/metadata/32171/thumb/-1")
|
||||
.parentThumb("/library/metadata/32170/thumb/1654134301")
|
||||
.grandparentThumb("/library/metadata/32132/thumb/1703933346")
|
||||
.grandparentArt("/library/metadata/32132/art/1703933346")
|
||||
.index(1)
|
||||
.parentIndex(13)
|
||||
.originallyAvailableAt(LocalDate.parse("2022-04-14T00:00:00Z"))
|
||||
.viewedAt(1654139223)
|
||||
.accountID(1)
|
||||
.deviceID(5)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_GetSessionHistory_RatingAscending() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSessionHistoryResponse res = sdk.sessions().getSessionHistory()
|
||||
.sort("<value>")
|
||||
.accountId(1L)
|
||||
.filter(QueryParamFilter.builder()
|
||||
.build())
|
||||
.librarySectionID(12L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetSessionHistoryResponseBody.builder()
|
||||
.mediaContainer(GetSessionHistoryMediaContainer.builder()
|
||||
.size(10855)
|
||||
.metadata(List.of(
|
||||
GetSessionHistoryMetadata.builder()
|
||||
.historyKey("/status/sessions/history/1")
|
||||
.key("/library/metadata/32171")
|
||||
.ratingKey("32171")
|
||||
.librarySectionID("2")
|
||||
.parentKey("/library/metadata/32170")
|
||||
.grandparentKey("/library/metadata/32132")
|
||||
.title("The Noise That Blue Makes")
|
||||
.grandparentTitle("Taskmaster")
|
||||
.type("episode")
|
||||
.thumb("/library/metadata/32171/thumb/-1")
|
||||
.parentThumb("/library/metadata/32170/thumb/1654134301")
|
||||
.grandparentThumb("/library/metadata/32132/thumb/1703933346")
|
||||
.grandparentArt("/library/metadata/32132/art/1703933346")
|
||||
.index(1)
|
||||
.parentIndex(13)
|
||||
.originallyAvailableAt(LocalDate.parse("2022-04-14T00:00:00Z"))
|
||||
.viewedAt(1654139223)
|
||||
.accountID(1)
|
||||
.deviceID(5)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_GetSessionHistory_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSessionHistoryResponse res = sdk.sessions().getSessionHistory()
|
||||
.sort("<value>")
|
||||
.accountId(1L)
|
||||
.filter(QueryParamFilter.builder()
|
||||
.build())
|
||||
.librarySectionID(12L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetSessionHistoryResponseBody.builder()
|
||||
.mediaContainer(GetSessionHistoryMediaContainer.builder()
|
||||
.size(10855)
|
||||
.metadata(List.of(
|
||||
GetSessionHistoryMetadata.builder()
|
||||
.historyKey("/status/sessions/history/1")
|
||||
.key("/library/metadata/32171")
|
||||
.ratingKey("32171")
|
||||
.librarySectionID("2")
|
||||
.parentKey("/library/metadata/32170")
|
||||
.grandparentKey("/library/metadata/32132")
|
||||
.title("The Noise That Blue Makes")
|
||||
.grandparentTitle("Taskmaster")
|
||||
.type("episode")
|
||||
.thumb("/library/metadata/32171/thumb/-1")
|
||||
.parentThumb("/library/metadata/32170/thumb/1654134301")
|
||||
.grandparentThumb("/library/metadata/32132/thumb/1703933346")
|
||||
.grandparentArt("/library/metadata/32132/art/1703933346")
|
||||
.index(1)
|
||||
.parentIndex(13)
|
||||
.originallyAvailableAt(LocalDate.parse("2022-04-14T00:00:00Z"))
|
||||
.viewedAt(1654139223)
|
||||
.accountID(1)
|
||||
.deviceID(5)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_GetSessionHistory_ViewedAt() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetSessionHistoryResponse res = sdk.sessions().getSessionHistory()
|
||||
.sort("<value>")
|
||||
.accountId(1L)
|
||||
.filter(QueryParamFilter.builder()
|
||||
.build())
|
||||
.librarySectionID(12L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetSessionHistoryResponseBody.builder()
|
||||
.mediaContainer(GetSessionHistoryMediaContainer.builder()
|
||||
.size(10855)
|
||||
.metadata(List.of(
|
||||
GetSessionHistoryMetadata.builder()
|
||||
.historyKey("/status/sessions/history/1")
|
||||
.key("/library/metadata/32171")
|
||||
.ratingKey("32171")
|
||||
.librarySectionID("2")
|
||||
.parentKey("/library/metadata/32170")
|
||||
.grandparentKey("/library/metadata/32132")
|
||||
.title("The Noise That Blue Makes")
|
||||
.grandparentTitle("Taskmaster")
|
||||
.type("episode")
|
||||
.thumb("/library/metadata/32171/thumb/-1")
|
||||
.parentThumb("/library/metadata/32170/thumb/1654134301")
|
||||
.grandparentThumb("/library/metadata/32132/thumb/1703933346")
|
||||
.grandparentArt("/library/metadata/32132/art/1703933346")
|
||||
.index(1)
|
||||
.parentIndex(13)
|
||||
.originallyAvailableAt(LocalDate.parse("2022-04-14T00:00:00Z"))
|
||||
.viewedAt(1654139223)
|
||||
.accountID(1)
|
||||
.deviceID(5)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_GetTranscodeSessions() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetTranscodeSessionsResponse res = sdk.sessions().getTranscodeSessions()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetTranscodeSessionsResponseBody.builder()
|
||||
.mediaContainer(GetTranscodeSessionsMediaContainer.builder()
|
||||
.size(1)
|
||||
.transcodeSession(List.of(
|
||||
TranscodeSession.builder()
|
||||
.key("vv3i2q2lax92qlzul1hbd4bx")
|
||||
.throttled(false)
|
||||
.complete(false)
|
||||
.progress(1.7999999523162842d)
|
||||
.size(-22)
|
||||
.speed(25.100000381469727d)
|
||||
.error(false)
|
||||
.duration(1445695)
|
||||
.remaining(53)
|
||||
.context("streaming")
|
||||
.sourceVideoCodec("h264")
|
||||
.sourceAudioCodec("aac")
|
||||
.videoDecision("transcode")
|
||||
.audioDecision("transcode")
|
||||
.subtitleDecision("burn")
|
||||
.protocol("http")
|
||||
.container("mkv")
|
||||
.videoCodec("h264")
|
||||
.audioCodec("opus")
|
||||
.audioChannels(1)
|
||||
.transcodeHwRequested(true)
|
||||
.timeStamp(1705895805.4919229d)
|
||||
.maxOffsetAvailable(29.53d)
|
||||
.minOffsetAvailable(3.003000020980835d)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testSessions_StopTranscodeSession() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
StopTranscodeSessionResponse res = sdk.sessions().stopTranscodeSession()
|
||||
.sessionKey("zz7llzqlx8w9vnrsbnwhbmep")
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
179
src/test/java/dev/plexapi/sdk/StatisticsTests.java
Normal file
179
src/test/java/dev/plexapi/sdk/StatisticsTests.java
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.Account;
|
||||
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsAccount;
|
||||
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsDevice;
|
||||
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetBandwidthStatisticsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetResourcesStatisticsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.GetStatisticsDevice;
|
||||
import dev.plexapi.sdk.models.operations.GetStatisticsMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetStatisticsResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetStatisticsResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.StatisticsBandwidth;
|
||||
import dev.plexapi.sdk.models.operations.StatisticsMedia;
|
||||
import dev.plexapi.sdk.models.operations.StatisticsResources;
|
||||
import java.lang.Exception;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class StatisticsTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testStatistics_GetStatistics_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetStatisticsResponse res = sdk.statistics().getStatistics()
|
||||
.timespan(4L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetStatisticsResponseBody.builder()
|
||||
.mediaContainer(GetStatisticsMediaContainer.builder()
|
||||
.size(5497)
|
||||
.device(List.of(
|
||||
GetStatisticsDevice.builder()
|
||||
.id(208)
|
||||
.name("Roku Express")
|
||||
.platform("Roku")
|
||||
.clientIdentifier("793095d235660625108ef785cc7646e9")
|
||||
.createdAt(1706470556)
|
||||
.build()))
|
||||
.account(List.of(
|
||||
Account.builder()
|
||||
.id(238960586)
|
||||
.key("/accounts/238960586")
|
||||
.name("Diane")
|
||||
.defaultAudioLanguage("en")
|
||||
.autoSelectAudio(true)
|
||||
.defaultSubtitleLanguage("en")
|
||||
.subtitleMode(1)
|
||||
.thumb("https://plex.tv/users/50d83634246da1de/avatar?c=1707110967")
|
||||
.build()))
|
||||
.statisticsMedia(List.of(
|
||||
StatisticsMedia.builder()
|
||||
.accountID(1)
|
||||
.deviceID(13)
|
||||
.timespan(4)
|
||||
.at(1707141600)
|
||||
.metadataType(4)
|
||||
.count(1)
|
||||
.duration(1555)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testStatistics_GetResourcesStatistics_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetResourcesStatisticsResponse res = sdk.statistics().getResourcesStatistics()
|
||||
.timespan(4L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetResourcesStatisticsResponseBody.builder()
|
||||
.mediaContainer(GetResourcesStatisticsMediaContainer.builder()
|
||||
.size(5497)
|
||||
.statisticsResources(List.of(
|
||||
StatisticsResources.builder()
|
||||
.timespan(6L)
|
||||
.at(1718384427L)
|
||||
.hostCpuUtilization(1.276f)
|
||||
.processCpuUtilization(0.025f)
|
||||
.hostMemoryUtilization(17.026f)
|
||||
.processMemoryUtilization(0.493f)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testStatistics_GetBandwidthStatistics_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetBandwidthStatisticsResponse res = sdk.statistics().getBandwidthStatistics()
|
||||
.timespan(4L)
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetBandwidthStatisticsResponseBody.builder()
|
||||
.mediaContainer(GetBandwidthStatisticsMediaContainer.builder()
|
||||
.size(5497)
|
||||
.device(List.of(
|
||||
GetBandwidthStatisticsDevice.builder()
|
||||
.id(208)
|
||||
.name("Roku Express")
|
||||
.platform("Roku")
|
||||
.clientIdentifier("793095d235660625108ef785cc7646e9")
|
||||
.createdAt(1706470556)
|
||||
.build()))
|
||||
.account(List.of(
|
||||
GetBandwidthStatisticsAccount.builder()
|
||||
.id(238960586)
|
||||
.key("/accounts/238960586")
|
||||
.name("Diane")
|
||||
.defaultAudioLanguage("en")
|
||||
.autoSelectAudio(true)
|
||||
.defaultSubtitleLanguage("en")
|
||||
.subtitleMode(1)
|
||||
.thumb("https://plex.tv/users/50d83634246da1de/avatar?c=1707110967")
|
||||
.build()))
|
||||
.statisticsBandwidth(List.of(
|
||||
StatisticsBandwidth.builder()
|
||||
.accountID(238960586)
|
||||
.deviceID(208)
|
||||
.timespan(6L)
|
||||
.at(1718387650)
|
||||
.lan(true)
|
||||
.bytes(22L)
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
}
|
||||
120
src/test/java/dev/plexapi/sdk/UpdaterTests.java
Normal file
120
src/test/java/dev/plexapi/sdk/UpdaterTests.java
Normal file
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.ApplyUpdatesResponse;
|
||||
import dev.plexapi.sdk.models.operations.CheckForUpdatesResponse;
|
||||
import dev.plexapi.sdk.models.operations.Download;
|
||||
import dev.plexapi.sdk.models.operations.GetUpdateStatusMediaContainer;
|
||||
import dev.plexapi.sdk.models.operations.GetUpdateStatusResponse;
|
||||
import dev.plexapi.sdk.models.operations.GetUpdateStatusResponseBody;
|
||||
import dev.plexapi.sdk.models.operations.Release;
|
||||
import dev.plexapi.sdk.models.operations.Skip;
|
||||
import dev.plexapi.sdk.models.operations.Tonight;
|
||||
import java.lang.Exception;
|
||||
import java.util.List;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class UpdaterTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testUpdater_GetUpdateStatus() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetUpdateStatusResponse res = sdk.updater().getUpdateStatus()
|
||||
.call();
|
||||
|
||||
assertEquals(
|
||||
GetUpdateStatusResponseBody.builder()
|
||||
.mediaContainer(GetUpdateStatusMediaContainer.builder()
|
||||
.size(1)
|
||||
.canInstall(false)
|
||||
.checkedAt(1705801232)
|
||||
.downloadURL("https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx")
|
||||
.status(0)
|
||||
.release(List.of(
|
||||
Release.builder()
|
||||
.key("https://plex.tv/updater/releases/5136")
|
||||
.version("1.40.0.7775-456fbaf97")
|
||||
.added("(PLEASE NOTE) This version makes changes to the database which will make it compatible only with server versions 1.31.2 or higher (released March 14). You will not be able to use your database on Plex Media Server versions lower than this after this update. Please also be patient when updating to this version if you have a very large database and allow the upgrade process to finish.\n(Collections) Items added to a collection from the item context menu will now lock the collection field on the items (#12793)
|
||||
(Music) Store track genres and add filtering options (#14653)
|
||||
(Music) Support ID3v2.4 null-separated tags for genres and release type (#14653)
|
||||
(View History) No longer create a view history entry for items marked as played (#10888)
|
||||
(Web) Updated to 4.118.0")
|
||||
.fixed("(Agents) Changing a 'Other Videos' type library to the modern movie agent would fail (#14483)\n(Agents) It is possible that agents are not initialised during startup on rare occasions (#14654)
|
||||
(Agents) Remove the legacy OpenSubtitles agent which is no longer supported upstream (#14667)
|
||||
(Collection) Server could become unresponsive when collection membership changes (#14612)
|
||||
(DVR) Previously watched recordings could be deleted without being watched again (#13779)
|
||||
(Libraries) When performing fix match on items from certain music libraries the language would default to Arabic (#14501)
|
||||
(Library) The Content Rating not equal to None filter does not work (#14620)
|
||||
(Search) Album search results could contain all the album's tracks too (#14486)
|
||||
(Subtitles) In some circumstances, sidecar subtitles can show up for media when they're no longer available (#14674)
|
||||
(Transcoder) HW encoding would fail on devices with no rate control (#14222)
|
||||
(Transcoder) Software transcoding on Ubuntu could cause unexpected behavior (#14605)")
|
||||
.downloadURL("https://plex.tv/downloads/latest/5?channel=8&build=linux-x86_64&distro=redhat&X-Plex-Token=xxxxxxxxxxxxxxxxxxxx")
|
||||
.state("notify")
|
||||
.build()))
|
||||
.build())
|
||||
.build(),
|
||||
res.object().get());
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testUpdater_CheckForUpdates_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
CheckForUpdatesResponse res = sdk.updater().checkForUpdates()
|
||||
.download(Download.ONE)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testUpdater_ApplyUpdates_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
ApplyUpdatesResponse res = sdk.updater().applyUpdates()
|
||||
.tonight(Tonight.ONE)
|
||||
.skip(Skip.ONE)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
92
src/test/java/dev/plexapi/sdk/VideoTests.java
Normal file
92
src/test/java/dev/plexapi/sdk/VideoTests.java
Normal file
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.GetTimelineRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetTimelineResponse;
|
||||
import dev.plexapi.sdk.models.operations.StartUniversalTranscodeRequest;
|
||||
import dev.plexapi.sdk.models.operations.StartUniversalTranscodeResponse;
|
||||
import dev.plexapi.sdk.models.operations.State;
|
||||
import java.lang.Exception;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class VideoTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testVideo_GetTimeline_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetTimelineRequest req = GetTimelineRequest.builder()
|
||||
.ratingKey(23409d)
|
||||
.key("/library/metadata/23409")
|
||||
.state(State.PLAYING)
|
||||
.hasMDE(1d)
|
||||
.time(2000d)
|
||||
.duration(10000d)
|
||||
.context("home:hub.continueWatching")
|
||||
.playQueueItemID(1d)
|
||||
.playBackTime(2000d)
|
||||
.row(1d)
|
||||
.build();
|
||||
|
||||
GetTimelineResponse res = sdk.video().getTimeline()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testVideo_StartUniversalTranscode_() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
StartUniversalTranscodeRequest req = StartUniversalTranscodeRequest.builder()
|
||||
.hasMDE(1d)
|
||||
.path("/library/metadata/23409")
|
||||
.mediaIndex(0d)
|
||||
.partIndex(0d)
|
||||
.protocol("hls")
|
||||
.fastSeek(0d)
|
||||
.directPlay(0d)
|
||||
.directStream(0d)
|
||||
.subtitleSize(100d)
|
||||
.subtites("burn")
|
||||
.audioBoost(100d)
|
||||
.location("lan")
|
||||
.mediaBufferSize(102400d)
|
||||
.session("zvcage8b7rkioqcm8f4uns4c")
|
||||
.addDebugOverlay(0d)
|
||||
.autoAdjustQuality(0d)
|
||||
.build();
|
||||
|
||||
StartUniversalTranscodeResponse res = sdk.video().startUniversalTranscode()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
44
src/test/java/dev/plexapi/sdk/WatchlistTests.java
Normal file
44
src/test/java/dev/plexapi/sdk/WatchlistTests.java
Normal file
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
||||
*/
|
||||
|
||||
package dev.plexapi.sdk;
|
||||
|
||||
import dev.plexapi.sdk.models.operations.Filter;
|
||||
import dev.plexapi.sdk.models.operations.GetWatchListRequest;
|
||||
import dev.plexapi.sdk.models.operations.GetWatchListResponse;
|
||||
import java.lang.Exception;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class WatchlistTests {
|
||||
|
||||
@Disabled // test marked as skipped for java or generated unit tests not production ready yet
|
||||
@Test
|
||||
public void testWatchlist_GetWatchList() throws Exception {
|
||||
|
||||
|
||||
PlexAPI sdk = PlexAPI.builder()
|
||||
.accessToken("<YOUR_API_KEY_HERE>")
|
||||
.clientID("gcgzw5rz2xovp84b4vha3a40")
|
||||
.clientName("Plex Web")
|
||||
.clientVersion("4.133.0")
|
||||
.clientPlatform("Chrome")
|
||||
.deviceName("Linux")
|
||||
.build();
|
||||
|
||||
GetWatchListRequest req = GetWatchListRequest.builder()
|
||||
.filter(Filter.RELEASED)
|
||||
.xPlexToken("CV5xoxjTpFKUzBTShsaf")
|
||||
.xPlexContainerStart(0)
|
||||
.xPlexContainerSize(50)
|
||||
.build();
|
||||
|
||||
GetWatchListResponse res = sdk.watchlist().getWatchList()
|
||||
.request(req)
|
||||
.call();
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user