diff --git a/.speakeasy/gen.lock b/.speakeasy/gen.lock index 1641e62d..63d95c3d 100755 --- a/.speakeasy/gen.lock +++ b/.speakeasy/gen.lock @@ -1,12 +1,12 @@ lockVersion: 2.0.0 id: 1732900d-e173-47c1-a90d-d45182eb35d9 management: - docChecksum: 14b35829d4be91a88269761c3ed01426 + docChecksum: 7dec92ab9151a1b5a35df5faa81811ba docVersion: 0.0.3 speakeasyVersion: 1.484.1 generationVersion: 2.503.2 - releaseVersion: 0.11.4 - configChecksum: 126ca5c605b680e9fad7993275f418f0 + releaseVersion: 0.11.5 + configChecksum: e1b162d958a45d93386466a95963ae3c repoURL: https://github.com/LukeHagar/plexjava.git published: true features: @@ -266,6 +266,10 @@ generatedFiles: - docs/models/errors/GetUserFriendsErrors.md - docs/models/errors/GetUserFriendsPlexErrors.md - docs/models/errors/GetUserFriendsUnauthorized.md + - docs/models/errors/GetUsersBadRequest.md + - docs/models/errors/GetUsersErrors.md + - docs/models/errors/GetUsersUnauthorized.md + - docs/models/errors/GetUsersUsersErrors.md - docs/models/errors/GetWatchListBadRequest.md - docs/models/errors/GetWatchListErrors.md - docs/models/errors/GetWatchListUnauthorized.md @@ -343,6 +347,12 @@ generatedFiles: - docs/models/operations/AddPlaylistContentsRequest.md - docs/models/operations/AddPlaylistContentsResponse.md - docs/models/operations/AddPlaylistContentsResponseBody.md + - docs/models/operations/AllLibraries.md + - docs/models/operations/AllowCameraUpload.md + - docs/models/operations/AllowChannels.md + - docs/models/operations/AllowSubtitleAdmin.md + - docs/models/operations/AllowSync.md + - docs/models/operations/AllowTuners.md - docs/models/operations/ApplyUpdatesRequest.md - docs/models/operations/ApplyUpdatesResponse.md - docs/models/operations/AutoSelectSubtitle.md @@ -705,6 +715,7 @@ generatedFiles: - docs/models/operations/GetTopWatchedContentResponse.md - docs/models/operations/GetTopWatchedContentResponseBody.md - docs/models/operations/GetTopWatchedContentRole.md + - docs/models/operations/GetTopWatchedContentUser.md - docs/models/operations/GetTranscodeSessionsMediaContainer.md - docs/models/operations/GetTranscodeSessionsResponse.md - docs/models/operations/GetTranscodeSessionsResponseBody.md @@ -715,11 +726,17 @@ generatedFiles: - docs/models/operations/GetUpdateStatusResponse.md - docs/models/operations/GetUpdateStatusResponseBody.md - docs/models/operations/GetUserFriendsResponse.md + - docs/models/operations/GetUsersMediaContainer.md + - docs/models/operations/GetUsersRequest.md + - docs/models/operations/GetUsersResponse.md + - docs/models/operations/GetUsersResponseBody.md + - docs/models/operations/GetUsersServer.md - docs/models/operations/GetWatchListRequest.md - docs/models/operations/GetWatchListResponse.md - docs/models/operations/GetWatchListResponseBody.md - docs/models/operations/Guids.md - docs/models/operations/HasThumbnail.md + - docs/models/operations/Home.md - docs/models/operations/Hub.md - docs/models/operations/Image.md - docs/models/operations/IncludeCollections.md @@ -755,9 +772,11 @@ generatedFiles: - docs/models/operations/OnlyTransient.md - docs/models/operations/Operator.md - docs/models/operations/OptimizedForStreaming.md + - docs/models/operations/Owned.md - docs/models/operations/Part.md - docs/models/operations/PastSubscription.md - docs/models/operations/PathParamTaskName.md + - docs/models/operations/Pending.md - docs/models/operations/PerformSearchRequest.md - docs/models/operations/PerformSearchResponse.md - docs/models/operations/PerformVoiceSearchRequest.md @@ -785,6 +804,7 @@ generatedFiles: - docs/models/operations/PostUsersSignInDataUserProfile.md - docs/models/operations/PostUsersSignInDataWatchedIndicator.md - docs/models/operations/Producer.md + - docs/models/operations/Protected.md - docs/models/operations/Protocol.md - docs/models/operations/Provider.md - docs/models/operations/QueryParamFilter.md @@ -798,6 +818,7 @@ generatedFiles: - docs/models/operations/Ratings.md - docs/models/operations/Release.md - docs/models/operations/ResponseBody.md + - docs/models/operations/Restricted.md - docs/models/operations/Role.md - docs/models/operations/Scope.md - docs/models/operations/SearchResult.md @@ -863,6 +884,7 @@ generatedFiles: - docs/sdks/sessions/README.md - docs/sdks/statistics/README.md - docs/sdks/updater/README.md + - docs/sdks/users/README.md - docs/sdks/video/README.md - docs/sdks/watchlist/README.md - gradle/wrapper/gradle-wrapper.jar @@ -887,6 +909,7 @@ generatedFiles: - src/main/java/dev/plexapi/sdk/Sessions.java - src/main/java/dev/plexapi/sdk/Statistics.java - src/main/java/dev/plexapi/sdk/Updater.java + - src/main/java/dev/plexapi/sdk/Users.java - src/main/java/dev/plexapi/sdk/Video.java - src/main/java/dev/plexapi/sdk/Watchlist.java - src/main/java/dev/plexapi/sdk/models/errors/AddPlaylistContentsBadRequest.java @@ -1125,6 +1148,10 @@ generatedFiles: - src/main/java/dev/plexapi/sdk/models/errors/GetUserFriendsErrors.java - src/main/java/dev/plexapi/sdk/models/errors/GetUserFriendsPlexErrors.java - src/main/java/dev/plexapi/sdk/models/errors/GetUserFriendsUnauthorized.java + - src/main/java/dev/plexapi/sdk/models/errors/GetUsersBadRequest.java + - src/main/java/dev/plexapi/sdk/models/errors/GetUsersErrors.java + - src/main/java/dev/plexapi/sdk/models/errors/GetUsersUnauthorized.java + - src/main/java/dev/plexapi/sdk/models/errors/GetUsersUsersErrors.java - src/main/java/dev/plexapi/sdk/models/errors/GetWatchListBadRequest.java - src/main/java/dev/plexapi/sdk/models/errors/GetWatchListErrors.java - src/main/java/dev/plexapi/sdk/models/errors/GetWatchListUnauthorized.java @@ -1204,6 +1231,12 @@ generatedFiles: - src/main/java/dev/plexapi/sdk/models/operations/AddPlaylistContentsRequestBuilder.java - src/main/java/dev/plexapi/sdk/models/operations/AddPlaylistContentsResponse.java - src/main/java/dev/plexapi/sdk/models/operations/AddPlaylistContentsResponseBody.java + - src/main/java/dev/plexapi/sdk/models/operations/AllLibraries.java + - src/main/java/dev/plexapi/sdk/models/operations/AllowCameraUpload.java + - src/main/java/dev/plexapi/sdk/models/operations/AllowChannels.java + - src/main/java/dev/plexapi/sdk/models/operations/AllowSubtitleAdmin.java + - src/main/java/dev/plexapi/sdk/models/operations/AllowSync.java + - src/main/java/dev/plexapi/sdk/models/operations/AllowTuners.java - src/main/java/dev/plexapi/sdk/models/operations/ApplyUpdatesRequest.java - src/main/java/dev/plexapi/sdk/models/operations/ApplyUpdatesRequestBuilder.java - src/main/java/dev/plexapi/sdk/models/operations/ApplyUpdatesResponse.java @@ -1622,6 +1655,7 @@ generatedFiles: - src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentResponse.java - src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentResponseBody.java - src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentRole.java + - src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentUser.java - src/main/java/dev/plexapi/sdk/models/operations/GetTranscodeSessionsMediaContainer.java - src/main/java/dev/plexapi/sdk/models/operations/GetTranscodeSessionsRequestBuilder.java - src/main/java/dev/plexapi/sdk/models/operations/GetTranscodeSessionsResponse.java @@ -1636,12 +1670,19 @@ generatedFiles: - src/main/java/dev/plexapi/sdk/models/operations/GetUpdateStatusResponseBody.java - src/main/java/dev/plexapi/sdk/models/operations/GetUserFriendsRequestBuilder.java - src/main/java/dev/plexapi/sdk/models/operations/GetUserFriendsResponse.java + - src/main/java/dev/plexapi/sdk/models/operations/GetUsersMediaContainer.java + - src/main/java/dev/plexapi/sdk/models/operations/GetUsersRequest.java + - src/main/java/dev/plexapi/sdk/models/operations/GetUsersRequestBuilder.java + - src/main/java/dev/plexapi/sdk/models/operations/GetUsersResponse.java + - src/main/java/dev/plexapi/sdk/models/operations/GetUsersResponseBody.java + - src/main/java/dev/plexapi/sdk/models/operations/GetUsersServer.java - src/main/java/dev/plexapi/sdk/models/operations/GetWatchListRequest.java - src/main/java/dev/plexapi/sdk/models/operations/GetWatchListRequestBuilder.java - src/main/java/dev/plexapi/sdk/models/operations/GetWatchListResponse.java - src/main/java/dev/plexapi/sdk/models/operations/GetWatchListResponseBody.java - src/main/java/dev/plexapi/sdk/models/operations/Guids.java - src/main/java/dev/plexapi/sdk/models/operations/HasThumbnail.java + - src/main/java/dev/plexapi/sdk/models/operations/Home.java - src/main/java/dev/plexapi/sdk/models/operations/Hub.java - src/main/java/dev/plexapi/sdk/models/operations/Image.java - src/main/java/dev/plexapi/sdk/models/operations/IncludeCollections.java @@ -1681,9 +1722,11 @@ generatedFiles: - src/main/java/dev/plexapi/sdk/models/operations/OnlyTransient.java - src/main/java/dev/plexapi/sdk/models/operations/Operator.java - src/main/java/dev/plexapi/sdk/models/operations/OptimizedForStreaming.java + - src/main/java/dev/plexapi/sdk/models/operations/Owned.java - src/main/java/dev/plexapi/sdk/models/operations/Part.java - src/main/java/dev/plexapi/sdk/models/operations/PastSubscription.java - src/main/java/dev/plexapi/sdk/models/operations/PathParamTaskName.java + - src/main/java/dev/plexapi/sdk/models/operations/Pending.java - src/main/java/dev/plexapi/sdk/models/operations/PerformSearchRequest.java - src/main/java/dev/plexapi/sdk/models/operations/PerformSearchRequestBuilder.java - src/main/java/dev/plexapi/sdk/models/operations/PerformSearchResponse.java @@ -1714,6 +1757,7 @@ generatedFiles: - src/main/java/dev/plexapi/sdk/models/operations/PostUsersSignInDataUserProfile.java - src/main/java/dev/plexapi/sdk/models/operations/PostUsersSignInDataWatchedIndicator.java - src/main/java/dev/plexapi/sdk/models/operations/Producer.java + - src/main/java/dev/plexapi/sdk/models/operations/Protected.java - src/main/java/dev/plexapi/sdk/models/operations/Protocol.java - src/main/java/dev/plexapi/sdk/models/operations/Provider.java - src/main/java/dev/plexapi/sdk/models/operations/QueryParamFilter.java @@ -1727,6 +1771,7 @@ generatedFiles: - src/main/java/dev/plexapi/sdk/models/operations/Ratings.java - src/main/java/dev/plexapi/sdk/models/operations/Release.java - src/main/java/dev/plexapi/sdk/models/operations/ResponseBody.java + - src/main/java/dev/plexapi/sdk/models/operations/Restricted.java - src/main/java/dev/plexapi/sdk/models/operations/Role.java - src/main/java/dev/plexapi/sdk/models/operations/SDKMethodInterfaces.java - src/main/java/dev/plexapi/sdk/models/operations/Scope.java @@ -2838,5 +2883,29 @@ examples: application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}, {"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]} "401": application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}]} + get-users: + "": + parameters: + header: + X-Plex-Client-Identifier: "3381b62b-9ab7-4e37-827b-203e9809eb58" + X-Plex-Product: "Plex for Roku" + X-Plex-Device: "Roku 3" + X-Plex-Device-Name: "Chrome" + X-Plex-Device-Screen-Resolution: "1487x1165,2560x1440" + X-Plex-Version: "2.4.1" + X-Plex-Platform: "Roku" + X-Plex-Features: "external-media,indirect-media,hub-style-list" + X-Plex-Model: "4200X" + X-Plex-Session-Id: "97e136ef-4ddd-4ff3-89a7-a5820c96c2ca" + X-Plex-Language: "en" + X-Plex-Platform-Version: "4.3 build 1057" + X-Plex-Token: "CV5xoxjTpFKUzBTShsaf" + responses: + "200": + application/xml: "0xa9CdebeF9E" + "400": + application/json: {"errors": [{"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}, {"code": 1000, "message": "X-Plex-Client-Identifier is missing", "status": 400}]} + "401": + application/json: {"errors": [{"code": 1001, "message": "User could not be authenticated", "status": 401}, {"code": 1001, "message": "User could not be authenticated", "status": 401}]} examplesVersion: 1.0.0 generatedTests: {} diff --git a/.speakeasy/gen.yaml b/.speakeasy/gen.yaml index 5ac9d35f..e1017e14 100644 --- a/.speakeasy/gen.yaml +++ b/.speakeasy/gen.yaml @@ -13,7 +13,7 @@ generation: oAuth2ClientCredentialsEnabled: true oAuth2PasswordEnabled: false java: - version: 0.11.4 + version: 0.11.5 additionalDependencies: [] additionalPlugins: [] artifactID: plexapi diff --git a/.speakeasy/workflow.lock b/.speakeasy/workflow.lock index a495eefc..de8bdcee 100644 --- a/.speakeasy/workflow.lock +++ b/.speakeasy/workflow.lock @@ -8,19 +8,19 @@ sources: - latest plexapi: sourceNamespace: plexapi - sourceRevisionDigest: sha256:0b88c8bfc41def63e19e91fdd4d51bab07cb947cc3d39d2b44e8523a209cec10 - sourceBlobDigest: sha256:89d5b8427d4fb61b25751aebbaf71f9613958e9e91073fc084fed2c2ec62ce55 + sourceRevisionDigest: sha256:e6ab335dd91a4165f4510e4a3af8a55819c6310b7e66251266d2384376f3ccae + sourceBlobDigest: sha256:89d1b1133e400c89f0d06efe5e5168f5ba25a413e1ab8380d442d6b233e2e5a9 tags: - latest - - speakeasy-sdk-regen-1738715170 + - speakeasy-sdk-regen-1738801581 targets: plexjava: source: plexapi sourceNamespace: plexapi - sourceRevisionDigest: sha256:0b88c8bfc41def63e19e91fdd4d51bab07cb947cc3d39d2b44e8523a209cec10 - sourceBlobDigest: sha256:89d5b8427d4fb61b25751aebbaf71f9613958e9e91073fc084fed2c2ec62ce55 + sourceRevisionDigest: sha256:e6ab335dd91a4165f4510e4a3af8a55819c6310b7e66251266d2384376f3ccae + sourceBlobDigest: sha256:89d1b1133e400c89f0d06efe5e5168f5ba25a413e1ab8380d442d6b233e2e5a9 codeSamplesNamespace: code-samples-java-plexjava - codeSamplesRevisionDigest: sha256:2aa7538a82c8a44f72d94eb4f26788f861508b856440d207b35e5160b54e9420 + codeSamplesRevisionDigest: sha256:85b9a83c615e20272177b4b49152c959df250bf45bc141a4652d71090ec72db7 workflow: workflowVersion: 1.0.0 speakeasyVersion: latest diff --git a/README.md b/README.md index 6066cf4c..42ea6dc9 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ The samples below show how a published SDK artifact is used: Gradle: ```groovy -implementation 'dev.plexapi:plexapi:0.11.4' +implementation 'dev.plexapi:plexapi:0.11.5' ``` Maven: @@ -77,7 +77,7 @@ Maven: dev.plexapi plexapi - 0.11.4 + 0.11.5 ``` @@ -253,6 +253,10 @@ public class Application { * [checkForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates * [applyUpdates](docs/sdks/updater/README.md#applyupdates) - Apply Updates +### [users()](docs/sdks/users/README.md) + +* [getUsers](docs/sdks/users/README.md#getusers) - Get list of all connected users + ### [video()](docs/sdks/video/README.md) * [getTimeline](docs/sdks/video/README.md#gettimeline) - Get the timeline for a media item diff --git a/RELEASES.md b/RELEASES.md index 8a0fbe13..5e211024 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -228,4 +228,14 @@ Based on: ### Generated - [java v0.11.4] . ### Releases -- [Maven Central v0.11.4] https://central.sonatype.com/artifact/dev.plexapi/plexapi/0.11.4 - . \ No newline at end of file +- [Maven Central v0.11.4] https://central.sonatype.com/artifact/dev.plexapi/plexapi/0.11.4 - . + +## 2025-02-06 00:26:06 +### Changes +Based on: +- OpenAPI Doc +- Speakeasy CLI 1.484.1 (2.503.2) https://github.com/speakeasy-api/speakeasy +### Generated +- [java v0.11.5] . +### Releases +- [Maven Central v0.11.5] https://central.sonatype.com/artifact/dev.plexapi/plexapi/0.11.5 - . \ No newline at end of file diff --git a/build.gradle b/build.gradle index 0a8dec69..defebae7 100644 --- a/build.gradle +++ b/build.gradle @@ -63,7 +63,7 @@ tasks.withType(Javadoc) { } group = "dev.plexapi" -version = "0.11.4" +version = "0.11.5" sourcesJar { archiveBaseName = "plexapi" @@ -101,7 +101,7 @@ publishing { maven(MavenPublication) { groupId = 'dev.plexapi' artifactId = 'plexapi' - version = '0.11.4' + version = '0.11.5' from components.java diff --git a/codeSamples.yaml b/codeSamples.yaml index 87d93487..3080ac74 100644 --- a/codeSamples.yaml +++ b/codeSamples.yaml @@ -2467,6 +2467,53 @@ actions: } } } + - target: $["paths"]["/users"]["get"] + update: + x-codeSamples: + - lang: java + label: users + source: |- + package hello.world; + + import dev.plexapi.plexapi.PlexAPI; + import dev.plexapi.plexapi.models.errors.GetUsersBadRequest; + import dev.plexapi.plexapi.models.errors.GetUsersUnauthorized; + import dev.plexapi.plexapi.models.operations.GetUsersRequest; + import dev.plexapi.plexapi.models.operations.GetUsersResponse; + import java.lang.Exception; + + public class Application { + + public static void main(String[] args) throws GetUsersBadRequest, GetUsersUnauthorized, Exception { + + PlexAPI sdk = PlexAPI.builder() + .build(); + + GetUsersRequest req = GetUsersRequest.builder() + .clientID("3381b62b-9ab7-4e37-827b-203e9809eb58") + .xPlexToken("CV5xoxjTpFKUzBTShsaf") + .clientName("Plex for Roku") + .deviceNickname("Roku 3") + .deviceName("Chrome") + .deviceScreenResolution("1487x1165,2560x1440") + .clientVersion("2.4.1") + .platform("Roku") + .clientFeatures("external-media,indirect-media,hub-style-list") + .model("4200X") + .xPlexSessionId("97e136ef-4ddd-4ff3-89a7-a5820c96c2ca") + .xPlexLanguage("en") + .platformVersion("4.3 build 1057") + .build(); + + GetUsersResponse res = sdk.users().getUsers() + .request(req) + .call(); + + if (res.body().isPresent()) { + // handle response + } + } + } - target: $["paths"]["/users/signin"]["post"] update: x-codeSamples: diff --git a/docs/models/errors/GetUsersBadRequest.md b/docs/models/errors/GetUsersBadRequest.md new file mode 100644 index 00000000..4a9a6b01 --- /dev/null +++ b/docs/models/errors/GetUsersBadRequest.md @@ -0,0 +1,11 @@ +# GetUsersBadRequest + +Bad Request - A parameter was not specified, or was specified incorrectly. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `errors` | List\<[GetUsersErrors](../../models/errors/GetUsersErrors.md)> | :heavy_minus_sign: | N/A | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/errors/GetUsersErrors.md b/docs/models/errors/GetUsersErrors.md new file mode 100644 index 00000000..95b00857 --- /dev/null +++ b/docs/models/errors/GetUsersErrors.md @@ -0,0 +1,10 @@ +# GetUsersErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | ----------------------------------- | +| `code` | *Optional\* | :heavy_minus_sign: | N/A | 1000 | +| `message` | *Optional\* | :heavy_minus_sign: | N/A | X-Plex-Client-Identifier is missing | +| `status` | *Optional\* | :heavy_minus_sign: | N/A | 400 | \ No newline at end of file diff --git a/docs/models/errors/GetUsersUnauthorized.md b/docs/models/errors/GetUsersUnauthorized.md new file mode 100644 index 00000000..f5a4fb6c --- /dev/null +++ b/docs/models/errors/GetUsersUnauthorized.md @@ -0,0 +1,11 @@ +# GetUsersUnauthorized + +Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `errors` | List\<[GetUsersUsersErrors](../../models/errors/GetUsersUsersErrors.md)> | :heavy_minus_sign: | N/A | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_minus_sign: | Raw HTTP response; suitable for custom response parsing | \ No newline at end of file diff --git a/docs/models/errors/GetUsersUsersErrors.md b/docs/models/errors/GetUsersUsersErrors.md new file mode 100644 index 00000000..695bfc36 --- /dev/null +++ b/docs/models/errors/GetUsersUsersErrors.md @@ -0,0 +1,10 @@ +# GetUsersUsersErrors + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | ------------------------------- | +| `code` | *Optional\* | :heavy_minus_sign: | N/A | 1001 | +| `message` | *Optional\* | :heavy_minus_sign: | N/A | User could not be authenticated | +| `status` | *Optional\* | :heavy_minus_sign: | N/A | 401 | \ No newline at end of file diff --git a/docs/models/operations/AllLibraries.md b/docs/models/operations/AllLibraries.md new file mode 100644 index 00000000..393878a3 --- /dev/null +++ b/docs/models/operations/AllLibraries.md @@ -0,0 +1,11 @@ +# AllLibraries + +Indicates if the user has access to all libraries. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/AllowCameraUpload.md b/docs/models/operations/AllowCameraUpload.md new file mode 100644 index 00000000..b080e796 --- /dev/null +++ b/docs/models/operations/AllowCameraUpload.md @@ -0,0 +1,11 @@ +# AllowCameraUpload + +Indicates if the user is allowed to upload from a camera. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/AllowChannels.md b/docs/models/operations/AllowChannels.md new file mode 100644 index 00000000..72073287 --- /dev/null +++ b/docs/models/operations/AllowChannels.md @@ -0,0 +1,11 @@ +# AllowChannels + +Indicates if the user has access to channels. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/AllowSubtitleAdmin.md b/docs/models/operations/AllowSubtitleAdmin.md new file mode 100644 index 00000000..63bf969b --- /dev/null +++ b/docs/models/operations/AllowSubtitleAdmin.md @@ -0,0 +1,11 @@ +# AllowSubtitleAdmin + +Indicates if the user can manage subtitles. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/AllowSync.md b/docs/models/operations/AllowSync.md new file mode 100644 index 00000000..92557733 --- /dev/null +++ b/docs/models/operations/AllowSync.md @@ -0,0 +1,11 @@ +# AllowSync + +Indicates if the user is allowed to sync media. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/AllowTuners.md b/docs/models/operations/AllowTuners.md new file mode 100644 index 00000000..fe810e45 --- /dev/null +++ b/docs/models/operations/AllowTuners.md @@ -0,0 +1,11 @@ +# AllowTuners + +Indicates if the user is allowed to use tuners. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/GetTopWatchedContentMetadata.md b/docs/models/operations/GetTopWatchedContentMetadata.md index fa07966c..c5d919dd 100644 --- a/docs/models/operations/GetTopWatchedContentMetadata.md +++ b/docs/models/operations/GetTopWatchedContentMetadata.md @@ -36,4 +36,4 @@ | `country` | List\<[GetTopWatchedContentCountry](../../models/operations/GetTopWatchedContentCountry.md)> | :heavy_minus_sign: | N/A | | | `guids` | List\<[GetTopWatchedContentGuids](../../models/operations/GetTopWatchedContentGuids.md)> | :heavy_minus_sign: | N/A | | | `role` | List\<[GetTopWatchedContentRole](../../models/operations/GetTopWatchedContentRole.md)> | :heavy_minus_sign: | N/A | | -| `user` | List\<[User](../../models/operations/User.md)> | :heavy_minus_sign: | N/A | | \ No newline at end of file +| `user` | List\<[GetTopWatchedContentUser](../../models/operations/GetTopWatchedContentUser.md)> | :heavy_minus_sign: | N/A | | \ No newline at end of file diff --git a/docs/models/operations/GetTopWatchedContentUser.md b/docs/models/operations/GetTopWatchedContentUser.md new file mode 100644 index 00000000..71b82023 --- /dev/null +++ b/docs/models/operations/GetTopWatchedContentUser.md @@ -0,0 +1,8 @@ +# GetTopWatchedContentUser + + +## Fields + +| Field | Type | Required | Description | Example | +| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- | +| `id` | *Optional\* | :heavy_minus_sign: | N/A | 220 | \ No newline at end of file diff --git a/docs/models/operations/GetUsersMediaContainer.md b/docs/models/operations/GetUsersMediaContainer.md new file mode 100644 index 00000000..9f8a9294 --- /dev/null +++ b/docs/models/operations/GetUsersMediaContainer.md @@ -0,0 +1,15 @@ +# GetUsersMediaContainer + +Container holding user and server details. + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | +| `friendlyName` | *String* | :heavy_check_mark: | The friendly name of the Plex instance. | myPlex | +| `identifier` | *String* | :heavy_check_mark: | N/A | com.plexapp.plugins.myplex | +| `machineIdentifier` | *String* | :heavy_check_mark: | Unique Machine identifier of the Plex server. | 3dff4c4da3b1229a649aa574a9e2b419a684a20e | +| `totalSize` | *long* | :heavy_check_mark: | Total number of users. | 30 | +| `size` | *long* | :heavy_check_mark: | Number of users in the current response. | 30 | +| `user` | List\<[User](../../models/operations/User.md)> | :heavy_check_mark: | List of users with access to the Plex server. | | \ No newline at end of file diff --git a/docs/models/operations/GetUsersRequest.md b/docs/models/operations/GetUsersRequest.md new file mode 100644 index 00000000..fb3e5db3 --- /dev/null +++ b/docs/models/operations/GetUsersRequest.md @@ -0,0 +1,20 @@ +# GetUsersRequest + + +## Fields + +| Field | Type | Required | Description | Example | +| ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| `clientID` | *String* | :heavy_check_mark: | An opaque identifier unique to the client (UUID, serial number, or other unique device ID) | 3381b62b-9ab7-4e37-827b-203e9809eb58 | +| `clientName` | *Optional\* | :heavy_minus_sign: | The name of the client application. (Plex Web, Plex Media Server, etc.) | Plex for Roku | +| `deviceNickname` | *Optional\* | :heavy_minus_sign: | A relatively friendly name for the client device | Roku 3 | +| `deviceName` | *Optional\* | :heavy_minus_sign: | The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) | Chrome | +| `deviceScreenResolution` | *Optional\* | :heavy_minus_sign: | The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) | 1487x1165,2560x1440 | +| `clientVersion` | *Optional\* | :heavy_minus_sign: | The version of the client application. | 2.4.1 | +| `platform` | *Optional\* | :heavy_minus_sign: | The platform of the client application. | Roku | +| `clientFeatures` | *Optional\* | :heavy_minus_sign: | The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) | external-media,indirect-media,hub-style-list | +| `model` | *Optional\* | :heavy_minus_sign: | A potentially less friendly identifier for the device model | 4200X | +| `xPlexSessionId` | *Optional\* | :heavy_minus_sign: | The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) | 97e136ef-4ddd-4ff3-89a7-a5820c96c2ca | +| `xPlexLanguage` | *Optional\* | :heavy_minus_sign: | The language of the client application. | en | +| `platformVersion` | *Optional\* | :heavy_minus_sign: | The version of the platform | 4.3 build 1057 | +| `xPlexToken` | *String* | :heavy_check_mark: | An authentication token, obtained from plex.tv | CV5xoxjTpFKUzBTShsaf | \ No newline at end of file diff --git a/docs/models/operations/GetUsersResponse.md b/docs/models/operations/GetUsersResponse.md new file mode 100644 index 00000000..8196229f --- /dev/null +++ b/docs/models/operations/GetUsersResponse.md @@ -0,0 +1,11 @@ +# GetUsersResponse + + +## Fields + +| Field | Type | Required | Description | +| ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ | +| `contentType` | *String* | :heavy_check_mark: | HTTP response content type for this operation | +| `statusCode` | *int* | :heavy_check_mark: | HTTP response status code for this operation | +| `rawResponse` | [HttpResponse\](https://docs.oracle.com/en/java/javase/11/docs/api/java.net.http/java/net/http/HttpResponse.html) | :heavy_check_mark: | Raw HTTP response; suitable for custom response parsing | +| `body` | *Optional\* | :heavy_minus_sign: | N/A | \ No newline at end of file diff --git a/docs/models/operations/GetUsersResponseBody.md b/docs/models/operations/GetUsersResponseBody.md new file mode 100644 index 00000000..68e0cb50 --- /dev/null +++ b/docs/models/operations/GetUsersResponseBody.md @@ -0,0 +1,10 @@ +# GetUsersResponseBody + +Successful response with media container data in XML + + +## Fields + +| Field | Type | Required | Description | +| -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------- | +| `mediaContainer` | [Optional\](../../models/operations/GetUsersMediaContainer.md) | :heavy_minus_sign: | Container holding user and server details. | \ No newline at end of file diff --git a/docs/models/operations/GetUsersServer.md b/docs/models/operations/GetUsersServer.md new file mode 100644 index 00000000..db7f3cdb --- /dev/null +++ b/docs/models/operations/GetUsersServer.md @@ -0,0 +1,16 @@ +# GetUsersServer + + +## Fields + +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | ------------------------------------------------------------------ | +| `id` | *long* | :heavy_check_mark: | Unique ID of the server of the connected user | 907759180 | +| `serverId` | *long* | :heavy_check_mark: | ID of the actual Plex server. | 9999999 | +| `machineIdentifier` | *String* | :heavy_check_mark: | Machine identifier of the Plex server. | fbb8aa6be6e0c997c6268bc2b4431c8807f70a3 | +| `name` | *String* | :heavy_check_mark: | Name of the Plex server of the connected user. | ConnectedUserFlix | +| `lastSeenAt` | *long* | :heavy_check_mark: | N/A | 1556281940 | +| `numLibraries` | *long* | :heavy_check_mark: | Number of libraries in the server this user has access to. | 16 | +| `allLibraries` | [Optional\](../../models/operations/AllLibraries.md) | :heavy_minus_sign: | N/A | 1 | +| `owned` | [Optional\](../../models/operations/Owned.md) | :heavy_minus_sign: | N/A | 1 | +| `pending` | [Optional\](../../models/operations/Pending.md) | :heavy_minus_sign: | N/A | 1 | \ No newline at end of file diff --git a/docs/models/operations/Home.md b/docs/models/operations/Home.md new file mode 100644 index 00000000..6733522f --- /dev/null +++ b/docs/models/operations/Home.md @@ -0,0 +1,11 @@ +# Home + +Indicates if the user is part of a home group. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/Owned.md b/docs/models/operations/Owned.md new file mode 100644 index 00000000..6f7fa480 --- /dev/null +++ b/docs/models/operations/Owned.md @@ -0,0 +1,11 @@ +# Owned + +Indicates if the user owns the server. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/Pending.md b/docs/models/operations/Pending.md new file mode 100644 index 00000000..53885102 --- /dev/null +++ b/docs/models/operations/Pending.md @@ -0,0 +1,11 @@ +# Pending + +Indicates if the server is pending approval. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/Protected.md b/docs/models/operations/Protected.md new file mode 100644 index 00000000..5e37e852 --- /dev/null +++ b/docs/models/operations/Protected.md @@ -0,0 +1,11 @@ +# Protected + +Indicates whether the account is protected. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/Restricted.md b/docs/models/operations/Restricted.md new file mode 100644 index 00000000..bbbb3665 --- /dev/null +++ b/docs/models/operations/Restricted.md @@ -0,0 +1,11 @@ +# Restricted + +Indicates if the user has restricted access. + + +## Values + +| Name | Value | +| --------- | --------- | +| `Disable` | 0 | +| `Enable` | 1 | \ No newline at end of file diff --git a/docs/models/operations/User.md b/docs/models/operations/User.md index e3ece996..7ea4e35c 100644 --- a/docs/models/operations/User.md +++ b/docs/models/operations/User.md @@ -3,6 +3,25 @@ ## Fields -| Field | Type | Required | Description | Example | -| -------------------- | -------------------- | -------------------- | -------------------- | -------------------- | -| `id` | *Optional\* | :heavy_minus_sign: | N/A | 220 | \ No newline at end of file +| Field | Type | Required | Description | Example | +| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ | +| `id` | *long* | :heavy_check_mark: | User's unique ID. | 22526914 | +| `title` | *String* | :heavy_check_mark: | User's display name. | Plex User | +| `username` | *String* | :heavy_check_mark: | User's username. | zgfuc7krcqfimrmb9lsl5j | +| `email` | *String* | :heavy_check_mark: | User's email address. | zgfuc7krcqfimrmb9lsl5j@protonmail.com | +| `recommendationsPlaylistId` | *JsonNullable\* | :heavy_minus_sign: | ID of the user's recommendation playlist. | | +| `thumb` | *String* | :heavy_check_mark: | URL to the user's avatar image. | https://plex.tv/users/3346028014e93acd/avatar?c=1731605021 | +| `protected_` | [Optional\](../../models/operations/Protected.md) | :heavy_minus_sign: | N/A | 1 | +| `home` | [Optional\](../../models/operations/Home.md) | :heavy_minus_sign: | N/A | 1 | +| `allowTuners` | [Optional\](../../models/operations/AllowTuners.md) | :heavy_minus_sign: | N/A | 1 | +| `allowSync` | [Optional\](../../models/operations/AllowSync.md) | :heavy_minus_sign: | N/A | 1 | +| `allowCameraUpload` | [Optional\](../../models/operations/AllowCameraUpload.md) | :heavy_minus_sign: | N/A | 1 | +| `allowChannels` | [Optional\](../../models/operations/AllowChannels.md) | :heavy_minus_sign: | N/A | 1 | +| `allowSubtitleAdmin` | [Optional\](../../models/operations/AllowSubtitleAdmin.md) | :heavy_minus_sign: | N/A | 1 | +| `filterAll` | *JsonNullable\* | :heavy_minus_sign: | Filters applied for all content. | | +| `filterMovies` | *JsonNullable\* | :heavy_minus_sign: | Filters applied for movies. | | +| `filterMusic` | *JsonNullable\* | :heavy_minus_sign: | Filters applied for music. | | +| `filterPhotos` | *JsonNullable\* | :heavy_minus_sign: | Filters applied for photos. | | +| `filterTelevision` | *Optional\* | :heavy_minus_sign: | Filters applied for television. | | +| `restricted` | [Optional\](../../models/operations/Restricted.md) | :heavy_minus_sign: | N/A | 1 | +| `server` | List\<[GetUsersServer](../../models/operations/GetUsersServer.md)> | :heavy_check_mark: | List of servers owned by the user. | | \ No newline at end of file diff --git a/docs/sdks/users/README.md b/docs/sdks/users/README.md new file mode 100644 index 00000000..2c75fe31 --- /dev/null +++ b/docs/sdks/users/README.md @@ -0,0 +1,77 @@ +# Users +(*users()*) + +## Overview + +### Available Operations + +* [getUsers](#getusers) - Get list of all connected users + +## getUsers + +Get list of all users that are friends and have library access with the provided Plex authentication token + +### Example Usage + +```java +package hello.world; + +import dev.plexapi.sdk.PlexAPI; +import dev.plexapi.sdk.models.errors.GetUsersBadRequest; +import dev.plexapi.sdk.models.errors.GetUsersUnauthorized; +import dev.plexapi.sdk.models.operations.GetUsersRequest; +import dev.plexapi.sdk.models.operations.GetUsersResponse; +import java.lang.Exception; + +public class Application { + + public static void main(String[] args) throws GetUsersBadRequest, GetUsersUnauthorized, Exception { + + PlexAPI sdk = PlexAPI.builder() + .build(); + + GetUsersRequest req = GetUsersRequest.builder() + .clientID("3381b62b-9ab7-4e37-827b-203e9809eb58") + .xPlexToken("CV5xoxjTpFKUzBTShsaf") + .clientName("Plex for Roku") + .deviceNickname("Roku 3") + .deviceName("Chrome") + .deviceScreenResolution("1487x1165,2560x1440") + .clientVersion("2.4.1") + .platform("Roku") + .clientFeatures("external-media,indirect-media,hub-style-list") + .model("4200X") + .xPlexSessionId("97e136ef-4ddd-4ff3-89a7-a5820c96c2ca") + .xPlexLanguage("en") + .platformVersion("4.3 build 1057") + .build(); + + GetUsersResponse res = sdk.users().getUsers() + .request(req) + .call(); + + if (res.body().isPresent()) { + // handle response + } + } +} +``` + +### Parameters + +| Parameter | Type | Required | Description | +| ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | ------------------------------------------------------------- | +| `request` | [GetUsersRequest](../../models/operations/GetUsersRequest.md) | :heavy_check_mark: | The request object to use for the request. | +| `serverURL` | *String* | :heavy_minus_sign: | An optional server URL to use. | + +### Response + +**[GetUsersResponse](../../models/operations/GetUsersResponse.md)** + +### Errors + +| Error Type | Status Code | Content Type | +| ---------------------------------- | ---------------------------------- | ---------------------------------- | +| models/errors/GetUsersBadRequest | 400 | application/json | +| models/errors/GetUsersUnauthorized | 401 | application/json | +| models/errors/SDKError | 4XX, 5XX | \*/\* | \ No newline at end of file diff --git a/src/main/java/dev/plexapi/sdk/PlexAPI.java b/src/main/java/dev/plexapi/sdk/PlexAPI.java index 0996d351..0d8b21d7 100644 --- a/src/main/java/dev/plexapi/sdk/PlexAPI.java +++ b/src/main/java/dev/plexapi/sdk/PlexAPI.java @@ -161,6 +161,8 @@ public class PlexAPI { */ private final Updater updater; + private final Users users; + /** * Operations against the Plex Media Server System. * @@ -299,6 +301,10 @@ public class PlexAPI { return updater; } + public Users users() { + return users; + } + private final SDKConfiguration sdkConfiguration; /** @@ -518,5 +524,6 @@ public class PlexAPI { this.statistics = new Statistics(sdkConfiguration); this.sessions = new Sessions(sdkConfiguration); this.updater = new Updater(sdkConfiguration); + this.users = new Users(sdkConfiguration); this.sdkConfiguration.initialize(); }} diff --git a/src/main/java/dev/plexapi/sdk/SDKConfiguration.java b/src/main/java/dev/plexapi/sdk/SDKConfiguration.java index de1bf519..1a1f46ea 100644 --- a/src/main/java/dev/plexapi/sdk/SDKConfiguration.java +++ b/src/main/java/dev/plexapi/sdk/SDKConfiguration.java @@ -43,7 +43,7 @@ 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.11.4"; + public static final String SDK_VERSION = "0.11.5"; public static final String GEN_VERSION = "2.503.2"; private static final String BASE_PACKAGE = "dev.plexapi.sdk"; public static final String USER_AGENT = diff --git a/src/main/java/dev/plexapi/sdk/Users.java b/src/main/java/dev/plexapi/sdk/Users.java new file mode 100644 index 00000000..34e7446a --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/Users.java @@ -0,0 +1,212 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk; + +import com.fasterxml.jackson.core.type.TypeReference; +import dev.plexapi.sdk.models.errors.GetUsersBadRequest; +import dev.plexapi.sdk.models.errors.GetUsersUnauthorized; +import dev.plexapi.sdk.models.errors.SDKError; +import dev.plexapi.sdk.models.operations.GetUsersRequest; +import dev.plexapi.sdk.models.operations.GetUsersRequestBuilder; +import dev.plexapi.sdk.models.operations.GetUsersResponse; +import dev.plexapi.sdk.models.operations.SDKMethodInterfaces.*; +import dev.plexapi.sdk.utils.HTTPClient; +import dev.plexapi.sdk.utils.HTTPRequest; +import dev.plexapi.sdk.utils.Hook.AfterErrorContextImpl; +import dev.plexapi.sdk.utils.Hook.AfterSuccessContextImpl; +import dev.plexapi.sdk.utils.Hook.BeforeRequestContextImpl; +import dev.plexapi.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Exception; +import java.lang.String; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.util.HashMap; +import java.util.List; +import java.util.Optional; + +public class Users implements + MethodCallGetUsers { + + /** + * GET_USERS_SERVERS contains the list of server urls available to the SDK. + */ + public static final String[] GET_USERS_SERVERS = { + "https://plex.tv/api", + }; + + private final SDKConfiguration sdkConfiguration; + + Users(SDKConfiguration sdkConfiguration) { + this.sdkConfiguration = sdkConfiguration; + } + + + /** + * Get list of all connected users + * Get list of all users that are friends and have library access with the provided Plex authentication token + * @return The call builder + */ + public GetUsersRequestBuilder getUsers() { + return new GetUsersRequestBuilder(this); + } + + /** + * Get list of all connected users + * Get list of all users that are friends and have library access with the provided Plex authentication token + * @param request The request object containing all of the parameters for the API call. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public GetUsersResponse getUsers( + GetUsersRequest request) throws Exception { + return getUsers(request, Optional.empty()); + } + + /** + * Get list of all connected users + * Get list of all users that are friends and have library access with the provided Plex authentication token + * @param request The request object containing all of the parameters for the API call. + * @param serverURL Overrides the server URL. + * @return The response from the API call + * @throws Exception if the API call fails + */ + public GetUsersResponse getUsers( + GetUsersRequest request, + Optional serverURL) throws Exception { + String _baseUrl = Utils.templateUrl(GET_USERS_SERVERS[0], new HashMap()); + if (serverURL.isPresent() && !serverURL.get().isBlank()) { + _baseUrl = serverURL.get(); + } + String _url = Utils.generateURL( + _baseUrl, + "/users"); + + HTTPRequest _req = new HTTPRequest(_url, "GET"); + _req.addHeader("Accept", "application/xml") + .addHeader("user-agent", + SDKConfiguration.USER_AGENT); + _req.addHeaders(Utils.getHeadersFromMetadata(request, null)); + Optional _hookSecuritySource = Optional.empty(); + HTTPClient _client = this.sdkConfiguration.defaultClient; + HttpRequest _r = + sdkConfiguration.hooks() + .beforeRequest( + new BeforeRequestContextImpl( + "get-users", + Optional.of(List.of()), + _hookSecuritySource), + _req.build()); + HttpResponse _httpRes; + try { + _httpRes = _client.send(_r); + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400", "401", "4XX", "5XX")) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + "get-users", + Optional.of(List.of()), + _hookSecuritySource), + Optional.of(_httpRes), + Optional.empty()); + } else { + _httpRes = sdkConfiguration.hooks() + .afterSuccess( + new AfterSuccessContextImpl( + "get-users", + Optional.of(List.of()), + _hookSecuritySource), + _httpRes); + } + } catch (Exception _e) { + _httpRes = sdkConfiguration.hooks() + .afterError( + new AfterErrorContextImpl( + "get-users", + Optional.of(List.of()), + _hookSecuritySource), + Optional.empty(), + Optional.of(_e)); + } + String _contentType = _httpRes + .headers() + .firstValue("Content-Type") + .orElse("application/octet-stream"); + GetUsersResponse.Builder _resBuilder = + GetUsersResponse + .builder() + .contentType(_contentType) + .statusCode(_httpRes.statusCode()) + .rawResponse(_httpRes); + + GetUsersResponse _res = _resBuilder.build(); + + if (Utils.statusCodeMatches(_httpRes.statusCode(), "200")) { + if (Utils.contentTypeMatches(_contentType, "application/xml")) { + return _res; + } else { + throw new SDKError( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "400")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + GetUsersBadRequest _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new SDKError( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "401")) { + if (Utils.contentTypeMatches(_contentType, "application/json")) { + GetUsersUnauthorized _out = Utils.mapper().readValue( + Utils.toUtf8AndClose(_httpRes.body()), + new TypeReference() {}); + _out.withRawResponse(Optional.ofNullable(_httpRes)); + + throw _out; + } else { + throw new SDKError( + _httpRes, + _httpRes.statusCode(), + "Unexpected content-type received: " + _contentType, + Utils.extractByteArrayFromBody(_httpRes)); + } + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "4XX")) { + // no content + throw new SDKError( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + if (Utils.statusCodeMatches(_httpRes.statusCode(), "5XX")) { + // no content + throw new SDKError( + _httpRes, + _httpRes.statusCode(), + "API error occurred", + Utils.extractByteArrayFromBody(_httpRes)); + } + throw new SDKError( + _httpRes, + _httpRes.statusCode(), + "Unexpected status code received: " + _httpRes.statusCode(), + Utils.extractByteArrayFromBody(_httpRes)); + } + +} diff --git a/src/main/java/dev/plexapi/sdk/models/errors/GetUsersBadRequest.java b/src/main/java/dev/plexapi/sdk/models/errors/GetUsersBadRequest.java new file mode 100644 index 00000000..a78e9024 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/errors/GetUsersBadRequest.java @@ -0,0 +1,173 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.errors; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import dev.plexapi.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +/** + * GetUsersBadRequest - Bad Request - A parameter was not specified, or was specified incorrectly. + */ +@SuppressWarnings("serial") +public class GetUsersBadRequest extends RuntimeException { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("errors") + private Optional> errors; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("RawResponse") + private Optional> rawResponse; + + @JsonCreator + public GetUsersBadRequest( + @JsonProperty("errors") Optional> errors, + @JsonProperty("RawResponse") Optional> rawResponse) { + Utils.checkNotNull(errors, "errors"); + Utils.checkNotNull(rawResponse, "rawResponse"); + this.errors = errors; + this.rawResponse = rawResponse; + } + + public GetUsersBadRequest() { + this(Optional.empty(), Optional.empty()); + } + + @SuppressWarnings("unchecked") + public Optional> errors(){ + return (Optional>) errors; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @SuppressWarnings("unchecked") + public Optional> rawResponse(){ + return (Optional>) rawResponse; + } + + public final static Builder builder() { + return new Builder(); + } + + public GetUsersBadRequest withErrors(List errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = Optional.ofNullable(errors); + return this; + } + + public GetUsersBadRequest withErrors(Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetUsersBadRequest withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = Optional.ofNullable(rawResponse); + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetUsersBadRequest withRawResponse(Optional> rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersBadRequest other = (GetUsersBadRequest) o; + return + Objects.deepEquals(this.errors, other.errors) && + Objects.deepEquals(this.rawResponse, other.rawResponse); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + errors, + rawResponse); + } + + @Override + public String toString() { + return Utils.toString(GetUsersBadRequest.class, + "errors", errors, + "rawResponse", rawResponse); + } + + public final static class Builder { + + private Optional> errors = Optional.empty(); + + private Optional> rawResponse; + + private Builder() { + // force use of static builder() method + } + + public Builder errors(List errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = Optional.ofNullable(errors); + return this; + } + + public Builder errors(Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = Optional.ofNullable(rawResponse); + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(Optional> rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + public GetUsersBadRequest build() { + return new GetUsersBadRequest( + errors, + rawResponse); + } + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/errors/GetUsersErrors.java b/src/main/java/dev/plexapi/sdk/models/errors/GetUsersErrors.java new file mode 100644 index 00000000..0a460e54 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/errors/GetUsersErrors.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.errors; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import dev.plexapi.sdk.utils.Utils; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; + + +public class GetUsersErrors { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("code") + private Optional code; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("message") + private Optional message; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("status") + private Optional status; + + @JsonCreator + public GetUsersErrors( + @JsonProperty("code") Optional code, + @JsonProperty("message") Optional message, + @JsonProperty("status") Optional status) { + Utils.checkNotNull(code, "code"); + Utils.checkNotNull(message, "message"); + Utils.checkNotNull(status, "status"); + this.code = code; + this.message = message; + this.status = status; + } + + public GetUsersErrors() { + this(Optional.empty(), Optional.empty(), Optional.empty()); + } + + @JsonIgnore + public Optional code() { + return code; + } + + @JsonIgnore + public Optional message() { + return message; + } + + @JsonIgnore + public Optional status() { + return status; + } + + public final static Builder builder() { + return new Builder(); + } + + public GetUsersErrors withCode(int code) { + Utils.checkNotNull(code, "code"); + this.code = Optional.ofNullable(code); + return this; + } + + public GetUsersErrors withCode(Optional code) { + Utils.checkNotNull(code, "code"); + this.code = code; + return this; + } + + public GetUsersErrors withMessage(String message) { + Utils.checkNotNull(message, "message"); + this.message = Optional.ofNullable(message); + return this; + } + + public GetUsersErrors withMessage(Optional message) { + Utils.checkNotNull(message, "message"); + this.message = message; + return this; + } + + public GetUsersErrors withStatus(int status) { + Utils.checkNotNull(status, "status"); + this.status = Optional.ofNullable(status); + return this; + } + + public GetUsersErrors withStatus(Optional status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersErrors other = (GetUsersErrors) o; + return + Objects.deepEquals(this.code, other.code) && + Objects.deepEquals(this.message, other.message) && + Objects.deepEquals(this.status, other.status); + } + + @Override + public int hashCode() { + return Objects.hash( + code, + message, + status); + } + + @Override + public String toString() { + return Utils.toString(GetUsersErrors.class, + "code", code, + "message", message, + "status", status); + } + + public final static class Builder { + + private Optional code = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional status = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + public Builder code(int code) { + Utils.checkNotNull(code, "code"); + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Optional code) { + Utils.checkNotNull(code, "code"); + this.code = code; + return this; + } + + public Builder message(String message) { + Utils.checkNotNull(message, "message"); + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Optional message) { + Utils.checkNotNull(message, "message"); + this.message = message; + return this; + } + + public Builder status(int status) { + Utils.checkNotNull(status, "status"); + this.status = Optional.ofNullable(status); + return this; + } + + public Builder status(Optional status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + public GetUsersErrors build() { + return new GetUsersErrors( + code, + message, + status); + } + } +} + diff --git a/src/main/java/dev/plexapi/sdk/models/errors/GetUsersUnauthorized.java b/src/main/java/dev/plexapi/sdk/models/errors/GetUsersUnauthorized.java new file mode 100644 index 00000000..788e6091 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/errors/GetUsersUnauthorized.java @@ -0,0 +1,173 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.errors; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import dev.plexapi.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.List; +import java.util.Objects; +import java.util.Optional; + +/** + * GetUsersUnauthorized - Unauthorized - Returned if the X-Plex-Token is missing from the header or query. + */ +@SuppressWarnings("serial") +public class GetUsersUnauthorized extends RuntimeException { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("errors") + private Optional> errors; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("RawResponse") + private Optional> rawResponse; + + @JsonCreator + public GetUsersUnauthorized( + @JsonProperty("errors") Optional> errors, + @JsonProperty("RawResponse") Optional> rawResponse) { + Utils.checkNotNull(errors, "errors"); + Utils.checkNotNull(rawResponse, "rawResponse"); + this.errors = errors; + this.rawResponse = rawResponse; + } + + public GetUsersUnauthorized() { + this(Optional.empty(), Optional.empty()); + } + + @SuppressWarnings("unchecked") + public Optional> errors(){ + return (Optional>) errors; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @SuppressWarnings("unchecked") + public Optional> rawResponse(){ + return (Optional>) rawResponse; + } + + public final static Builder builder() { + return new Builder(); + } + + public GetUsersUnauthorized withErrors(List errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = Optional.ofNullable(errors); + return this; + } + + public GetUsersUnauthorized withErrors(Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetUsersUnauthorized withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = Optional.ofNullable(rawResponse); + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetUsersUnauthorized withRawResponse(Optional> rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersUnauthorized other = (GetUsersUnauthorized) o; + return + Objects.deepEquals(this.errors, other.errors) && + Objects.deepEquals(this.rawResponse, other.rawResponse); + } + + @Override + public int hashCode() { + return java.util.Objects.hash( + errors, + rawResponse); + } + + @Override + public String toString() { + return Utils.toString(GetUsersUnauthorized.class, + "errors", errors, + "rawResponse", rawResponse); + } + + public final static class Builder { + + private Optional> errors = Optional.empty(); + + private Optional> rawResponse; + + private Builder() { + // force use of static builder() method + } + + public Builder errors(List errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = Optional.ofNullable(errors); + return this; + } + + public Builder errors(Optional> errors) { + Utils.checkNotNull(errors, "errors"); + this.errors = errors; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = Optional.ofNullable(rawResponse); + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(Optional> rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + public GetUsersUnauthorized build() { + return new GetUsersUnauthorized( + errors, + rawResponse); + } + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/errors/GetUsersUsersErrors.java b/src/main/java/dev/plexapi/sdk/models/errors/GetUsersUsersErrors.java new file mode 100644 index 00000000..af2068dc --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/errors/GetUsersUsersErrors.java @@ -0,0 +1,194 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.errors; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import dev.plexapi.sdk.utils.Utils; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; + + +public class GetUsersUsersErrors { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("code") + private Optional code; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("message") + private Optional message; + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("status") + private Optional status; + + @JsonCreator + public GetUsersUsersErrors( + @JsonProperty("code") Optional code, + @JsonProperty("message") Optional message, + @JsonProperty("status") Optional status) { + Utils.checkNotNull(code, "code"); + Utils.checkNotNull(message, "message"); + Utils.checkNotNull(status, "status"); + this.code = code; + this.message = message; + this.status = status; + } + + public GetUsersUsersErrors() { + this(Optional.empty(), Optional.empty(), Optional.empty()); + } + + @JsonIgnore + public Optional code() { + return code; + } + + @JsonIgnore + public Optional message() { + return message; + } + + @JsonIgnore + public Optional status() { + return status; + } + + public final static Builder builder() { + return new Builder(); + } + + public GetUsersUsersErrors withCode(int code) { + Utils.checkNotNull(code, "code"); + this.code = Optional.ofNullable(code); + return this; + } + + public GetUsersUsersErrors withCode(Optional code) { + Utils.checkNotNull(code, "code"); + this.code = code; + return this; + } + + public GetUsersUsersErrors withMessage(String message) { + Utils.checkNotNull(message, "message"); + this.message = Optional.ofNullable(message); + return this; + } + + public GetUsersUsersErrors withMessage(Optional message) { + Utils.checkNotNull(message, "message"); + this.message = message; + return this; + } + + public GetUsersUsersErrors withStatus(int status) { + Utils.checkNotNull(status, "status"); + this.status = Optional.ofNullable(status); + return this; + } + + public GetUsersUsersErrors withStatus(Optional status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersUsersErrors other = (GetUsersUsersErrors) o; + return + Objects.deepEquals(this.code, other.code) && + Objects.deepEquals(this.message, other.message) && + Objects.deepEquals(this.status, other.status); + } + + @Override + public int hashCode() { + return Objects.hash( + code, + message, + status); + } + + @Override + public String toString() { + return Utils.toString(GetUsersUsersErrors.class, + "code", code, + "message", message, + "status", status); + } + + public final static class Builder { + + private Optional code = Optional.empty(); + + private Optional message = Optional.empty(); + + private Optional status = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + public Builder code(int code) { + Utils.checkNotNull(code, "code"); + this.code = Optional.ofNullable(code); + return this; + } + + public Builder code(Optional code) { + Utils.checkNotNull(code, "code"); + this.code = code; + return this; + } + + public Builder message(String message) { + Utils.checkNotNull(message, "message"); + this.message = Optional.ofNullable(message); + return this; + } + + public Builder message(Optional message) { + Utils.checkNotNull(message, "message"); + this.message = message; + return this; + } + + public Builder status(int status) { + Utils.checkNotNull(status, "status"); + this.status = Optional.ofNullable(status); + return this; + } + + public Builder status(Optional status) { + Utils.checkNotNull(status, "status"); + this.status = status; + return this; + } + + public GetUsersUsersErrors build() { + return new GetUsersUsersErrors( + code, + message, + status); + } + } +} + diff --git a/src/main/java/dev/plexapi/sdk/models/operations/AllLibraries.java b/src/main/java/dev/plexapi/sdk/models/operations/AllLibraries.java new file mode 100644 index 00000000..fae556dc --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/AllLibraries.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * AllLibraries - Indicates if the user has access to all libraries. + */ +public enum AllLibraries { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private AllLibraries(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (AllLibraries o: AllLibraries.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/AllowCameraUpload.java b/src/main/java/dev/plexapi/sdk/models/operations/AllowCameraUpload.java new file mode 100644 index 00000000..677eab3a --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/AllowCameraUpload.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * AllowCameraUpload - Indicates if the user is allowed to upload from a camera. + */ +public enum AllowCameraUpload { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private AllowCameraUpload(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (AllowCameraUpload o: AllowCameraUpload.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/AllowChannels.java b/src/main/java/dev/plexapi/sdk/models/operations/AllowChannels.java new file mode 100644 index 00000000..30182c27 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/AllowChannels.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * AllowChannels - Indicates if the user has access to channels. + */ +public enum AllowChannels { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private AllowChannels(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (AllowChannels o: AllowChannels.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/AllowSubtitleAdmin.java b/src/main/java/dev/plexapi/sdk/models/operations/AllowSubtitleAdmin.java new file mode 100644 index 00000000..66c0a471 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/AllowSubtitleAdmin.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * AllowSubtitleAdmin - Indicates if the user can manage subtitles. + */ +public enum AllowSubtitleAdmin { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private AllowSubtitleAdmin(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (AllowSubtitleAdmin o: AllowSubtitleAdmin.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/AllowSync.java b/src/main/java/dev/plexapi/sdk/models/operations/AllowSync.java new file mode 100644 index 00000000..eb2a0807 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/AllowSync.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * AllowSync - Indicates if the user is allowed to sync media. + */ +public enum AllowSync { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private AllowSync(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (AllowSync o: AllowSync.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/AllowTuners.java b/src/main/java/dev/plexapi/sdk/models/operations/AllowTuners.java new file mode 100644 index 00000000..8c8c4fa4 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/AllowTuners.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * AllowTuners - Indicates if the user is allowed to use tuners. + */ +public enum AllowTuners { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private AllowTuners(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (AllowTuners o: AllowTuners.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentMetadata.java b/src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentMetadata.java index 60f7cb13..35f26bfd 100644 --- a/src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentMetadata.java +++ b/src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentMetadata.java @@ -151,7 +151,7 @@ public class GetTopWatchedContentMetadata { @JsonInclude(Include.NON_ABSENT) @JsonProperty("User") - private Optional> user; + private Optional> user; @JsonCreator public GetTopWatchedContentMetadata( @@ -186,7 +186,7 @@ public class GetTopWatchedContentMetadata { @JsonProperty("Country") Optional> country, @JsonProperty("Guid") Optional> guids, @JsonProperty("Role") Optional> role, - @JsonProperty("User") Optional> user) { + @JsonProperty("User") Optional> user) { Utils.checkNotNull(ratingKey, "ratingKey"); Utils.checkNotNull(key, "key"); Utils.checkNotNull(guid, "guid"); @@ -418,8 +418,8 @@ public class GetTopWatchedContentMetadata { @SuppressWarnings("unchecked") @JsonIgnore - public Optional> user() { - return (Optional>) user; + public Optional> user() { + return (Optional>) user; } public final static Builder builder() { @@ -798,13 +798,13 @@ public class GetTopWatchedContentMetadata { return this; } - public GetTopWatchedContentMetadata withUser(List user) { + public GetTopWatchedContentMetadata withUser(List user) { Utils.checkNotNull(user, "user"); this.user = Optional.ofNullable(user); return this; } - public GetTopWatchedContentMetadata withUser(Optional> user) { + public GetTopWatchedContentMetadata withUser(Optional> user) { Utils.checkNotNull(user, "user"); this.user = user; return this; @@ -992,7 +992,7 @@ public class GetTopWatchedContentMetadata { private Optional> role = Optional.empty(); - private Optional> user = Optional.empty(); + private Optional> user = Optional.empty(); private Builder() { // force use of static builder() method @@ -1370,13 +1370,13 @@ public class GetTopWatchedContentMetadata { return this; } - public Builder user(List user) { + public Builder user(List user) { Utils.checkNotNull(user, "user"); this.user = Optional.ofNullable(user); return this; } - public Builder user(Optional> user) { + public Builder user(Optional> user) { Utils.checkNotNull(user, "user"); this.user = user; return this; diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentUser.java b/src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentUser.java new file mode 100644 index 00000000..0bb8341b --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/GetTopWatchedContentUser.java @@ -0,0 +1,110 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import dev.plexapi.sdk.utils.Utils; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; + + +public class GetTopWatchedContentUser { + + @JsonInclude(Include.NON_ABSENT) + @JsonProperty("id") + private Optional id; + + @JsonCreator + public GetTopWatchedContentUser( + @JsonProperty("id") Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + } + + public GetTopWatchedContentUser() { + this(Optional.empty()); + } + + @JsonIgnore + public Optional id() { + return id; + } + + public final static Builder builder() { + return new Builder(); + } + + public GetTopWatchedContentUser withId(int id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + public GetTopWatchedContentUser withId(Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetTopWatchedContentUser other = (GetTopWatchedContentUser) o; + return + Objects.deepEquals(this.id, other.id); + } + + @Override + public int hashCode() { + return Objects.hash( + id); + } + + @Override + public String toString() { + return Utils.toString(GetTopWatchedContentUser.class, + "id", id); + } + + public final static class Builder { + + private Optional id = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + public Builder id(int id) { + Utils.checkNotNull(id, "id"); + this.id = Optional.ofNullable(id); + return this; + } + + public Builder id(Optional id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + public GetTopWatchedContentUser build() { + return new GetTopWatchedContentUser( + id); + } + } +} + diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetUsersMediaContainer.java b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersMediaContainer.java new file mode 100644 index 00000000..54ce014a --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersMediaContainer.java @@ -0,0 +1,292 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import dev.plexapi.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.util.List; +import java.util.Objects; + +/** + * GetUsersMediaContainer - Container holding user and server details. + */ + +public class GetUsersMediaContainer { + + /** + * The friendly name of the Plex instance. + */ + private String friendlyName; + + private String identifier; + + /** + * Unique Machine identifier of the Plex server. + */ + private String machineIdentifier; + + /** + * Total number of users. + */ + private long totalSize; + + /** + * Number of users in the current response. + */ + private long size; + + /** + * List of users with access to the Plex server. + */ + private List user; + + @JsonCreator + public GetUsersMediaContainer( + String friendlyName, + String identifier, + String machineIdentifier, + long totalSize, + long size, + List user) { + Utils.checkNotNull(friendlyName, "friendlyName"); + Utils.checkNotNull(identifier, "identifier"); + Utils.checkNotNull(machineIdentifier, "machineIdentifier"); + Utils.checkNotNull(totalSize, "totalSize"); + Utils.checkNotNull(size, "size"); + Utils.checkNotNull(user, "user"); + this.friendlyName = friendlyName; + this.identifier = identifier; + this.machineIdentifier = machineIdentifier; + this.totalSize = totalSize; + this.size = size; + this.user = user; + } + + /** + * The friendly name of the Plex instance. + */ + @JsonIgnore + public String friendlyName() { + return friendlyName; + } + + @JsonIgnore + public String identifier() { + return identifier; + } + + /** + * Unique Machine identifier of the Plex server. + */ + @JsonIgnore + public String machineIdentifier() { + return machineIdentifier; + } + + /** + * Total number of users. + */ + @JsonIgnore + public long totalSize() { + return totalSize; + } + + /** + * Number of users in the current response. + */ + @JsonIgnore + public long size() { + return size; + } + + /** + * List of users with access to the Plex server. + */ + @JsonIgnore + public List user() { + return user; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * The friendly name of the Plex instance. + */ + public GetUsersMediaContainer withFriendlyName(String friendlyName) { + Utils.checkNotNull(friendlyName, "friendlyName"); + this.friendlyName = friendlyName; + return this; + } + + public GetUsersMediaContainer withIdentifier(String identifier) { + Utils.checkNotNull(identifier, "identifier"); + this.identifier = identifier; + return this; + } + + /** + * Unique Machine identifier of the Plex server. + */ + public GetUsersMediaContainer withMachineIdentifier(String machineIdentifier) { + Utils.checkNotNull(machineIdentifier, "machineIdentifier"); + this.machineIdentifier = machineIdentifier; + return this; + } + + /** + * Total number of users. + */ + public GetUsersMediaContainer withTotalSize(long totalSize) { + Utils.checkNotNull(totalSize, "totalSize"); + this.totalSize = totalSize; + return this; + } + + /** + * Number of users in the current response. + */ + public GetUsersMediaContainer withSize(long size) { + Utils.checkNotNull(size, "size"); + this.size = size; + return this; + } + + /** + * List of users with access to the Plex server. + */ + public GetUsersMediaContainer withUser(List user) { + Utils.checkNotNull(user, "user"); + this.user = user; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersMediaContainer other = (GetUsersMediaContainer) o; + return + Objects.deepEquals(this.friendlyName, other.friendlyName) && + Objects.deepEquals(this.identifier, other.identifier) && + Objects.deepEquals(this.machineIdentifier, other.machineIdentifier) && + Objects.deepEquals(this.totalSize, other.totalSize) && + Objects.deepEquals(this.size, other.size) && + Objects.deepEquals(this.user, other.user); + } + + @Override + public int hashCode() { + return Objects.hash( + friendlyName, + identifier, + machineIdentifier, + totalSize, + size, + user); + } + + @Override + public String toString() { + return Utils.toString(GetUsersMediaContainer.class, + "friendlyName", friendlyName, + "identifier", identifier, + "machineIdentifier", machineIdentifier, + "totalSize", totalSize, + "size", size, + "user", user); + } + + public final static class Builder { + + private String friendlyName; + + private String identifier; + + private String machineIdentifier; + + private Long totalSize; + + private Long size; + + private List user; + + private Builder() { + // force use of static builder() method + } + + /** + * The friendly name of the Plex instance. + */ + public Builder friendlyName(String friendlyName) { + Utils.checkNotNull(friendlyName, "friendlyName"); + this.friendlyName = friendlyName; + return this; + } + + public Builder identifier(String identifier) { + Utils.checkNotNull(identifier, "identifier"); + this.identifier = identifier; + return this; + } + + /** + * Unique Machine identifier of the Plex server. + */ + public Builder machineIdentifier(String machineIdentifier) { + Utils.checkNotNull(machineIdentifier, "machineIdentifier"); + this.machineIdentifier = machineIdentifier; + return this; + } + + /** + * Total number of users. + */ + public Builder totalSize(long totalSize) { + Utils.checkNotNull(totalSize, "totalSize"); + this.totalSize = totalSize; + return this; + } + + /** + * Number of users in the current response. + */ + public Builder size(long size) { + Utils.checkNotNull(size, "size"); + this.size = size; + return this; + } + + /** + * List of users with access to the Plex server. + */ + public Builder user(List user) { + Utils.checkNotNull(user, "user"); + this.user = user; + return this; + } + + public GetUsersMediaContainer build() { + return new GetUsersMediaContainer( + friendlyName, + identifier, + machineIdentifier, + totalSize, + size, + user); + } + } +} + diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetUsersRequest.java b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersRequest.java new file mode 100644 index 00000000..5430c72f --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersRequest.java @@ -0,0 +1,798 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import dev.plexapi.sdk.utils.SpeakeasyMetadata; +import dev.plexapi.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.util.Objects; +import java.util.Optional; + + +public class GetUsersRequest { + + /** + * An opaque identifier unique to the client (UUID, serial number, or other unique device ID) + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Client-Identifier") + private String clientID; + + /** + * The name of the client application. (Plex Web, Plex Media Server, etc.) + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Product") + private Optional clientName; + + /** + * A relatively friendly name for the client device + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Device") + private Optional deviceNickname; + + /** + * The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Device-Name") + private Optional deviceName; + + /** + * The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Device-Screen-Resolution") + private Optional deviceScreenResolution; + + /** + * The version of the client application. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Version") + private Optional clientVersion; + + /** + * The platform of the client application. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Platform") + private Optional platform; + + /** + * The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Features") + private Optional clientFeatures; + + /** + * A potentially less friendly identifier for the device model + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Model") + private Optional model; + + /** + * The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Session-Id") + private Optional xPlexSessionId; + + /** + * The language of the client application. + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Language") + private Optional xPlexLanguage; + + /** + * The version of the platform + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Platform-Version") + private Optional platformVersion; + + /** + * An authentication token, obtained from plex.tv + */ + @SpeakeasyMetadata("header:style=simple,explode=false,name=X-Plex-Token") + private String xPlexToken; + + @JsonCreator + public GetUsersRequest( + String clientID, + Optional clientName, + Optional deviceNickname, + Optional deviceName, + Optional deviceScreenResolution, + Optional clientVersion, + Optional platform, + Optional clientFeatures, + Optional model, + Optional xPlexSessionId, + Optional xPlexLanguage, + Optional platformVersion, + String xPlexToken) { + Utils.checkNotNull(clientID, "clientID"); + Utils.checkNotNull(clientName, "clientName"); + Utils.checkNotNull(deviceNickname, "deviceNickname"); + Utils.checkNotNull(deviceName, "deviceName"); + Utils.checkNotNull(deviceScreenResolution, "deviceScreenResolution"); + Utils.checkNotNull(clientVersion, "clientVersion"); + Utils.checkNotNull(platform, "platform"); + Utils.checkNotNull(clientFeatures, "clientFeatures"); + Utils.checkNotNull(model, "model"); + Utils.checkNotNull(xPlexSessionId, "xPlexSessionId"); + Utils.checkNotNull(xPlexLanguage, "xPlexLanguage"); + Utils.checkNotNull(platformVersion, "platformVersion"); + Utils.checkNotNull(xPlexToken, "xPlexToken"); + this.clientID = clientID; + this.clientName = clientName; + this.deviceNickname = deviceNickname; + this.deviceName = deviceName; + this.deviceScreenResolution = deviceScreenResolution; + this.clientVersion = clientVersion; + this.platform = platform; + this.clientFeatures = clientFeatures; + this.model = model; + this.xPlexSessionId = xPlexSessionId; + this.xPlexLanguage = xPlexLanguage; + this.platformVersion = platformVersion; + this.xPlexToken = xPlexToken; + } + + public GetUsersRequest( + String clientID, + String xPlexToken) { + this(clientID, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), xPlexToken); + } + + /** + * An opaque identifier unique to the client (UUID, serial number, or other unique device ID) + */ + @JsonIgnore + public String clientID() { + return clientID; + } + + /** + * The name of the client application. (Plex Web, Plex Media Server, etc.) + */ + @JsonIgnore + public Optional clientName() { + return clientName; + } + + /** + * A relatively friendly name for the client device + */ + @JsonIgnore + public Optional deviceNickname() { + return deviceNickname; + } + + /** + * The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) + */ + @JsonIgnore + public Optional deviceName() { + return deviceName; + } + + /** + * The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) + */ + @JsonIgnore + public Optional deviceScreenResolution() { + return deviceScreenResolution; + } + + /** + * The version of the client application. + */ + @JsonIgnore + public Optional clientVersion() { + return clientVersion; + } + + /** + * The platform of the client application. + */ + @JsonIgnore + public Optional platform() { + return platform; + } + + /** + * The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) + */ + @JsonIgnore + public Optional clientFeatures() { + return clientFeatures; + } + + /** + * A potentially less friendly identifier for the device model + */ + @JsonIgnore + public Optional model() { + return model; + } + + /** + * The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) + */ + @JsonIgnore + public Optional xPlexSessionId() { + return xPlexSessionId; + } + + /** + * The language of the client application. + */ + @JsonIgnore + public Optional xPlexLanguage() { + return xPlexLanguage; + } + + /** + * The version of the platform + */ + @JsonIgnore + public Optional platformVersion() { + return platformVersion; + } + + /** + * An authentication token, obtained from plex.tv + */ + @JsonIgnore + public String xPlexToken() { + return xPlexToken; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * An opaque identifier unique to the client (UUID, serial number, or other unique device ID) + */ + public GetUsersRequest withClientID(String clientID) { + Utils.checkNotNull(clientID, "clientID"); + this.clientID = clientID; + return this; + } + + /** + * The name of the client application. (Plex Web, Plex Media Server, etc.) + */ + public GetUsersRequest withClientName(String clientName) { + Utils.checkNotNull(clientName, "clientName"); + this.clientName = Optional.ofNullable(clientName); + return this; + } + + /** + * The name of the client application. (Plex Web, Plex Media Server, etc.) + */ + public GetUsersRequest withClientName(Optional clientName) { + Utils.checkNotNull(clientName, "clientName"); + this.clientName = clientName; + return this; + } + + /** + * A relatively friendly name for the client device + */ + public GetUsersRequest withDeviceNickname(String deviceNickname) { + Utils.checkNotNull(deviceNickname, "deviceNickname"); + this.deviceNickname = Optional.ofNullable(deviceNickname); + return this; + } + + /** + * A relatively friendly name for the client device + */ + public GetUsersRequest withDeviceNickname(Optional deviceNickname) { + Utils.checkNotNull(deviceNickname, "deviceNickname"); + this.deviceNickname = deviceNickname; + return this; + } + + /** + * The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) + */ + public GetUsersRequest withDeviceName(String deviceName) { + Utils.checkNotNull(deviceName, "deviceName"); + this.deviceName = Optional.ofNullable(deviceName); + return this; + } + + /** + * The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) + */ + public GetUsersRequest withDeviceName(Optional deviceName) { + Utils.checkNotNull(deviceName, "deviceName"); + this.deviceName = deviceName; + return this; + } + + /** + * The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) + */ + public GetUsersRequest withDeviceScreenResolution(String deviceScreenResolution) { + Utils.checkNotNull(deviceScreenResolution, "deviceScreenResolution"); + this.deviceScreenResolution = Optional.ofNullable(deviceScreenResolution); + return this; + } + + /** + * The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) + */ + public GetUsersRequest withDeviceScreenResolution(Optional deviceScreenResolution) { + Utils.checkNotNull(deviceScreenResolution, "deviceScreenResolution"); + this.deviceScreenResolution = deviceScreenResolution; + return this; + } + + /** + * The version of the client application. + */ + public GetUsersRequest withClientVersion(String clientVersion) { + Utils.checkNotNull(clientVersion, "clientVersion"); + this.clientVersion = Optional.ofNullable(clientVersion); + return this; + } + + /** + * The version of the client application. + */ + public GetUsersRequest withClientVersion(Optional clientVersion) { + Utils.checkNotNull(clientVersion, "clientVersion"); + this.clientVersion = clientVersion; + return this; + } + + /** + * The platform of the client application. + */ + public GetUsersRequest withPlatform(String platform) { + Utils.checkNotNull(platform, "platform"); + this.platform = Optional.ofNullable(platform); + return this; + } + + /** + * The platform of the client application. + */ + public GetUsersRequest withPlatform(Optional platform) { + Utils.checkNotNull(platform, "platform"); + this.platform = platform; + return this; + } + + /** + * The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) + */ + public GetUsersRequest withClientFeatures(String clientFeatures) { + Utils.checkNotNull(clientFeatures, "clientFeatures"); + this.clientFeatures = Optional.ofNullable(clientFeatures); + return this; + } + + /** + * The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) + */ + public GetUsersRequest withClientFeatures(Optional clientFeatures) { + Utils.checkNotNull(clientFeatures, "clientFeatures"); + this.clientFeatures = clientFeatures; + return this; + } + + /** + * A potentially less friendly identifier for the device model + */ + public GetUsersRequest withModel(String model) { + Utils.checkNotNull(model, "model"); + this.model = Optional.ofNullable(model); + return this; + } + + /** + * A potentially less friendly identifier for the device model + */ + public GetUsersRequest withModel(Optional model) { + Utils.checkNotNull(model, "model"); + this.model = model; + return this; + } + + /** + * The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) + */ + public GetUsersRequest withXPlexSessionId(String xPlexSessionId) { + Utils.checkNotNull(xPlexSessionId, "xPlexSessionId"); + this.xPlexSessionId = Optional.ofNullable(xPlexSessionId); + return this; + } + + /** + * The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) + */ + public GetUsersRequest withXPlexSessionId(Optional xPlexSessionId) { + Utils.checkNotNull(xPlexSessionId, "xPlexSessionId"); + this.xPlexSessionId = xPlexSessionId; + return this; + } + + /** + * The language of the client application. + */ + public GetUsersRequest withXPlexLanguage(String xPlexLanguage) { + Utils.checkNotNull(xPlexLanguage, "xPlexLanguage"); + this.xPlexLanguage = Optional.ofNullable(xPlexLanguage); + return this; + } + + /** + * The language of the client application. + */ + public GetUsersRequest withXPlexLanguage(Optional xPlexLanguage) { + Utils.checkNotNull(xPlexLanguage, "xPlexLanguage"); + this.xPlexLanguage = xPlexLanguage; + return this; + } + + /** + * The version of the platform + */ + public GetUsersRequest withPlatformVersion(String platformVersion) { + Utils.checkNotNull(platformVersion, "platformVersion"); + this.platformVersion = Optional.ofNullable(platformVersion); + return this; + } + + /** + * The version of the platform + */ + public GetUsersRequest withPlatformVersion(Optional platformVersion) { + Utils.checkNotNull(platformVersion, "platformVersion"); + this.platformVersion = platformVersion; + return this; + } + + /** + * An authentication token, obtained from plex.tv + */ + public GetUsersRequest withXPlexToken(String xPlexToken) { + Utils.checkNotNull(xPlexToken, "xPlexToken"); + this.xPlexToken = xPlexToken; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersRequest other = (GetUsersRequest) o; + return + Objects.deepEquals(this.clientID, other.clientID) && + Objects.deepEquals(this.clientName, other.clientName) && + Objects.deepEquals(this.deviceNickname, other.deviceNickname) && + Objects.deepEquals(this.deviceName, other.deviceName) && + Objects.deepEquals(this.deviceScreenResolution, other.deviceScreenResolution) && + Objects.deepEquals(this.clientVersion, other.clientVersion) && + Objects.deepEquals(this.platform, other.platform) && + Objects.deepEquals(this.clientFeatures, other.clientFeatures) && + Objects.deepEquals(this.model, other.model) && + Objects.deepEquals(this.xPlexSessionId, other.xPlexSessionId) && + Objects.deepEquals(this.xPlexLanguage, other.xPlexLanguage) && + Objects.deepEquals(this.platformVersion, other.platformVersion) && + Objects.deepEquals(this.xPlexToken, other.xPlexToken); + } + + @Override + public int hashCode() { + return Objects.hash( + clientID, + clientName, + deviceNickname, + deviceName, + deviceScreenResolution, + clientVersion, + platform, + clientFeatures, + model, + xPlexSessionId, + xPlexLanguage, + platformVersion, + xPlexToken); + } + + @Override + public String toString() { + return Utils.toString(GetUsersRequest.class, + "clientID", clientID, + "clientName", clientName, + "deviceNickname", deviceNickname, + "deviceName", deviceName, + "deviceScreenResolution", deviceScreenResolution, + "clientVersion", clientVersion, + "platform", platform, + "clientFeatures", clientFeatures, + "model", model, + "xPlexSessionId", xPlexSessionId, + "xPlexLanguage", xPlexLanguage, + "platformVersion", platformVersion, + "xPlexToken", xPlexToken); + } + + public final static class Builder { + + private String clientID; + + private Optional clientName = Optional.empty(); + + private Optional deviceNickname = Optional.empty(); + + private Optional deviceName = Optional.empty(); + + private Optional deviceScreenResolution = Optional.empty(); + + private Optional clientVersion = Optional.empty(); + + private Optional platform = Optional.empty(); + + private Optional clientFeatures = Optional.empty(); + + private Optional model = Optional.empty(); + + private Optional xPlexSessionId = Optional.empty(); + + private Optional xPlexLanguage = Optional.empty(); + + private Optional platformVersion = Optional.empty(); + + private String xPlexToken; + + private Builder() { + // force use of static builder() method + } + + /** + * An opaque identifier unique to the client (UUID, serial number, or other unique device ID) + */ + public Builder clientID(String clientID) { + Utils.checkNotNull(clientID, "clientID"); + this.clientID = clientID; + return this; + } + + /** + * The name of the client application. (Plex Web, Plex Media Server, etc.) + */ + public Builder clientName(String clientName) { + Utils.checkNotNull(clientName, "clientName"); + this.clientName = Optional.ofNullable(clientName); + return this; + } + + /** + * The name of the client application. (Plex Web, Plex Media Server, etc.) + */ + public Builder clientName(Optional clientName) { + Utils.checkNotNull(clientName, "clientName"); + this.clientName = clientName; + return this; + } + + /** + * A relatively friendly name for the client device + */ + public Builder deviceNickname(String deviceNickname) { + Utils.checkNotNull(deviceNickname, "deviceNickname"); + this.deviceNickname = Optional.ofNullable(deviceNickname); + return this; + } + + /** + * A relatively friendly name for the client device + */ + public Builder deviceNickname(Optional deviceNickname) { + Utils.checkNotNull(deviceNickname, "deviceNickname"); + this.deviceNickname = deviceNickname; + return this; + } + + /** + * The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) + */ + public Builder deviceName(String deviceName) { + Utils.checkNotNull(deviceName, "deviceName"); + this.deviceName = Optional.ofNullable(deviceName); + return this; + } + + /** + * The name of the device the client application is running on. This is used to track the client application and its usage. (Chrome, Safari, etc.) + */ + public Builder deviceName(Optional deviceName) { + Utils.checkNotNull(deviceName, "deviceName"); + this.deviceName = deviceName; + return this; + } + + /** + * The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) + */ + public Builder deviceScreenResolution(String deviceScreenResolution) { + Utils.checkNotNull(deviceScreenResolution, "deviceScreenResolution"); + this.deviceScreenResolution = Optional.ofNullable(deviceScreenResolution); + return this; + } + + /** + * The resolution of the device the client application is running on. This is used to track the client application and its usage. (1487x1165,2560x1440) + */ + public Builder deviceScreenResolution(Optional deviceScreenResolution) { + Utils.checkNotNull(deviceScreenResolution, "deviceScreenResolution"); + this.deviceScreenResolution = deviceScreenResolution; + return this; + } + + /** + * The version of the client application. + */ + public Builder clientVersion(String clientVersion) { + Utils.checkNotNull(clientVersion, "clientVersion"); + this.clientVersion = Optional.ofNullable(clientVersion); + return this; + } + + /** + * The version of the client application. + */ + public Builder clientVersion(Optional clientVersion) { + Utils.checkNotNull(clientVersion, "clientVersion"); + this.clientVersion = clientVersion; + return this; + } + + /** + * The platform of the client application. + */ + public Builder platform(String platform) { + Utils.checkNotNull(platform, "platform"); + this.platform = Optional.ofNullable(platform); + return this; + } + + /** + * The platform of the client application. + */ + public Builder platform(Optional platform) { + Utils.checkNotNull(platform, "platform"); + this.platform = platform; + return this; + } + + /** + * The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) + */ + public Builder clientFeatures(String clientFeatures) { + Utils.checkNotNull(clientFeatures, "clientFeatures"); + this.clientFeatures = Optional.ofNullable(clientFeatures); + return this; + } + + /** + * The features of the client application. This is used to track the client application and its usage. (external-media,indirect-media,hub-style-list) + */ + public Builder clientFeatures(Optional clientFeatures) { + Utils.checkNotNull(clientFeatures, "clientFeatures"); + this.clientFeatures = clientFeatures; + return this; + } + + /** + * A potentially less friendly identifier for the device model + */ + public Builder model(String model) { + Utils.checkNotNull(model, "model"); + this.model = Optional.ofNullable(model); + return this; + } + + /** + * A potentially less friendly identifier for the device model + */ + public Builder model(Optional model) { + Utils.checkNotNull(model, "model"); + this.model = model; + return this; + } + + /** + * The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) + */ + public Builder xPlexSessionId(String xPlexSessionId) { + Utils.checkNotNull(xPlexSessionId, "xPlexSessionId"); + this.xPlexSessionId = Optional.ofNullable(xPlexSessionId); + return this; + } + + /** + * The session ID of the client application. This is used to track the client application and its usage. (97e136ef-4ddd-4ff3-89a7-a5820c96c2ca) + */ + public Builder xPlexSessionId(Optional xPlexSessionId) { + Utils.checkNotNull(xPlexSessionId, "xPlexSessionId"); + this.xPlexSessionId = xPlexSessionId; + return this; + } + + /** + * The language of the client application. + */ + public Builder xPlexLanguage(String xPlexLanguage) { + Utils.checkNotNull(xPlexLanguage, "xPlexLanguage"); + this.xPlexLanguage = Optional.ofNullable(xPlexLanguage); + return this; + } + + /** + * The language of the client application. + */ + public Builder xPlexLanguage(Optional xPlexLanguage) { + Utils.checkNotNull(xPlexLanguage, "xPlexLanguage"); + this.xPlexLanguage = xPlexLanguage; + return this; + } + + /** + * The version of the platform + */ + public Builder platformVersion(String platformVersion) { + Utils.checkNotNull(platformVersion, "platformVersion"); + this.platformVersion = Optional.ofNullable(platformVersion); + return this; + } + + /** + * The version of the platform + */ + public Builder platformVersion(Optional platformVersion) { + Utils.checkNotNull(platformVersion, "platformVersion"); + this.platformVersion = platformVersion; + return this; + } + + /** + * An authentication token, obtained from plex.tv + */ + public Builder xPlexToken(String xPlexToken) { + Utils.checkNotNull(xPlexToken, "xPlexToken"); + this.xPlexToken = xPlexToken; + return this; + } + + public GetUsersRequest build() { + return new GetUsersRequest( + clientID, + clientName, + deviceNickname, + deviceName, + deviceScreenResolution, + clientVersion, + platform, + clientFeatures, + model, + xPlexSessionId, + xPlexLanguage, + platformVersion, + xPlexToken); + } + } +} + diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetUsersRequestBuilder.java b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersRequestBuilder.java new file mode 100644 index 00000000..68eed22c --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersRequestBuilder.java @@ -0,0 +1,45 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import dev.plexapi.sdk.utils.Utils; +import java.lang.String; +import java.util.Optional; + +public class GetUsersRequestBuilder { + + private GetUsersRequest request; + private Optional serverURL = Optional.empty(); + private final SDKMethodInterfaces.MethodCallGetUsers sdk; + + public GetUsersRequestBuilder(SDKMethodInterfaces.MethodCallGetUsers sdk) { + this.sdk = sdk; + } + + public GetUsersRequestBuilder request(GetUsersRequest request) { + Utils.checkNotNull(request, "request"); + this.request = request; + return this; + } + + public GetUsersRequestBuilder serverURL(String serverURL) { + Utils.checkNotNull(serverURL, "serverURL"); + this.serverURL = Optional.of(serverURL); + return this; + } + + public GetUsersRequestBuilder serverURL(Optional serverURL) { + Utils.checkNotNull(serverURL, "serverURL"); + this.serverURL = serverURL; + return this; + } + + public GetUsersResponse call() throws Exception { + + return sdk.getUsers( + request, + serverURL); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetUsersResponse.java b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersResponse.java new file mode 100644 index 00000000..a443b63e --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersResponse.java @@ -0,0 +1,233 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import dev.plexapi.sdk.utils.Response; +import dev.plexapi.sdk.utils.Utils; +import java.io.InputStream; +import java.lang.Integer; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.net.http.HttpResponse; +import java.util.Objects; +import java.util.Optional; + + +public class GetUsersResponse implements Response { + + /** + * HTTP response content type for this operation + */ + private String contentType; + + /** + * HTTP response status code for this operation + */ + private int statusCode; + + /** + * Raw HTTP response; suitable for custom response parsing + */ + private HttpResponse rawResponse; + + private Optional body; + + @JsonCreator + public GetUsersResponse( + String contentType, + int statusCode, + HttpResponse rawResponse, + Optional body) { + Utils.checkNotNull(contentType, "contentType"); + Utils.checkNotNull(statusCode, "statusCode"); + Utils.checkNotNull(rawResponse, "rawResponse"); + Utils.checkNotNull(body, "body"); + this.contentType = contentType; + this.statusCode = statusCode; + this.rawResponse = rawResponse; + this.body = body; + } + + public GetUsersResponse( + String contentType, + int statusCode, + HttpResponse rawResponse) { + this(contentType, statusCode, rawResponse, Optional.empty()); + } + + /** + * HTTP response content type for this operation + */ + @JsonIgnore + public String contentType() { + return contentType; + } + + /** + * HTTP response status code for this operation + */ + @JsonIgnore + public int statusCode() { + return statusCode; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + @JsonIgnore + public HttpResponse rawResponse() { + return rawResponse; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional body() { + return (Optional) body; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * HTTP response content type for this operation + */ + public GetUsersResponse withContentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public GetUsersResponse withStatusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public GetUsersResponse withRawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + public GetUsersResponse withBody(byte[] body) { + Utils.checkNotNull(body, "body"); + this.body = Optional.ofNullable(body); + return this; + } + + public GetUsersResponse withBody(Optional body) { + Utils.checkNotNull(body, "body"); + this.body = body; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersResponse other = (GetUsersResponse) o; + return + Objects.deepEquals(this.contentType, other.contentType) && + Objects.deepEquals(this.statusCode, other.statusCode) && + Objects.deepEquals(this.rawResponse, other.rawResponse) && + Objects.deepEquals(this.body, other.body); + } + + @Override + public int hashCode() { + return Objects.hash( + contentType, + statusCode, + rawResponse, + body); + } + + @Override + public String toString() { + return Utils.toString(GetUsersResponse.class, + "contentType", contentType, + "statusCode", statusCode, + "rawResponse", rawResponse, + "body", body); + } + + public final static class Builder { + + private String contentType; + + private Integer statusCode; + + private HttpResponse rawResponse; + + private Optional body = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * HTTP response content type for this operation + */ + public Builder contentType(String contentType) { + Utils.checkNotNull(contentType, "contentType"); + this.contentType = contentType; + return this; + } + + /** + * HTTP response status code for this operation + */ + public Builder statusCode(int statusCode) { + Utils.checkNotNull(statusCode, "statusCode"); + this.statusCode = statusCode; + return this; + } + + /** + * Raw HTTP response; suitable for custom response parsing + */ + public Builder rawResponse(HttpResponse rawResponse) { + Utils.checkNotNull(rawResponse, "rawResponse"); + this.rawResponse = rawResponse; + return this; + } + + public Builder body(byte[] body) { + Utils.checkNotNull(body, "body"); + this.body = Optional.ofNullable(body); + return this; + } + + public Builder body(Optional body) { + Utils.checkNotNull(body, "body"); + this.body = body; + return this; + } + + public GetUsersResponse build() { + return new GetUsersResponse( + contentType, + statusCode, + rawResponse, + body); + } + } +} + diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetUsersResponseBody.java b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersResponseBody.java new file mode 100644 index 00000000..95f18874 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersResponseBody.java @@ -0,0 +1,127 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import dev.plexapi.sdk.utils.Utils; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Objects; +import java.util.Optional; + +/** + * GetUsersResponseBody - Successful response with media container data in XML + */ + +public class GetUsersResponseBody { + + /** + * Container holding user and server details. + */ + private Optional mediaContainer; + + @JsonCreator + public GetUsersResponseBody( + Optional mediaContainer) { + Utils.checkNotNull(mediaContainer, "mediaContainer"); + this.mediaContainer = mediaContainer; + } + + public GetUsersResponseBody() { + this(Optional.empty()); + } + + /** + * Container holding user and server details. + */ + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional mediaContainer() { + return (Optional) mediaContainer; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * Container holding user and server details. + */ + public GetUsersResponseBody withMediaContainer(GetUsersMediaContainer mediaContainer) { + Utils.checkNotNull(mediaContainer, "mediaContainer"); + this.mediaContainer = Optional.ofNullable(mediaContainer); + return this; + } + + /** + * Container holding user and server details. + */ + public GetUsersResponseBody withMediaContainer(Optional mediaContainer) { + Utils.checkNotNull(mediaContainer, "mediaContainer"); + this.mediaContainer = mediaContainer; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersResponseBody other = (GetUsersResponseBody) o; + return + Objects.deepEquals(this.mediaContainer, other.mediaContainer); + } + + @Override + public int hashCode() { + return Objects.hash( + mediaContainer); + } + + @Override + public String toString() { + return Utils.toString(GetUsersResponseBody.class, + "mediaContainer", mediaContainer); + } + + public final static class Builder { + + private Optional mediaContainer = Optional.empty(); + + private Builder() { + // force use of static builder() method + } + + /** + * Container holding user and server details. + */ + public Builder mediaContainer(GetUsersMediaContainer mediaContainer) { + Utils.checkNotNull(mediaContainer, "mediaContainer"); + this.mediaContainer = Optional.ofNullable(mediaContainer); + return this; + } + + /** + * Container holding user and server details. + */ + public Builder mediaContainer(Optional mediaContainer) { + Utils.checkNotNull(mediaContainer, "mediaContainer"); + this.mediaContainer = mediaContainer; + return this; + } + + public GetUsersResponseBody build() { + return new GetUsersResponseBody( + mediaContainer); + } + } +} + diff --git a/src/main/java/dev/plexapi/sdk/models/operations/GetUsersServer.java b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersServer.java new file mode 100644 index 00000000..c148a37f --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/GetUsersServer.java @@ -0,0 +1,451 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.core.type.TypeReference; +import dev.plexapi.sdk.utils.LazySingletonValue; +import dev.plexapi.sdk.utils.Utils; +import java.lang.Long; +import java.lang.Override; +import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.Objects; +import java.util.Optional; + + +public class GetUsersServer { + + /** + * Unique ID of the server of the connected user + */ + private long id; + + /** + * ID of the actual Plex server. + */ + private long serverId; + + /** + * Machine identifier of the Plex server. + */ + private String machineIdentifier; + + /** + * Name of the Plex server of the connected user. + */ + private String name; + + private long lastSeenAt; + + /** + * Number of libraries in the server this user has access to. + */ + private long numLibraries; + + private Optional allLibraries; + + private Optional owned; + + private Optional pending; + + @JsonCreator + public GetUsersServer( + long id, + long serverId, + String machineIdentifier, + String name, + long lastSeenAt, + long numLibraries, + Optional allLibraries, + Optional owned, + Optional pending) { + Utils.checkNotNull(id, "id"); + Utils.checkNotNull(serverId, "serverId"); + Utils.checkNotNull(machineIdentifier, "machineIdentifier"); + Utils.checkNotNull(name, "name"); + Utils.checkNotNull(lastSeenAt, "lastSeenAt"); + Utils.checkNotNull(numLibraries, "numLibraries"); + Utils.checkNotNull(allLibraries, "allLibraries"); + Utils.checkNotNull(owned, "owned"); + Utils.checkNotNull(pending, "pending"); + this.id = id; + this.serverId = serverId; + this.machineIdentifier = machineIdentifier; + this.name = name; + this.lastSeenAt = lastSeenAt; + this.numLibraries = numLibraries; + this.allLibraries = allLibraries; + this.owned = owned; + this.pending = pending; + } + + public GetUsersServer( + long id, + long serverId, + String machineIdentifier, + String name, + long lastSeenAt, + long numLibraries) { + this(id, serverId, machineIdentifier, name, lastSeenAt, numLibraries, Optional.empty(), Optional.empty(), Optional.empty()); + } + + /** + * Unique ID of the server of the connected user + */ + @JsonIgnore + public long id() { + return id; + } + + /** + * ID of the actual Plex server. + */ + @JsonIgnore + public long serverId() { + return serverId; + } + + /** + * Machine identifier of the Plex server. + */ + @JsonIgnore + public String machineIdentifier() { + return machineIdentifier; + } + + /** + * Name of the Plex server of the connected user. + */ + @JsonIgnore + public String name() { + return name; + } + + @JsonIgnore + public long lastSeenAt() { + return lastSeenAt; + } + + /** + * Number of libraries in the server this user has access to. + */ + @JsonIgnore + public long numLibraries() { + return numLibraries; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional allLibraries() { + return (Optional) allLibraries; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional owned() { + return (Optional) owned; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional pending() { + return (Optional) pending; + } + + public final static Builder builder() { + return new Builder(); + } + + /** + * Unique ID of the server of the connected user + */ + public GetUsersServer withId(long id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * ID of the actual Plex server. + */ + public GetUsersServer withServerId(long serverId) { + Utils.checkNotNull(serverId, "serverId"); + this.serverId = serverId; + return this; + } + + /** + * Machine identifier of the Plex server. + */ + public GetUsersServer withMachineIdentifier(String machineIdentifier) { + Utils.checkNotNull(machineIdentifier, "machineIdentifier"); + this.machineIdentifier = machineIdentifier; + return this; + } + + /** + * Name of the Plex server of the connected user. + */ + public GetUsersServer withName(String name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + public GetUsersServer withLastSeenAt(long lastSeenAt) { + Utils.checkNotNull(lastSeenAt, "lastSeenAt"); + this.lastSeenAt = lastSeenAt; + return this; + } + + /** + * Number of libraries in the server this user has access to. + */ + public GetUsersServer withNumLibraries(long numLibraries) { + Utils.checkNotNull(numLibraries, "numLibraries"); + this.numLibraries = numLibraries; + return this; + } + + public GetUsersServer withAllLibraries(AllLibraries allLibraries) { + Utils.checkNotNull(allLibraries, "allLibraries"); + this.allLibraries = Optional.ofNullable(allLibraries); + return this; + } + + public GetUsersServer withAllLibraries(Optional allLibraries) { + Utils.checkNotNull(allLibraries, "allLibraries"); + this.allLibraries = allLibraries; + return this; + } + + public GetUsersServer withOwned(Owned owned) { + Utils.checkNotNull(owned, "owned"); + this.owned = Optional.ofNullable(owned); + return this; + } + + public GetUsersServer withOwned(Optional owned) { + Utils.checkNotNull(owned, "owned"); + this.owned = owned; + return this; + } + + public GetUsersServer withPending(Pending pending) { + Utils.checkNotNull(pending, "pending"); + this.pending = Optional.ofNullable(pending); + return this; + } + + public GetUsersServer withPending(Optional pending) { + Utils.checkNotNull(pending, "pending"); + this.pending = pending; + return this; + } + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + GetUsersServer other = (GetUsersServer) o; + return + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.serverId, other.serverId) && + Objects.deepEquals(this.machineIdentifier, other.machineIdentifier) && + Objects.deepEquals(this.name, other.name) && + Objects.deepEquals(this.lastSeenAt, other.lastSeenAt) && + Objects.deepEquals(this.numLibraries, other.numLibraries) && + Objects.deepEquals(this.allLibraries, other.allLibraries) && + Objects.deepEquals(this.owned, other.owned) && + Objects.deepEquals(this.pending, other.pending); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + serverId, + machineIdentifier, + name, + lastSeenAt, + numLibraries, + allLibraries, + owned, + pending); + } + + @Override + public String toString() { + return Utils.toString(GetUsersServer.class, + "id", id, + "serverId", serverId, + "machineIdentifier", machineIdentifier, + "name", name, + "lastSeenAt", lastSeenAt, + "numLibraries", numLibraries, + "allLibraries", allLibraries, + "owned", owned, + "pending", pending); + } + + public final static class Builder { + + private Long id; + + private Long serverId; + + private String machineIdentifier; + + private String name; + + private Long lastSeenAt; + + private Long numLibraries; + + private Optional allLibraries; + + private Optional owned; + + private Optional pending; + + private Builder() { + // force use of static builder() method + } + + /** + * Unique ID of the server of the connected user + */ + public Builder id(long id) { + Utils.checkNotNull(id, "id"); + this.id = id; + return this; + } + + /** + * ID of the actual Plex server. + */ + public Builder serverId(long serverId) { + Utils.checkNotNull(serverId, "serverId"); + this.serverId = serverId; + return this; + } + + /** + * Machine identifier of the Plex server. + */ + public Builder machineIdentifier(String machineIdentifier) { + Utils.checkNotNull(machineIdentifier, "machineIdentifier"); + this.machineIdentifier = machineIdentifier; + return this; + } + + /** + * Name of the Plex server of the connected user. + */ + public Builder name(String name) { + Utils.checkNotNull(name, "name"); + this.name = name; + return this; + } + + public Builder lastSeenAt(long lastSeenAt) { + Utils.checkNotNull(lastSeenAt, "lastSeenAt"); + this.lastSeenAt = lastSeenAt; + return this; + } + + /** + * Number of libraries in the server this user has access to. + */ + public Builder numLibraries(long numLibraries) { + Utils.checkNotNull(numLibraries, "numLibraries"); + this.numLibraries = numLibraries; + return this; + } + + public Builder allLibraries(AllLibraries allLibraries) { + Utils.checkNotNull(allLibraries, "allLibraries"); + this.allLibraries = Optional.ofNullable(allLibraries); + return this; + } + + public Builder allLibraries(Optional allLibraries) { + Utils.checkNotNull(allLibraries, "allLibraries"); + this.allLibraries = allLibraries; + return this; + } + + public Builder owned(Owned owned) { + Utils.checkNotNull(owned, "owned"); + this.owned = Optional.ofNullable(owned); + return this; + } + + public Builder owned(Optional owned) { + Utils.checkNotNull(owned, "owned"); + this.owned = owned; + return this; + } + + public Builder pending(Pending pending) { + Utils.checkNotNull(pending, "pending"); + this.pending = Optional.ofNullable(pending); + return this; + } + + public Builder pending(Optional pending) { + Utils.checkNotNull(pending, "pending"); + this.pending = pending; + return this; + } + + public GetUsersServer build() { + if (allLibraries == null) { + allLibraries = _SINGLETON_VALUE_AllLibraries.value(); + } + if (owned == null) { + owned = _SINGLETON_VALUE_Owned.value(); + } + if (pending == null) { + pending = _SINGLETON_VALUE_Pending.value(); + } return new GetUsersServer( + id, + serverId, + machineIdentifier, + name, + lastSeenAt, + numLibraries, + allLibraries, + owned, + pending); + } + + private static final LazySingletonValue> _SINGLETON_VALUE_AllLibraries = + new LazySingletonValue<>( + "allLibraries", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_Owned = + new LazySingletonValue<>( + "owned", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_Pending = + new LazySingletonValue<>( + "pending", + "0", + new TypeReference>() {}); + } +} + diff --git a/src/main/java/dev/plexapi/sdk/models/operations/Home.java b/src/main/java/dev/plexapi/sdk/models/operations/Home.java new file mode 100644 index 00000000..16fe2793 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/Home.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * Home - Indicates if the user is part of a home group. + */ +public enum Home { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private Home(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (Home o: Home.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/Owned.java b/src/main/java/dev/plexapi/sdk/models/operations/Owned.java new file mode 100644 index 00000000..bf54d3e0 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/Owned.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * Owned - Indicates if the user owns the server. + */ +public enum Owned { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private Owned(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (Owned o: Owned.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/Pending.java b/src/main/java/dev/plexapi/sdk/models/operations/Pending.java new file mode 100644 index 00000000..b329fa8f --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/Pending.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * Pending - Indicates if the server is pending approval. + */ +public enum Pending { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private Pending(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (Pending o: Pending.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/Protected.java b/src/main/java/dev/plexapi/sdk/models/operations/Protected.java new file mode 100644 index 00000000..c413d314 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/Protected.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * Protected - Indicates whether the account is protected. + */ +public enum Protected { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private Protected(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (Protected o: Protected.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/Restricted.java b/src/main/java/dev/plexapi/sdk/models/operations/Restricted.java new file mode 100644 index 00000000..b7a913f3 --- /dev/null +++ b/src/main/java/dev/plexapi/sdk/models/operations/Restricted.java @@ -0,0 +1,37 @@ +/* + * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. + */ + +package dev.plexapi.sdk.models.operations; + +import com.fasterxml.jackson.annotation.JsonValue; +import java.util.Objects; +import java.util.Optional; + +/** + * Restricted - Indicates if the user has restricted access. + */ +public enum Restricted { + Disable(0), + Enable(1); + + @JsonValue + private final int value; + + private Restricted(int value) { + this.value = value; + } + + public int value() { + return value; + } + + public static Optional fromValue(int value) { + for (Restricted o: Restricted.values()) { + if (Objects.deepEquals(o.value, value)) { + return Optional.of(o); + } + } + return Optional.empty(); + } +} diff --git a/src/main/java/dev/plexapi/sdk/models/operations/SDKMethodInterfaces.java b/src/main/java/dev/plexapi/sdk/models/operations/SDKMethodInterfaces.java index 4847cda0..73a7cfd5 100644 --- a/src/main/java/dev/plexapi/sdk/models/operations/SDKMethodInterfaces.java +++ b/src/main/java/dev/plexapi/sdk/models/operations/SDKMethodInterfaces.java @@ -501,4 +501,11 @@ public class SDKMethodInterfaces { } + public interface MethodCallGetUsers { + GetUsersResponse getUsers( + GetUsersRequest request, + Optional serverURL) throws Exception; + } + + } diff --git a/src/main/java/dev/plexapi/sdk/models/operations/User.java b/src/main/java/dev/plexapi/sdk/models/operations/User.java index 9ff6a2ee..8d1fabab 100644 --- a/src/main/java/dev/plexapi/sdk/models/operations/User.java +++ b/src/main/java/dev/plexapi/sdk/models/operations/User.java @@ -7,52 +7,574 @@ package dev.plexapi.sdk.models.operations; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude.Include; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.core.type.TypeReference; +import dev.plexapi.sdk.utils.LazySingletonValue; import dev.plexapi.sdk.utils.Utils; -import java.lang.Integer; +import java.lang.Long; import java.lang.Override; import java.lang.String; +import java.lang.SuppressWarnings; +import java.util.List; import java.util.Objects; import java.util.Optional; +import org.openapitools.jackson.nullable.JsonNullable; public class User { - @JsonInclude(Include.NON_ABSENT) - @JsonProperty("id") - private Optional id; + /** + * User's unique ID. + */ + private long id; + + /** + * User's display name. + */ + private String title; + + /** + * User's username. + */ + private String username; + + /** + * User's email address. + */ + private String email; + + /** + * ID of the user's recommendation playlist. + */ + private JsonNullable recommendationsPlaylistId; + + /** + * URL to the user's avatar image. + */ + private String thumb; + + private Optional protected_; + + private Optional home; + + private Optional allowTuners; + + private Optional allowSync; + + private Optional allowCameraUpload; + + private Optional allowChannels; + + private Optional allowSubtitleAdmin; + + /** + * Filters applied for all content. + */ + private JsonNullable filterAll; + + /** + * Filters applied for movies. + */ + private JsonNullable filterMovies; + + /** + * Filters applied for music. + */ + private JsonNullable filterMusic; + + /** + * Filters applied for photos. + */ + private JsonNullable filterPhotos; + + /** + * Filters applied for television. + */ + private Optional filterTelevision; + + private Optional restricted; + + /** + * List of servers owned by the user. + */ + private List server; @JsonCreator public User( - @JsonProperty("id") Optional id) { + long id, + String title, + String username, + String email, + JsonNullable recommendationsPlaylistId, + String thumb, + Optional protected_, + Optional home, + Optional allowTuners, + Optional allowSync, + Optional allowCameraUpload, + Optional allowChannels, + Optional allowSubtitleAdmin, + JsonNullable filterAll, + JsonNullable filterMovies, + JsonNullable filterMusic, + JsonNullable filterPhotos, + Optional filterTelevision, + Optional restricted, + List server) { Utils.checkNotNull(id, "id"); + Utils.checkNotNull(title, "title"); + Utils.checkNotNull(username, "username"); + Utils.checkNotNull(email, "email"); + Utils.checkNotNull(recommendationsPlaylistId, "recommendationsPlaylistId"); + Utils.checkNotNull(thumb, "thumb"); + Utils.checkNotNull(protected_, "protected_"); + Utils.checkNotNull(home, "home"); + Utils.checkNotNull(allowTuners, "allowTuners"); + Utils.checkNotNull(allowSync, "allowSync"); + Utils.checkNotNull(allowCameraUpload, "allowCameraUpload"); + Utils.checkNotNull(allowChannels, "allowChannels"); + Utils.checkNotNull(allowSubtitleAdmin, "allowSubtitleAdmin"); + Utils.checkNotNull(filterAll, "filterAll"); + Utils.checkNotNull(filterMovies, "filterMovies"); + Utils.checkNotNull(filterMusic, "filterMusic"); + Utils.checkNotNull(filterPhotos, "filterPhotos"); + Utils.checkNotNull(filterTelevision, "filterTelevision"); + Utils.checkNotNull(restricted, "restricted"); + Utils.checkNotNull(server, "server"); this.id = id; + this.title = title; + this.username = username; + this.email = email; + this.recommendationsPlaylistId = recommendationsPlaylistId; + this.thumb = thumb; + this.protected_ = protected_; + this.home = home; + this.allowTuners = allowTuners; + this.allowSync = allowSync; + this.allowCameraUpload = allowCameraUpload; + this.allowChannels = allowChannels; + this.allowSubtitleAdmin = allowSubtitleAdmin; + this.filterAll = filterAll; + this.filterMovies = filterMovies; + this.filterMusic = filterMusic; + this.filterPhotos = filterPhotos; + this.filterTelevision = filterTelevision; + this.restricted = restricted; + this.server = server; } - public User() { - this(Optional.empty()); + public User( + long id, + String title, + String username, + String email, + String thumb, + List server) { + this(id, title, username, email, JsonNullable.undefined(), thumb, Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), JsonNullable.undefined(), Optional.empty(), Optional.empty(), server); } + /** + * User's unique ID. + */ @JsonIgnore - public Optional id() { + public long id() { return id; } + /** + * User's display name. + */ + @JsonIgnore + public String title() { + return title; + } + + /** + * User's username. + */ + @JsonIgnore + public String username() { + return username; + } + + /** + * User's email address. + */ + @JsonIgnore + public String email() { + return email; + } + + /** + * ID of the user's recommendation playlist. + */ + @JsonIgnore + public JsonNullable recommendationsPlaylistId() { + return recommendationsPlaylistId; + } + + /** + * URL to the user's avatar image. + */ + @JsonIgnore + public String thumb() { + return thumb; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional protected_() { + return (Optional) protected_; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional home() { + return (Optional) home; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional allowTuners() { + return (Optional) allowTuners; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional allowSync() { + return (Optional) allowSync; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional allowCameraUpload() { + return (Optional) allowCameraUpload; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional allowChannels() { + return (Optional) allowChannels; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional allowSubtitleAdmin() { + return (Optional) allowSubtitleAdmin; + } + + /** + * Filters applied for all content. + */ + @JsonIgnore + public JsonNullable filterAll() { + return filterAll; + } + + /** + * Filters applied for movies. + */ + @JsonIgnore + public JsonNullable filterMovies() { + return filterMovies; + } + + /** + * Filters applied for music. + */ + @JsonIgnore + public JsonNullable filterMusic() { + return filterMusic; + } + + /** + * Filters applied for photos. + */ + @JsonIgnore + public JsonNullable filterPhotos() { + return filterPhotos; + } + + /** + * Filters applied for television. + */ + @JsonIgnore + public Optional filterTelevision() { + return filterTelevision; + } + + @SuppressWarnings("unchecked") + @JsonIgnore + public Optional restricted() { + return (Optional) restricted; + } + + /** + * List of servers owned by the user. + */ + @JsonIgnore + public List server() { + return server; + } + public final static Builder builder() { return new Builder(); } - public User withId(int id) { + /** + * User's unique ID. + */ + public User withId(long id) { Utils.checkNotNull(id, "id"); - this.id = Optional.ofNullable(id); + this.id = id; return this; } - public User withId(Optional id) { - Utils.checkNotNull(id, "id"); - this.id = id; + /** + * User's display name. + */ + public User withTitle(String title) { + Utils.checkNotNull(title, "title"); + this.title = title; + return this; + } + + /** + * User's username. + */ + public User withUsername(String username) { + Utils.checkNotNull(username, "username"); + this.username = username; + return this; + } + + /** + * User's email address. + */ + public User withEmail(String email) { + Utils.checkNotNull(email, "email"); + this.email = email; + return this; + } + + /** + * ID of the user's recommendation playlist. + */ + public User withRecommendationsPlaylistId(String recommendationsPlaylistId) { + Utils.checkNotNull(recommendationsPlaylistId, "recommendationsPlaylistId"); + this.recommendationsPlaylistId = JsonNullable.of(recommendationsPlaylistId); + return this; + } + + /** + * ID of the user's recommendation playlist. + */ + public User withRecommendationsPlaylistId(JsonNullable recommendationsPlaylistId) { + Utils.checkNotNull(recommendationsPlaylistId, "recommendationsPlaylistId"); + this.recommendationsPlaylistId = recommendationsPlaylistId; + return this; + } + + /** + * URL to the user's avatar image. + */ + public User withThumb(String thumb) { + Utils.checkNotNull(thumb, "thumb"); + this.thumb = thumb; + return this; + } + + public User withProtected(Protected protected_) { + Utils.checkNotNull(protected_, "protected_"); + this.protected_ = Optional.ofNullable(protected_); + return this; + } + + public User withProtected(Optional protected_) { + Utils.checkNotNull(protected_, "protected_"); + this.protected_ = protected_; + return this; + } + + public User withHome(Home home) { + Utils.checkNotNull(home, "home"); + this.home = Optional.ofNullable(home); + return this; + } + + public User withHome(Optional home) { + Utils.checkNotNull(home, "home"); + this.home = home; + return this; + } + + public User withAllowTuners(AllowTuners allowTuners) { + Utils.checkNotNull(allowTuners, "allowTuners"); + this.allowTuners = Optional.ofNullable(allowTuners); + return this; + } + + public User withAllowTuners(Optional allowTuners) { + Utils.checkNotNull(allowTuners, "allowTuners"); + this.allowTuners = allowTuners; + return this; + } + + public User withAllowSync(AllowSync allowSync) { + Utils.checkNotNull(allowSync, "allowSync"); + this.allowSync = Optional.ofNullable(allowSync); + return this; + } + + public User withAllowSync(Optional allowSync) { + Utils.checkNotNull(allowSync, "allowSync"); + this.allowSync = allowSync; + return this; + } + + public User withAllowCameraUpload(AllowCameraUpload allowCameraUpload) { + Utils.checkNotNull(allowCameraUpload, "allowCameraUpload"); + this.allowCameraUpload = Optional.ofNullable(allowCameraUpload); + return this; + } + + public User withAllowCameraUpload(Optional allowCameraUpload) { + Utils.checkNotNull(allowCameraUpload, "allowCameraUpload"); + this.allowCameraUpload = allowCameraUpload; + return this; + } + + public User withAllowChannels(AllowChannels allowChannels) { + Utils.checkNotNull(allowChannels, "allowChannels"); + this.allowChannels = Optional.ofNullable(allowChannels); + return this; + } + + public User withAllowChannels(Optional allowChannels) { + Utils.checkNotNull(allowChannels, "allowChannels"); + this.allowChannels = allowChannels; + return this; + } + + public User withAllowSubtitleAdmin(AllowSubtitleAdmin allowSubtitleAdmin) { + Utils.checkNotNull(allowSubtitleAdmin, "allowSubtitleAdmin"); + this.allowSubtitleAdmin = Optional.ofNullable(allowSubtitleAdmin); + return this; + } + + public User withAllowSubtitleAdmin(Optional allowSubtitleAdmin) { + Utils.checkNotNull(allowSubtitleAdmin, "allowSubtitleAdmin"); + this.allowSubtitleAdmin = allowSubtitleAdmin; + return this; + } + + /** + * Filters applied for all content. + */ + public User withFilterAll(String filterAll) { + Utils.checkNotNull(filterAll, "filterAll"); + this.filterAll = JsonNullable.of(filterAll); + return this; + } + + /** + * Filters applied for all content. + */ + public User withFilterAll(JsonNullable filterAll) { + Utils.checkNotNull(filterAll, "filterAll"); + this.filterAll = filterAll; + return this; + } + + /** + * Filters applied for movies. + */ + public User withFilterMovies(String filterMovies) { + Utils.checkNotNull(filterMovies, "filterMovies"); + this.filterMovies = JsonNullable.of(filterMovies); + return this; + } + + /** + * Filters applied for movies. + */ + public User withFilterMovies(JsonNullable filterMovies) { + Utils.checkNotNull(filterMovies, "filterMovies"); + this.filterMovies = filterMovies; + return this; + } + + /** + * Filters applied for music. + */ + public User withFilterMusic(String filterMusic) { + Utils.checkNotNull(filterMusic, "filterMusic"); + this.filterMusic = JsonNullable.of(filterMusic); + return this; + } + + /** + * Filters applied for music. + */ + public User withFilterMusic(JsonNullable filterMusic) { + Utils.checkNotNull(filterMusic, "filterMusic"); + this.filterMusic = filterMusic; + return this; + } + + /** + * Filters applied for photos. + */ + public User withFilterPhotos(String filterPhotos) { + Utils.checkNotNull(filterPhotos, "filterPhotos"); + this.filterPhotos = JsonNullable.of(filterPhotos); + return this; + } + + /** + * Filters applied for photos. + */ + public User withFilterPhotos(JsonNullable filterPhotos) { + Utils.checkNotNull(filterPhotos, "filterPhotos"); + this.filterPhotos = filterPhotos; + return this; + } + + /** + * Filters applied for television. + */ + public User withFilterTelevision(String filterTelevision) { + Utils.checkNotNull(filterTelevision, "filterTelevision"); + this.filterTelevision = Optional.ofNullable(filterTelevision); + return this; + } + + /** + * Filters applied for television. + */ + public User withFilterTelevision(Optional filterTelevision) { + Utils.checkNotNull(filterTelevision, "filterTelevision"); + this.filterTelevision = filterTelevision; + return this; + } + + public User withRestricted(Restricted restricted) { + Utils.checkNotNull(restricted, "restricted"); + this.restricted = Optional.ofNullable(restricted); + return this; + } + + public User withRestricted(Optional restricted) { + Utils.checkNotNull(restricted, "restricted"); + this.restricted = restricted; + return this; + } + + /** + * List of servers owned by the user. + */ + public User withServer(List server) { + Utils.checkNotNull(server, "server"); + this.server = server; return this; } @@ -66,45 +588,476 @@ public class User { } User other = (User) o; return - Objects.deepEquals(this.id, other.id); + Objects.deepEquals(this.id, other.id) && + Objects.deepEquals(this.title, other.title) && + Objects.deepEquals(this.username, other.username) && + Objects.deepEquals(this.email, other.email) && + Objects.deepEquals(this.recommendationsPlaylistId, other.recommendationsPlaylistId) && + Objects.deepEquals(this.thumb, other.thumb) && + Objects.deepEquals(this.protected_, other.protected_) && + Objects.deepEquals(this.home, other.home) && + Objects.deepEquals(this.allowTuners, other.allowTuners) && + Objects.deepEquals(this.allowSync, other.allowSync) && + Objects.deepEquals(this.allowCameraUpload, other.allowCameraUpload) && + Objects.deepEquals(this.allowChannels, other.allowChannels) && + Objects.deepEquals(this.allowSubtitleAdmin, other.allowSubtitleAdmin) && + Objects.deepEquals(this.filterAll, other.filterAll) && + Objects.deepEquals(this.filterMovies, other.filterMovies) && + Objects.deepEquals(this.filterMusic, other.filterMusic) && + Objects.deepEquals(this.filterPhotos, other.filterPhotos) && + Objects.deepEquals(this.filterTelevision, other.filterTelevision) && + Objects.deepEquals(this.restricted, other.restricted) && + Objects.deepEquals(this.server, other.server); } @Override public int hashCode() { return Objects.hash( - id); + id, + title, + username, + email, + recommendationsPlaylistId, + thumb, + protected_, + home, + allowTuners, + allowSync, + allowCameraUpload, + allowChannels, + allowSubtitleAdmin, + filterAll, + filterMovies, + filterMusic, + filterPhotos, + filterTelevision, + restricted, + server); } @Override public String toString() { return Utils.toString(User.class, - "id", id); + "id", id, + "title", title, + "username", username, + "email", email, + "recommendationsPlaylistId", recommendationsPlaylistId, + "thumb", thumb, + "protected_", protected_, + "home", home, + "allowTuners", allowTuners, + "allowSync", allowSync, + "allowCameraUpload", allowCameraUpload, + "allowChannels", allowChannels, + "allowSubtitleAdmin", allowSubtitleAdmin, + "filterAll", filterAll, + "filterMovies", filterMovies, + "filterMusic", filterMusic, + "filterPhotos", filterPhotos, + "filterTelevision", filterTelevision, + "restricted", restricted, + "server", server); } public final static class Builder { - private Optional id = Optional.empty(); + private Long id; + + private String title; + + private String username; + + private String email; + + private JsonNullable recommendationsPlaylistId = JsonNullable.undefined(); + + private String thumb; + + private Optional protected_; + + private Optional home; + + private Optional allowTuners; + + private Optional allowSync; + + private Optional allowCameraUpload; + + private Optional allowChannels; + + private Optional allowSubtitleAdmin; + + private JsonNullable filterAll = JsonNullable.undefined(); + + private JsonNullable filterMovies = JsonNullable.undefined(); + + private JsonNullable filterMusic = JsonNullable.undefined(); + + private JsonNullable filterPhotos = JsonNullable.undefined(); + + private Optional filterTelevision = Optional.empty(); + + private Optional restricted; + + private List server; private Builder() { // force use of static builder() method } - public Builder id(int id) { - Utils.checkNotNull(id, "id"); - this.id = Optional.ofNullable(id); - return this; - } - - public Builder id(Optional id) { + /** + * User's unique ID. + */ + public Builder id(long id) { Utils.checkNotNull(id, "id"); this.id = id; return this; } + + /** + * User's display name. + */ + public Builder title(String title) { + Utils.checkNotNull(title, "title"); + this.title = title; + return this; + } + + /** + * User's username. + */ + public Builder username(String username) { + Utils.checkNotNull(username, "username"); + this.username = username; + return this; + } + + /** + * User's email address. + */ + public Builder email(String email) { + Utils.checkNotNull(email, "email"); + this.email = email; + return this; + } + + /** + * ID of the user's recommendation playlist. + */ + public Builder recommendationsPlaylistId(String recommendationsPlaylistId) { + Utils.checkNotNull(recommendationsPlaylistId, "recommendationsPlaylistId"); + this.recommendationsPlaylistId = JsonNullable.of(recommendationsPlaylistId); + return this; + } + + /** + * ID of the user's recommendation playlist. + */ + public Builder recommendationsPlaylistId(JsonNullable recommendationsPlaylistId) { + Utils.checkNotNull(recommendationsPlaylistId, "recommendationsPlaylistId"); + this.recommendationsPlaylistId = recommendationsPlaylistId; + return this; + } + + /** + * URL to the user's avatar image. + */ + public Builder thumb(String thumb) { + Utils.checkNotNull(thumb, "thumb"); + this.thumb = thumb; + return this; + } + + public Builder protected_(Protected protected_) { + Utils.checkNotNull(protected_, "protected_"); + this.protected_ = Optional.ofNullable(protected_); + return this; + } + + public Builder protected_(Optional protected_) { + Utils.checkNotNull(protected_, "protected_"); + this.protected_ = protected_; + return this; + } + + public Builder home(Home home) { + Utils.checkNotNull(home, "home"); + this.home = Optional.ofNullable(home); + return this; + } + + public Builder home(Optional home) { + Utils.checkNotNull(home, "home"); + this.home = home; + return this; + } + + public Builder allowTuners(AllowTuners allowTuners) { + Utils.checkNotNull(allowTuners, "allowTuners"); + this.allowTuners = Optional.ofNullable(allowTuners); + return this; + } + + public Builder allowTuners(Optional allowTuners) { + Utils.checkNotNull(allowTuners, "allowTuners"); + this.allowTuners = allowTuners; + return this; + } + + public Builder allowSync(AllowSync allowSync) { + Utils.checkNotNull(allowSync, "allowSync"); + this.allowSync = Optional.ofNullable(allowSync); + return this; + } + + public Builder allowSync(Optional allowSync) { + Utils.checkNotNull(allowSync, "allowSync"); + this.allowSync = allowSync; + return this; + } + + public Builder allowCameraUpload(AllowCameraUpload allowCameraUpload) { + Utils.checkNotNull(allowCameraUpload, "allowCameraUpload"); + this.allowCameraUpload = Optional.ofNullable(allowCameraUpload); + return this; + } + + public Builder allowCameraUpload(Optional allowCameraUpload) { + Utils.checkNotNull(allowCameraUpload, "allowCameraUpload"); + this.allowCameraUpload = allowCameraUpload; + return this; + } + + public Builder allowChannels(AllowChannels allowChannels) { + Utils.checkNotNull(allowChannels, "allowChannels"); + this.allowChannels = Optional.ofNullable(allowChannels); + return this; + } + + public Builder allowChannels(Optional allowChannels) { + Utils.checkNotNull(allowChannels, "allowChannels"); + this.allowChannels = allowChannels; + return this; + } + + public Builder allowSubtitleAdmin(AllowSubtitleAdmin allowSubtitleAdmin) { + Utils.checkNotNull(allowSubtitleAdmin, "allowSubtitleAdmin"); + this.allowSubtitleAdmin = Optional.ofNullable(allowSubtitleAdmin); + return this; + } + + public Builder allowSubtitleAdmin(Optional allowSubtitleAdmin) { + Utils.checkNotNull(allowSubtitleAdmin, "allowSubtitleAdmin"); + this.allowSubtitleAdmin = allowSubtitleAdmin; + return this; + } + + /** + * Filters applied for all content. + */ + public Builder filterAll(String filterAll) { + Utils.checkNotNull(filterAll, "filterAll"); + this.filterAll = JsonNullable.of(filterAll); + return this; + } + + /** + * Filters applied for all content. + */ + public Builder filterAll(JsonNullable filterAll) { + Utils.checkNotNull(filterAll, "filterAll"); + this.filterAll = filterAll; + return this; + } + + /** + * Filters applied for movies. + */ + public Builder filterMovies(String filterMovies) { + Utils.checkNotNull(filterMovies, "filterMovies"); + this.filterMovies = JsonNullable.of(filterMovies); + return this; + } + + /** + * Filters applied for movies. + */ + public Builder filterMovies(JsonNullable filterMovies) { + Utils.checkNotNull(filterMovies, "filterMovies"); + this.filterMovies = filterMovies; + return this; + } + + /** + * Filters applied for music. + */ + public Builder filterMusic(String filterMusic) { + Utils.checkNotNull(filterMusic, "filterMusic"); + this.filterMusic = JsonNullable.of(filterMusic); + return this; + } + + /** + * Filters applied for music. + */ + public Builder filterMusic(JsonNullable filterMusic) { + Utils.checkNotNull(filterMusic, "filterMusic"); + this.filterMusic = filterMusic; + return this; + } + + /** + * Filters applied for photos. + */ + public Builder filterPhotos(String filterPhotos) { + Utils.checkNotNull(filterPhotos, "filterPhotos"); + this.filterPhotos = JsonNullable.of(filterPhotos); + return this; + } + + /** + * Filters applied for photos. + */ + public Builder filterPhotos(JsonNullable filterPhotos) { + Utils.checkNotNull(filterPhotos, "filterPhotos"); + this.filterPhotos = filterPhotos; + return this; + } + + /** + * Filters applied for television. + */ + public Builder filterTelevision(String filterTelevision) { + Utils.checkNotNull(filterTelevision, "filterTelevision"); + this.filterTelevision = Optional.ofNullable(filterTelevision); + return this; + } + + /** + * Filters applied for television. + */ + public Builder filterTelevision(Optional filterTelevision) { + Utils.checkNotNull(filterTelevision, "filterTelevision"); + this.filterTelevision = filterTelevision; + return this; + } + + public Builder restricted(Restricted restricted) { + Utils.checkNotNull(restricted, "restricted"); + this.restricted = Optional.ofNullable(restricted); + return this; + } + + public Builder restricted(Optional restricted) { + Utils.checkNotNull(restricted, "restricted"); + this.restricted = restricted; + return this; + } + + /** + * List of servers owned by the user. + */ + public Builder server(List server) { + Utils.checkNotNull(server, "server"); + this.server = server; + return this; + } public User build() { - return new User( - id); + if (protected_ == null) { + protected_ = _SINGLETON_VALUE_Protected.value(); + } + if (home == null) { + home = _SINGLETON_VALUE_Home.value(); + } + if (allowTuners == null) { + allowTuners = _SINGLETON_VALUE_AllowTuners.value(); + } + if (allowSync == null) { + allowSync = _SINGLETON_VALUE_AllowSync.value(); + } + if (allowCameraUpload == null) { + allowCameraUpload = _SINGLETON_VALUE_AllowCameraUpload.value(); + } + if (allowChannels == null) { + allowChannels = _SINGLETON_VALUE_AllowChannels.value(); + } + if (allowSubtitleAdmin == null) { + allowSubtitleAdmin = _SINGLETON_VALUE_AllowSubtitleAdmin.value(); + } + if (restricted == null) { + restricted = _SINGLETON_VALUE_Restricted.value(); + } return new User( + id, + title, + username, + email, + recommendationsPlaylistId, + thumb, + protected_, + home, + allowTuners, + allowSync, + allowCameraUpload, + allowChannels, + allowSubtitleAdmin, + filterAll, + filterMovies, + filterMusic, + filterPhotos, + filterTelevision, + restricted, + server); } + + private static final LazySingletonValue> _SINGLETON_VALUE_Protected = + new LazySingletonValue<>( + "protected", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_Home = + new LazySingletonValue<>( + "home", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_AllowTuners = + new LazySingletonValue<>( + "allowTuners", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_AllowSync = + new LazySingletonValue<>( + "allowSync", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_AllowCameraUpload = + new LazySingletonValue<>( + "allowCameraUpload", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_AllowChannels = + new LazySingletonValue<>( + "allowChannels", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_AllowSubtitleAdmin = + new LazySingletonValue<>( + "allowSubtitleAdmin", + "0", + new TypeReference>() {}); + + private static final LazySingletonValue> _SINGLETON_VALUE_Restricted = + new LazySingletonValue<>( + "restricted", + "0", + new TypeReference>() {}); } }