@jellyfin/sdk 0.8.2 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/README.md +14 -4
  2. package/lib/api.d.ts +1 -0
  3. package/lib/api.js +4 -4
  4. package/lib/discovery/discovery-service.js +4 -9
  5. package/lib/discovery/recommended-server-discovery.js +39 -36
  6. package/lib/generated-client/api/activity-log-api.js +19 -11
  7. package/lib/generated-client/api/api-key-api.js +35 -31
  8. package/lib/generated-client/api/artists-api.d.ts +28 -26
  9. package/lib/generated-client/api/artists-api.js +47 -43
  10. package/lib/generated-client/api/audio-api.d.ts +20 -20
  11. package/lib/generated-client/api/audio-api.js +45 -43
  12. package/lib/generated-client/api/branding-api.js +32 -28
  13. package/lib/generated-client/api/channels-api.d.ts +9 -8
  14. package/lib/generated-client/api/channels-api.js +54 -54
  15. package/lib/generated-client/api/client-log-api.js +19 -11
  16. package/lib/generated-client/api/collection-api.js +35 -31
  17. package/lib/generated-client/api/configuration-api.d.ts +0 -47
  18. package/lib/generated-client/api/configuration-api.js +51 -117
  19. package/lib/generated-client/api/dashboard-api.js +26 -20
  20. package/lib/generated-client/api/devices-api.d.ts +3 -12
  21. package/lib/generated-client/api/devices-api.js +54 -60
  22. package/lib/generated-client/api/display-preferences-api.d.ts +22 -22
  23. package/lib/generated-client/api/display-preferences-api.js +39 -37
  24. package/lib/generated-client/api/dynamic-hls-api.d.ts +49 -31
  25. package/lib/generated-client/api/dynamic-hls-api.js +104 -100
  26. package/lib/generated-client/api/environment-api.js +59 -61
  27. package/lib/generated-client/api/filter-api.d.ts +9 -8
  28. package/lib/generated-client/api/filter-api.js +30 -24
  29. package/lib/generated-client/api/genres-api.d.ts +9 -8
  30. package/lib/generated-client/api/genres-api.js +30 -24
  31. package/lib/generated-client/api/hls-segment-api.js +48 -48
  32. package/lib/generated-client/api/image-api.d.ts +109 -1184
  33. package/lib/generated-client/api/image-api.js +394 -1307
  34. package/lib/generated-client/api/instant-mix-api.d.ts +35 -35
  35. package/lib/generated-client/api/instant-mix-api.js +125 -131
  36. package/lib/generated-client/api/item-lookup-api.js +99 -111
  37. package/lib/generated-client/api/item-refresh-api.js +19 -11
  38. package/lib/generated-client/api/item-update-api.js +35 -31
  39. package/lib/generated-client/api/items-api.d.ts +333 -1012
  40. package/lib/generated-client/api/items-api.js +191 -617
  41. package/lib/generated-client/api/library-api.d.ts +9 -8
  42. package/lib/generated-client/api/library-api.js +214 -254
  43. package/lib/generated-client/api/library-structure-api.js +75 -81
  44. package/lib/generated-client/api/live-tv-api.d.ts +17 -16
  45. package/lib/generated-client/api/live-tv-api.js +343 -415
  46. package/lib/generated-client/api/localization-api.js +43 -41
  47. package/lib/generated-client/api/lyrics-api.d.ts +344 -0
  48. package/lib/generated-client/api/lyrics-api.js +449 -0
  49. package/lib/generated-client/api/media-info-api.d.ts +7 -7
  50. package/lib/generated-client/api/media-info-api.js +54 -56
  51. package/lib/generated-client/api/movies-api.js +19 -11
  52. package/lib/generated-client/api/music-genres-api.d.ts +9 -8
  53. package/lib/generated-client/api/music-genres-api.js +30 -24
  54. package/lib/generated-client/api/package-api.js +59 -61
  55. package/lib/generated-client/api/persons-api.js +27 -21
  56. package/lib/generated-client/api/playlists-api.d.ts +315 -36
  57. package/lib/generated-client/api/playlists-api.js +416 -71
  58. package/lib/generated-client/api/playstate-api.d.ts +41 -68
  59. package/lib/generated-client/api/playstate-api.js +127 -153
  60. package/lib/generated-client/api/plugins-api.js +83 -91
  61. package/lib/generated-client/api/quick-connect-api.d.ts +46 -37
  62. package/lib/generated-client/api/quick-connect-api.js +83 -75
  63. package/lib/generated-client/api/remote-image-api.js +35 -31
  64. package/lib/generated-client/api/scheduled-tasks-api.js +51 -51
  65. package/lib/generated-client/api/search-api.d.ts +41 -40
  66. package/lib/generated-client/api/search-api.js +34 -26
  67. package/lib/generated-client/api/session-api.d.ts +9 -17
  68. package/lib/generated-client/api/session-api.js +145 -173
  69. package/lib/generated-client/api/startup-api.js +67 -71
  70. package/lib/generated-client/api/studios-api.js +27 -21
  71. package/lib/generated-client/api/subtitle-api.d.ts +7 -7
  72. package/lib/generated-client/api/subtitle-api.js +99 -109
  73. package/lib/generated-client/api/suggestions-api.d.ts +14 -13
  74. package/lib/generated-client/api/suggestions-api.js +31 -23
  75. package/lib/generated-client/api/sync-play-api.js +179 -211
  76. package/lib/generated-client/api/system-api.js +88 -98
  77. package/lib/generated-client/api/time-sync-api.js +18 -10
  78. package/lib/generated-client/api/tmdb-api.js +19 -11
  79. package/lib/generated-client/api/trailers-api.d.ts +35 -33
  80. package/lib/generated-client/api/trailers-api.js +40 -32
  81. package/lib/generated-client/api/trickplay-api.d.ts +176 -0
  82. package/lib/generated-client/api/trickplay-api.js +208 -0
  83. package/lib/generated-client/api/tv-shows-api.d.ts +25 -15
  84. package/lib/generated-client/api/tv-shows-api.js +58 -50
  85. package/lib/generated-client/api/universal-audio-api.d.ts +17 -16
  86. package/lib/generated-client/api/universal-audio-api.js +33 -27
  87. package/lib/generated-client/api/user-api.d.ts +35 -155
  88. package/lib/generated-client/api/user-api.js +152 -319
  89. package/lib/generated-client/api/user-library-api.d.ts +100 -100
  90. package/lib/generated-client/api/user-library-api.js +190 -200
  91. package/lib/generated-client/api/user-views-api.d.ts +22 -21
  92. package/lib/generated-client/api/user-views-api.js +47 -41
  93. package/lib/generated-client/api/video-attachments-api.js +18 -10
  94. package/lib/generated-client/api/videos-api.d.ts +12 -12
  95. package/lib/generated-client/api/videos-api.js +63 -67
  96. package/lib/generated-client/api/years-api.d.ts +15 -13
  97. package/lib/generated-client/api/years-api.js +33 -27
  98. package/lib/generated-client/api.d.ts +2 -4
  99. package/lib/generated-client/base.js +13 -0
  100. package/lib/generated-client/common.js +19 -11
  101. package/lib/generated-client/index.js +19 -10
  102. package/lib/generated-client/models/activity-log-entry-message.d.ts +37 -0
  103. package/lib/generated-client/models/activity-log-entry-start-message.d.ts +30 -0
  104. package/lib/generated-client/models/activity-log-entry-stop-message.d.ts +24 -0
  105. package/lib/generated-client/models/audio-spatial-format.d.ts +21 -0
  106. package/lib/generated-client/models/audio-spatial-format.js +24 -0
  107. package/lib/generated-client/models/authenticate-user-by-name.d.ts +0 -7
  108. package/lib/generated-client/models/base-item-dto.d.ts +37 -17
  109. package/lib/generated-client/models/base-item-person.d.ts +4 -3
  110. package/lib/generated-client/models/cast-receiver-application.d.ts +29 -0
  111. package/lib/generated-client/models/client-capabilities-dto.d.ts +17 -20
  112. package/lib/generated-client/models/client-capabilities.d.ts +16 -19
  113. package/lib/generated-client/models/collection-type-options.d.ts +9 -9
  114. package/lib/generated-client/models/collection-type-options.js +9 -9
  115. package/lib/generated-client/models/collection-type.d.ts +31 -0
  116. package/lib/generated-client/models/collection-type.js +34 -0
  117. package/lib/generated-client/models/container-profile.d.ts +1 -1
  118. package/lib/generated-client/models/create-playlist-dto.d.ts +18 -4
  119. package/lib/generated-client/models/create-user-by-name.d.ts +1 -1
  120. package/lib/generated-client/models/device-info.d.ts +6 -0
  121. package/lib/generated-client/models/device-profile.d.ts +0 -171
  122. package/lib/generated-client/models/dlna-profile-type.d.ts +1 -0
  123. package/lib/generated-client/models/dlna-profile-type.js +2 -1
  124. package/lib/generated-client/models/down-mix-stereo-algorithms.d.ts +21 -0
  125. package/lib/generated-client/models/down-mix-stereo-algorithms.js +24 -0
  126. package/lib/generated-client/models/encoding-options.d.ts +77 -40
  127. package/lib/generated-client/models/external-id-media-type.d.ts +1 -0
  128. package/lib/generated-client/models/external-id-media-type.js +2 -1
  129. package/lib/generated-client/models/extra-type.d.ts +30 -0
  130. package/lib/generated-client/models/extra-type.js +33 -0
  131. package/lib/generated-client/models/force-keep-alive-message.d.ts +36 -0
  132. package/lib/generated-client/models/general-command-message.d.ts +37 -0
  133. package/lib/generated-client/models/general-command-type.d.ts +1 -0
  134. package/lib/generated-client/models/general-command-type.js +2 -1
  135. package/lib/generated-client/models/get-programs-dto.d.ts +4 -3
  136. package/lib/generated-client/models/group-info-dto-group-update.d.ts +37 -0
  137. package/lib/generated-client/models/group-state-update-group-update.d.ts +37 -0
  138. package/lib/generated-client/models/group-state-update.d.ts +31 -0
  139. package/lib/generated-client/models/group-update.d.ts +20 -0
  140. package/lib/generated-client/models/hardware-encoding-type.d.ts +1 -0
  141. package/lib/generated-client/models/hardware-encoding-type.js +2 -1
  142. package/lib/generated-client/models/image-format.d.ts +1 -0
  143. package/lib/generated-client/models/image-format.js +2 -1
  144. package/lib/generated-client/models/image-resolution.d.ts +27 -0
  145. package/lib/generated-client/models/{ffmpeg-location.js → image-resolution.js} +12 -7
  146. package/lib/generated-client/models/inbound-keep-alive-message.d.ts +24 -0
  147. package/lib/generated-client/models/inbound-web-socket-message.d.ts +23 -0
  148. package/lib/generated-client/models/index.d.ts +74 -25
  149. package/lib/generated-client/models/index.js +17 -6
  150. package/lib/generated-client/models/item-fields.d.ts +1 -2
  151. package/lib/generated-client/models/item-fields.js +1 -2
  152. package/lib/generated-client/models/item-sort-by.d.ts +50 -0
  153. package/lib/generated-client/models/item-sort-by.js +53 -0
  154. package/lib/generated-client/models/library-changed-message.d.ts +37 -0
  155. package/lib/generated-client/models/library-options.d.ts +36 -0
  156. package/lib/generated-client/models/live-tv-options.d.ts +12 -0
  157. package/lib/generated-client/models/log-file.d.ts +1 -1
  158. package/lib/generated-client/models/lyric-dto.d.ts +31 -0
  159. package/lib/generated-client/models/lyric-line.d.ts +29 -0
  160. package/lib/generated-client/models/lyric-metadata.d.ts +77 -0
  161. package/lib/generated-client/models/media-source-info.d.ts +3 -2
  162. package/lib/generated-client/models/media-stream-protocol.d.ts +20 -0
  163. package/lib/generated-client/models/{header-match-type.js → media-stream-protocol.js} +5 -6
  164. package/lib/generated-client/models/media-stream-type.d.ts +1 -0
  165. package/lib/generated-client/models/media-stream-type.js +2 -1
  166. package/lib/generated-client/models/media-stream.d.ts +27 -6
  167. package/lib/generated-client/models/media-type.d.ts +23 -0
  168. package/lib/generated-client/models/{architecture.js → media-type.js} +8 -9
  169. package/lib/generated-client/models/metadata-editor-info.d.ts +3 -2
  170. package/lib/generated-client/models/network-configuration.d.ts +50 -116
  171. package/lib/generated-client/models/outbound-keep-alive-message.d.ts +30 -0
  172. package/lib/generated-client/models/outbound-web-socket-message.d.ts +44 -0
  173. package/lib/generated-client/models/parental-rating.d.ts +1 -1
  174. package/lib/generated-client/models/person-kind.d.ts +43 -0
  175. package/lib/generated-client/models/person-kind.js +46 -0
  176. package/lib/generated-client/models/play-message.d.ts +37 -0
  177. package/lib/generated-client/models/play-queue-update-group-update.d.ts +37 -0
  178. package/lib/generated-client/models/play-queue-update-reason.d.ts +28 -0
  179. package/lib/generated-client/models/play-queue-update-reason.js +31 -0
  180. package/lib/generated-client/models/play-queue-update.d.ts +69 -0
  181. package/lib/generated-client/models/playback-order.d.ts +20 -0
  182. package/lib/generated-client/models/{send-to-user-type.js → playback-order.js} +5 -6
  183. package/lib/generated-client/models/playback-progress-info.d.ts +7 -0
  184. package/lib/generated-client/models/playback-request-type.d.ts +35 -0
  185. package/lib/generated-client/models/playback-request-type.js +38 -0
  186. package/lib/generated-client/models/playback-start-info.d.ts +7 -0
  187. package/lib/generated-client/models/player-state-info.d.ts +7 -0
  188. package/lib/generated-client/models/playlist-user-permissions.d.ts +29 -0
  189. package/lib/generated-client/models/playstate-message.d.ts +37 -0
  190. package/lib/generated-client/models/plugin-installation-cancelled-message.d.ts +37 -0
  191. package/lib/generated-client/models/plugin-installation-completed-message.d.ts +37 -0
  192. package/lib/generated-client/models/plugin-installation-failed-message.d.ts +37 -0
  193. package/lib/generated-client/models/plugin-installing-message.d.ts +37 -0
  194. package/lib/generated-client/models/plugin-uninstalled-message.d.ts +37 -0
  195. package/lib/generated-client/models/process-priority-class.d.ts +24 -0
  196. package/lib/generated-client/models/process-priority-class.js +27 -0
  197. package/lib/generated-client/models/public-system-info.d.ts +1 -0
  198. package/lib/generated-client/models/refresh-progress-message.d.ts +38 -0
  199. package/lib/generated-client/models/remote-lyric-info-dto.d.ts +36 -0
  200. package/lib/generated-client/models/remote-subtitle-info.d.ts +30 -0
  201. package/lib/generated-client/models/remove-from-playlist-request-dto.d.ts +1 -1
  202. package/lib/generated-client/models/restart-required-message.d.ts +30 -0
  203. package/lib/generated-client/models/scheduled-task-ended-message.d.ts +37 -0
  204. package/lib/generated-client/models/scheduled-tasks-info-message.d.ts +37 -0
  205. package/lib/generated-client/models/scheduled-tasks-info-start-message.d.ts +30 -0
  206. package/lib/generated-client/models/scheduled-tasks-info-stop-message.d.ts +24 -0
  207. package/lib/generated-client/models/search-hint.d.ts +19 -16
  208. package/lib/generated-client/models/series-status.d.ts +2 -1
  209. package/lib/generated-client/models/series-status.js +3 -2
  210. package/lib/generated-client/models/series-timer-cancelled-message.d.ts +37 -0
  211. package/lib/generated-client/models/series-timer-created-message.d.ts +37 -0
  212. package/lib/generated-client/models/server-configuration.d.ts +45 -0
  213. package/lib/generated-client/models/server-restarting-message.d.ts +30 -0
  214. package/lib/generated-client/models/server-shutting-down-message.d.ts +30 -0
  215. package/lib/generated-client/models/session-info.d.ts +9 -9
  216. package/lib/generated-client/models/sessions-message.d.ts +37 -0
  217. package/lib/generated-client/models/sessions-start-message.d.ts +30 -0
  218. package/lib/generated-client/models/sessions-stop-message.d.ts +24 -0
  219. package/lib/generated-client/models/string-group-update.d.ts +36 -0
  220. package/lib/generated-client/models/sync-play-command-message.d.ts +37 -0
  221. package/lib/generated-client/models/sync-play-group-update-command-message.d.ts +37 -0
  222. package/lib/generated-client/models/sync-play-queue-item.d.ts +29 -0
  223. package/lib/generated-client/models/system-info.d.ts +17 -6
  224. package/lib/generated-client/models/timer-cancelled-message.d.ts +37 -0
  225. package/lib/generated-client/models/timer-created-message.d.ts +37 -0
  226. package/lib/generated-client/models/transcoding-info.d.ts +3 -2
  227. package/lib/generated-client/models/transcoding-info.js +15 -0
  228. package/lib/generated-client/models/transcoding-profile.d.ts +3 -2
  229. package/lib/generated-client/models/trickplay-info.d.ts +59 -0
  230. package/lib/generated-client/models/trickplay-options.d.ts +85 -0
  231. package/lib/generated-client/models/trickplay-scan-behavior.d.ts +20 -0
  232. package/lib/generated-client/models/{notification-level.js → trickplay-scan-behavior.js} +5 -6
  233. package/lib/generated-client/models/tuner-host-info.d.ts +6 -0
  234. package/lib/generated-client/models/update-playlist-dto.d.ts +42 -0
  235. package/lib/generated-client/models/update-playlist-user-dto.d.ts +23 -0
  236. package/lib/generated-client/models/update-user-item-data-dto.d.ts +83 -0
  237. package/lib/generated-client/models/upload-subtitle-dto.d.ts +6 -0
  238. package/lib/generated-client/models/user-configuration.d.ts +6 -0
  239. package/lib/generated-client/models/user-data-change-info.d.ts +30 -0
  240. package/lib/generated-client/models/user-data-changed-message.d.ts +37 -0
  241. package/lib/generated-client/models/user-deleted-message.d.ts +36 -0
  242. package/lib/generated-client/models/user-dto.d.ts +1 -0
  243. package/lib/generated-client/models/user-policy.d.ts +26 -2
  244. package/lib/generated-client/models/user-updated-message.d.ts +37 -0
  245. package/lib/generated-client/models/video-range-type.d.ts +27 -0
  246. package/lib/generated-client/models/video-range-type.js +30 -0
  247. package/lib/generated-client/models/video-range.d.ts +21 -0
  248. package/lib/generated-client/models/{device-profile-type.js → video-range.js} +6 -5
  249. package/lib/generated-client/models/web-socket-message.d.ts +18 -0
  250. package/lib/utils/api/image-api.d.ts +2 -2
  251. package/lib/utils/api/image-api.js +2 -2
  252. package/lib/utils/api/image-urls-api.d.ts +55 -0
  253. package/lib/utils/api/image-urls-api.js +115 -0
  254. package/lib/utils/api/index.d.ts +2 -4
  255. package/lib/utils/api/index.js +2 -4
  256. package/lib/utils/api/{dlna-api.d.ts → lyrics-api.d.ts} +2 -2
  257. package/lib/utils/api/{dlna-api.js → lyrics-api.js} +4 -4
  258. package/lib/utils/api/{dlna-server-api.d.ts → trickplay-api.d.ts} +2 -2
  259. package/lib/utils/api/trickplay-api.js +12 -0
  260. package/lib/utils/authentication.js +5 -6
  261. package/lib/utils/index.d.ts +2 -1
  262. package/lib/utils/index.js +2 -1
  263. package/lib/utils/versioning.d.ts +9 -0
  264. package/lib/utils/versioning.js +32 -0
  265. package/lib/versions.d.ts +2 -2
  266. package/lib/versions.js +2 -2
  267. package/package.json +17 -22
  268. package/lib/generated-client/api/dlna-api.js +0 -422
  269. package/lib/generated-client/api/dlna-server-api.js +0 -1088
  270. package/lib/generated-client/api/image-by-name-api.js +0 -423
  271. package/lib/generated-client/api/notifications-api.js +0 -484
  272. package/lib/node_modules/tslib/tslib.es6.js +0 -26
  273. package/lib/utils/api/dlna-server-api.js +0 -12
  274. package/lib/utils/api/image-by-name-api.d.ts +0 -8
  275. package/lib/utils/api/image-by-name-api.js +0 -12
  276. package/lib/utils/api/notifications-api.d.ts +0 -8
  277. package/lib/utils/api/notifications-api.js +0 -12
