IApiClient.cs 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871
  1. using MediaBrowser.Model.Configuration;
  2. using MediaBrowser.Model.Dto;
  3. using MediaBrowser.Model.Entities;
  4. using MediaBrowser.Model.Globalization;
  5. using MediaBrowser.Model.Notifications;
  6. using MediaBrowser.Model.Plugins;
  7. using MediaBrowser.Model.Querying;
  8. using MediaBrowser.Model.Search;
  9. using MediaBrowser.Model.Serialization;
  10. using MediaBrowser.Model.Session;
  11. using MediaBrowser.Model.System;
  12. using MediaBrowser.Model.Tasks;
  13. using MediaBrowser.Model.Users;
  14. using System;
  15. using System.Collections.Generic;
  16. using System.IO;
  17. using System.Threading;
  18. using System.Threading.Tasks;
  19. namespace MediaBrowser.Model.ApiClient
  20. {
  21. /// <summary>
  22. /// Interface IApiClient
  23. /// </summary>
  24. public interface IApiClient : IDisposable
  25. {
  26. /// <summary>
  27. /// Occurs when [server location changed].
  28. /// </summary>
  29. event EventHandler ServerLocationChanged;
  30. /// <summary>
  31. /// Occurs when [HTTP response received].
  32. /// </summary>
  33. event EventHandler<HttpResponseEventArgs> HttpResponseReceived;
  34. /// <summary>
  35. /// Gets the API URL.
  36. /// </summary>
  37. /// <param name="handler">The handler.</param>
  38. /// <returns>System.String.</returns>
  39. string GetApiUrl(string handler);
  40. /// <summary>
  41. /// Gets the game system summaries async.
  42. /// </summary>
  43. /// <param name="cancellationToken">The cancellation token.</param>
  44. /// <returns>Task{List{GameSystemSummary}}.</returns>
  45. Task<List<GameSystemSummary>> GetGameSystemSummariesAsync(CancellationToken cancellationToken);
  46. /// <summary>
  47. /// Gets the async.
  48. /// </summary>
  49. /// <typeparam name="T"></typeparam>
  50. /// <param name="url">The URL.</param>
  51. /// <param name="cancellationToken">The cancellation token.</param>
  52. /// <returns>Task{``0}.</returns>
  53. Task<T> GetAsync<T>(string url, CancellationToken cancellationToken)
  54. where T : class;
  55. /// <summary>
  56. /// Gets the critic reviews.
  57. /// </summary>
  58. /// <param name="itemId">The item id.</param>
  59. /// <param name="cancellationToken">The cancellation token.</param>
  60. /// <param name="startIndex">The start index.</param>
  61. /// <param name="limit">The limit.</param>
  62. /// <returns>Task{ItemReviewsResult}.</returns>
  63. Task<ItemReviewsResult> GetCriticReviews(string itemId, CancellationToken cancellationToken, int? startIndex = null, int? limit = null);
  64. /// <summary>
  65. /// Gets the theme songs async.
  66. /// </summary>
  67. /// <param name="userId">The user id.</param>
  68. /// <param name="itemId">The item id.</param>
  69. /// <param name="inheritFromParents">if set to <c>true</c> [inherit from parents].</param>
  70. /// <param name="cancellationToken">The cancellation token.</param>
  71. /// <returns>Task{ThemeMediaResult}.</returns>
  72. Task<ThemeMediaResult> GetThemeSongsAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken);
  73. /// <summary>
  74. /// Gets the search hints async.
  75. /// </summary>
  76. /// <param name="userId">The user id.</param>
  77. /// <param name="searchTerm">The search term.</param>
  78. /// <param name="startIndex">The start index.</param>
  79. /// <param name="limit">The limit.</param>
  80. /// <returns>Task{SearchHintResult}.</returns>
  81. Task<SearchHintResult> GetSearchHintsAsync(string userId, string searchTerm, int? startIndex = null,
  82. int? limit = null);
  83. /// <summary>
  84. /// Gets the theme videos async.
  85. /// </summary>
  86. /// <param name="userId">The user id.</param>
  87. /// <param name="itemId">The item id.</param>
  88. /// <param name="inheritFromParents">if set to <c>true</c> [inherit from parents].</param>
  89. /// <param name="cancellationToken">The cancellation token.</param>
  90. /// <returns>Task{ThemeMediaResult}.</returns>
  91. Task<ThemeMediaResult> GetThemeVideosAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken);
  92. /// <summary>
  93. /// Gets all theme media async.
  94. /// </summary>
  95. /// <param name="userId">The user id.</param>
  96. /// <param name="itemId">The item id.</param>
  97. /// <param name="inheritFromParents">if set to <c>true</c> [inherit from parents].</param>
  98. /// <param name="cancellationToken">The cancellation token.</param>
  99. /// <returns>Task{AllThemeMediaResult}.</returns>
  100. Task<AllThemeMediaResult> GetAllThemeMediaAsync(string userId, string itemId, bool inheritFromParents, CancellationToken cancellationToken);
  101. /// <summary>
  102. /// Marks the notifications read.
  103. /// </summary>
  104. /// <param name="userId">The user id.</param>
  105. /// <param name="notificationIdList">The notification id list.</param>
  106. /// <param name="isRead">if set to <c>true</c> [is read].</param>
  107. /// <returns>Task.</returns>
  108. Task MarkNotificationsRead(string userId, IEnumerable<Guid> notificationIdList, bool isRead);
  109. /// <summary>
  110. /// Updates the notification.
  111. /// </summary>
  112. /// <param name="notification">The notification.</param>
  113. /// <returns>Task.</returns>
  114. Task UpdateNotification(Notification notification);
  115. /// <summary>
  116. /// Adds the notification.
  117. /// </summary>
  118. /// <param name="notification">The notification.</param>
  119. /// <returns>Task{Notification}.</returns>
  120. Task<Notification> AddNotification(Notification notification);
  121. /// <summary>
  122. /// Gets the notifications summary.
  123. /// </summary>
  124. /// <param name="userId">The user id.</param>
  125. /// <returns>Task{NotificationsSummary}.</returns>
  126. Task<NotificationsSummary> GetNotificationsSummary(string userId);
  127. /// <summary>
  128. /// Gets the notifications async.
  129. /// </summary>
  130. /// <param name="query">The query.</param>
  131. /// <returns>Task{NotificationResult}.</returns>
  132. Task<NotificationResult> GetNotificationsAsync(NotificationQuery query);
  133. /// <summary>
  134. /// Gets an image stream based on a url
  135. /// </summary>
  136. /// <param name="url">The URL.</param>
  137. /// <param name="cancellationToken">The cancellation token.</param>
  138. /// <returns>Task{Stream}.</returns>
  139. /// <exception cref="ArgumentNullException">url</exception>
  140. Task<Stream> GetImageStreamAsync(string url, CancellationToken cancellationToken);
  141. /// <summary>
  142. /// Gets a BaseItem
  143. /// </summary>
  144. /// <param name="id">The id.</param>
  145. /// <param name="userId">The user id.</param>
  146. /// <returns>Task{BaseItemDto}.</returns>
  147. /// <exception cref="ArgumentNullException">id</exception>
  148. Task<BaseItemDto> GetItemAsync(string id, string userId);
  149. /// <summary>
  150. /// Gets the intros async.
  151. /// </summary>
  152. /// <param name="itemId">The item id.</param>
  153. /// <param name="userId">The user id.</param>
  154. /// <returns>Task{System.String[]}.</returns>
  155. /// <exception cref="ArgumentNullException">id</exception>
  156. Task<string[]> GetIntrosAsync(string itemId, string userId);
  157. /// <summary>
  158. /// Gets a BaseItem
  159. /// </summary>
  160. /// <param name="userId">The user id.</param>
  161. /// <returns>Task{BaseItemDto}.</returns>
  162. /// <exception cref="ArgumentNullException">userId</exception>
  163. Task<BaseItemDto> GetRootFolderAsync(string userId);
  164. /// <summary>
  165. /// Gets the users async.
  166. /// </summary>
  167. /// <param name="query">The query.</param>
  168. /// <returns>Task{UserDto[]}.</returns>
  169. Task<UserDto[]> GetUsersAsync(UserQuery query);
  170. /// <summary>
  171. /// Gets the public users async.
  172. /// </summary>
  173. /// <param name="cancellationToken">The cancellation token.</param>
  174. /// <returns>Task{UserDto[]}.</returns>
  175. Task<UserDto[]> GetPublicUsersAsync(CancellationToken cancellationToken);
  176. /// <summary>
  177. /// Gets active client sessions.
  178. /// </summary>
  179. /// <param name="query">The query.</param>
  180. /// <returns>Task{SessionInfoDto[]}.</returns>
  181. Task<SessionInfoDto[]> GetClientSessionsAsync(SessionQuery query);
  182. /// <summary>
  183. /// Gets the item counts async.
  184. /// </summary>
  185. /// <param name="userId">The user id.</param>
  186. /// <returns>Task{ItemCounts}.</returns>
  187. Task<ItemCounts> GetItemCountsAsync(string userId);
  188. /// <summary>
  189. /// Queries for items
  190. /// </summary>
  191. /// <param name="query">The query.</param>
  192. /// <returns>Task{ItemsResult}.</returns>
  193. /// <exception cref="ArgumentNullException">query</exception>
  194. Task<ItemsResult> GetItemsAsync(ItemQuery query);
  195. /// <summary>
  196. /// Gets the instant mix from song async.
  197. /// </summary>
  198. /// <param name="query">The query.</param>
  199. /// <returns>Task{ItemsResult}.</returns>
  200. Task<ItemsResult> GetInstantMixFromSongAsync(SimilarItemsQuery query);
  201. /// <summary>
  202. /// Gets the instant mix from album async.
  203. /// </summary>
  204. /// <param name="query">The query.</param>
  205. /// <returns>Task{ItemsResult}.</returns>
  206. Task<ItemsResult> GetInstantMixFromAlbumAsync(SimilarItemsQuery query);
  207. /// <summary>
  208. /// Gets the instant mix from artist async.
  209. /// </summary>
  210. /// <param name="query">The query.</param>
  211. /// <returns>Task{ItemsResult}.</returns>
  212. Task<ItemsResult> GetInstantMixFromArtistAsync(SimilarItemsByNameQuery query);
  213. /// <summary>
  214. /// Gets the instant mix from music genre async.
  215. /// </summary>
  216. /// <param name="query">The query.</param>
  217. /// <returns>Task{ItemsResult}.</returns>
  218. Task<ItemsResult> GetInstantMixFromMusicGenreAsync(SimilarItemsByNameQuery query);
  219. /// <summary>
  220. /// Gets the similar movies async.
  221. /// </summary>
  222. /// <param name="query">The query.</param>
  223. /// <returns>Task{ItemsResult}.</returns>
  224. Task<ItemsResult> GetSimilarMoviesAsync(SimilarItemsQuery query);
  225. /// <summary>
  226. /// Gets the similar trailers async.
  227. /// </summary>
  228. /// <param name="query">The query.</param>
  229. /// <returns>Task{ItemsResult}.</returns>
  230. Task<ItemsResult> GetSimilarTrailersAsync(SimilarItemsQuery query);
  231. /// <summary>
  232. /// Gets the similar series async.
  233. /// </summary>
  234. /// <param name="query">The query.</param>
  235. /// <returns>Task{ItemsResult}.</returns>
  236. Task<ItemsResult> GetSimilarSeriesAsync(SimilarItemsQuery query);
  237. /// <summary>
  238. /// Gets the similar albums async.
  239. /// </summary>
  240. /// <param name="query">The query.</param>
  241. /// <returns>Task{ItemsResult}.</returns>
  242. Task<ItemsResult> GetSimilarAlbumsAsync(SimilarItemsQuery query);
  243. /// <summary>
  244. /// Gets the similar games async.
  245. /// </summary>
  246. /// <param name="query">The query.</param>
  247. /// <returns>Task{ItemsResult}.</returns>
  248. Task<ItemsResult> GetSimilarGamesAsync(SimilarItemsQuery query);
  249. /// <summary>
  250. /// Gets the people async.
  251. /// </summary>
  252. /// <param name="query">The query.</param>
  253. /// <returns>Task{ItemsResult}.</returns>
  254. /// <exception cref="ArgumentNullException">userId</exception>
  255. Task<ItemsResult> GetPeopleAsync(PersonsQuery query);
  256. /// <summary>
  257. /// Gets the artists.
  258. /// </summary>
  259. /// <param name="query">The query.</param>
  260. /// <returns>Task{ItemsResult}.</returns>
  261. /// <exception cref="ArgumentNullException">userId</exception>
  262. Task<ItemsResult> GetArtistsAsync(ArtistsQuery query);
  263. /// <summary>
  264. /// Gets a studio
  265. /// </summary>
  266. /// <param name="name">The name.</param>
  267. /// <param name="userId">The user id.</param>
  268. /// <returns>Task{BaseItemDto}.</returns>
  269. /// <exception cref="ArgumentNullException">userId</exception>
  270. Task<BaseItemDto> GetStudioAsync(string name, string userId);
  271. /// <summary>
  272. /// Gets the next up async.
  273. /// </summary>
  274. /// <param name="query">The query.</param>
  275. /// <returns>Task{ItemsResult}.</returns>
  276. Task<ItemsResult> GetNextUpAsync(NextUpQuery query);
  277. /// <summary>
  278. /// Gets a genre
  279. /// </summary>
  280. /// <param name="name">The name.</param>
  281. /// <param name="userId">The user id.</param>
  282. /// <returns>Task{BaseItemDto}.</returns>
  283. /// <exception cref="ArgumentNullException">userId</exception>
  284. Task<BaseItemDto> GetGenreAsync(string name, string userId);
  285. /// <summary>
  286. /// Gets the genres async.
  287. /// </summary>
  288. /// <param name="query">The query.</param>
  289. /// <returns>Task{ItemsResult}.</returns>
  290. Task<ItemsResult> GetGenresAsync(ItemsByNameQuery query);
  291. /// <summary>
  292. /// Gets the music genres async.
  293. /// </summary>
  294. /// <param name="query">The query.</param>
  295. /// <returns>Task{ItemsResult}.</returns>
  296. Task<ItemsResult> GetMusicGenresAsync(ItemsByNameQuery query);
  297. /// <summary>
  298. /// Gets the game genres async.
  299. /// </summary>
  300. /// <param name="query">The query.</param>
  301. /// <returns>Task{ItemsResult}.</returns>
  302. Task<ItemsResult> GetGameGenresAsync(ItemsByNameQuery query);
  303. /// <summary>
  304. /// Gets the studios async.
  305. /// </summary>
  306. /// <param name="query">The query.</param>
  307. /// <returns>Task{ItemsResult}.</returns>
  308. Task<ItemsResult> GetStudiosAsync(ItemsByNameQuery query);
  309. /// <summary>
  310. /// Gets the music genre async.
  311. /// </summary>
  312. /// <param name="name">The name.</param>
  313. /// <param name="userId">The user id.</param>
  314. /// <returns>Task{BaseItemDto}.</returns>
  315. Task<BaseItemDto> GetMusicGenreAsync(string name, string userId);
  316. /// <summary>
  317. /// Gets the game genre async.
  318. /// </summary>
  319. /// <param name="name">The name.</param>
  320. /// <param name="userId">The user id.</param>
  321. /// <returns>Task{BaseItemDto}.</returns>
  322. Task<BaseItemDto> GetGameGenreAsync(string name, string userId);
  323. /// <summary>
  324. /// Gets the artist async.
  325. /// </summary>
  326. /// <param name="name">The name.</param>
  327. /// <param name="userId">The user id.</param>
  328. /// <returns>Task{BaseItemDto}.</returns>
  329. /// <exception cref="ArgumentNullException">name</exception>
  330. Task<BaseItemDto> GetArtistAsync(string name, string userId);
  331. /// <summary>
  332. /// Restarts the server.
  333. /// </summary>
  334. /// <returns>Task.</returns>
  335. Task RestartServerAsync();
  336. /// <summary>
  337. /// Gets the system status async.
  338. /// </summary>
  339. /// <returns>Task{SystemInfo}.</returns>
  340. Task<SystemInfo> GetSystemInfoAsync();
  341. /// <summary>
  342. /// Gets a person
  343. /// </summary>
  344. /// <param name="name">The name.</param>
  345. /// <param name="userId">The user id.</param>
  346. /// <returns>Task{BaseItemDto}.</returns>
  347. /// <exception cref="ArgumentNullException">userId</exception>
  348. Task<BaseItemDto> GetPersonAsync(string name, string userId);
  349. /// <summary>
  350. /// Gets a list of plugins installed on the server
  351. /// </summary>
  352. /// <returns>Task{PluginInfo[]}.</returns>
  353. Task<PluginInfo[]> GetInstalledPluginsAsync();
  354. /// <summary>
  355. /// Gets the current server configuration
  356. /// </summary>
  357. /// <returns>Task{ServerConfiguration}.</returns>
  358. Task<ServerConfiguration> GetServerConfigurationAsync();
  359. /// <summary>
  360. /// Gets the scheduled tasks.
  361. /// </summary>
  362. /// <returns>Task{TaskInfo[]}.</returns>
  363. Task<TaskInfo[]> GetScheduledTasksAsync();
  364. /// <summary>
  365. /// Gets the scheduled task async.
  366. /// </summary>
  367. /// <param name="id">The id.</param>
  368. /// <returns>Task{TaskInfo}.</returns>
  369. /// <exception cref="ArgumentNullException">id</exception>
  370. Task<TaskInfo> GetScheduledTaskAsync(Guid id);
  371. /// <summary>
  372. /// Gets a user by id
  373. /// </summary>
  374. /// <param name="id">The id.</param>
  375. /// <returns>Task{UserDto}.</returns>
  376. /// <exception cref="ArgumentNullException">id</exception>
  377. Task<UserDto> GetUserAsync(string id);
  378. /// <summary>
  379. /// Gets the parental ratings async.
  380. /// </summary>
  381. /// <returns>Task{List{ParentalRating}}.</returns>
  382. Task<List<ParentalRating>> GetParentalRatingsAsync();
  383. /// <summary>
  384. /// Gets local trailers for an item
  385. /// </summary>
  386. /// <param name="userId">The user id.</param>
  387. /// <param name="itemId">The item id.</param>
  388. /// <returns>Task{ItemsResult}.</returns>
  389. /// <exception cref="ArgumentNullException">query</exception>
  390. Task<BaseItemDto[]> GetLocalTrailersAsync(string userId, string itemId);
  391. /// <summary>
  392. /// Gets special features for an item
  393. /// </summary>
  394. /// <param name="userId">The user id.</param>
  395. /// <param name="itemId">The item id.</param>
  396. /// <returns>Task{BaseItemDto[]}.</returns>
  397. /// <exception cref="ArgumentNullException">userId</exception>
  398. Task<BaseItemDto[]> GetSpecialFeaturesAsync(string userId, string itemId);
  399. /// <summary>
  400. /// Gets the cultures async.
  401. /// </summary>
  402. /// <returns>Task{CultureDto[]}.</returns>
  403. Task<CultureDto[]> GetCulturesAsync();
  404. /// <summary>
  405. /// Gets the countries async.
  406. /// </summary>
  407. /// <returns>Task{CountryInfo[]}.</returns>
  408. Task<CountryInfo[]> GetCountriesAsync();
  409. /// <summary>
  410. /// Marks the played async.
  411. /// </summary>
  412. /// <param name="itemId">The item id.</param>
  413. /// <param name="userId">The user id.</param>
  414. /// <param name="datePlayed">The date played.</param>
  415. /// <returns>Task{UserItemDataDto}.</returns>
  416. Task<UserItemDataDto> MarkPlayedAsync(string itemId, string userId, DateTime? datePlayed);
  417. /// <summary>
  418. /// Marks the unplayed async.
  419. /// </summary>
  420. /// <param name="itemId">The item id.</param>
  421. /// <param name="userId">The user id.</param>
  422. /// <returns>Task{UserItemDataDto}.</returns>
  423. Task<UserItemDataDto> MarkUnplayedAsync(string itemId, string userId);
  424. /// <summary>
  425. /// Updates the favorite status async.
  426. /// </summary>
  427. /// <param name="itemId">The item id.</param>
  428. /// <param name="userId">The user id.</param>
  429. /// <param name="isFavorite">if set to <c>true</c> [is favorite].</param>
  430. /// <returns>Task.</returns>
  431. /// <exception cref="ArgumentNullException">itemId</exception>
  432. Task<UserItemDataDto> UpdateFavoriteStatusAsync(string itemId, string userId, bool isFavorite);
  433. /// <summary>
  434. /// Reports to the server that the user has begun playing an item
  435. /// </summary>
  436. /// <param name="itemId">The item id.</param>
  437. /// <param name="userId">The user id.</param>
  438. /// <param name="isSeekable">if set to <c>true</c> [is seekable].</param>
  439. /// <param name="queueableMediaTypes">The list of media types that the client is capable of queuing onto the playlist. See MediaType class.</param>
  440. /// <returns>Task{UserItemDataDto}.</returns>
  441. /// <exception cref="ArgumentNullException">itemId</exception>
  442. Task ReportPlaybackStartAsync(string itemId, string userId, bool isSeekable, List<string> queueableMediaTypes);
  443. /// <summary>
  444. /// Reports playback progress to the server
  445. /// </summary>
  446. /// <param name="itemId">The item id.</param>
  447. /// <param name="userId">The user id.</param>
  448. /// <param name="positionTicks">The position ticks.</param>
  449. /// <param name="isPaused">if set to <c>true</c> [is paused].</param>
  450. /// <param name="isMuted">if set to <c>true</c> [is muted].</param>
  451. /// <returns>Task{UserItemDataDto}.</returns>
  452. /// <exception cref="ArgumentNullException">itemId</exception>
  453. Task ReportPlaybackProgressAsync(string itemId, string userId, long? positionTicks, bool isPaused, bool isMuted);
  454. /// <summary>
  455. /// Reports to the server that the user has stopped playing an item
  456. /// </summary>
  457. /// <param name="itemId">The item id.</param>
  458. /// <param name="userId">The user id.</param>
  459. /// <param name="positionTicks">The position ticks.</param>
  460. /// <returns>Task{UserItemDataDto}.</returns>
  461. /// <exception cref="ArgumentNullException">itemId</exception>
  462. Task ReportPlaybackStoppedAsync(string itemId, string userId, long? positionTicks);
  463. /// <summary>
  464. /// Instructs antoher client to browse to a library item.
  465. /// </summary>
  466. /// <param name="sessionId">The session id.</param>
  467. /// <param name="itemId">The id of the item to browse to.</param>
  468. /// <param name="itemName">The name of the item to browse to.</param>
  469. /// <param name="itemType">The type of the item to browse to.</param>
  470. /// <param name="context">Optional ui context (movies, music, tv, games, etc). The client is free to ignore this.</param>
  471. /// <returns>Task.</returns>
  472. Task SendBrowseCommandAsync(string sessionId, string itemId, string itemName, string itemType, string context);
  473. /// <summary>
  474. /// Sends the playstate command async.
  475. /// </summary>
  476. /// <param name="sessionId">The session id.</param>
  477. /// <param name="request">The request.</param>
  478. /// <returns>Task.</returns>
  479. Task SendPlaystateCommandAsync(string sessionId, PlaystateRequest request);
  480. /// <summary>
  481. /// Sends the play command async.
  482. /// </summary>
  483. /// <param name="sessionId">The session id.</param>
  484. /// <param name="request">The request.</param>
  485. /// <returns>Task.</returns>
  486. /// <exception cref="ArgumentNullException">sessionId
  487. /// or
  488. /// request</exception>
  489. Task SendPlayCommandAsync(string sessionId, PlayRequest request);
  490. /// <summary>
  491. /// Sends a system command to the client
  492. /// </summary>
  493. /// <param name="sessionId">The session id.</param>
  494. /// <param name="command">The command.</param>
  495. /// <returns>Task.</returns>
  496. Task SendSystemCommandAsync(string sessionId, SystemCommand command);
  497. /// <summary>
  498. /// Instructs the client to display a message to the user
  499. /// </summary>
  500. /// <param name="sessionId">The session id.</param>
  501. /// <param name="command">The command.</param>
  502. /// <returns>Task.</returns>
  503. Task SendMessageCommandAsync(string sessionId, MessageCommand command);
  504. /// <summary>
  505. /// Clears a user's rating for an item
  506. /// </summary>
  507. /// <param name="itemId">The item id.</param>
  508. /// <param name="userId">The user id.</param>
  509. /// <returns>Task{UserItemDataDto}.</returns>
  510. /// <exception cref="ArgumentNullException">itemId</exception>
  511. Task<UserItemDataDto> ClearUserItemRatingAsync(string itemId, string userId);
  512. /// <summary>
  513. /// Updates a user's rating for an item, based on likes or dislikes
  514. /// </summary>
  515. /// <param name="itemId">The item id.</param>
  516. /// <param name="userId">The user id.</param>
  517. /// <param name="likes">if set to <c>true</c> [likes].</param>
  518. /// <returns>Task.</returns>
  519. /// <exception cref="ArgumentNullException">itemId</exception>
  520. Task<UserItemDataDto> UpdateUserItemRatingAsync(string itemId, string userId, bool likes);
  521. /// <summary>
  522. /// Authenticates a user and returns the result
  523. /// </summary>
  524. /// <param name="username">The username.</param>
  525. /// <param name="sha1Hash">The sha1 hash.</param>
  526. /// <returns>Task.</returns>
  527. /// <exception cref="ArgumentNullException">userId</exception>
  528. Task<AuthenticationResult> AuthenticateUserAsync(string username, byte[] sha1Hash);
  529. /// <summary>
  530. /// Updates the server configuration async.
  531. /// </summary>
  532. /// <param name="configuration">The configuration.</param>
  533. /// <returns>Task.</returns>
  534. /// <exception cref="ArgumentNullException">configuration</exception>
  535. Task UpdateServerConfigurationAsync(ServerConfiguration configuration);
  536. /// <summary>
  537. /// Updates the scheduled task triggers.
  538. /// </summary>
  539. /// <param name="id">The id.</param>
  540. /// <param name="triggers">The triggers.</param>
  541. /// <returns>Task{RequestResult}.</returns>
  542. /// <exception cref="ArgumentNullException">id</exception>
  543. Task UpdateScheduledTaskTriggersAsync(Guid id, TaskTriggerInfo[] triggers);
  544. /// <summary>
  545. /// Gets the display preferences.
  546. /// </summary>
  547. /// <param name="id">The id.</param>
  548. /// <param name="userId">The user id.</param>
  549. /// <param name="client">The client.</param>
  550. /// <param name="cancellationToken">The cancellation token.</param>
  551. /// <returns>Task{BaseItemDto}.</returns>
  552. Task<DisplayPreferences> GetDisplayPreferencesAsync(string id, string userId, string client, CancellationToken cancellationToken);
  553. /// <summary>
  554. /// Updates display preferences for a user
  555. /// </summary>
  556. /// <param name="displayPreferences">The display preferences.</param>
  557. /// <param name="userId">The user id.</param>
  558. /// <param name="client">The client.</param>
  559. /// <param name="cancellationToken">The cancellation token.</param>
  560. /// <returns>Task{DisplayPreferences}.</returns>
  561. /// <exception cref="System.ArgumentNullException">userId</exception>
  562. Task UpdateDisplayPreferencesAsync(DisplayPreferences displayPreferences, string userId, string client, CancellationToken cancellationToken);
  563. /// <summary>
  564. /// Posts a set of data to a url, and deserializes the return stream into T
  565. /// </summary>
  566. /// <typeparam name="T"></typeparam>
  567. /// <param name="url">The URL.</param>
  568. /// <param name="args">The args.</param>
  569. /// <returns>Task{``0}.</returns>
  570. Task<T> PostAsync<T>(string url, Dictionary<string, string> args)
  571. where T : class;
  572. /// <summary>
  573. /// This is a helper around getting a stream from the server that contains serialized data
  574. /// </summary>
  575. /// <param name="url">The URL.</param>
  576. /// <returns>Task{Stream}.</returns>
  577. Task<Stream> GetSerializedStreamAsync(string url);
  578. /// <summary>
  579. /// Gets the json serializer.
  580. /// </summary>
  581. /// <value>The json serializer.</value>
  582. IJsonSerializer JsonSerializer { get; set; }
  583. /// <summary>
  584. /// Gets or sets the server host name (myserver or 192.168.x.x)
  585. /// </summary>
  586. /// <value>The name of the server host.</value>
  587. string ServerHostName { get; set; }
  588. /// <summary>
  589. /// Gets or sets the port number used by the API
  590. /// </summary>
  591. /// <value>The server API port.</value>
  592. int ServerApiPort { get; set; }
  593. /// <summary>
  594. /// Gets or sets the type of the client.
  595. /// </summary>
  596. /// <value>The type of the client.</value>
  597. string ClientName { get; set; }
  598. /// <summary>
  599. /// Gets or sets the name of the device.
  600. /// </summary>
  601. /// <value>The name of the device.</value>
  602. string DeviceName { get; set; }
  603. /// <summary>
  604. /// Gets or sets the device id.
  605. /// </summary>
  606. /// <value>The device id.</value>
  607. string DeviceId { get; set; }
  608. /// <summary>
  609. /// Gets or sets the current user id.
  610. /// </summary>
  611. /// <value>The current user id.</value>
  612. string CurrentUserId { get; set; }
  613. /// <summary>
  614. /// Gets the image URL.
  615. /// </summary>
  616. /// <param name="item">The item.</param>
  617. /// <param name="options">The options.</param>
  618. /// <returns>System.String.</returns>
  619. /// <exception cref="ArgumentNullException">item</exception>
  620. string GetImageUrl(BaseItemDto item, ImageOptions options);
  621. /// <summary>
  622. /// Gets an image url that can be used to download an image from the api
  623. /// </summary>
  624. /// <param name="itemId">The Id of the item</param>
  625. /// <param name="options">The options.</param>
  626. /// <returns>System.String.</returns>
  627. /// <exception cref="ArgumentNullException">itemId</exception>
  628. string GetImageUrl(string itemId, ImageOptions options);
  629. /// <summary>
  630. /// Gets the user image URL.
  631. /// </summary>
  632. /// <param name="user">The user.</param>
  633. /// <param name="options">The options.</param>
  634. /// <returns>System.String.</returns>
  635. /// <exception cref="ArgumentNullException">user</exception>
  636. string GetUserImageUrl(UserDto user, ImageOptions options);
  637. /// <summary>
  638. /// Gets an image url that can be used to download an image from the api
  639. /// </summary>
  640. /// <param name="userId">The Id of the user</param>
  641. /// <param name="options">The options.</param>
  642. /// <returns>System.String.</returns>
  643. /// <exception cref="ArgumentNullException">userId</exception>
  644. string GetUserImageUrl(string userId, ImageOptions options);
  645. /// <summary>
  646. /// Gets the person image URL.
  647. /// </summary>
  648. /// <param name="item">The item.</param>
  649. /// <param name="options">The options.</param>
  650. /// <returns>System.String.</returns>
  651. /// <exception cref="ArgumentNullException">item</exception>
  652. string GetPersonImageUrl(BaseItemPerson item, ImageOptions options);
  653. /// <summary>
  654. /// Gets an image url that can be used to download an image from the api
  655. /// </summary>
  656. /// <param name="name">The name of the person</param>
  657. /// <param name="options">The options.</param>
  658. /// <returns>System.String.</returns>
  659. /// <exception cref="ArgumentNullException">name</exception>
  660. string GetPersonImageUrl(string name, ImageOptions options);
  661. /// <summary>
  662. /// Gets the year image URL.
  663. /// </summary>
  664. /// <param name="item">The item.</param>
  665. /// <param name="options">The options.</param>
  666. /// <returns>System.String.</returns>
  667. /// <exception cref="ArgumentNullException">item</exception>
  668. string GetYearImageUrl(BaseItemDto item, ImageOptions options);
  669. /// <summary>
  670. /// Gets an image url that can be used to download an image from the api
  671. /// </summary>
  672. /// <param name="year">The year.</param>
  673. /// <param name="options">The options.</param>
  674. /// <returns>System.String.</returns>
  675. string GetYearImageUrl(int year, ImageOptions options);
  676. /// <summary>
  677. /// Gets an image url that can be used to download an image from the api
  678. /// </summary>
  679. /// <param name="name">The name.</param>
  680. /// <param name="options">The options.</param>
  681. /// <returns>System.String.</returns>
  682. /// <exception cref="ArgumentNullException">name</exception>
  683. string GetGenreImageUrl(string name, ImageOptions options);
  684. /// <summary>
  685. /// Gets the music genre image URL.
  686. /// </summary>
  687. /// <param name="name">The name.</param>
  688. /// <param name="options">The options.</param>
  689. /// <returns>System.String.</returns>
  690. string GetMusicGenreImageUrl(string name, ImageOptions options);
  691. /// <summary>
  692. /// Gets the game genre image URL.
  693. /// </summary>
  694. /// <param name="name">The name.</param>
  695. /// <param name="options">The options.</param>
  696. /// <returns>System.String.</returns>
  697. string GetGameGenreImageUrl(string name, ImageOptions options);
  698. /// <summary>
  699. /// Gets an image url that can be used to download an image from the api
  700. /// </summary>
  701. /// <param name="name">The name.</param>
  702. /// <param name="options">The options.</param>
  703. /// <returns>System.String.</returns>
  704. /// <exception cref="ArgumentNullException">name</exception>
  705. string GetStudioImageUrl(string name, ImageOptions options);
  706. /// <summary>
  707. /// Gets the artist image URL.
  708. /// </summary>
  709. /// <param name="name">The name.</param>
  710. /// <param name="options">The options.</param>
  711. /// <returns>System.String.</returns>
  712. /// <exception cref="ArgumentNullException">name</exception>
  713. string GetArtistImageUrl(string name, ImageOptions options);
  714. /// <summary>
  715. /// 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.
  716. /// </summary>
  717. /// <param name="item">A given item.</param>
  718. /// <param name="options">The options.</param>
  719. /// <returns>System.String[][].</returns>
  720. /// <exception cref="ArgumentNullException">item</exception>
  721. string[] GetBackdropImageUrls(BaseItemDto item, ImageOptions options);
  722. /// <summary>
  723. /// 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.
  724. /// </summary>
  725. /// <param name="item">A given item.</param>
  726. /// <param name="options">The options.</param>
  727. /// <returns>System.String.</returns>
  728. /// <exception cref="ArgumentNullException">item</exception>
  729. string GetLogoImageUrl(BaseItemDto item, ImageOptions options);
  730. /// <summary>
  731. /// Gets the art image URL.
  732. /// </summary>
  733. /// <param name="item">The item.</param>
  734. /// <param name="options">The options.</param>
  735. /// <returns>System.String.</returns>
  736. string GetArtImageUrl(BaseItemDto item, ImageOptions options);
  737. /// <summary>
  738. /// Gets the url needed to stream an audio file
  739. /// </summary>
  740. /// <param name="options">The options.</param>
  741. /// <returns>System.String.</returns>
  742. /// <exception cref="ArgumentNullException">options</exception>
  743. string GetAudioStreamUrl(StreamOptions options);
  744. /// <summary>
  745. /// Gets the url needed to stream a video file
  746. /// </summary>
  747. /// <param name="options">The options.</param>
  748. /// <returns>System.String.</returns>
  749. /// <exception cref="ArgumentNullException">options</exception>
  750. string GetVideoStreamUrl(VideoStreamOptions options);
  751. /// <summary>
  752. /// Formulates a url for streaming audio using the HLS protocol
  753. /// </summary>
  754. /// <param name="options">The options.</param>
  755. /// <returns>System.String.</returns>
  756. /// <exception cref="ArgumentNullException">options</exception>
  757. string GetHlsAudioStreamUrl(StreamOptions options);
  758. /// <summary>
  759. /// Formulates a url for streaming video using the HLS protocol
  760. /// </summary>
  761. /// <param name="options">The options.</param>
  762. /// <returns>System.String.</returns>
  763. /// <exception cref="ArgumentNullException">options</exception>
  764. string GetHlsVideoStreamUrl(VideoStreamOptions options);
  765. }
  766. }