mirror of
https://github.com/LukeHagar/plexjava.git
synced 2025-12-09 20:47:45 +00:00
48 lines
1.5 KiB
Markdown
48 lines
1.5 KiB
Markdown
<!-- Start SDK Example Usage [usage] -->
|
|
```java
|
|
package hello.world;
|
|
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigInteger;
|
|
import java.time.LocalDate;
|
|
import java.time.OffsetDateTime;
|
|
import java.util.Optional;
|
|
import lukehagar.plexapi.plexapi.PlexAPI;
|
|
import lukehagar.plexapi.plexapi.models.operations.*;
|
|
import lukehagar.plexapi.plexapi.models.shared.*;
|
|
import lukehagar.plexapi.plexapi.models.shared.Security;
|
|
import lukehagar.plexapi.plexapi.utils.EventStream;
|
|
import org.openapitools.jackson.nullable.JsonNullable;
|
|
import static java.util.Map.entry;
|
|
|
|
public class Application {
|
|
|
|
public static void main(String[] args) throws Exception {
|
|
try {
|
|
PlexAPI sdk = PlexAPI.builder()
|
|
.accessToken("<YOUR_API_KEY_HERE>")
|
|
.xPlexClientIdentifier("Postman")
|
|
.build();
|
|
|
|
GetServerCapabilitiesResponse res = sdk.server().getServerCapabilities()
|
|
.call();
|
|
|
|
if (res.object().isPresent()) {
|
|
// handle response
|
|
}
|
|
} catch (lukehagar.plexapi.plexapi.models.errors.GetServerCapabilitiesResponseBody e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (lukehagar.plexapi.plexapi.models.errors.SDKError e) {
|
|
// handle exception
|
|
throw e;
|
|
} catch (Exception e) {
|
|
// handle exception
|
|
throw e;
|
|
}
|
|
|
|
}
|
|
}
|
|
```
|
|
<!-- End SDK Example Usage [usage] --> |