IApiClient.cs 33 KB

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