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.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.Tasks; namespace MediaBrowser.Model.ApiClient { public interface IApiClient : IDisposable { /// /// Occurs when [HTTP response received]. /// event EventHandler HttpResponseReceived; /// /// Gets the critic reviews. /// /// The item id. /// The start index. /// The limit. /// Task{ItemReviewsResult}. Task GetCriticReviews(string itemId, int? startIndex = null, int? limit = null); /// /// Gets the theme songs async. /// /// The user id. /// The item id. /// if set to true [inherit from parents]. /// Task{ThemeMediaResult}. Task GetThemeSongsAsync(string userId, string itemId, bool inheritFromParents); /// /// Gets the theme videos async. /// /// The user id. /// The item id. /// if set to true [inherit from parents]. /// Task{ThemeMediaResult}. Task GetThemeVideosAsync(string userId, string itemId, bool inheritFromParents); /// /// Gets all theme media async. /// /// The user id. /// The item id. /// if set to true [inherit from parents]. /// Task{AllThemeMediaResult}. Task GetAllThemeMediaAsync(string userId, string itemId, bool inheritFromParents); /// /// 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. /// Task{Stream}. /// url Task GetImageStreamAsync(string url); /// /// 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{System.String[]}. /// id Task GetIntrosAsync(string itemId, string userId); /// /// Gets a BaseItem /// /// The user id. /// Task{BaseItemDto}. /// userId Task GetRootFolderAsync(string userId); /// /// Gets the users async. /// /// Task{UserDto[]}. Task GetUsersAsync(UserQuery query); /// /// Gets the public users async. /// /// Task{UserDto[]}. Task GetPublicUsersAsync(); /// /// Gets active client sessions. /// /// Task{SessionInfoDto[]}. Task GetClientSessionsAsync(); /// /// Gets the item counts async. /// /// The user id. /// Task{ItemCounts}. Task GetItemCountsAsync(string userId); /// /// Queries for items /// /// The query. /// Task{ItemsResult}. /// query Task GetItemsAsync(ItemQuery 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 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 an item as played or unplayed. /// This should not be used to update playstate following playback. /// There are separate playstate check-in methods for that. This should be used for a /// separate option to reset playstate. /// /// The item id. /// The user id. /// if set to true [was played]. /// Task. /// itemId Task UpdatePlayedStatusAsync(string itemId, string userId, bool wasPlayed); /// /// 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. /// Task{UserItemDataDto}. /// itemId Task ReportPlaybackStartAsync(string itemId, string userId); /// /// Reports playback progress to the server /// /// The item id. /// The user id. /// The position ticks. /// if set to true [is paused]. /// Task{UserItemDataDto}. /// itemId Task ReportPlaybackProgressAsync(string itemId, string userId, long? positionTicks, bool isPaused); /// /// 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); /// /// 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. /// Task{BaseItemDto}. Task GetDisplayPreferencesAsync(string id, string userId, string client); /// /// Updates display preferences for a user /// /// The id. /// The display preferences. /// Task{DisplayPreferences}. /// userId Task UpdateDisplayPreferencesAsync(DisplayPreferences displayPreferences, string userId, string client); /// /// 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; set; } /// /// Gets or sets the port number used by the API /// /// The server API port. int ServerApiPort { get; set; } /// /// 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 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); } }