IApiClient.cs 31 KB

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