IApiClient.cs 36 KB

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