2
0

IApiClient.cs 34 KB

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