IApiClient.cs 38 KB

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