package/README.md CHANGED
@@ -10,8 +10,8 @@
10
10
  <a href="https://github.com/jellyfin/jellyfin-sdk-typescript/blob/master/LICENSE"><img alt="MPL-2.0 license" src="https://img.shields.io/github/license/jellyfin/jellyfin-sdk-typescript"></a>
11
11
  <a href="https://github.com/jellyfin/jellyfin-sdk-typescript/releases"><img alt="Current Release" src="https://img.shields.io/github/release/jellyfin/jellyfin-sdk-typescript.svg"/></a>
12
12
  <a href="https://www.npmjs.com/package/@jellyfin/sdk"><img alt="npm" src="https://img.shields.io/npm/v/@jellyfin/sdk"></a>
13
- <a href="https://codecov.io/gh/jellyfin/jellyfin-sdk-typescript">
14
- <img alt="Codecov" src="https://img.shields.io/codecov/c/github/jellyfin/jellyfin-sdk-typescript?token=eFF0jvWiyq">
13
+ <a href="https://sonarcloud.io/component_measures?metric=coverage&id=jellyfin_jellyfin-sdk-typescript">
14
+ <img alt="Sonar Coverage" src="https://img.shields.io/sonar/coverage/jellyfin_jellyfin-sdk-typescript/master?server=https%3A%2F%2Fsonarcloud.io">
15
15
  </a>
