IApiClient.cs 38 KB

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