IApiClient.cs 34 KB

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