aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/ApiClient/IApiClient.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model/ApiClient/IApiClient.cs')
-rw-r--r--MediaBrowser.Model/ApiClient/IApiClient.cs237
1 files changed, 192 insertions, 45 deletions
diff --git a/MediaBrowser.Model/ApiClient/IApiClient.cs b/MediaBrowser.Model/ApiClient/IApiClient.cs
index 1ce7b4af8..9faa8fced 100644
--- a/MediaBrowser.Model/ApiClient/IApiClient.cs
+++ b/MediaBrowser.Model/ApiClient/IApiClient.cs
@@ -1,9 +1,13 @@
using MediaBrowser.Model.Channels;
using MediaBrowser.Model.Configuration;
+using MediaBrowser.Model.Devices;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
+using MediaBrowser.Model.Events;
using MediaBrowser.Model.Globalization;
using MediaBrowser.Model.LiveTv;
+using MediaBrowser.Model.MediaInfo;
+using MediaBrowser.Model.Net;
using MediaBrowser.Model.Notifications;
using MediaBrowser.Model.Playlists;
using MediaBrowser.Model.Plugins;
@@ -11,6 +15,7 @@ using MediaBrowser.Model.Querying;
using MediaBrowser.Model.Search;
using MediaBrowser.Model.Serialization;
using MediaBrowser.Model.Session;
+using MediaBrowser.Model.Sync;
using MediaBrowser.Model.System;
using MediaBrowser.Model.Tasks;
using MediaBrowser.Model.Users;
@@ -25,18 +30,18 @@ namespace MediaBrowser.Model.ApiClient
/// <summary>
/// Interface IApiClient
/// </summary>
- public interface IApiClient : IDisposable
+ public interface IApiClient : IServerEvents, IDisposable
{
/// <summary>
- /// Occurs when [server location changed].
+ /// Occurs when [remote logged out].
/// </summary>
- event EventHandler ServerLocationChanged;
+ event EventHandler<GenericEventArgs<RemoteLogoutReason>> RemoteLoggedOut;
/// <summary>
- /// Occurs when [HTTP response received].
+ /// Occurs when [authenticated].
/// </summary>
- event EventHandler<HttpResponseEventArgs> HttpResponseReceived;
-
+ event EventHandler<GenericEventArgs<AuthenticationResult>> Authenticated;
+
/// <summary>
/// Gets the API URL.
/// </summary>
@@ -120,6 +125,16 @@ namespace MediaBrowser.Model.ApiClient
Task<SearchHintResult> GetSearchHintsAsync(SearchQuery query);
/// <summary>
+ /// Gets the filters.
+ /// </summary>
+ /// <param name="userId">The user identifier.</param>
+ /// <param name="parentId">The parent identifier.</param>
+ /// <param name="mediaTypes">The media types.</param>
+ /// <param name="itemTypes">The item types.</param>
+ /// <returns>Task&lt;QueryFilters&gt;.</returns>
+ Task<QueryFilters> GetFilters(string userId, string parentId, string[] mediaTypes, string[] itemTypes);
+
+ /// <summary>
/// Gets the theme videos async.
/// </summary>
/// <param name="userId">The user id.</param>
@@ -172,6 +187,30 @@ namespace MediaBrowser.Model.ApiClient
Task<Stream> GetImageStreamAsync(string url, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
+ /// Gets the stream.
+ /// </summary>
+ /// <param name="url">The URL.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task&lt;Stream&gt;.</returns>
+ Task<Stream> GetStream(string url, CancellationToken cancellationToken = default(CancellationToken));
+
+ /// <summary>
+ /// Gets the response.
+ /// </summary>
+ /// <param name="url">The URL.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task&lt;HttpResponse&gt;.</returns>
+ Task<HttpResponse> GetResponse(string url, CancellationToken cancellationToken = default(CancellationToken));
+
+ /// <summary>
+ /// Updates the user configuration.
+ /// </summary>
+ /// <param name="userId">The user identifier.</param>
+ /// <param name="configuration">The configuration.</param>
+ /// <returns>Task.</returns>
+ Task UpdateUserConfiguration(string userId, UserConfiguration configuration);
+
+ /// <summary>
/// Gets a BaseItem
/// </summary>
/// <param name="id">The id.</param>
@@ -212,6 +251,14 @@ namespace MediaBrowser.Model.ApiClient
Task<ItemsResult> GetAdditionalParts(string itemId, string userId);
/// <summary>
+ /// Gets the live media information.
+ /// </summary>
+ /// <param name="itemId">The item identifier.</param>
+ /// <param name="userId">The user identifier.</param>
+ /// <returns>Task&lt;LiveMediaInfoResult&gt;.</returns>
+ Task<LiveMediaInfoResult> GetLiveMediaInfo(string itemId, string userId);
+
+ /// <summary>
/// Gets the users async.
/// </summary>
/// <param name="query">The query.</param>
@@ -392,7 +439,7 @@ namespace MediaBrowser.Model.ApiClient
/// </summary>
/// <param name="query">The query.</param>
/// <returns>Task{ItemsResult}.</returns>
- Task<ItemsResult> GetUpcomingEpisodesAsync(NextUpQuery query);
+ Task<ItemsResult> GetUpcomingEpisodesAsync(UpcomingEpisodesQuery query);
/// <summary>
/// Gets a genre
@@ -475,15 +522,6 @@ namespace MediaBrowser.Model.ApiClient
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;PublicSystemInfo&gt;.</returns>
Task<PublicSystemInfo> GetPublicSystemInfoAsync(CancellationToken cancellationToken = default(CancellationToken));
-
- /// <summary>
- /// Gets a person
- /// </summary>
- /// <param name="name">The name.</param>
- /// <param name="userId">The user id.</param>
- /// <returns>Task{BaseItemDto}.</returns>
- /// <exception cref="ArgumentNullException">userId</exception>
- Task<BaseItemDto> GetPersonAsync(string name, string userId);
/// <summary>
/// Gets a list of plugins installed on the server
@@ -713,10 +751,11 @@ namespace MediaBrowser.Model.ApiClient
/// Authenticates a user and returns the result
/// </summary>
/// <param name="username">The username.</param>
- /// <param name="sha1Hash">The sha1 hash.</param>
+ /// <param name="password">The password.</param>
/// <returns>Task.</returns>
/// <exception cref="ArgumentNullException">userId</exception>
- Task<AuthenticationResult> AuthenticateUserAsync(string username, byte[] sha1Hash);
+ Task<AuthenticationResult> AuthenticateUserAsync(string username,
+ string password);
/// <summary>
/// Updates the server configuration async.
@@ -787,29 +826,28 @@ namespace MediaBrowser.Model.ApiClient
string ServerAddress { get; }
/// <summary>
- /// Changes the server location.
- /// </summary>
- /// <param name="address">The address.</param>
- /// <param name="keepExistingAuth">Don't clear any existing authentication</param>
- void ChangeServerLocation(string address, bool keepExistingAuth = false);
-
- /// <summary>
/// Gets or sets the type of the client.
/// </summary>
/// <value>The type of the client.</value>
string ClientName { get; set; }
/// <summary>
+ /// Gets the device.
+ /// </summary>
+ /// <value>The device.</value>
+ IDevice Device { get; }
+
+ /// <summary>
/// Gets or sets the name of the device.
/// </summary>
/// <value>The name of the device.</value>
- string DeviceName { get; set; }
+ string DeviceName { get; }
/// <summary>
/// Gets or sets the device id.
/// </summary>
/// <value>The device id.</value>
- string DeviceId { get; set; }
+ string DeviceId { get; }
/// <summary>
/// Gets or sets the current user id.
@@ -842,6 +880,26 @@ namespace MediaBrowser.Model.ApiClient
void ClearAuthenticationInfo();
/// <summary>
+ /// Changes the server location.
+ /// </summary>
+ /// <param name="address">The address.</param>
+ /// <param name="keepExistingAuth">if set to <c>true</c> [keep existing authentication].</param>
+ void ChangeServerLocation(string address, bool keepExistingAuth = false);
+
+ /// <summary>
+ /// Starts the receiving session updates.
+ /// </summary>
+ /// <param name="intervalMs">The interval ms.</param>
+ /// <returns>Task.</returns>
+ Task StartReceivingSessionUpdates(int intervalMs);
+
+ /// <summary>
+ /// Stops the receiving session updates.
+ /// </summary>
+ /// <returns>Task.</returns>
+ Task StopReceivingSessionUpdates();
+
+ /// <summary>
/// Gets the image URL.
/// </summary>
/// <param name="item">The item.</param>
@@ -920,15 +978,6 @@ namespace MediaBrowser.Model.ApiClient
/// <summary>
/// Gets an image url that can be used to download an image from the api
/// </summary>
- /// <param name="name">The name of the person</param>
- /// <param name="options">The options.</param>
- /// <returns>System.String.</returns>
- /// <exception cref="ArgumentNullException">name</exception>
- string GetPersonImageUrl(string name, ImageOptions options);
-
- /// <summary>
- /// Gets an image url that can be used to download an image from the api
- /// </summary>
/// <param name="year">The year.</param>
/// <param name="options">The options.</param>
/// <returns>System.String.</returns>
@@ -1268,15 +1317,6 @@ namespace MediaBrowser.Model.ApiClient
Task<QueryResult<BaseItemDto>> GetPlaylistItems(PlaylistItemQuery query);
/// <summary>
- /// Gets the url needed to stream an audio file
- /// </summary>
- /// <param name="options">The options.</param>
- /// <returns>System.String.</returns>
- /// <exception cref="ArgumentNullException">options</exception>
- [Obsolete]
- string GetAudioStreamUrl(StreamOptions options);
-
- /// <summary>
/// Gets the url needed to stream a video file
/// </summary>
/// <param name="options">The options.</param>
@@ -1293,5 +1333,112 @@ namespace MediaBrowser.Model.ApiClient
/// <exception cref="ArgumentNullException">options</exception>
[Obsolete]
string GetHlsVideoStreamUrl(VideoStreamOptions options);
+
+ /// <summary>
+ /// Sends the context message asynchronous.
+ /// </summary>
+ /// <param name="itemType">Type of the item.</param>
+ /// <param name="itemId">The item identifier.</param>
+ /// <param name="itemName">Name of the item.</param>
+ /// <param name="context">The context.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task SendContextMessageAsync(string itemType, string itemId, string itemName, string context,
+ CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the content upload history.
+ /// </summary>
+ /// <param name="deviceId">The device identifier.</param>
+ /// <returns>Task&lt;ContentUploadHistory&gt;.</returns>
+ Task<ContentUploadHistory> GetContentUploadHistory(string deviceId);
+
+ /// <summary>
+ /// Uploads the file.
+ /// </summary>
+ /// <param name="stream">The stream.</param>
+ /// <param name="file">The file.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task.</returns>
+ Task UploadFile(Stream stream,
+ LocalFileInfo file,
+ CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Gets the devices options options.
+ /// </summary>
+ /// <returns>Task&lt;DevicesOptions&gt;.</returns>
+ Task<DevicesOptions> GetDevicesOptions();
+
+ /// <summary>
+ /// Updates the item.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ /// <returns>Task.</returns>
+ Task UpdateItem(BaseItemDto item);
+
+ /// <summary>
+ /// Creates the synchronize job.
+ /// </summary>
+ /// <param name="request">The request.</param>
+ /// <returns>Task&lt;SyncJob&gt;.</returns>
+ Task<SyncJob> CreateSyncJob(SyncJobRequest request);
+
+ /// <summary>
+ /// Gets the synchronize jobs.
+ /// </summary>
+ /// <param name="query">The query.</param>
+ /// <returns>Task&lt;QueryResult&lt;SyncJob&gt;&gt;.</returns>
+ Task<QueryResult<SyncJob>> GetSyncJobs(SyncJobQuery query);
+
+ /// <summary>
+ /// Gets the synchronize job items.
+ /// </summary>
+ /// <param name="query">The query.</param>
+ /// <returns>Task&lt;QueryResult&lt;SyncJobItem&gt;&gt;.</returns>
+ Task<QueryResult<SyncJobItem>> GetSyncJobItems(SyncJobItemQuery query);
+
+ /// <summary>
+ /// Reports the synchronize job item transferred.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <returns>Task.</returns>
+ Task ReportSyncJobItemTransferred(string id);
+
+ /// <summary>
+ /// Gets the synchronize job item file.
+ /// </summary>
+ /// <param name="id">The identifier.</param>
+ /// <param name="cancellationToken">The cancellation token.</param>
+ /// <returns>Task&lt;Stream&gt;.</returns>
+ Task<Stream> GetSyncJobItemFile(string id, CancellationToken cancellationToken);
+
+ /// <summary>
+ /// Opens the web socket.
+ /// </summary>
+ /// <param name="webSocketFactory">The web socket factory.</param>
+ /// <param name="keepAliveTimerMs">The keep alive timer ms.</param>
+ void OpenWebSocket(Func<IClientWebSocket> webSocketFactory, int keepAliveTimerMs = 60000);
+
+ /// <summary>
+ /// Reports the offline actions.
+ /// </summary>
+ /// <param name="actions">The actions.</param>
+ /// <returns>Task.</returns>
+ Task ReportOfflineActions(List<UserAction> actions);
+
+ /// <summary>
+ /// Gets the ready synchronize items.
+ /// </summary>
+ /// <param name="targetId">The target identifier.</param>
+ /// <returns>List&lt;SyncedItem&gt;.</returns>
+ Task<List<SyncedItem>> GetReadySyncItems(string targetId);
+
+ /// <summary>
+ /// Synchronizes the data.
+ /// </summary>
+ /// <param name="request">The request.</param>
+ /// <returns>Task&lt;SyncDataResponse&gt;.</returns>
+ Task<SyncDataResponse> SyncData(SyncDataRequest request);
}
} \ No newline at end of file