/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ package dev.plexapi.sdk; import static dev.plexapi.sdk.operations.Operations.AsyncRequestlessOperation; import static dev.plexapi.sdk.operations.Operations.AsyncRequestOperation; import dev.plexapi.sdk.models.operations.AddProviderRequest; import dev.plexapi.sdk.models.operations.DeleteMediaProviderRequest; import dev.plexapi.sdk.models.operations.async.AddProviderRequestBuilder; import dev.plexapi.sdk.models.operations.async.AddProviderResponse; import dev.plexapi.sdk.models.operations.async.DeleteMediaProviderRequestBuilder; import dev.plexapi.sdk.models.operations.async.DeleteMediaProviderResponse; import dev.plexapi.sdk.models.operations.async.ListProvidersRequestBuilder; import dev.plexapi.sdk.models.operations.async.ListProvidersResponse; import dev.plexapi.sdk.models.operations.async.RefreshProvidersRequestBuilder; import dev.plexapi.sdk.models.operations.async.RefreshProvidersResponse; import dev.plexapi.sdk.operations.AddProvider; import dev.plexapi.sdk.operations.DeleteMediaProvider; import dev.plexapi.sdk.operations.ListProviders; import dev.plexapi.sdk.operations.RefreshProviders; import java.util.concurrent.CompletableFuture; /** * Media providers are the starting points for the entire Plex Media Server media library API. It defines the paths for the groups of endpoints. The `/media/providers` should be the only hard-coded path in clients when accessing the media library. Non-media library endpoints are outside the scope of the media provider. See the description in See [the section in API Info](#section/API-Info/Media-Providers) for more information on how to use media providers. */ public class AsyncProvider { private final SDKConfiguration sdkConfiguration; private final Provider syncSDK; AsyncProvider(Provider syncSDK, SDKConfiguration sdkConfiguration) { this.sdkConfiguration = sdkConfiguration; this.syncSDK = syncSDK; } /** * Switches to the sync SDK. * * @return The sync SDK */ public Provider sync() { return syncSDK; } /** * Get the list of available media providers * *

Get the list of all available media providers for this PMS. This will generally include the library provider and possibly EPG if DVR is set up. * * @return The async call builder */ public ListProvidersRequestBuilder listProviders() { return new ListProvidersRequestBuilder(sdkConfiguration); } /** * Get the list of available media providers * *

Get the list of all available media providers for this PMS. This will generally include the library provider and possibly EPG if DVR is set up. * * @return CompletableFuture<ListProvidersResponse> - The async response */ public CompletableFuture listProvidersDirect() { AsyncRequestlessOperation operation = new ListProviders.Async(sdkConfiguration); return operation.doRequest() .thenCompose(operation::handleResponse); } /** * Add a media provider * *

This endpoint registers a media provider with the server. Once registered, the media server acts as a reverse proxy to the provider, allowing both local and remote providers to work. * * @return The async call builder */ public AddProviderRequestBuilder addProvider() { return new AddProviderRequestBuilder(sdkConfiguration); } /** * Add a media provider * *

This endpoint registers a media provider with the server. Once registered, the media server acts as a reverse proxy to the provider, allowing both local and remote providers to work. * * @param request The request object containing all the parameters for the API call. * @return CompletableFuture<AddProviderResponse> - The async response */ public CompletableFuture addProvider(AddProviderRequest request) { AsyncRequestOperation operation = new AddProvider.Async(sdkConfiguration); return operation.doRequest(request) .thenCompose(operation::handleResponse); } /** * Refresh media providers * *

Refresh all known media providers. This is useful in case a provider has updated features. * * @return The async call builder */ public RefreshProvidersRequestBuilder refreshProviders() { return new RefreshProvidersRequestBuilder(sdkConfiguration); } /** * Refresh media providers * *

Refresh all known media providers. This is useful in case a provider has updated features. * * @return CompletableFuture<RefreshProvidersResponse> - The async response */ public CompletableFuture refreshProvidersDirect() { AsyncRequestlessOperation operation = new RefreshProviders.Async(sdkConfiguration); return operation.doRequest() .thenCompose(operation::handleResponse); } /** * Delete a media provider * *

Deletes a media provider with the given id * * @return The async call builder */ public DeleteMediaProviderRequestBuilder deleteMediaProvider() { return new DeleteMediaProviderRequestBuilder(sdkConfiguration); } /** * Delete a media provider * *

Deletes a media provider with the given id * * @param request The request object containing all the parameters for the API call. * @return CompletableFuture<DeleteMediaProviderResponse> - The async response */ public CompletableFuture deleteMediaProvider(DeleteMediaProviderRequest request) { AsyncRequestOperation operation = new DeleteMediaProvider.Async(sdkConfiguration); return operation.doRequest(request) .thenCompose(operation::handleResponse); } }