16
16
  </p>
17
17
 
@@ -35,7 +35,9 @@ yarn add @jellyfin/sdk
35
35
 
36
36
  | SDK Version | Jellyfin Version |
37
37
  |:-:|:-:|
38
- | 0.8.2 - 0.6.0 | 10.8.1 - 10.8.9 |
38
+ | 0.10.0 | 10.9.x |
39
+ | 0.9.0 | 10.9.x |
40
+ | 0.8.2 - 0.6.0 | 10.8.1 - 10.8.13 |
39
41
  | 0.5.0 | 10.8.0 |
40
42
  | <0.5.0 | 10.7.x |
41
43
 
@@ -106,6 +108,14 @@ await api.logout();
106
108
 
107
109
  ## Breaking Changes
108
110
 
111
+ ### v0.10.0
112
+
113
+ * Updated build target to ES2018. [#712](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/712)
114
+
115
+ ### v0.9.0
116
+
117
+ * Updated OpenAPI spec for Jellyfin 10.9.1. [#694](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/694)
118
+
109
119
  ### v0.8.0
110
120
 
111
121
  * The library is now fully targeted to ES6/ES2015.
@@ -145,7 +155,7 @@ await api.logout();
145
155
  * [x] Use custom generator templates for API versions [#231](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/231) (Currently uses sed to update the value could be improved.)
146
156
  * [x] Automate OpenAPI spec updates using GitHub [#351](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/351)
147
157
  * [x] Create branch tracking unstable Jellyfin builds with automated builds [#354](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/354)
148
- * [ ] Fix authentication header escaping
158
+ * [x] Fix authentication header escaping [#564](https://github.com/jellyfin/jellyfin-sdk-typescript/pull/564)
149
159
  * [ ] Add WebSocket API support
150
160
  * [ ] Add example projects for different ecosystems [#186](https://github.com/jellyfin/jellyfin-sdk-typescript/issues/186)
151
161
  * [ ] Add utility function for `getFile` [#164](https://github.com/jellyfin/jellyfin-sdk-typescript/issues/164)
package/lib/api.d.ts CHANGED
@@ -32,6 +32,7 @@ export declare class Api {
32
32
  logout(): Promise<AxiosResponse<never> | AxiosResponse<void>>;
33
33
  /**
34
34
  * Get an item image URL.
35
+ * @deprecated Use {@link ImageUrlsApi.getItemImageUrlById} instead.
35
36
  * @param itemId The Item ID.
36
37
  * @param imageType An optional Image Type (Primary by default).
37
38
  * @param params Additional request parameters.
package/lib/api.js CHANGED
@@ -2,6 +2,7 @@ import globalAxios from 'axios';
2
2
  import { Configuration } from './generated-client/configuration.js';
3
3
  import { ImageType } from './generated-client/models/image-type.js';
4
4
  import { getAuthorizationHeader } from './utils/authentication.js';
5
+ import { getImageApi } from './utils/api/image-api.js';
5
6
  import { getSessionApi } from './utils/api/session-api.js';
6
7
  import { getUserApi } from './utils/api/user-api.js';
7
8
 
@@ -50,16 +51,15 @@ class Api {
50
51
  }
51
52
  /**
52
53
  * Get an item image URL.
54
+ * @deprecated Use {@link ImageUrlsApi.getItemImageUrlById} instead.
53
55
  * @param itemId The Item ID.
54
56
  * @param imageType An optional Image Type (Primary by default).
55
57
  * @param params Additional request parameters.
56
58
  * @returns The image URL.
57
59
  */
58
60
  getItemImageUrl(itemId, imageType = ImageType.Primary, params = {}) {
59
- // TODO: We could probably use ImageApiAxiosParamCreator to make this more robust
60
- return globalAxios.create({
61
- baseURL: this.basePath
62
- }).getUri({ url: `/Items/${itemId}/Images/${imageType}`, params });
61
+ return getImageApi(this)
62
+ .getItemImageUrlById(itemId, imageType, params);
63
63
  }
64
64
  get authorizationHeader() {
65
65
  return getAuthorizationHeader(this.clientInfo, this.deviceInfo, this.accessToken);
@@ -1,4 +1,3 @@
1
- import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
2
1
  import { RecommendedServerInfoScore } from '../models/recommended-server-info.js';
3
2
  import { getAddressCandidates } from '../utils/address-candidates.js';
4
3
  import { RecommendedServerDiscovery } from './recommended-server-discovery.js';
@@ -49,10 +48,8 @@ class DiscoveryService {
49
48
  * @param minimumScore The minimum server score to include in the results.
50
49
  * @returns A list of RecommendedServerInfo from the possible server addresses.
51
50
  */
52
- getRecommendedServers(servers, minimumScore) {
53
- return __awaiter(this, void 0, void 0, function* () {
54
- return this.recommendedServerDiscovery.discover(servers, minimumScore);
55
- });
51
+ async getRecommendedServers(servers, minimumScore) {
52
+ return this.recommendedServerDiscovery.discover(servers, minimumScore);
56
53
  }
57
54
  /**
58
55
  * Gets a list of recommended server information from the address
@@ -61,10 +58,8 @@ class DiscoveryService {
61
58
  * @param minimumScore The minimum server score to include in the results.
62
59
  * @returns A list of RecommendedServerInfo from the address candidates.
63
60
  */
64
- getRecommendedServerCandidates(input, minimumScore) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- return this.getRecommendedServers(this.getAddressCandidates(input), minimumScore);
67
- });
61
+ async getRecommendedServerCandidates(input, minimumScore) {
62
+ return this.getRecommendedServers(this.getAddressCandidates(input), minimumScore);
68
63
  }
69
64
  }
70
65
 
@@ -1,8 +1,7 @@
1
- import { __awaiter } from '../node_modules/tslib/tslib.es6.js';
2
- import { compare } from 'compare-versions';
3
1
  import { RecommendedServerInfoScore } from '../models/recommended-server-info.js';
4
2
  import { SystemInfoIssue, ProductNameIssue, VersionMissingIssue, VersionUnsupportedIssue, VersionOutdatedIssue, SlowResponseIssue } from '../models/recommended-server-issue.js';
5
3
  import { getSystemApi } from '../utils/api/system-api.js';
4
+ import { isVersionLess } from '../utils/versioning.js';
6
5
  import { MINIMUM_VERSION, API_VERSION } from '../versions.js';
7
6
 
8
7
  /**
@@ -36,20 +35,28 @@ function toRecommendedServerInfo(result) {
36
35
  scores.push(RecommendedServerInfoScore.BAD);
37
36
  }
38
37
  const version = (_b = result.response) === null || _b === void 0 ? void 0 : _b.data.Version;
39
- if (!version) {
40
- // No version was returned
41
- issues.push(new VersionMissingIssue());
42
- scores.push(RecommendedServerInfoScore.BAD);
43
- }
44
- else if (compare(version, MINIMUM_VERSION, '<')) {
45
- // Version is less than the minimum supported
46
- issues.push(new VersionUnsupportedIssue(version));
47
- scores.push(RecommendedServerInfoScore.OK);
38
+ try {
39
+ if (!version) {
40
+ // No version was returned
41
+ issues.push(new VersionMissingIssue());
42
+ scores.push(RecommendedServerInfoScore.BAD);
43
+ }
44
+ else if (isVersionLess(version, MINIMUM_VERSION)) {
45
+ // Version is less than the minimum supported
46
+ issues.push(new VersionUnsupportedIssue(version));
47
+ scores.push(RecommendedServerInfoScore.OK);
48
+ }
49
+ else if (isVersionLess(version, API_VERSION)) {
50
+ // Version is less than the generated client, but above the minimum
51
+ issues.push(new VersionOutdatedIssue(version));
52
+ scores.push(RecommendedServerInfoScore.GOOD);
53
+ }
48
54
  }
49
- else if (compare(version, API_VERSION, '<')) {
50
- // Version is less than the generated client, but above the minimum
51
- issues.push(new VersionOutdatedIssue(version));
52
- scores.push(RecommendedServerInfoScore.GOOD);
55
+ catch (error) {
56
+ if (error instanceof TypeError) {
57
+ issues.push(new VersionMissingIssue());
58
+ scores.push(RecommendedServerInfoScore.BAD);
59
+ }
53
60
  }
54
61
  if (result.responseTime > SLOW_RESPONSE_TIME) {
55
62
  // Response was slow
@@ -74,33 +81,29 @@ class RecommendedServerDiscovery {
74
81
  * @param address The server address.
75
82
  * @returns The resulting RecommendedServerInfo.
76
83
  */
77
- fetchRecommendedServerInfo(address) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- const api = this.jellyfin.createApi(address);
80
- const startTime = Date.now();
81
- return getSystemApi(api).getPublicSystemInfo({ timeout: HTTP_TIMEOUT })
82
- .then(response => ({
83
- address,
84
- response,
85
- responseTime: Date.now() - startTime
86
- }))
87
- .catch(error => ({
88
- address,
89
- error,
90
- responseTime: Date.now() - startTime
91
- }))
92
- .then(result => toRecommendedServerInfo(result));
93
- });
84
+ async fetchRecommendedServerInfo(address) {
85
+ const api = this.jellyfin.createApi(address);
86
+ const startTime = Date.now();
87
+ return getSystemApi(api).getPublicSystemInfo({ timeout: HTTP_TIMEOUT })
88
+ .then(response => ({
89
+ address,
90
+ response,
91
+ responseTime: Date.now() - startTime
92
+ }))
93
+ .catch(error => ({
94
+ address,
95
+ error,
96
+ responseTime: Date.now() - startTime
97
+ }))
98
+ .then(result => toRecommendedServerInfo(result));
94
99
  }
95
100
  /**
96
101
  * Fetches the RecommendedServerInfo for multiple server addresses.
97
102
  * @param servers An array of server addresses.
98
103
  * @returns The RecommendedServerInfo for each address.
99
104
  */
100
- discover(servers, minimumScore = RecommendedServerInfoScore.BAD) {
101
- return __awaiter(this, void 0, void 0, function* () {
102
- return (yield Promise.all(servers.map(server => this.fetchRecommendedServerInfo(server)))).filter(serverInfo => serverInfo.score >= minimumScore);
103
- });
105
+ async discover(servers, minimumScore = RecommendedServerInfoScore.BAD) {
106
+ return (await Promise.all(servers.map(server => this.fetchRecommendedServerInfo(server)))).filter(serverInfo => serverInfo.score >= minimumScore);
104
107
  }
105
108
  }
106
109
 
@@ -1,9 +1,19 @@
1
- import { __awaiter } from '../../node_modules/tslib/tslib.es6.js';
2
1
  import globalAxios from 'axios';
3
2
  import { DUMMY_BASE_URL, setApiKeyToObject, setSearchParams, toPathString, createRequestFunction } from '../common.js';
4
3
  import { BaseAPI, BASE_PATH } from '../base.js';
5
4
 
6
5
  /* tslint:disable */
6
+ /* eslint-disable */
7
+ /**
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * Do not edit the class manually.
10
+ *
11
+ * Jellyfin API
12
+ *
13
+ * This Source Code Form is subject to the terms of the Mozilla Public
14
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
15
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
16
+ */
7
17
  /**
8
18
  * ActivityLogApi - axios parameter creator
9
19
  * @export
@@ -20,7 +30,7 @@ const ActivityLogApiAxiosParamCreator = function (configuration) {
20
30
  * @param {*} [options] Override http request option.
21
31
  * @throws {RequiredError}
22
32
  */
23
- getLogEntries: (startIndex, limit, minDate, hasUserId, options = {}) => __awaiter(this, void 0, void 0, function* () {
33
+ getLogEntries: async (startIndex, limit, minDate, hasUserId, options = {}) => {
24
34
  const localVarPath = `/System/ActivityLog/Entries`;
25
35
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
26
36
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
@@ -28,11 +38,11 @@ const ActivityLogApiAxiosParamCreator = function (configuration) {
28
38
  if (configuration) {
29
39
  baseOptions = configuration.baseOptions;
30
40
  }
31
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
41
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
32
42
  const localVarHeaderParameter = {};
33
43
  const localVarQueryParameter = {};
34
44
  // authentication CustomAuthentication required
35
- yield setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
45
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
36
46
  if (startIndex !== undefined) {
37
47
  localVarQueryParameter['startIndex'] = startIndex;
38
48
  }
@@ -49,12 +59,12 @@ const ActivityLogApiAxiosParamCreator = function (configuration) {
49
59
  }
50
60
  setSearchParams(localVarUrlObj, localVarQueryParameter);
51
61
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
52
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
62
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
53
63
  return {
54
64
  url: toPathString(localVarUrlObj),
55
65
  options: localVarRequestOptions,
56
66
  };
57
- }),
67
+ },
58
68
  };
59
69
  };
60
70
  /**
@@ -74,11 +84,9 @@ const ActivityLogApiFp = function (configuration) {
74
84
  * @param {*} [options] Override http request option.
75
85
  * @throws {RequiredError}
76
86
  */
77
- getLogEntries(startIndex, limit, minDate, hasUserId, options) {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- const localVarAxiosArgs = yield localVarAxiosParamCreator.getLogEntries(startIndex, limit, minDate, hasUserId, options);
80
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
81
- });
87
+ async getLogEntries(startIndex, limit, minDate, hasUserId, options) {
88
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getLogEntries(startIndex, limit, minDate, hasUserId, options);
89
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
82
90
  },
83
91
  };
84
92
  };
@@ -1,9 +1,19 @@
1
- import { __awaiter } from '../../node_modules/tslib/tslib.es6.js';
2
1
  import globalAxios from 'axios';
3
2
  import { assertParamExists, DUMMY_BASE_URL, setApiKeyToObject, setSearchParams, toPathString, createRequestFunction } from '../common.js';
4
3
  import { BaseAPI, BASE_PATH } from '../base.js';
5
4
 
6
5
  /* tslint:disable */
6
+ /* eslint-disable */
7
+ /**
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * Do not edit the class manually.
10
+ *
11
+ * Jellyfin API
12
+ *
13
+ * This Source Code Form is subject to the terms of the Mozilla Public
14
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
15
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
16
+ */
7
17
  /**
8
18
  * ApiKeyApi - axios parameter creator
9
19
  * @export
@@ -17,7 +27,7 @@ const ApiKeyApiAxiosParamCreator = function (configuration) {
17
27
  * @param {*} [options] Override http request option.
18
28
  * @throws {RequiredError}
19
29
  */
20
- createKey: (app, options = {}) => __awaiter(this, void 0, void 0, function* () {
30
+ createKey: async (app, options = {}) => {
21
31
  // verify required parameter 'app' is not null or undefined
22
32
  assertParamExists('createKey', 'app', app);
23
33
  const localVarPath = `/Auth/Keys`;
@@ -27,29 +37,29 @@ const ApiKeyApiAxiosParamCreator = function (configuration) {
27
37
  if (configuration) {
28
38
  baseOptions = configuration.baseOptions;
29
39
  }
30
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'POST' }, baseOptions), options);
40
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
31
41
  const localVarHeaderParameter = {};
32
42
  const localVarQueryParameter = {};
33
43
  // authentication CustomAuthentication required
34
- yield setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
44
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
35
45
  if (app !== undefined) {
36
46
  localVarQueryParameter['app'] = app;
37
47
  }
38
48
  setSearchParams(localVarUrlObj, localVarQueryParameter);
39
49
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
40
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
50
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
41
51
  return {
42
52
  url: toPathString(localVarUrlObj),
43
53
  options: localVarRequestOptions,
44
54
  };
45
- }),
55
+ },
46
56
  /**
47
57
  *
48
58
  * @summary Get all keys.
49
59
  * @param {*} [options] Override http request option.
50
60
  * @throws {RequiredError}
51
61
  */
52
- getKeys: (options = {}) => __awaiter(this, void 0, void 0, function* () {
62
+ getKeys: async (options = {}) => {
53
63
  const localVarPath = `/Auth/Keys`;
54
64
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
55
65
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
@@ -57,19 +67,19 @@ const ApiKeyApiAxiosParamCreator = function (configuration) {
57
67
  if (configuration) {
58
68
  baseOptions = configuration.baseOptions;
59
69
  }
60
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
70
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
61
71
  const localVarHeaderParameter = {};
62
72
  const localVarQueryParameter = {};
63
73
  // authentication CustomAuthentication required
64
- yield setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
74
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
65
75
  setSearchParams(localVarUrlObj, localVarQueryParameter);
66
76
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
67
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
77
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
68
78
  return {
69
79
  url: toPathString(localVarUrlObj),
70
80
  options: localVarRequestOptions,
71
81
  };
72
- }),
82
+ },
73
83
  /**
74
84
  *
75
85
  * @summary Remove an api key.
@@ -77,7 +87,7 @@ const ApiKeyApiAxiosParamCreator = function (configuration) {
77
87
  * @param {*} [options] Override http request option.
78
88
  * @throws {RequiredError}
79
89
  */
80
- revokeKey: (key, options = {}) => __awaiter(this, void 0, void 0, function* () {
90
+ revokeKey: async (key, options = {}) => {
81
91
  // verify required parameter 'key' is not null or undefined
82
92
  assertParamExists('revokeKey', 'key', key);
83
93
  const localVarPath = `/Auth/Keys/{key}`
@@ -88,19 +98,19 @@ const ApiKeyApiAxiosParamCreator = function (configuration) {
88
98
  if (configuration) {
89
99
  baseOptions = configuration.baseOptions;
90
100
  }
91
- const localVarRequestOptions = Object.assign(Object.assign({ method: 'DELETE' }, baseOptions), options);
101
+ const localVarRequestOptions = { method: 'DELETE', ...baseOptions, ...options };
92
102
  const localVarHeaderParameter = {};
93
103
  const localVarQueryParameter = {};
94
104
  // authentication CustomAuthentication required
95
- yield setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
105
+ await setApiKeyToObject(localVarHeaderParameter, "Authorization", configuration);
96
106
  setSearchParams(localVarUrlObj, localVarQueryParameter);
97
107
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
98
- localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
108
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
99
109
  return {
100
110
  url: toPathString(localVarUrlObj),
101
111
  options: localVarRequestOptions,
102
112
  };
103
- }),
113
+ },
104
114
  };
105
115
  };
106
116
  /**
@@ -117,11 +127,9 @@ const ApiKeyApiFp = function (configuration) {
117
127
  * @param {*} [options] Override http request option.
118
128
  * @throws {RequiredError}
119
129
  */
120
- createKey(app, options) {
121
- return __awaiter(this, void 0, void 0, function* () {
122
- const localVarAxiosArgs = yield localVarAxiosParamCreator.createKey(app, options);
123
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
124
- });
130
+ async createKey(app, options) {
131
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createKey(app, options);
132
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
125
133
  },
126
134
  /**
127
135
  *
@@ -129,11 +137,9 @@ const ApiKeyApiFp = function (configuration) {
129
137
  * @param {*} [options] Override http request option.
130
138
  * @throws {RequiredError}
131
139
  */
132
- getKeys(options) {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- const localVarAxiosArgs = yield localVarAxiosParamCreator.getKeys(options);
135
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
136
- });
140
+ async getKeys(options) {
141
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getKeys(options);
142
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
137
143
  },
138
144
  /**
139
145
  *
@@ -142,11 +148,9 @@ const ApiKeyApiFp = function (configuration) {
142
148
  * @param {*} [options] Override http request option.
143
149
  * @throws {RequiredError}
144
150
  */
145
- revokeKey(key, options) {
146
- return __awaiter(this, void 0, void 0, function* () {
147
- const localVarAxiosArgs = yield localVarAxiosParamCreator.revokeKey(key, options);
148
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
149
- });
151
+ async revokeKey(key, options) {
152
+ const localVarAxiosArgs = await localVarAxiosParamCreator.revokeKey(key, options);
153
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
150
154
  },
151
155
  };
152
156
  };