IApiClient.cs 37 KB

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