using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Plugins;
using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Search;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Users;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Model.ApiClient
{
///
/// Interface IApiClient
///
public interface IApiClient : IDisposable
{
///
/// Occurs when [server location changed].
///
event EventHandler ServerLocationChanged;
///
/// Occurs when [HTTP response received].
///
event EventHandler HttpResponseReceived;
///
/// Gets the API URL.
///
/// The handler.
/// System.String.
string GetApiUrl(string handler);
///
/// Gets the game system summaries async.
///
/// The cancellation token.
/// Task{List{GameSystemSummary}}.
Task> GetGameSystemSummariesAsync(CancellationToken cancellationToken);
///
/// Gets the async.
///
///
/// The URL.
/// The cancellation token.
/// Task{``0}.
Task GetAsync(string url, CancellationToken cancellationToken)
where T : class;
///
/// Gets the index of the game players.
///
/// The user id.
/// The cancellation token.
/// Task{List{ItemIndex}}.
Task> GetGamePlayerIndex(string userId, CancellationToken cancellationToken);
///
/// Gets the index of the year.
///
/// The user id.
/// The include item types.
/// The cancellation token.
/// Task{List{ItemIndex}}.
Task> GetYearIndex(string userId, string[] includeItemTypes, CancellationToken cancellationToken);
///
/// Gets the critic reviews.
///
/// The item id.
/// The cancellation token.
/// The start index.
/// The limit.
/// Task{ItemReviewsResult}.
Task> GetCriticReviews(string itemId, CancellationToken cancellationToken, int? startIndex = null, int? limit = null);
///
/// Gets the theme songs async.
///
/// The user id.
/// The item id.
/// if set to true [inherit from parents].
/// The cancellation token.
/// Task{ThemeMediaResult}.
Task GetThemeSongsAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken);
///
/// Gets the search hints async.
///
/// The user id.
/// The search term.
/// The start index.
/// The limit.
/// Task{SearchHintResult}.
Task GetSearchHintsAsync(string userId, string searchTerm, int? startIndex = null,
int? limit = null);
///
/// Gets the theme videos async.
///
/// The user id.
/// The item id.
/// if set to true [inherit from parents].
/// The cancellation token.
/// Task{ThemeMediaResult}.
Task GetThemeVideosAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken);
///
/// Gets all theme media async.
///
/// The user id.
/// The item id.
/// if set to true [inherit from parents].
/// The cancellation token.
/// Task{AllThemeMediaResult}.
Task GetAllThemeMediaAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken);
///
/// Marks the notifications read.
///
/// The user id.
/// The notification id list.
/// if set to true [is read].
/// Task.
Task MarkNotificationsRead(string userId, IEnumerable notificationIdList, bool isRead);
///
/// Updates the notification.
///
/// The notification.
/// Task.
Task UpdateNotification(Notification notification);
///
/// Adds the notification.
///
/// The notification.
/// Task{Notification}.
Task AddNotification(Notification notification);
///
/// Gets the notifications summary.
///
/// The user id.
/// Task{NotificationsSummary}.
Task GetNotificationsSummary(string userId);
///
/// Gets the notifications async.
///
/// The query.
/// Task{NotificationResult}.
Task GetNotificationsAsync(NotificationQuery query);
///
/// Gets an image stream based on a url
///
/// The URL.
/// The cancellation token.
/// Task{Stream}.
/// url
Task GetImageStreamAsync(string url, CancellationToken cancellationToken);
///
/// Gets a BaseItem
///
/// The id.
/// The user id.
/// Task{BaseItemDto}.
/// id
Task GetItemAsync(string id, string userId);
///
/// Gets the intros async.
///
/// The item id.
/// The user id.
/// Task{ItemsResult}.
Task GetIntrosAsync(string itemId, string userId);
///
/// Gets a BaseItem
///
/// The user id.
/// Task{BaseItemDto}.
/// userId
Task GetRootFolderAsync(string userId);
///
/// Gets the users async.
///
/// The query.
/// Task{UserDto[]}.
Task GetUsersAsync(UserQuery query);
///
/// Gets the public users async.
///
/// The cancellation token.
/// Task{UserDto[]}.
Task GetPublicUsersAsync(CancellationToken cancellationToken);
///
/// Gets active client sessions.
///
/// The query.
/// Task{SessionInfoDto[]}.
Task GetClientSessionsAsync(SessionQuery query);
///
/// Gets the item counts async.
///
/// The query.
/// Task{ItemCounts}.
Task GetItemCountsAsync(ItemCountsQuery query);
///
/// Gets the episodes asynchronous.
///
/// The query.
/// Task{ItemsResult}.
Task GetEpisodesAsync(EpisodeQuery query);
///
/// Queries for items
///
/// The query.
/// Task{ItemsResult}.
/// query
Task GetItemsAsync(ItemQuery query);
///
/// Gets the instant mix from song async.
///
/// The query.
/// Task{ItemsResult}.
Task GetInstantMixFromSongAsync(SimilarItemsQuery query);
///
/// Gets the instant mix from album async.
///
/// The query.
/// Task{ItemsResult}.
Task GetInstantMixFromAlbumAsync(SimilarItemsQuery query);
///
/// Gets the instant mix from artist async.
///
/// The query.
/// Task{ItemsResult}.
Task GetInstantMixFromArtistAsync(SimilarItemsByNameQuery query);
///
/// Gets the instant mix from music genre async.
///
/// The query.
/// Task{ItemsResult}.
Task GetInstantMixFromMusicGenreAsync(SimilarItemsByNameQuery query);
///
/// Gets the similar movies async.
///
/// The query.
/// Task{ItemsResult}.
Task GetSimilarMoviesAsync(SimilarItemsQuery query);
///
/// Gets the similar trailers async.
///
/// The query.
/// Task{ItemsResult}.
Task GetSimilarTrailersAsync(SimilarItemsQuery query);
///
/// Gets the similar series async.
///
/// The query.
/// Task{ItemsResult}.
Task GetSimilarSeriesAsync(SimilarItemsQuery query);
///
/// Gets the similar albums async.
///
/// The query.
/// Task{ItemsResult}.
Task GetSimilarAlbumsAsync(SimilarItemsQuery query);
///
/// Gets the similar games async.
///
/// The query.
/// Task{ItemsResult}.
Task GetSimilarGamesAsync(SimilarItemsQuery query);
///
/// Gets the people async.
///
/// The query.
/// Task{ItemsResult}.
/// userId
Task GetPeopleAsync(PersonsQuery query);
///
/// Gets the artists.
///
/// The query.
/// Task{ItemsResult}.
/// userId
Task GetArtistsAsync(ArtistsQuery query);
///
/// Gets a studio
///
/// The name.
/// The user id.
/// Task{BaseItemDto}.
/// userId
Task GetStudioAsync(string name, string userId);
///
/// Gets the next up async.
///
/// The query.
/// Task{ItemsResult}.
Task GetNextUpAsync(NextUpQuery query);
///
/// Gets a genre
///
/// The name.
/// The user id.
/// Task{BaseItemDto}.
/// userId
Task GetGenreAsync(string name, string userId);
///
/// Gets the genres async.
///
/// The query.
/// Task{ItemsResult}.
Task GetGenresAsync(ItemsByNameQuery query);
///
/// Gets the music genres async.
///
/// The query.
/// Task{ItemsResult}.
Task GetMusicGenresAsync(ItemsByNameQuery query);
///
/// Gets the game genres async.
///
/// The query.
/// Task{ItemsResult}.
Task GetGameGenresAsync(ItemsByNameQuery query);
///
/// Gets the studios async.
///
/// The query.
/// Task{ItemsResult}.
Task GetStudiosAsync(ItemsByNameQuery query);
///
/// Gets the music genre async.
///
/// The name.
/// The user id.
/// Task{BaseItemDto}.
Task GetMusicGenreAsync(string name, string userId);
///
/// Gets the game genre async.
///
/// The name.
/// The user id.
/// Task{BaseItemDto}.
Task GetGameGenreAsync(string name, string userId);
///
/// Gets the artist async.
///
/// The name.
/// The user id.
/// Task{BaseItemDto}.
/// name
Task GetArtistAsync(string name, string userId);
///
/// Restarts the server.
///
/// Task.
Task RestartServerAsync();
///
/// Gets the system status async.
///
/// Task{SystemInfo}.
Task GetSystemInfoAsync();
///
/// Gets a person
///
/// The name.
/// The user id.
/// Task{BaseItemDto}.
/// userId
Task GetPersonAsync(string name, string userId);
///
/// Gets a list of plugins installed on the server
///
/// Task{PluginInfo[]}.
Task GetInstalledPluginsAsync();
///
/// Gets the current server configuration
///
/// Task{ServerConfiguration}.
Task GetServerConfigurationAsync();
///
/// Gets the scheduled tasks.
///
/// Task{TaskInfo[]}.
Task GetScheduledTasksAsync();
///
/// Gets the scheduled task async.
///
/// The id.
/// Task{TaskInfo}.
/// id
Task GetScheduledTaskAsync(Guid id);
///
/// Gets a user by id
///
/// The id.
/// Task{UserDto}.
/// id
Task GetUserAsync(string id);
///
/// Gets the parental ratings async.
///
/// Task{List{ParentalRating}}.
Task> GetParentalRatingsAsync();
///
/// Gets local trailers for an item
///
/// The user id.
/// The item id.
/// Task{ItemsResult}.
/// query
Task GetLocalTrailersAsync(string userId, string itemId);
///
/// Gets special features for an item
///
/// The user id.
/// The item id.
/// Task{BaseItemDto[]}.
/// userId
Task GetSpecialFeaturesAsync(string userId, string itemId);
///
/// Gets the cultures async.
///
/// Task{CultureDto[]}.
Task GetCulturesAsync();
///
/// Gets the countries async.
///
/// Task{CountryInfo[]}.
Task GetCountriesAsync();
///
/// Marks the played async.
///
/// The item id.
/// The user id.
/// The date played.
/// Task{UserItemDataDto}.
Task MarkPlayedAsync(string itemId, string userId, DateTime? datePlayed);
///
/// Marks the unplayed async.
///
/// The item id.
/// The user id.
/// Task{UserItemDataDto}.
Task MarkUnplayedAsync(string itemId, string userId);
///
/// Updates the favorite status async.
///
/// The item id.
/// The user id.
/// if set to true [is favorite].
/// Task.
/// itemId
Task UpdateFavoriteStatusAsync(string itemId, string userId, bool isFavorite);
///
/// Reports to the server that the user has begun playing an item
///
/// The item id.
/// The user id.
/// if set to true [is seekable].
/// The list of media types that the client is capable of queuing onto the playlist. See MediaType class.
/// Task{UserItemDataDto}.
/// itemId
Task ReportPlaybackStartAsync(string itemId, string userId, bool isSeekable, List queueableMediaTypes);
///
/// Reports playback progress to the server
///
/// The item id.
/// The user id.
/// The position ticks.
/// if set to true [is paused].
/// if set to true [is muted].
/// Task{UserItemDataDto}.
/// itemId
Task ReportPlaybackProgressAsync(string itemId, string userId, long? positionTicks, bool isPaused, bool isMuted);
///
/// Reports to the server that the user has stopped playing an item
///
/// The item id.
/// The user id.
/// The position ticks.
/// Task{UserItemDataDto}.
/// itemId
Task ReportPlaybackStoppedAsync(string itemId, string userId, long? positionTicks);
///
/// Instructs antoher client to browse to a library item.
///
/// The session id.
/// The id of the item to browse to.
/// The name of the item to browse to.
/// The type of the item to browse to.
/// Optional ui context (movies, music, tv, games, etc). The client is free to ignore this.
/// Task.
Task SendBrowseCommandAsync(string sessionId, string itemId, string itemName, string itemType, string context);
///
/// Sends the playstate command async.
///
/// The session id.
/// The request.
/// Task.
Task SendPlaystateCommandAsync(string sessionId, PlaystateRequest request);
///
/// Sends the play command async.
///
/// The session id.
/// The request.
/// Task.
/// sessionId
/// or
/// request
Task SendPlayCommandAsync(string sessionId, PlayRequest request);
///
/// Sends a system command to the client
///
/// The session id.
/// The command.
/// Task.
Task SendSystemCommandAsync(string sessionId, SystemCommand command);
///
/// Instructs the client to display a message to the user
///
/// The session id.
/// The command.
/// Task.
Task SendMessageCommandAsync(string sessionId, MessageCommand command);
///
/// Clears a user's rating for an item
///
/// The item id.
/// The user id.
/// Task{UserItemDataDto}.
/// itemId
Task ClearUserItemRatingAsync(string itemId, string userId);
///
/// Updates a user's rating for an item, based on likes or dislikes
///
/// The item id.
/// The user id.
/// if set to true [likes].
/// Task.
/// itemId
Task UpdateUserItemRatingAsync(string itemId, string userId, bool likes);
///
/// Authenticates a user and returns the result
///
/// The username.
/// The sha1 hash.
/// Task.
/// userId
Task AuthenticateUserAsync(string username, byte[] sha1Hash);
///
/// Updates the server configuration async.
///
/// The configuration.
/// Task.
/// configuration
Task UpdateServerConfigurationAsync(ServerConfiguration configuration);
///
/// Updates the scheduled task triggers.
///
/// The id.
/// The triggers.
/// Task{RequestResult}.
/// id
Task UpdateScheduledTaskTriggersAsync(Guid id, TaskTriggerInfo[] triggers);
///
/// Gets the display preferences.
///
/// The id.
/// The user id.
/// The client.
/// The cancellation token.
/// Task{BaseItemDto}.
Task GetDisplayPreferencesAsync(string id, string userId, string client, CancellationToken cancellationToken);
///
/// Updates display preferences for a user
///
/// The display preferences.
/// The user id.
/// The client.
/// The cancellation token.
/// Task{DisplayPreferences}.
/// userId
Task UpdateDisplayPreferencesAsync(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken);
///
/// Posts a set of data to a url, and deserializes the return stream into T
///
///
/// The URL.
/// The args.
/// Task{``0}.
Task PostAsync(string url, Dictionary args)
where T : class;
///
/// This is a helper around getting a stream from the server that contains serialized data
///
/// The URL.
/// Task{Stream}.
Task GetSerializedStreamAsync(string url);
///
/// Gets the json serializer.
///
/// The json serializer.
IJsonSerializer JsonSerializer { get; set; }
///
/// Gets or sets the server host name (myserver or 192.168.x.x)
///
/// The name of the server host.
string ServerHostName { get; }
///
/// Gets or sets the port number used by the API
///
/// The server API port.
int ServerApiPort { get; }
///
/// Changes the server location.
///
/// Name of the host.
/// The API port.
void ChangeServerLocation(string hostName, int apiPort);
///
/// Gets or sets the type of the client.
///
/// The type of the client.
string ClientName { get; set; }
///
/// Gets or sets the name of the device.
///
/// The name of the device.
string DeviceName { get; set; }
///
/// Gets or sets the device id.
///
/// The device id.
string DeviceId { get; set; }
///
/// Gets or sets the current user id.
///
/// The current user id.
string CurrentUserId { get; set; }
///
/// Gets the image URL.
///
/// The item.
/// The options.
/// System.String.
/// item
string GetImageUrl(BaseItemDto item, ImageOptions options);
///
/// Gets an image url that can be used to download an image from the api
///
/// The Id of the item
/// The options.
/// System.String.
/// itemId
string GetImageUrl(string itemId, ImageOptions options);
///
/// Gets the user image URL.
///
/// The user.
/// The options.
/// System.String.
/// user
string GetUserImageUrl(UserDto user, ImageOptions options);
///
/// Gets an image url that can be used to download an image from the api
///
/// The Id of the user
/// The options.
/// System.String.
/// userId
string GetUserImageUrl(string userId, ImageOptions options);
///
/// Gets the person image URL.
///
/// The item.
/// The options.
/// System.String.
/// item
string GetPersonImageUrl(BaseItemPerson item, ImageOptions options);
///
/// Gets an image url that can be used to download an image from the api
///
/// The name of the person
/// The options.
/// System.String.
/// name
string GetPersonImageUrl(string name, ImageOptions options);
///
/// Gets the year image URL.
///
/// The item.
/// The options.
/// System.String.
/// item
string GetYearImageUrl(BaseItemDto item, ImageOptions options);
///
/// Gets an image url that can be used to download an image from the api
///
/// The year.
/// The options.
/// System.String.
string GetYearImageUrl(int year, ImageOptions options);
///
/// Gets an image url that can be used to download an image from the api
///
/// The name.
/// The options.
/// System.String.
/// name
string GetGenreImageUrl(string name, ImageOptions options);
///
/// Gets the music genre image URL.
///
/// The name.
/// The options.
/// System.String.
string GetMusicGenreImageUrl(string name, ImageOptions options);
///
/// Gets the game genre image URL.
///
/// The name.
/// The options.
/// System.String.
string GetGameGenreImageUrl(string name, ImageOptions options);
///
/// Gets an image url that can be used to download an image from the api
///
/// The name.
/// The options.
/// System.String.
/// name
string GetStudioImageUrl(string name, ImageOptions options);
///
/// Gets the artist image URL.
///
/// The name.
/// The options.
/// System.String.
/// name
string GetArtistImageUrl(string name, ImageOptions options);
///
/// This is a helper to get a list of backdrop url's from a given ApiBaseItemWrapper. If the actual item does not have any backdrops it will return backdrops from the first parent that does.
///
/// A given item.
/// The options.
/// System.String[][].
/// item
string[] GetBackdropImageUrls(BaseItemDto item, ImageOptions options);
///
/// This is a helper to get the logo image url from a given ApiBaseItemWrapper. If the actual item does not have a logo, it will return the logo from the first parent that does, or null.
///
/// A given item.
/// The options.
/// System.String.
/// item
string GetLogoImageUrl(BaseItemDto item, ImageOptions options);
///
/// Gets the art image URL.
///
/// The item.
/// The options.
/// System.String.
string GetArtImageUrl(BaseItemDto item, ImageOptions options);
///
/// Gets the thumb image URL.
///
/// The item.
/// The options.
/// System.String.
string GetThumbImageUrl(BaseItemDto item, ImageOptions options);
///
/// Gets the url needed to stream an audio file
///
/// The options.
/// System.String.
/// options
string GetAudioStreamUrl(StreamOptions options);
///
/// Gets the url needed to stream a video file
///
/// The options.
/// System.String.
/// options
string GetVideoStreamUrl(VideoStreamOptions options);
///
/// Formulates a url for streaming audio using the HLS protocol
///
/// The options.
/// System.String.
/// options
string GetHlsAudioStreamUrl(StreamOptions options);
///
/// Formulates a url for streaming video using the HLS protocol
///
/// The options.
/// System.String.
/// options
string GetHlsVideoStreamUrl(VideoStreamOptions options);
}
}