mirror of
https://github.com/LukeHagar/plexjava.git
synced 2025-12-06 04:20:46 +00:00
572 lines
22 KiB
Markdown
572 lines
22 KiB
Markdown
# plexapi
|
|
|
|
<div align="left">
|
|
<a href="https://speakeasyapi.dev/"><img src="https://custom-icon-badges.demolab.com/badge/-Built%20By%20Speakeasy-212015?style=for-the-badge&logoColor=FBE331&logo=speakeasy&labelColor=545454" /></a>
|
|
<a href="https://mit-license.org/">
|
|
<img src="https://img.shields.io/badge/License-MIT-blue.svg" style="width: 100px; height: 28px;" />
|
|
</a>
|
|
</div>
|
|
|
|
|
|
<!-- Start Summary [summary] -->
|
|
## Summary
|
|
|
|
Plex-API: An Open API Spec for interacting with Plex.tv and Plex Media Server
|
|
<!-- End Summary [summary] -->
|
|
|
|
<!-- Start Table of Contents [toc] -->
|
|
## Table of Contents
|
|
|
|
* [SDK Installation](#sdk-installation)
|
|
* [SDK Example Usage](#sdk-example-usage)
|
|
* [Available Resources and Operations](#available-resources-and-operations)
|
|
* [Global Parameters](#global-parameters)
|
|
* [Error Handling](#error-handling)
|
|
* [Server Selection](#server-selection)
|
|
* [Authentication](#authentication)
|
|
<!-- End Table of Contents [toc] -->
|
|
|
|
<!-- Start SDK Installation [installation] -->
|
|
## SDK Installation
|
|
|
|
### Getting started
|
|
|
|
JDK 11 or later is required.
|
|
|
|
The samples below show how a published SDK artifact is used:
|
|
|
|
Gradle:
|
|
```groovy
|
|
implementation 'dev.plexapi:plexapi:0.2.1'
|
|
```
|
|
|
|
Maven:
|
|
```xml
|
|
<dependency>
|
|
<groupId>dev.plexapi</groupId>
|
|
<artifactId>plexapi</artifactId>
|
|
<version>0.2.1</version>
|
|
</dependency>
|
|
```
|
|
|
|
### How to build
|
|
After cloning the git repository to your file system you can build the SDK artifact from source to the `build` directory by running `./gradlew build` on *nix systems or `gradlew.bat` on Windows systems.
|
|
|
|
If you wish to build from source and publish the SDK artifact to your local Maven repository (on your filesystem) then use the following command (after cloning the git repo locally):
|
|
|
|
On *nix:
|
|
```bash
|
|
./gradlew publishToMavenLocal -Pskip.signing
|
|
```
|
|
On Windows:
|
|
```bash
|
|
gradlew.bat publishToMavenLocal -Pskip.signing
|
|
```
|
|
<!-- End SDK Installation [installation] -->
|
|
|
|
<!-- Start SDK Example Usage [usage] -->
|
|
## SDK Example Usage
|
|
|
|
### Example
|
|
|
|
```java
|
|
package hello.world;
|
|
|
|
import dev.plexapi.sdk.PlexAPI;
|
|
import dev.plexapi.sdk.models.errors.SDKError;
|
|
import dev.plexapi.sdk.models.operations.GetServerCapabilitiesResponse;
|
|
import java.lang.Exception;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
PlexAPI sdk = PlexAPI.builder()
|
|
.accessToken("<YOUR_API_KEY_HERE>")
|
|
.xPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40")
|
|
.build();
|
|
|
|
GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities()
|
|
.call();
|
|
|
|
if (res.object().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (dev.plexapi.sdk.models.errors.GetServerCapabilitiesResponseBody e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
|
|
}
|
|
}
|
|
```
|
|
<!-- End SDK Example Usage [usage] -->
|
|
|
|
<!-- Start Available Resources and Operations [operations] -->
|
|
## Available Resources and Operations
|
|
|
|
### [server()](docs/sdks/server/README.md)
|
|
|
|
* [getServerCapabilities](docs/sdks/server/README.md#getservercapabilities) - Get Server Capabilities
|
|
* [getServerPreferences](docs/sdks/server/README.md#getserverpreferences) - Get Server Preferences
|
|
* [getAvailableClients](docs/sdks/server/README.md#getavailableclients) - Get Available Clients
|
|
* [getDevices](docs/sdks/server/README.md#getdevices) - Get Devices
|
|
* [getServerIdentity](docs/sdks/server/README.md#getserveridentity) - Get Server Identity
|
|
* [getMyPlexAccount](docs/sdks/server/README.md#getmyplexaccount) - Get MyPlex Account
|
|
* [getResizedPhoto](docs/sdks/server/README.md#getresizedphoto) - Get a Resized Photo
|
|
* [getMediaProviders](docs/sdks/server/README.md#getmediaproviders) - Get Media Providers
|
|
* [getServerList](docs/sdks/server/README.md#getserverlist) - Get Server List
|
|
|
|
### [media()](docs/sdks/media/README.md)
|
|
|
|
* [markPlayed](docs/sdks/media/README.md#markplayed) - Mark Media Played
|
|
* [markUnplayed](docs/sdks/media/README.md#markunplayed) - Mark Media Unplayed
|
|
* [updatePlayProgress](docs/sdks/media/README.md#updateplayprogress) - Update Media Play Progress
|
|
* [getBannerImage](docs/sdks/media/README.md#getbannerimage) - Get Banner Image
|
|
* [getThumbImage](docs/sdks/media/README.md#getthumbimage) - Get Thumb Image
|
|
|
|
### [video()](docs/sdks/video/README.md)
|
|
|
|
* [getTimeline](docs/sdks/video/README.md#gettimeline) - Get the timeline for a media item
|
|
* [startUniversalTranscode](docs/sdks/video/README.md#startuniversaltranscode) - Start Universal Transcode
|
|
|
|
### [activities()](docs/sdks/activities/README.md)
|
|
|
|
* [getServerActivities](docs/sdks/activities/README.md#getserveractivities) - Get Server Activities
|
|
* [cancelServerActivities](docs/sdks/activities/README.md#cancelserveractivities) - Cancel Server Activities
|
|
|
|
### [butler()](docs/sdks/butler/README.md)
|
|
|
|
* [getButlerTasks](docs/sdks/butler/README.md#getbutlertasks) - Get Butler tasks
|
|
* [startAllTasks](docs/sdks/butler/README.md#startalltasks) - Start all Butler tasks
|
|
* [stopAllTasks](docs/sdks/butler/README.md#stopalltasks) - Stop all Butler tasks
|
|
* [startTask](docs/sdks/butler/README.md#starttask) - Start a single Butler task
|
|
* [stopTask](docs/sdks/butler/README.md#stoptask) - Stop a single Butler task
|
|
|
|
### [plex()](docs/sdks/plex/README.md)
|
|
|
|
* [getCompanionsData](docs/sdks/plex/README.md#getcompanionsdata) - Get Companions Data
|
|
* [getUserFriends](docs/sdks/plex/README.md#getuserfriends) - Get list of friends of the user logged in
|
|
* [getGeoData](docs/sdks/plex/README.md#getgeodata) - Get Geo Data
|
|
* [getHomeData](docs/sdks/plex/README.md#gethomedata) - Get Plex Home Data
|
|
* [getServerResources](docs/sdks/plex/README.md#getserverresources) - Get Server Resources
|
|
* [getPin](docs/sdks/plex/README.md#getpin) - Get a Pin
|
|
* [getTokenByPinId](docs/sdks/plex/README.md#gettokenbypinid) - Get Access Token by PinId
|
|
|
|
### [hubs()](docs/sdks/hubs/README.md)
|
|
|
|
* [getGlobalHubs](docs/sdks/hubs/README.md#getglobalhubs) - Get Global Hubs
|
|
* [getLibraryHubs](docs/sdks/hubs/README.md#getlibraryhubs) - Get library specific hubs
|
|
|
|
### [search()](docs/sdks/search/README.md)
|
|
|
|
* [performSearch](docs/sdks/search/README.md#performsearch) - Perform a search
|
|
* [performVoiceSearch](docs/sdks/search/README.md#performvoicesearch) - Perform a voice search
|
|
* [getSearchResults](docs/sdks/search/README.md#getsearchresults) - Get Search Results
|
|
|
|
### [library()](docs/sdks/library/README.md)
|
|
|
|
* [getFileHash](docs/sdks/library/README.md#getfilehash) - Get Hash Value
|
|
* [getRecentlyAdded](docs/sdks/library/README.md#getrecentlyadded) - Get Recently Added
|
|
* [getAllLibraries](docs/sdks/library/README.md#getalllibraries) - Get All Libraries
|
|
* [getLibraryDetails](docs/sdks/library/README.md#getlibrarydetails) - Get Library Details
|
|
* [deleteLibrary](docs/sdks/library/README.md#deletelibrary) - Delete Library Section
|
|
* [getLibraryItems](docs/sdks/library/README.md#getlibraryitems) - Get Library Items
|
|
* [getRefreshLibraryMetadata](docs/sdks/library/README.md#getrefreshlibrarymetadata) - Refresh Metadata Of The Library
|
|
* [getSearchLibrary](docs/sdks/library/README.md#getsearchlibrary) - Search Library
|
|
* [getMetaDataByRatingKey](docs/sdks/library/README.md#getmetadatabyratingkey) - Get Metadata by RatingKey
|
|
* [getMetadataChildren](docs/sdks/library/README.md#getmetadatachildren) - Get Items Children
|
|
* [getTopWatchedContent](docs/sdks/library/README.md#gettopwatchedcontent) - Get Top Watched Content
|
|
* [getOnDeck](docs/sdks/library/README.md#getondeck) - Get On Deck
|
|
|
|
### [watchlist()](docs/sdks/watchlist/README.md)
|
|
|
|
* [getWatchList](docs/sdks/watchlist/README.md#getwatchlist) - Get User Watchlist
|
|
|
|
### [log()](docs/sdks/log/README.md)
|
|
|
|
* [logLine](docs/sdks/log/README.md#logline) - Logging a single line message.
|
|
* [logMultiLine](docs/sdks/log/README.md#logmultiline) - Logging a multi-line message
|
|
* [enablePaperTrail](docs/sdks/log/README.md#enablepapertrail) - Enabling Papertrail
|
|
|
|
### [playlists()](docs/sdks/playlists/README.md)
|
|
|
|
* [createPlaylist](docs/sdks/playlists/README.md#createplaylist) - Create a Playlist
|
|
* [getPlaylists](docs/sdks/playlists/README.md#getplaylists) - Get All Playlists
|
|
* [getPlaylist](docs/sdks/playlists/README.md#getplaylist) - Retrieve Playlist
|
|
* [deletePlaylist](docs/sdks/playlists/README.md#deleteplaylist) - Deletes a Playlist
|
|
* [updatePlaylist](docs/sdks/playlists/README.md#updateplaylist) - Update a Playlist
|
|
* [getPlaylistContents](docs/sdks/playlists/README.md#getplaylistcontents) - Retrieve Playlist Contents
|
|
* [clearPlaylistContents](docs/sdks/playlists/README.md#clearplaylistcontents) - Delete Playlist Contents
|
|
* [addPlaylistContents](docs/sdks/playlists/README.md#addplaylistcontents) - Adding to a Playlist
|
|
* [uploadPlaylist](docs/sdks/playlists/README.md#uploadplaylist) - Upload Playlist
|
|
|
|
### [authentication()](docs/sdks/authentication/README.md)
|
|
|
|
* [getTransientToken](docs/sdks/authentication/README.md#gettransienttoken) - Get a Transient Token.
|
|
* [getSourceConnectionInformation](docs/sdks/authentication/README.md#getsourceconnectioninformation) - Get Source Connection Information
|
|
* [getUserDetails](docs/sdks/authentication/README.md#getuserdetails) - Get User Data By Token
|
|
* [postUsersSignInData](docs/sdks/authentication/README.md#postuserssignindata) - Get User SignIn Data
|
|
|
|
### [statistics()](docs/sdks/statistics/README.md)
|
|
|
|
* [getStatistics](docs/sdks/statistics/README.md#getstatistics) - Get Media Statistics
|
|
* [getResourcesStatistics](docs/sdks/statistics/README.md#getresourcesstatistics) - Get Resources Statistics
|
|
* [getBandwidthStatistics](docs/sdks/statistics/README.md#getbandwidthstatistics) - Get Bandwidth Statistics
|
|
|
|
### [sessions()](docs/sdks/sessions/README.md)
|
|
|
|
* [getSessions](docs/sdks/sessions/README.md#getsessions) - Get Active Sessions
|
|
* [getSessionHistory](docs/sdks/sessions/README.md#getsessionhistory) - Get Session History
|
|
* [getTranscodeSessions](docs/sdks/sessions/README.md#gettranscodesessions) - Get Transcode Sessions
|
|
* [stopTranscodeSession](docs/sdks/sessions/README.md#stoptranscodesession) - Stop a Transcode Session
|
|
|
|
### [updater()](docs/sdks/updater/README.md)
|
|
|
|
* [getUpdateStatus](docs/sdks/updater/README.md#getupdatestatus) - Querying status of updates
|
|
* [checkForUpdates](docs/sdks/updater/README.md#checkforupdates) - Checking for updates
|
|
* [applyUpdates](docs/sdks/updater/README.md#applyupdates) - Apply Updates
|
|
<!-- End Available Resources and Operations [operations] -->
|
|
|
|
<!-- Start Global Parameters [global-parameters] -->
|
|
## Global Parameters
|
|
|
|
A parameter is configured globally. This parameter may be set on the SDK client instance itself during initialization. When configured as an option during SDK initialization, This global value will be used as the default on the operations that use it. When such operations are called, there is a place in each to override the global value, if needed.
|
|
|
|
For example, you can set `X-Plex-Client-Identifier` to `"gcgzw5rz2xovp84b4vha3a40"` at SDK initialization and then you do not have to pass the same value on calls to operations like `getServerResources`. But if you want to do so you may, which will locally override the global setting. See the example code below for a demonstration.
|
|
|
|
|
|
### Available Globals
|
|
|
|
The following global parameter is available.
|
|
|
|
| Name | Type | Required | Description |
|
|
| ---- | ---- |:--------:| ----------- |
|
|
| xPlexClientIdentifier | java.lang.String | | The unique identifier for the client application
|
|
This is used to track the client application and its usage
|
|
(UUID, serial number, or other number unique per device)
|
|
|
|
|
|
|
|
|
### Example
|
|
|
|
```java
|
|
package hello.world;
|
|
|
|
import dev.plexapi.sdk.PlexAPI;
|
|
import dev.plexapi.sdk.models.errors.SDKError;
|
|
import dev.plexapi.sdk.models.operations.GetServerResourcesRequest;
|
|
import dev.plexapi.sdk.models.operations.GetServerResourcesResponse;
|
|
import dev.plexapi.sdk.models.operations.IncludeHttps;
|
|
import dev.plexapi.sdk.models.operations.IncludeIPv6;
|
|
import dev.plexapi.sdk.models.operations.IncludeRelay;
|
|
import java.lang.Exception;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
PlexAPI sdk = PlexAPI.builder()
|
|
.accessToken("<YOUR_API_KEY_HERE>")
|
|
.xPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40")
|
|
.build();
|
|
|
|
GetServerResourcesRequest req = GetServerResourcesRequest.builder()
|
|
.xPlexToken("CV5xoxjTpFKUzBTShsaf")
|
|
.includeHttps(IncludeHttps.ONE)
|
|
.includeRelay(IncludeRelay.ONE)
|
|
.includeIPv6(IncludeIPv6.ONE)
|
|
.build();
|
|
|
|
GetServerResourcesResponse res = sdk.plex().getServerResources()
|
|
.request(req)
|
|
.call();
|
|
|
|
if (res.plexDevices().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (dev.plexapi.sdk.models.errors.GetServerResourcesResponseBody e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
|
|
}
|
|
}
|
|
```
|
|
<!-- End Global Parameters [global-parameters] -->
|
|
|
|
<!-- Start Error Handling [errors] -->
|
|
## Error Handling
|
|
|
|
Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will throw the appropriate Exception type.
|
|
|
|
| Error Object | Status Code | Content Type |
|
|
| ----------------------------------------------- | ----------------------------------------------- | ----------------------------------------------- |
|
|
| models/errors/GetServerCapabilitiesResponseBody | 401 | application/json |
|
|
| models/errors/SDKError | 4xx-5xx | \*\/* |
|
|
|
|
### Example
|
|
|
|
```java
|
|
package hello.world;
|
|
|
|
import dev.plexapi.sdk.PlexAPI;
|
|
import dev.plexapi.sdk.models.errors.SDKError;
|
|
import dev.plexapi.sdk.models.operations.GetServerCapabilitiesResponse;
|
|
import java.lang.Exception;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
PlexAPI sdk = PlexAPI.builder()
|
|
.accessToken("<YOUR_API_KEY_HERE>")
|
|
.xPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40")
|
|
.build();
|
|
|
|
GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities()
|
|
.call();
|
|
|
|
if (res.object().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (dev.plexapi.sdk.models.errors.GetServerCapabilitiesResponseBody e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
|
|
}
|
|
}
|
|
```
|
|
<!-- End Error Handling [errors] -->
|
|
|
|
<!-- Start Server Selection [server] -->
|
|
## Server Selection
|
|
|
|
### Select Server by Index
|
|
|
|
You can override the default server globally by passing a server index to the `serverIndex` builder method when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the indexes associated with the available servers:
|
|
|
|
| # | Server | Variables |
|
|
| - | ------ | --------- |
|
|
| 0 | `{protocol}://{ip}:{port}` | `protocol` (default is `https`), `ip` (default is `10.10.10.47`), `port` (default is `32400`) |
|
|
|
|
#### Example
|
|
|
|
```java
|
|
package hello.world;
|
|
|
|
import dev.plexapi.sdk.PlexAPI;
|
|
import dev.plexapi.sdk.models.errors.SDKError;
|
|
import dev.plexapi.sdk.models.operations.GetServerCapabilitiesResponse;
|
|
import java.lang.Exception;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
PlexAPI sdk = PlexAPI.builder()
|
|
.serverIndex(0)
|
|
.accessToken("<YOUR_API_KEY_HERE>")
|
|
.xPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40")
|
|
.build();
|
|
|
|
GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities()
|
|
.call();
|
|
|
|
if (res.object().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (dev.plexapi.sdk.models.errors.GetServerCapabilitiesResponseBody e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
|
|
}
|
|
}
|
|
```
|
|
|
|
#### Variables
|
|
|
|
Some of the server options above contain variables. If you want to set the values of those variables, the following optional parameters are available when initializing the SDK client instance:
|
|
* `ServerProtocol protocol`
|
|
* `String ip`
|
|
* `String port`
|
|
|
|
### Override Server URL Per-Client
|
|
|
|
The default server can also be overridden globally by passing a URL to the `serverURL` builder method when initializing the SDK client instance. For example:
|
|
```java
|
|
package hello.world;
|
|
|
|
import dev.plexapi.sdk.PlexAPI;
|
|
import dev.plexapi.sdk.models.errors.SDKError;
|
|
import dev.plexapi.sdk.models.operations.GetServerCapabilitiesResponse;
|
|
import java.lang.Exception;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
PlexAPI sdk = PlexAPI.builder()
|
|
.serverURL("{protocol}://{ip}:{port}")
|
|
.accessToken("<YOUR_API_KEY_HERE>")
|
|
.xPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40")
|
|
.build();
|
|
|
|
GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities()
|
|
.call();
|
|
|
|
if (res.object().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (dev.plexapi.sdk.models.errors.GetServerCapabilitiesResponseBody e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
|
|
}
|
|
}
|
|
```
|
|
|
|
### Override Server URL Per-Operation
|
|
|
|
The server URL can also be overridden on a per-operation basis, provided a server list was specified for the operation. For example:
|
|
```java
|
|
package hello.world;
|
|
|
|
import dev.plexapi.sdk.PlexAPI;
|
|
import dev.plexapi.sdk.models.errors.SDKError;
|
|
import dev.plexapi.sdk.models.operations.GetCompanionsDataResponse;
|
|
import java.lang.Exception;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
PlexAPI sdk = PlexAPI.builder()
|
|
.accessToken("<YOUR_API_KEY_HERE>")
|
|
.xPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40")
|
|
.build();
|
|
|
|
GetCompanionsDataResponse res = sdk.plex().getCompanionsData()
|
|
.serverURL("https://plex.tv/api/v2")
|
|
.call();
|
|
|
|
if (res.responseBodies().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (dev.plexapi.sdk.models.errors.GetCompanionsDataResponseBody e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
|
|
}
|
|
}
|
|
```
|
|
<!-- End Server Selection [server] -->
|
|
|
|
<!-- Start Authentication [security] -->
|
|
## Authentication
|
|
|
|
### Per-Client Security Schemes
|
|
|
|
This SDK supports the following security scheme globally:
|
|
|
|
| Name | Type | Scheme |
|
|
| ------------- | ------------- | ------------- |
|
|
| `accessToken` | apiKey | API key |
|
|
|
|
To authenticate with the API the `accessToken` parameter must be set when initializing the SDK client instance. For example:
|
|
```java
|
|
package hello.world;
|
|
|
|
import dev.plexapi.sdk.PlexAPI;
|
|
import dev.plexapi.sdk.models.errors.SDKError;
|
|
import dev.plexapi.sdk.models.operations.GetServerCapabilitiesResponse;
|
|
import java.lang.Exception;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
PlexAPI sdk = PlexAPI.builder()
|
|
.accessToken("<YOUR_API_KEY_HERE>")
|
|
.xPlexClientIdentifier("gcgzw5rz2xovp84b4vha3a40")
|
|
.build();
|
|
|
|
GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities()
|
|
.call();
|
|
|
|
if (res.object().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (dev.plexapi.sdk.models.errors.GetServerCapabilitiesResponseBody e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
|
|
}
|
|
}
|
|
```
|
|
<!-- End Authentication [security] -->
|
|
|
|
<!-- Placeholder for Future Speakeasy SDK Sections -->
|
|
|
|
# Development
|
|
|
|
## Maturity
|
|
|
|
This SDK is in beta, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning usage
|
|
to a specific package version. This way, you can install the same version each time without breaking changes unless you are intentionally
|
|
looking for the latest version.
|
|
|
|
## Contributions
|
|
|
|
While we value open-source contributions to this SDK, this library is generated programmatically. Any manual changes added to internal files will be overwritten on the next generation.
|
|
We look forward to hearing your feedback. Feel free to open a PR or an issue with a proof of concept and we'll do our best to include it in a future release.
|
|
|
|
### SDK Created by [Speakeasy](https://docs.speakeasyapi.dev/docs/using-speakeasy/client-sdks)
|