/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ package dev.plexapi.sdk; import static dev.plexapi.sdk.operations.Operations.RequestOperation; import static dev.plexapi.sdk.operations.Operations.RequestlessOperation; import dev.plexapi.sdk.models.operations.DeleteLibraryRequest; import dev.plexapi.sdk.models.operations.DeleteLibraryRequestBuilder; import dev.plexapi.sdk.models.operations.DeleteLibraryResponse; import dev.plexapi.sdk.models.operations.Force; import dev.plexapi.sdk.models.operations.GetActorsLibraryQueryParamType; import dev.plexapi.sdk.models.operations.GetActorsLibraryRequest; import dev.plexapi.sdk.models.operations.GetActorsLibraryRequestBuilder; import dev.plexapi.sdk.models.operations.GetActorsLibraryResponse; import dev.plexapi.sdk.models.operations.GetAllLibrariesRequestBuilder; import dev.plexapi.sdk.models.operations.GetAllLibrariesResponse; import dev.plexapi.sdk.models.operations.GetCountriesLibraryQueryParamType; import dev.plexapi.sdk.models.operations.GetCountriesLibraryRequest; import dev.plexapi.sdk.models.operations.GetCountriesLibraryRequestBuilder; import dev.plexapi.sdk.models.operations.GetCountriesLibraryResponse; import dev.plexapi.sdk.models.operations.GetFileHashRequest; import dev.plexapi.sdk.models.operations.GetFileHashRequestBuilder; import dev.plexapi.sdk.models.operations.GetFileHashResponse; import dev.plexapi.sdk.models.operations.GetGenresLibraryQueryParamType; import dev.plexapi.sdk.models.operations.GetGenresLibraryRequest; import dev.plexapi.sdk.models.operations.GetGenresLibraryRequestBuilder; import dev.plexapi.sdk.models.operations.GetGenresLibraryResponse; import dev.plexapi.sdk.models.operations.GetLibraryDetailsRequest; import dev.plexapi.sdk.models.operations.GetLibraryDetailsRequestBuilder; import dev.plexapi.sdk.models.operations.GetLibraryDetailsResponse; import dev.plexapi.sdk.models.operations.GetLibraryItemsRequest; import dev.plexapi.sdk.models.operations.GetLibraryItemsRequestBuilder; import dev.plexapi.sdk.models.operations.GetLibraryItemsResponse; import dev.plexapi.sdk.models.operations.GetLibrarySectionsAllRequest; import dev.plexapi.sdk.models.operations.GetLibrarySectionsAllRequestBuilder; import dev.plexapi.sdk.models.operations.GetLibrarySectionsAllResponse; import dev.plexapi.sdk.models.operations.GetMediaArtsRequest; import dev.plexapi.sdk.models.operations.GetMediaArtsRequestBuilder; import dev.plexapi.sdk.models.operations.GetMediaArtsResponse; import dev.plexapi.sdk.models.operations.GetMediaMetaDataRequest; import dev.plexapi.sdk.models.operations.GetMediaMetaDataRequestBuilder; import dev.plexapi.sdk.models.operations.GetMediaMetaDataResponse; import dev.plexapi.sdk.models.operations.GetMediaPostersRequest; import dev.plexapi.sdk.models.operations.GetMediaPostersRequestBuilder; import dev.plexapi.sdk.models.operations.GetMediaPostersResponse; import dev.plexapi.sdk.models.operations.GetMetadataChildrenRequest; import dev.plexapi.sdk.models.operations.GetMetadataChildrenRequestBuilder; import dev.plexapi.sdk.models.operations.GetMetadataChildrenResponse; import dev.plexapi.sdk.models.operations.GetRecentlyAddedLibraryRequest; import dev.plexapi.sdk.models.operations.GetRecentlyAddedLibraryRequestBuilder; import dev.plexapi.sdk.models.operations.GetRecentlyAddedLibraryResponse; import dev.plexapi.sdk.models.operations.GetRefreshLibraryMetadataRequest; import dev.plexapi.sdk.models.operations.GetRefreshLibraryMetadataRequestBuilder; import dev.plexapi.sdk.models.operations.GetRefreshLibraryMetadataResponse; import dev.plexapi.sdk.models.operations.GetSearchAllLibrariesRequest; import dev.plexapi.sdk.models.operations.GetSearchAllLibrariesRequestBuilder; import dev.plexapi.sdk.models.operations.GetSearchAllLibrariesResponse; import dev.plexapi.sdk.models.operations.GetSearchLibraryQueryParamType; import dev.plexapi.sdk.models.operations.GetSearchLibraryRequest; import dev.plexapi.sdk.models.operations.GetSearchLibraryRequestBuilder; import dev.plexapi.sdk.models.operations.GetSearchLibraryResponse; import dev.plexapi.sdk.models.operations.GetTopWatchedContentQueryParamIncludeGuids; import dev.plexapi.sdk.models.operations.GetTopWatchedContentQueryParamType; import dev.plexapi.sdk.models.operations.GetTopWatchedContentRequest; import dev.plexapi.sdk.models.operations.GetTopWatchedContentRequestBuilder; import dev.plexapi.sdk.models.operations.GetTopWatchedContentResponse; import dev.plexapi.sdk.models.operations.IncludeDetails; import dev.plexapi.sdk.models.operations.PostMediaArtsRequest; import dev.plexapi.sdk.models.operations.PostMediaArtsRequestBuilder; import dev.plexapi.sdk.models.operations.PostMediaArtsResponse; import dev.plexapi.sdk.models.operations.PostMediaPosterRequest; import dev.plexapi.sdk.models.operations.PostMediaPosterRequestBuilder; import dev.plexapi.sdk.models.operations.PostMediaPosterResponse; import dev.plexapi.sdk.operations.DeleteLibrary; import dev.plexapi.sdk.operations.GetActorsLibrary; import dev.plexapi.sdk.operations.GetAllLibraries; import dev.plexapi.sdk.operations.GetCountriesLibrary; import dev.plexapi.sdk.operations.GetFileHash; import dev.plexapi.sdk.operations.GetGenresLibrary; import dev.plexapi.sdk.operations.GetLibraryDetails; import dev.plexapi.sdk.operations.GetLibraryItems; import dev.plexapi.sdk.operations.GetLibrarySectionsAll; import dev.plexapi.sdk.operations.GetMediaArts; import dev.plexapi.sdk.operations.GetMediaMetaData; import dev.plexapi.sdk.operations.GetMediaPosters; import dev.plexapi.sdk.operations.GetMetadataChildren; import dev.plexapi.sdk.operations.GetRecentlyAddedLibrary; import dev.plexapi.sdk.operations.GetRefreshLibraryMetadata; import dev.plexapi.sdk.operations.GetSearchAllLibraries; import dev.plexapi.sdk.operations.GetSearchLibrary; import dev.plexapi.sdk.operations.GetTopWatchedContent; import dev.plexapi.sdk.operations.PostMediaArts; import dev.plexapi.sdk.operations.PostMediaPoster; import java.lang.Double; import java.lang.Exception; import java.lang.String; import java.util.Optional; /** * API Calls interacting with Plex Media Server Libraries */ public class Library { private final SDKConfiguration sdkConfiguration; private final AsyncLibrary asyncSDK; Library(SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; this.asyncSDK = new AsyncLibrary(this, sdkConfiguration); } /** * Switches to the async SDK. * * @return The async SDK */ public AsyncLibrary async() { return asyncSDK; } /** * Get Hash Value * *

This resource returns hash values for local files * * @return The call builder */ public GetFileHashRequestBuilder getFileHash() { return new GetFileHashRequestBuilder(sdkConfiguration); } /** * Get Hash Value * *

This resource returns hash values for local files * * @param url This is the path to the local file, must be prefixed by `file://` * @return The response from the API call * @throws Exception if the API call fails */ public GetFileHashResponse getFileHash(String url) throws Exception { return getFileHash(url, Optional.empty()); } /** * Get Hash Value * *

This resource returns hash values for local files * * @param url This is the path to the local file, must be prefixed by `file://` * @param type Item type * @return The response from the API call * @throws Exception if the API call fails */ public GetFileHashResponse getFileHash(String url, Optional type) throws Exception { GetFileHashRequest request = GetFileHashRequest .builder() .url(url) .type(type) .build(); RequestOperation operation = new GetFileHash.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Recently Added * *

This endpoint will return the recently added content. * * @return The call builder */ public GetRecentlyAddedLibraryRequestBuilder getRecentlyAddedLibrary() { return new GetRecentlyAddedLibraryRequestBuilder(sdkConfiguration); } /** * Get Recently Added * *

This endpoint will return the recently added content. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call * @throws Exception if the API call fails */ public GetRecentlyAddedLibraryResponse getRecentlyAddedLibrary(GetRecentlyAddedLibraryRequest request) throws Exception { RequestOperation operation = new GetRecentlyAddedLibrary.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get All Libraries * *

A library section (commonly referred to as just a library) is a collection of media. * Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. * For example, a music library has an artist > albums > tracks structure, whereas a movie library is flat. * *

Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. * This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year). * * @return The call builder */ public GetAllLibrariesRequestBuilder getAllLibraries() { return new GetAllLibrariesRequestBuilder(sdkConfiguration); } /** * Get All Libraries * *

A library section (commonly referred to as just a library) is a collection of media. * Libraries are typed, and depending on their type provide either a flat or a hierarchical view of the media. * For example, a music library has an artist > albums > tracks structure, whereas a movie library is flat. * *

Libraries have features beyond just being a collection of media; for starters, they include information about supported types, filters and sorts. * This allows a client to provide a rich interface around the media (e.g. allow sorting movies by release year). * * @return The response from the API call * @throws Exception if the API call fails */ public GetAllLibrariesResponse getAllLibrariesDirect() throws Exception { RequestlessOperation operation = new GetAllLibraries.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest()); } /** * Get Library Details * *

## Library Details Endpoint * *

This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself. * *

The details include: * *

### Directories * Organized into three categories: * *

- **Primary Directories**: * - Used in some clients for quick access to media subsets (e.g., "All", "On Deck"). * - Most can be replicated via media queries. * - Customizable by users. * *

- **Secondary Directories**: * - Marked with `secondary="1"`. * - Used in older clients for structured navigation. * *

- **Special Directories**: * - Includes a "By Folder" entry for filesystem-based browsing. * - Contains an obsolete `search="1"` entry for on-the-fly search dialog creation. * *

### Types * Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls: * *

- **Type Object Attributes**: * - `key`: Endpoint for the media list of this type. * - `type`: Metadata type (if standard Plex type). * - `title`: Title for this content type (e.g., "Movies"). * *

- **Filter Objects**: * - Subset of the media query language. * - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`. * *

- **Sort Objects**: * - Description of sort fields. * - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. * *

> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. * * @return The call builder */ public GetLibraryDetailsRequestBuilder getLibraryDetails() { return new GetLibraryDetailsRequestBuilder(sdkConfiguration); } /** * Get Library Details * *

## Library Details Endpoint * *

This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself. * *

The details include: * *

### Directories * Organized into three categories: * *

- **Primary Directories**: * - Used in some clients for quick access to media subsets (e.g., "All", "On Deck"). * - Most can be replicated via media queries. * - Customizable by users. * *

- **Secondary Directories**: * - Marked with `secondary="1"`. * - Used in older clients for structured navigation. * *

- **Special Directories**: * - Includes a "By Folder" entry for filesystem-based browsing. * - Contains an obsolete `search="1"` entry for on-the-fly search dialog creation. * *

### Types * Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls: * *

- **Type Object Attributes**: * - `key`: Endpoint for the media list of this type. * - `type`: Metadata type (if standard Plex type). * - `title`: Title for this content type (e.g., "Movies"). * *

- **Filter Objects**: * - Subset of the media query language. * - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`. * *

- **Sort Objects**: * - Description of sort fields. * - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. * *

> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. * * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @return The response from the API call * @throws Exception if the API call fails */ public GetLibraryDetailsResponse getLibraryDetails(int sectionKey) throws Exception { return getLibraryDetails(Optional.empty(), sectionKey); } /** * Get Library Details * *

## Library Details Endpoint * *

This endpoint provides comprehensive details about the library, focusing on organizational aspects rather than the content itself. * *

The details include: * *

### Directories * Organized into three categories: * *

- **Primary Directories**: * - Used in some clients for quick access to media subsets (e.g., "All", "On Deck"). * - Most can be replicated via media queries. * - Customizable by users. * *

- **Secondary Directories**: * - Marked with `secondary="1"`. * - Used in older clients for structured navigation. * *

- **Special Directories**: * - Includes a "By Folder" entry for filesystem-based browsing. * - Contains an obsolete `search="1"` entry for on-the-fly search dialog creation. * *

### Types * Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls: * *

- **Type Object Attributes**: * - `key`: Endpoint for the media list of this type. * - `type`: Metadata type (if standard Plex type). * - `title`: Title for this content type (e.g., "Movies"). * *

- **Filter Objects**: * - Subset of the media query language. * - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`. * *

- **Sort Objects**: * - Description of sort fields. * - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. * *

> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. * * @param includeDetails Whether or not to include details for a section (types, filters, and sorts). * Only exists for backwards compatibility, media providers other than the server libraries have it on always. * * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @return The response from the API call * @throws Exception if the API call fails */ public GetLibraryDetailsResponse getLibraryDetails(Optional includeDetails, int sectionKey) throws Exception { GetLibraryDetailsRequest request = GetLibraryDetailsRequest .builder() .includeDetails(includeDetails) .sectionKey(sectionKey) .build(); RequestOperation operation = new GetLibraryDetails.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Delete Library Section * *

Delete a library using a specific section id * * @return The call builder */ public DeleteLibraryRequestBuilder deleteLibrary() { return new DeleteLibraryRequestBuilder(sdkConfiguration); } /** * Delete Library Section * *

Delete a library using a specific section id * * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @return The response from the API call * @throws Exception if the API call fails */ public DeleteLibraryResponse deleteLibrary(int sectionKey) throws Exception { DeleteLibraryRequest request = DeleteLibraryRequest .builder() .sectionKey(sectionKey) .build(); RequestOperation operation = new DeleteLibrary.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Library Items * *

Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values: * - `all`: All items in the section. * - `unwatched`: Items that have not been played. * - `newest`: Items that are recently released. * - `recentlyAdded`: Items that are recently added to the library. * - `recentlyViewed`: Items that were recently viewed. * - `onDeck`: Items to continue watching. * - `collection`: Items categorized by collection. * - `edition`: Items categorized by edition. * - `genre`: Items categorized by genre. * - `year`: Items categorized by year of release. * - `decade`: Items categorized by decade. * - `director`: Items categorized by director. * - `actor`: Items categorized by starring actor. * - `country`: Items categorized by country of origin. * - `contentRating`: Items categorized by content rating. * - `rating`: Items categorized by rating. * - `resolution`: Items categorized by resolution. * - `firstCharacter`: Items categorized by the first letter. * - `folder`: Items categorized by folder. * - `albums`: Items categorized by album. * * @return The call builder */ public GetLibraryItemsRequestBuilder getLibraryItems() { return new GetLibraryItemsRequestBuilder(sdkConfiguration); } /** * Get Library Items * *

Fetches details from a specific section of the library identified by a section key and a tag. The tag parameter accepts the following values: * - `all`: All items in the section. * - `unwatched`: Items that have not been played. * - `newest`: Items that are recently released. * - `recentlyAdded`: Items that are recently added to the library. * - `recentlyViewed`: Items that were recently viewed. * - `onDeck`: Items to continue watching. * - `collection`: Items categorized by collection. * - `edition`: Items categorized by edition. * - `genre`: Items categorized by genre. * - `year`: Items categorized by year of release. * - `decade`: Items categorized by decade. * - `director`: Items categorized by director. * - `actor`: Items categorized by starring actor. * - `country`: Items categorized by country of origin. * - `contentRating`: Items categorized by content rating. * - `rating`: Items categorized by rating. * - `resolution`: Items categorized by resolution. * - `firstCharacter`: Items categorized by the first letter. * - `folder`: Items categorized by folder. * - `albums`: Items categorized by album. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call * @throws Exception if the API call fails */ public GetLibraryItemsResponse getLibraryItems(GetLibraryItemsRequest request) throws Exception { RequestOperation operation = new GetLibraryItems.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Library section media by tag ALL * *

Retrieves a list of all general media data for this library. * * @return The call builder */ public GetLibrarySectionsAllRequestBuilder getLibrarySectionsAll() { return new GetLibrarySectionsAllRequestBuilder(sdkConfiguration); } /** * Get Library section media by tag ALL * *

Retrieves a list of all general media data for this library. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call * @throws Exception if the API call fails */ public GetLibrarySectionsAllResponse getLibrarySectionsAll(GetLibrarySectionsAllRequest request) throws Exception { RequestOperation operation = new GetLibrarySectionsAll.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Refresh Metadata Of The Library * *

This endpoint Refreshes all the Metadata of the library. * * @return The call builder */ public GetRefreshLibraryMetadataRequestBuilder getRefreshLibraryMetadata() { return new GetRefreshLibraryMetadataRequestBuilder(sdkConfiguration); } /** * Refresh Metadata Of The Library * *

This endpoint Refreshes all the Metadata of the library. * * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @return The response from the API call * @throws Exception if the API call fails */ public GetRefreshLibraryMetadataResponse getRefreshLibraryMetadata(int sectionKey) throws Exception { return getRefreshLibraryMetadata(Optional.empty(), sectionKey); } /** * Refresh Metadata Of The Library * *

This endpoint Refreshes all the Metadata of the library. * * @param force Force the refresh even if the library is already being refreshed. * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @return The response from the API call * @throws Exception if the API call fails */ public GetRefreshLibraryMetadataResponse getRefreshLibraryMetadata(Optional force, int sectionKey) throws Exception { GetRefreshLibraryMetadataRequest request = GetRefreshLibraryMetadataRequest .builder() .force(force) .sectionKey(sectionKey) .build(); RequestOperation operation = new GetRefreshLibraryMetadata.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Search Library * *

Search for content within a specific section of the library. * *

### Types * Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls: * *

- **Type Object Attributes**: * - `type`: Metadata type (if standard Plex type). * - `title`: Title for this content type (e.g., "Movies"). * *

- **Filter Objects**: * - Subset of the media query language. * - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`. * *

- **Sort Objects**: * - Description of sort fields. * - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. * *

> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. * * @return The call builder */ public GetSearchLibraryRequestBuilder getSearchLibrary() { return new GetSearchLibraryRequestBuilder(sdkConfiguration); } /** * Search Library * *

Search for content within a specific section of the library. * *

### Types * Each type in the library comes with a set of filters and sorts, aiding in building dynamic media controls: * *

- **Type Object Attributes**: * - `type`: Metadata type (if standard Plex type). * - `title`: Title for this content type (e.g., "Movies"). * *

- **Filter Objects**: * - Subset of the media query language. * - Attributes include `filter` (name), `filterType` (data type), `key` (endpoint for value range), and `title`. * *

- **Sort Objects**: * - Description of sort fields. * - Attributes include `defaultDirection` (asc/desc), `descKey` and `key` (sort parameters), and `title`. * *

> **Note**: Filters and sorts are optional; without them, no filtering controls are rendered. * * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @param type The type of media to retrieve or filter by. * 1 = movie * 2 = show * 3 = season * 4 = episode * E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries * * @return The response from the API call * @throws Exception if the API call fails */ public GetSearchLibraryResponse getSearchLibrary(int sectionKey, GetSearchLibraryQueryParamType type) throws Exception { GetSearchLibraryRequest request = GetSearchLibraryRequest .builder() .sectionKey(sectionKey) .type(type) .build(); RequestOperation operation = new GetSearchLibrary.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Genres of library media * *

Retrieves a list of all the genres that are found for the media in this library. * * @return The call builder */ public GetGenresLibraryRequestBuilder getGenresLibrary() { return new GetGenresLibraryRequestBuilder(sdkConfiguration); } /** * Get Genres of library media * *

Retrieves a list of all the genres that are found for the media in this library. * * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @param type The type of media to retrieve or filter by. * 1 = movie * 2 = show * 3 = season * 4 = episode * E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries * * @return The response from the API call * @throws Exception if the API call fails */ public GetGenresLibraryResponse getGenresLibrary(int sectionKey, GetGenresLibraryQueryParamType type) throws Exception { GetGenresLibraryRequest request = GetGenresLibraryRequest .builder() .sectionKey(sectionKey) .type(type) .build(); RequestOperation operation = new GetGenresLibrary.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Countries of library media * *

Retrieves a list of all the countries that are found for the media in this library. * * @return The call builder */ public GetCountriesLibraryRequestBuilder getCountriesLibrary() { return new GetCountriesLibraryRequestBuilder(sdkConfiguration); } /** * Get Countries of library media * *

Retrieves a list of all the countries that are found for the media in this library. * * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @param type The type of media to retrieve or filter by. * 1 = movie * 2 = show * 3 = season * 4 = episode * E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries * * @return The response from the API call * @throws Exception if the API call fails */ public GetCountriesLibraryResponse getCountriesLibrary(int sectionKey, GetCountriesLibraryQueryParamType type) throws Exception { GetCountriesLibraryRequest request = GetCountriesLibraryRequest .builder() .sectionKey(sectionKey) .type(type) .build(); RequestOperation operation = new GetCountriesLibrary.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Actors of library media * *

Retrieves a list of all the actors that are found for the media in this library. * * @return The call builder */ public GetActorsLibraryRequestBuilder getActorsLibrary() { return new GetActorsLibraryRequestBuilder(sdkConfiguration); } /** * Get Actors of library media * *

Retrieves a list of all the actors that are found for the media in this library. * * @param sectionKey The unique key of the Plex library. * Note: This is unique in the context of the Plex server. * * @param type The type of media to retrieve or filter by. * 1 = movie * 2 = show * 3 = season * 4 = episode * E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries * * @return The response from the API call * @throws Exception if the API call fails */ public GetActorsLibraryResponse getActorsLibrary(int sectionKey, GetActorsLibraryQueryParamType type) throws Exception { GetActorsLibraryRequest request = GetActorsLibraryRequest .builder() .sectionKey(sectionKey) .type(type) .build(); RequestOperation operation = new GetActorsLibrary.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Search All Libraries * *

Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type. * * @return The call builder */ public GetSearchAllLibrariesRequestBuilder getSearchAllLibraries() { return new GetSearchAllLibrariesRequestBuilder(sdkConfiguration); } /** * Search All Libraries * *

Search the provided query across all library sections, or a single section, and return matches as hubs, split up by type. * * @param request The request object containing all the parameters for the API call. * @return The response from the API call * @throws Exception if the API call fails */ public GetSearchAllLibrariesResponse getSearchAllLibraries(GetSearchAllLibrariesRequest request) throws Exception { RequestOperation operation = new GetSearchAllLibraries.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Media Metadata * *

This endpoint will return all the (meta)data of one or more library items specified by the ratingKey. * Multiple rating keys can be provided as a comma-separated list (e.g., "21119,21617"). * * @return The call builder */ public GetMediaMetaDataRequestBuilder getMediaMetaData() { return new GetMediaMetaDataRequestBuilder(sdkConfiguration); } /** * Get Media Metadata * *

This endpoint will return all the (meta)data of one or more library items specified by the ratingKey. * Multiple rating keys can be provided as a comma-separated list (e.g., "21119,21617"). * * @param request The request object containing all the parameters for the API call. * @return The response from the API call * @throws Exception if the API call fails */ public GetMediaMetaDataResponse getMediaMetaData(GetMediaMetaDataRequest request) throws Exception { RequestOperation operation = new GetMediaMetaData.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Media Background Artwork * *

Returns the background artwork for a library item. * * @return The call builder */ public GetMediaArtsRequestBuilder getMediaArts() { return new GetMediaArtsRequestBuilder(sdkConfiguration); } /** * Get Media Background Artwork * *

Returns the background artwork for a library item. * * @param ratingKey the id of the library item to return the artwork of. * @return The response from the API call * @throws Exception if the API call fails */ public GetMediaArtsResponse getMediaArts(long ratingKey) throws Exception { GetMediaArtsRequest request = GetMediaArtsRequest .builder() .ratingKey(ratingKey) .build(); RequestOperation operation = new GetMediaArts.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Upload Media Background Artwork * *

Uploads an image to use as the background artwork for a library item, either from a local file or a remote URL * * @return The call builder */ public PostMediaArtsRequestBuilder postMediaArts() { return new PostMediaArtsRequestBuilder(sdkConfiguration); } /** * Upload Media Background Artwork * *

Uploads an image to use as the background artwork for a library item, either from a local file or a remote URL * * @param ratingKey the id of the library item to return the posters of. * @return The response from the API call * @throws Exception if the API call fails */ public PostMediaArtsResponse postMediaArts(long ratingKey) throws Exception { return postMediaArts(ratingKey, Optional.empty(), Optional.empty()); } /** * Upload Media Background Artwork * *

Uploads an image to use as the background artwork for a library item, either from a local file or a remote URL * * @param ratingKey the id of the library item to return the posters of. * @param url The URL of the image, if uploading a remote image * @param requestBody The contents of the image, if uploading a local file * @return The response from the API call * @throws Exception if the API call fails */ public PostMediaArtsResponse postMediaArts( long ratingKey, Optional url, Optional requestBody) throws Exception { PostMediaArtsRequest request = PostMediaArtsRequest .builder() .ratingKey(ratingKey) .url(url) .requestBody(requestBody) .build(); RequestOperation operation = new PostMediaArts.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Media Posters * *

Returns the available posters for a library item. * * @return The call builder */ public GetMediaPostersRequestBuilder getMediaPosters() { return new GetMediaPostersRequestBuilder(sdkConfiguration); } /** * Get Media Posters * *

Returns the available posters for a library item. * * @param ratingKey the id of the library item to return the posters of. * @return The response from the API call * @throws Exception if the API call fails */ public GetMediaPostersResponse getMediaPosters(long ratingKey) throws Exception { GetMediaPostersRequest request = GetMediaPostersRequest .builder() .ratingKey(ratingKey) .build(); RequestOperation operation = new GetMediaPosters.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Upload Media Poster * *

Uploads a poster to a library item, either from a local file or a remote URL * * @return The call builder */ public PostMediaPosterRequestBuilder postMediaPoster() { return new PostMediaPosterRequestBuilder(sdkConfiguration); } /** * Upload Media Poster * *

Uploads a poster to a library item, either from a local file or a remote URL * * @param ratingKey the id of the library item to return the posters of. * @return The response from the API call * @throws Exception if the API call fails */ public PostMediaPosterResponse postMediaPoster(long ratingKey) throws Exception { return postMediaPoster(ratingKey, Optional.empty(), Optional.empty()); } /** * Upload Media Poster * *

Uploads a poster to a library item, either from a local file or a remote URL * * @param ratingKey the id of the library item to return the posters of. * @param url The URL of the image, if uploading a remote image * @param requestBody The contents of the image, if uploading a local file * @return The response from the API call * @throws Exception if the API call fails */ public PostMediaPosterResponse postMediaPoster( long ratingKey, Optional url, Optional requestBody) throws Exception { PostMediaPosterRequest request = PostMediaPosterRequest .builder() .ratingKey(ratingKey) .url(url) .requestBody(requestBody) .build(); RequestOperation operation = new PostMediaPoster.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Items Children * *

This endpoint will return the children of of a library item specified with the ratingKey. * * @return The call builder */ public GetMetadataChildrenRequestBuilder getMetadataChildren() { return new GetMetadataChildrenRequestBuilder(sdkConfiguration); } /** * Get Items Children * *

This endpoint will return the children of of a library item specified with the ratingKey. * * @param ratingKey the id of the library item to return the children of. * @return The response from the API call * @throws Exception if the API call fails */ public GetMetadataChildrenResponse getMetadataChildren(double ratingKey) throws Exception { return getMetadataChildren(ratingKey, Optional.empty()); } /** * Get Items Children * *

This endpoint will return the children of of a library item specified with the ratingKey. * * @param ratingKey the id of the library item to return the children of. * @param includeElements Adds additional elements to the response. Supported types are (Stream) * * @return The response from the API call * @throws Exception if the API call fails */ public GetMetadataChildrenResponse getMetadataChildren(double ratingKey, Optional includeElements) throws Exception { GetMetadataChildrenRequest request = GetMetadataChildrenRequest .builder() .ratingKey(ratingKey) .includeElements(includeElements) .build(); RequestOperation operation = new GetMetadataChildren.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } /** * Get Top Watched Content * *

This endpoint will return the top watched content from libraries of a certain type * * @return The call builder */ public GetTopWatchedContentRequestBuilder getTopWatchedContent() { return new GetTopWatchedContentRequestBuilder(sdkConfiguration); } /** * Get Top Watched Content * *

This endpoint will return the top watched content from libraries of a certain type * * @param type The type of media to retrieve or filter by. * 1 = movie * 2 = show * 3 = season * 4 = episode * E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries * * @return The response from the API call * @throws Exception if the API call fails */ public GetTopWatchedContentResponse getTopWatchedContent(GetTopWatchedContentQueryParamType type) throws Exception { return getTopWatchedContent(type, Optional.empty()); } /** * Get Top Watched Content * *

This endpoint will return the top watched content from libraries of a certain type * * @param type The type of media to retrieve or filter by. * 1 = movie * 2 = show * 3 = season * 4 = episode * E.g. A movie library will not return anything with type 3 as there are no seasons for movie libraries * * @param includeGuids Adds the Guid object to the response * * @return The response from the API call * @throws Exception if the API call fails */ public GetTopWatchedContentResponse getTopWatchedContent(GetTopWatchedContentQueryParamType type, Optional includeGuids) throws Exception { GetTopWatchedContentRequest request = GetTopWatchedContentRequest .builder() .type(type) .includeGuids(includeGuids) .build(); RequestOperation operation = new GetTopWatchedContent.Sync(sdkConfiguration); return operation.handleResponse(operation.doRequest(request)); } }