IApiClient.cs 38 KB

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