2
0

IApiClient.cs 36 KB

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