IApiClient.cs 37 KB

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