comic-vine-sdk 1.3.1 → 2.0.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 (557) hide show
  1. package/README.md +36 -732
  2. package/lib/index.cjs +1456 -0
  3. package/lib/index.cjs.map +7 -0
  4. package/lib/index.d.ts +2716 -0
  5. package/lib/index.js +845 -0
  6. package/lib/index.js.map +1 -0
  7. package/package.json +108 -54
  8. package/.gitattributes +0 -23
  9. package/.husky/pre-commit +0 -1
  10. package/.prettierignore +0 -1
  11. package/.prettierrc.json +0 -4
  12. package/.projen/tasks.json +0 -261
  13. package/.releaserc.json +0 -17
  14. package/CHANGELOG.md +0 -97
  15. package/CODE_OF_CONDUCT.md +0 -128
  16. package/CONTRIBUTING.md +0 -294
  17. package/eslint.config.js +0 -168
  18. package/lib/cjs/comic-vine.d.ts +0 -42
  19. package/lib/cjs/comic-vine.js +0 -92
  20. package/lib/cjs/errors/base-error.d.ts +0 -9
  21. package/lib/cjs/errors/base-error.js +0 -18
  22. package/lib/cjs/errors/custom-error.d.ts +0 -2
  23. package/lib/cjs/errors/custom-error.js +0 -12
  24. package/lib/cjs/errors/filter-error.d.ts +0 -4
  25. package/lib/cjs/errors/filter-error.js +0 -14
  26. package/lib/cjs/errors/generic-error.d.ts +0 -4
  27. package/lib/cjs/errors/generic-error.js +0 -14
  28. package/lib/cjs/errors/generic-request-error.d.ts +0 -10
  29. package/lib/cjs/errors/generic-request-error.js +0 -23
  30. package/lib/cjs/errors/index.d.ts +0 -10
  31. package/lib/cjs/errors/index.js +0 -27
  32. package/lib/cjs/errors/jsonp-callback-missing-error.d.ts +0 -4
  33. package/lib/cjs/errors/jsonp-callback-missing-error.js +0 -14
  34. package/lib/cjs/errors/object-not-found-error.d.ts +0 -4
  35. package/lib/cjs/errors/object-not-found-error.js +0 -14
  36. package/lib/cjs/errors/options-validation-error.d.ts +0 -4
  37. package/lib/cjs/errors/options-validation-error.js +0 -14
  38. package/lib/cjs/errors/subscriber-only-error.d.ts +0 -4
  39. package/lib/cjs/errors/subscriber-only-error.js +0 -14
  40. package/lib/cjs/errors/unauthorized-error.d.ts +0 -4
  41. package/lib/cjs/errors/unauthorized-error.js +0 -14
  42. package/lib/cjs/errors/url-format-error.d.ts +0 -4
  43. package/lib/cjs/errors/url-format-error.js +0 -14
  44. package/lib/cjs/http-client/http-client-factory.d.ts +0 -6
  45. package/lib/cjs/http-client/http-client-factory.js +0 -15
  46. package/lib/cjs/http-client/http-client.d.ts +0 -8
  47. package/lib/cjs/http-client/http-client.js +0 -71
  48. package/lib/cjs/http-client/index.d.ts +0 -1
  49. package/lib/cjs/http-client/index.js +0 -18
  50. package/lib/cjs/http-client/status-code.d.ts +0 -9
  51. package/lib/cjs/http-client/status-code.js +0 -14
  52. package/lib/cjs/http-client/url-builder.d.ts +0 -29
  53. package/lib/cjs/http-client/url-builder.js +0 -107
  54. package/lib/cjs/index.d.ts +0 -3
  55. package/lib/cjs/index.js +0 -5
  56. package/lib/cjs/options/index.d.ts +0 -20
  57. package/lib/cjs/options/index.js +0 -32
  58. package/lib/cjs/package.json +0 -3
  59. package/lib/cjs/resources/base-resource.d.ts +0 -19
  60. package/lib/cjs/resources/base-resource.js +0 -87
  61. package/lib/cjs/resources/character/character.d.ts +0 -6
  62. package/lib/cjs/resources/character/character.js +0 -13
  63. package/lib/cjs/resources/character/index.d.ts +0 -1
  64. package/lib/cjs/resources/character/index.js +0 -18
  65. package/lib/cjs/resources/character/types/character-details.d.ts +0 -110
  66. package/lib/cjs/resources/character/types/character-details.js +0 -3
  67. package/lib/cjs/resources/character/types/character-list-item.d.ts +0 -71
  68. package/lib/cjs/resources/character/types/character-list-item.js +0 -3
  69. package/lib/cjs/resources/character/types/index.d.ts +0 -2
  70. package/lib/cjs/resources/character/types/index.js +0 -19
  71. package/lib/cjs/resources/common-types.d.ts +0 -58
  72. package/lib/cjs/resources/common-types.js +0 -3
  73. package/lib/cjs/resources/concept/concept.d.ts +0 -6
  74. package/lib/cjs/resources/concept/concept.js +0 -13
  75. package/lib/cjs/resources/concept/index.d.ts +0 -1
  76. package/lib/cjs/resources/concept/index.js +0 -18
  77. package/lib/cjs/resources/concept/types/concept-details.d.ts +0 -58
  78. package/lib/cjs/resources/concept/types/concept-details.js +0 -3
  79. package/lib/cjs/resources/concept/types/concept-list-item.d.ts +0 -52
  80. package/lib/cjs/resources/concept/types/concept-list-item.js +0 -3
  81. package/lib/cjs/resources/concept/types/index.d.ts +0 -2
  82. package/lib/cjs/resources/concept/types/index.js +0 -19
  83. package/lib/cjs/resources/episode/episode.d.ts +0 -6
  84. package/lib/cjs/resources/episode/episode.js +0 -13
  85. package/lib/cjs/resources/episode/index.d.ts +0 -1
  86. package/lib/cjs/resources/episode/index.js +0 -18
  87. package/lib/cjs/resources/episode/types/episode-details.d.ts +0 -87
  88. package/lib/cjs/resources/episode/types/episode-details.js +0 -3
  89. package/lib/cjs/resources/episode/types/episode-list-item.d.ts +0 -53
  90. package/lib/cjs/resources/episode/types/episode-list-item.js +0 -3
  91. package/lib/cjs/resources/episode/types/index.d.ts +0 -2
  92. package/lib/cjs/resources/episode/types/index.js +0 -19
  93. package/lib/cjs/resources/index.d.ts +0 -3
  94. package/lib/cjs/resources/index.js +0 -20
  95. package/lib/cjs/resources/issue/index.d.ts +0 -1
  96. package/lib/cjs/resources/issue/index.js +0 -18
  97. package/lib/cjs/resources/issue/issue.d.ts +0 -6
  98. package/lib/cjs/resources/issue/issue.js +0 -13
  99. package/lib/cjs/resources/issue/types/index.d.ts +0 -2
  100. package/lib/cjs/resources/issue/types/index.js +0 -19
  101. package/lib/cjs/resources/issue/types/issue-details.d.ts +0 -94
  102. package/lib/cjs/resources/issue/types/issue-details.js +0 -3
  103. package/lib/cjs/resources/issue/types/issue-list-item.d.ts +0 -61
  104. package/lib/cjs/resources/issue/types/issue-list-item.js +0 -3
  105. package/lib/cjs/resources/location/index.d.ts +0 -1
  106. package/lib/cjs/resources/location/index.js +0 -18
  107. package/lib/cjs/resources/location/location.d.ts +0 -6
  108. package/lib/cjs/resources/location/location.js +0 -13
  109. package/lib/cjs/resources/location/types/index.d.ts +0 -2
  110. package/lib/cjs/resources/location/types/index.js +0 -19
  111. package/lib/cjs/resources/location/types/location-details.d.ts +0 -62
  112. package/lib/cjs/resources/location/types/location-details.js +0 -3
  113. package/lib/cjs/resources/location/types/location-list-item.d.ts +0 -55
  114. package/lib/cjs/resources/location/types/location-list-item.js +0 -3
  115. package/lib/cjs/resources/movie/index.d.ts +0 -1
  116. package/lib/cjs/resources/movie/index.js +0 -18
  117. package/lib/cjs/resources/movie/movie.d.ts +0 -6
  118. package/lib/cjs/resources/movie/movie.js +0 -13
  119. package/lib/cjs/resources/movie/types/index.d.ts +0 -2
  120. package/lib/cjs/resources/movie/types/index.js +0 -19
  121. package/lib/cjs/resources/movie/types/movie-details.d.ts +0 -91
  122. package/lib/cjs/resources/movie/types/movie-details.js +0 -3
  123. package/lib/cjs/resources/movie/types/movie-list-item.d.ts +0 -74
  124. package/lib/cjs/resources/movie/types/movie-list-item.js +0 -3
  125. package/lib/cjs/resources/origin/index.d.ts +0 -1
  126. package/lib/cjs/resources/origin/index.js +0 -18
  127. package/lib/cjs/resources/origin/origin.d.ts +0 -6
  128. package/lib/cjs/resources/origin/origin.js +0 -13
  129. package/lib/cjs/resources/origin/types/index.d.ts +0 -2
  130. package/lib/cjs/resources/origin/types/index.js +0 -19
  131. package/lib/cjs/resources/origin/types/origin-details.d.ts +0 -22
  132. package/lib/cjs/resources/origin/types/origin-details.js +0 -3
  133. package/lib/cjs/resources/origin/types/origin-list-item.d.ts +0 -18
  134. package/lib/cjs/resources/origin/types/origin-list-item.js +0 -3
  135. package/lib/cjs/resources/person/index.d.ts +0 -1
  136. package/lib/cjs/resources/person/index.js +0 -18
  137. package/lib/cjs/resources/person/person.d.ts +0 -6
  138. package/lib/cjs/resources/person/person.js +0 -13
  139. package/lib/cjs/resources/person/types/index.d.ts +0 -2
  140. package/lib/cjs/resources/person/types/index.js +0 -19
  141. package/lib/cjs/resources/person/types/person-details.d.ts +0 -82
  142. package/lib/cjs/resources/person/types/person-details.js +0 -3
  143. package/lib/cjs/resources/person/types/person-list-item.d.ts +0 -77
  144. package/lib/cjs/resources/person/types/person-list-item.js +0 -8
  145. package/lib/cjs/resources/power/index.d.ts +0 -1
  146. package/lib/cjs/resources/power/index.js +0 -18
  147. package/lib/cjs/resources/power/power.d.ts +0 -6
  148. package/lib/cjs/resources/power/power.js +0 -13
  149. package/lib/cjs/resources/power/types/index.d.ts +0 -2
  150. package/lib/cjs/resources/power/types/index.js +0 -19
  151. package/lib/cjs/resources/power/types/power-details.d.ts +0 -39
  152. package/lib/cjs/resources/power/types/power-details.js +0 -3
  153. package/lib/cjs/resources/power/types/power-list-item.d.ts +0 -34
  154. package/lib/cjs/resources/power/types/power-list-item.js +0 -3
  155. package/lib/cjs/resources/promo/index.d.ts +0 -1
  156. package/lib/cjs/resources/promo/index.js +0 -18
  157. package/lib/cjs/resources/promo/promo.d.ts +0 -6
  158. package/lib/cjs/resources/promo/promo.js +0 -13
  159. package/lib/cjs/resources/promo/types/index.d.ts +0 -2
  160. package/lib/cjs/resources/promo/types/index.js +0 -19
  161. package/lib/cjs/resources/promo/types/promo-details.d.ts +0 -40
  162. package/lib/cjs/resources/promo/types/promo-details.js +0 -3
  163. package/lib/cjs/resources/promo/types/promo-list-item.d.ts +0 -40
  164. package/lib/cjs/resources/promo/types/promo-list-item.js +0 -3
  165. package/lib/cjs/resources/publisher/index.d.ts +0 -1
  166. package/lib/cjs/resources/publisher/index.js +0 -18
  167. package/lib/cjs/resources/publisher/publisher.d.ts +0 -6
  168. package/lib/cjs/resources/publisher/publisher.js +0 -13
  169. package/lib/cjs/resources/publisher/types/index.d.ts +0 -2
  170. package/lib/cjs/resources/publisher/types/index.js +0 -19
  171. package/lib/cjs/resources/publisher/types/publisher-details.d.ts +0 -71
  172. package/lib/cjs/resources/publisher/types/publisher-details.js +0 -3
  173. package/lib/cjs/resources/publisher/types/publisher-list-item.d.ts +0 -61
  174. package/lib/cjs/resources/publisher/types/publisher-list-item.js +0 -11
  175. package/lib/cjs/resources/resource-factory.d.ts +0 -8
  176. package/lib/cjs/resources/resource-factory.js +0 -53
  177. package/lib/cjs/resources/resource-list.d.ts +0 -19
  178. package/lib/cjs/resources/resource-list.js +0 -36
  179. package/lib/cjs/resources/resource-map.d.ts +0 -7
  180. package/lib/cjs/resources/resource-map.js +0 -40
  181. package/lib/cjs/resources/resource-type.d.ts +0 -21
  182. package/lib/cjs/resources/resource-type.js +0 -27
  183. package/lib/cjs/resources/series/index.d.ts +0 -1
  184. package/lib/cjs/resources/series/index.js +0 -18
  185. package/lib/cjs/resources/series/series.d.ts +0 -6
  186. package/lib/cjs/resources/series/series.js +0 -13
  187. package/lib/cjs/resources/series/types/index.d.ts +0 -2
  188. package/lib/cjs/resources/series/types/index.js +0 -19
  189. package/lib/cjs/resources/series/types/series-details.d.ts +0 -68
  190. package/lib/cjs/resources/series/types/series-details.js +0 -3
  191. package/lib/cjs/resources/series/types/series-list-item.d.ts +0 -18
  192. package/lib/cjs/resources/series/types/series-list-item.js +0 -3
  193. package/lib/cjs/resources/story-arc/index.d.ts +0 -1
  194. package/lib/cjs/resources/story-arc/index.js +0 -18
  195. package/lib/cjs/resources/story-arc/story-arc.d.ts +0 -6
  196. package/lib/cjs/resources/story-arc/story-arc.js +0 -13
  197. package/lib/cjs/resources/story-arc/types/index.d.ts +0 -2
  198. package/lib/cjs/resources/story-arc/types/index.js +0 -19
  199. package/lib/cjs/resources/story-arc/types/story-arc-details.d.ts +0 -62
  200. package/lib/cjs/resources/story-arc/types/story-arc-details.js +0 -3
  201. package/lib/cjs/resources/story-arc/types/story-arc-list-item.d.ts +0 -53
  202. package/lib/cjs/resources/story-arc/types/story-arc-list-item.js +0 -3
  203. package/lib/cjs/resources/team/index.d.ts +0 -1
  204. package/lib/cjs/resources/team/index.js +0 -18
  205. package/lib/cjs/resources/team/team.d.ts +0 -6
  206. package/lib/cjs/resources/team/team.js +0 -13
  207. package/lib/cjs/resources/team/types/index.d.ts +0 -2
  208. package/lib/cjs/resources/team/types/index.js +0 -19
  209. package/lib/cjs/resources/team/types/team-details.d.ts +0 -80
  210. package/lib/cjs/resources/team/types/team-details.js +0 -3
  211. package/lib/cjs/resources/team/types/team-list-item.d.ts +0 -56
  212. package/lib/cjs/resources/team/types/team-list-item.js +0 -3
  213. package/lib/cjs/resources/thing/index.d.ts +0 -1
  214. package/lib/cjs/resources/thing/index.js +0 -18
  215. package/lib/cjs/resources/thing/thing.d.ts +0 -6
  216. package/lib/cjs/resources/thing/thing.js +0 -13
  217. package/lib/cjs/resources/thing/types/index.d.ts +0 -2
  218. package/lib/cjs/resources/thing/types/index.js +0 -19
  219. package/lib/cjs/resources/thing/types/thing-details.d.ts +0 -62
  220. package/lib/cjs/resources/thing/types/thing-details.js +0 -3
  221. package/lib/cjs/resources/thing/types/thing-list-item.d.ts +0 -55
  222. package/lib/cjs/resources/thing/types/thing-list-item.js +0 -3
  223. package/lib/cjs/resources/video/index.d.ts +0 -1
  224. package/lib/cjs/resources/video/index.js +0 -18
  225. package/lib/cjs/resources/video/types/index.d.ts +0 -2
  226. package/lib/cjs/resources/video/types/index.js +0 -19
  227. package/lib/cjs/resources/video/types/video-details.d.ts +0 -63
  228. package/lib/cjs/resources/video/types/video-details.js +0 -3
  229. package/lib/cjs/resources/video/types/video-list-item.d.ts +0 -85
  230. package/lib/cjs/resources/video/types/video-list-item.js +0 -28
  231. package/lib/cjs/resources/video/video.d.ts +0 -6
  232. package/lib/cjs/resources/video/video.js +0 -13
  233. package/lib/cjs/resources/video-category/index.d.ts +0 -1
  234. package/lib/cjs/resources/video-category/index.js +0 -18
  235. package/lib/cjs/resources/video-category/types/index.d.ts +0 -2
  236. package/lib/cjs/resources/video-category/types/index.js +0 -19
  237. package/lib/cjs/resources/video-category/types/video-category-details.d.ts +0 -24
  238. package/lib/cjs/resources/video-category/types/video-category-details.js +0 -3
  239. package/lib/cjs/resources/video-category/types/video-category-list-item.d.ts +0 -24
  240. package/lib/cjs/resources/video-category/types/video-category-list-item.js +0 -3
  241. package/lib/cjs/resources/video-category/video-category.d.ts +0 -6
  242. package/lib/cjs/resources/video-category/video-category.js +0 -13
  243. package/lib/cjs/resources/video-type/index.d.ts +0 -1
  244. package/lib/cjs/resources/video-type/index.js +0 -18
  245. package/lib/cjs/resources/video-type/types/index.d.ts +0 -2
  246. package/lib/cjs/resources/video-type/types/index.js +0 -19
  247. package/lib/cjs/resources/video-type/types/video-type-details.d.ts +0 -22
  248. package/lib/cjs/resources/video-type/types/video-type-details.js +0 -3
  249. package/lib/cjs/resources/video-type/types/video-type-list-item.d.ts +0 -22
  250. package/lib/cjs/resources/video-type/types/video-type-list-item.js +0 -3
  251. package/lib/cjs/resources/video-type/video-type.d.ts +0 -6
  252. package/lib/cjs/resources/video-type/video-type.js +0 -13
  253. package/lib/cjs/resources/volume/index.d.ts +0 -1
  254. package/lib/cjs/resources/volume/index.js +0 -18
  255. package/lib/cjs/resources/volume/types/index.d.ts +0 -2
  256. package/lib/cjs/resources/volume/types/index.js +0 -19
  257. package/lib/cjs/resources/volume/types/volume-details.d.ts +0 -77
  258. package/lib/cjs/resources/volume/types/volume-details.js +0 -3
  259. package/lib/cjs/resources/volume/types/volume-list-item.d.ts +0 -63
  260. package/lib/cjs/resources/volume/types/volume-list-item.js +0 -3
  261. package/lib/cjs/resources/volume/volume.d.ts +0 -6
  262. package/lib/cjs/resources/volume/volume.js +0 -13
  263. package/lib/cjs/types/apply-override.d.ts +0 -1
  264. package/lib/cjs/types/apply-override.js +0 -3
  265. package/lib/cjs/types/http-client.d.ts +0 -4
  266. package/lib/cjs/types/http-client.js +0 -3
  267. package/lib/cjs/types/index.d.ts +0 -7
  268. package/lib/cjs/types/index.js +0 -24
  269. package/lib/cjs/types/iso-date.d.ts +0 -7
  270. package/lib/cjs/types/iso-date.js +0 -3
  271. package/lib/cjs/types/pick-filters.d.ts +0 -6
  272. package/lib/cjs/types/pick-filters.js +0 -3
  273. package/lib/cjs/types/request.d.ts +0 -31
  274. package/lib/cjs/types/request.js +0 -3
  275. package/lib/cjs/types/response.d.ts +0 -10
  276. package/lib/cjs/types/response.js +0 -3
  277. package/lib/cjs/types/url-builder.d.ts +0 -6
  278. package/lib/cjs/types/url-builder.js +0 -3
  279. package/lib/cjs/types/valueof.d.ts +0 -1
  280. package/lib/cjs/types/valueof.js +0 -3
  281. package/lib/cjs/utils/case-converter.d.ts +0 -4
  282. package/lib/cjs/utils/case-converter.js +0 -34
  283. package/lib/cjs/utils/index.d.ts +0 -2
  284. package/lib/cjs/utils/index.js +0 -19
  285. package/lib/cjs/utils/is-object.d.ts +0 -1
  286. package/lib/cjs/utils/is-object.js +0 -8
  287. package/lib/esm/comic-vine.d.ts +0 -42
  288. package/lib/esm/comic-vine.js +0 -88
  289. package/lib/esm/errors/base-error.d.ts +0 -9
  290. package/lib/esm/errors/base-error.js +0 -14
  291. package/lib/esm/errors/custom-error.d.ts +0 -2
  292. package/lib/esm/errors/custom-error.js +0 -8
  293. package/lib/esm/errors/filter-error.d.ts +0 -4
  294. package/lib/esm/errors/filter-error.js +0 -10
  295. package/lib/esm/errors/generic-error.d.ts +0 -4
  296. package/lib/esm/errors/generic-error.js +0 -10
  297. package/lib/esm/errors/generic-request-error.d.ts +0 -10
  298. package/lib/esm/errors/generic-request-error.js +0 -18
  299. package/lib/esm/errors/index.d.ts +0 -10
  300. package/lib/esm/errors/index.js +0 -11
  301. package/lib/esm/errors/jsonp-callback-missing-error.d.ts +0 -4
  302. package/lib/esm/errors/jsonp-callback-missing-error.js +0 -10
  303. package/lib/esm/errors/object-not-found-error.d.ts +0 -4
  304. package/lib/esm/errors/object-not-found-error.js +0 -10
  305. package/lib/esm/errors/options-validation-error.d.ts +0 -4
  306. package/lib/esm/errors/options-validation-error.js +0 -10
  307. package/lib/esm/errors/subscriber-only-error.d.ts +0 -4
  308. package/lib/esm/errors/subscriber-only-error.js +0 -10
  309. package/lib/esm/errors/unauthorized-error.d.ts +0 -4
  310. package/lib/esm/errors/unauthorized-error.js +0 -10
  311. package/lib/esm/errors/url-format-error.d.ts +0 -4
  312. package/lib/esm/errors/url-format-error.js +0 -10
  313. package/lib/esm/http-client/http-client-factory.d.ts +0 -6
  314. package/lib/esm/http-client/http-client-factory.js +0 -11
  315. package/lib/esm/http-client/http-client.d.ts +0 -8
  316. package/lib/esm/http-client/http-client.js +0 -52
  317. package/lib/esm/http-client/index.d.ts +0 -1
  318. package/lib/esm/http-client/index.js +0 -2
  319. package/lib/esm/http-client/status-code.d.ts +0 -9
  320. package/lib/esm/http-client/status-code.js +0 -11
  321. package/lib/esm/http-client/url-builder.d.ts +0 -29
  322. package/lib/esm/http-client/url-builder.js +0 -103
  323. package/lib/esm/index.d.ts +0 -3
  324. package/lib/esm/index.js +0 -3
  325. package/lib/esm/options/index.d.ts +0 -20
  326. package/lib/esm/options/index.js +0 -28
  327. package/lib/esm/package.json +0 -3
  328. package/lib/esm/resources/base-resource.d.ts +0 -19
  329. package/lib/esm/resources/base-resource.js +0 -54
  330. package/lib/esm/resources/character/character.d.ts +0 -6
  331. package/lib/esm/resources/character/character.js +0 -9
  332. package/lib/esm/resources/character/index.d.ts +0 -1
  333. package/lib/esm/resources/character/index.js +0 -2
  334. package/lib/esm/resources/character/types/character-details.d.ts +0 -110
  335. package/lib/esm/resources/character/types/character-details.js +0 -2
  336. package/lib/esm/resources/character/types/character-list-item.d.ts +0 -71
  337. package/lib/esm/resources/character/types/character-list-item.js +0 -2
  338. package/lib/esm/resources/character/types/index.d.ts +0 -2
  339. package/lib/esm/resources/character/types/index.js +0 -3
  340. package/lib/esm/resources/common-types.d.ts +0 -58
  341. package/lib/esm/resources/common-types.js +0 -2
  342. package/lib/esm/resources/concept/concept.d.ts +0 -6
  343. package/lib/esm/resources/concept/concept.js +0 -9
  344. package/lib/esm/resources/concept/index.d.ts +0 -1
  345. package/lib/esm/resources/concept/index.js +0 -2
  346. package/lib/esm/resources/concept/types/concept-details.d.ts +0 -58
  347. package/lib/esm/resources/concept/types/concept-details.js +0 -2
  348. package/lib/esm/resources/concept/types/concept-list-item.d.ts +0 -52
  349. package/lib/esm/resources/concept/types/concept-list-item.js +0 -2
  350. package/lib/esm/resources/concept/types/index.d.ts +0 -2
  351. package/lib/esm/resources/concept/types/index.js +0 -3
  352. package/lib/esm/resources/episode/episode.d.ts +0 -6
  353. package/lib/esm/resources/episode/episode.js +0 -9
  354. package/lib/esm/resources/episode/index.d.ts +0 -1
  355. package/lib/esm/resources/episode/index.js +0 -2
  356. package/lib/esm/resources/episode/types/episode-details.d.ts +0 -87
  357. package/lib/esm/resources/episode/types/episode-details.js +0 -2
  358. package/lib/esm/resources/episode/types/episode-list-item.d.ts +0 -53
  359. package/lib/esm/resources/episode/types/episode-list-item.js +0 -2
  360. package/lib/esm/resources/episode/types/index.d.ts +0 -2
  361. package/lib/esm/resources/episode/types/index.js +0 -3
  362. package/lib/esm/resources/index.d.ts +0 -3
  363. package/lib/esm/resources/index.js +0 -4
  364. package/lib/esm/resources/issue/index.d.ts +0 -1
  365. package/lib/esm/resources/issue/index.js +0 -2
  366. package/lib/esm/resources/issue/issue.d.ts +0 -6
  367. package/lib/esm/resources/issue/issue.js +0 -9
  368. package/lib/esm/resources/issue/types/index.d.ts +0 -2
  369. package/lib/esm/resources/issue/types/index.js +0 -3
  370. package/lib/esm/resources/issue/types/issue-details.d.ts +0 -94
  371. package/lib/esm/resources/issue/types/issue-details.js +0 -2
  372. package/lib/esm/resources/issue/types/issue-list-item.d.ts +0 -61
  373. package/lib/esm/resources/issue/types/issue-list-item.js +0 -2
  374. package/lib/esm/resources/location/index.d.ts +0 -1
  375. package/lib/esm/resources/location/index.js +0 -2
  376. package/lib/esm/resources/location/location.d.ts +0 -6
  377. package/lib/esm/resources/location/location.js +0 -9
  378. package/lib/esm/resources/location/types/index.d.ts +0 -2
  379. package/lib/esm/resources/location/types/index.js +0 -3
  380. package/lib/esm/resources/location/types/location-details.d.ts +0 -62
  381. package/lib/esm/resources/location/types/location-details.js +0 -2
  382. package/lib/esm/resources/location/types/location-list-item.d.ts +0 -55
  383. package/lib/esm/resources/location/types/location-list-item.js +0 -2
  384. package/lib/esm/resources/movie/index.d.ts +0 -1
  385. package/lib/esm/resources/movie/index.js +0 -2
  386. package/lib/esm/resources/movie/movie.d.ts +0 -6
  387. package/lib/esm/resources/movie/movie.js +0 -9
  388. package/lib/esm/resources/movie/types/index.d.ts +0 -2
  389. package/lib/esm/resources/movie/types/index.js +0 -3
  390. package/lib/esm/resources/movie/types/movie-details.d.ts +0 -91
  391. package/lib/esm/resources/movie/types/movie-details.js +0 -2
  392. package/lib/esm/resources/movie/types/movie-list-item.d.ts +0 -74
  393. package/lib/esm/resources/movie/types/movie-list-item.js +0 -2
  394. package/lib/esm/resources/origin/index.d.ts +0 -1
  395. package/lib/esm/resources/origin/index.js +0 -2
  396. package/lib/esm/resources/origin/origin.d.ts +0 -6
  397. package/lib/esm/resources/origin/origin.js +0 -9
  398. package/lib/esm/resources/origin/types/index.d.ts +0 -2
  399. package/lib/esm/resources/origin/types/index.js +0 -3
  400. package/lib/esm/resources/origin/types/origin-details.d.ts +0 -22
  401. package/lib/esm/resources/origin/types/origin-details.js +0 -2
  402. package/lib/esm/resources/origin/types/origin-list-item.d.ts +0 -18
  403. package/lib/esm/resources/origin/types/origin-list-item.js +0 -2
  404. package/lib/esm/resources/person/index.d.ts +0 -1
  405. package/lib/esm/resources/person/index.js +0 -2
  406. package/lib/esm/resources/person/person.d.ts +0 -6
  407. package/lib/esm/resources/person/person.js +0 -9
  408. package/lib/esm/resources/person/types/index.d.ts +0 -2
  409. package/lib/esm/resources/person/types/index.js +0 -3
  410. package/lib/esm/resources/person/types/person-details.d.ts +0 -82
  411. package/lib/esm/resources/person/types/person-details.js +0 -2
  412. package/lib/esm/resources/person/types/person-list-item.d.ts +0 -77
  413. package/lib/esm/resources/person/types/person-list-item.js +0 -5
  414. package/lib/esm/resources/power/index.d.ts +0 -1
  415. package/lib/esm/resources/power/index.js +0 -2
  416. package/lib/esm/resources/power/power.d.ts +0 -6
  417. package/lib/esm/resources/power/power.js +0 -9
  418. package/lib/esm/resources/power/types/index.d.ts +0 -2
  419. package/lib/esm/resources/power/types/index.js +0 -3
  420. package/lib/esm/resources/power/types/power-details.d.ts +0 -39
  421. package/lib/esm/resources/power/types/power-details.js +0 -2
  422. package/lib/esm/resources/power/types/power-list-item.d.ts +0 -34
  423. package/lib/esm/resources/power/types/power-list-item.js +0 -2
  424. package/lib/esm/resources/promo/index.d.ts +0 -1
  425. package/lib/esm/resources/promo/index.js +0 -2
  426. package/lib/esm/resources/promo/promo.d.ts +0 -6
  427. package/lib/esm/resources/promo/promo.js +0 -9
  428. package/lib/esm/resources/promo/types/index.d.ts +0 -2
  429. package/lib/esm/resources/promo/types/index.js +0 -3
  430. package/lib/esm/resources/promo/types/promo-details.d.ts +0 -40
  431. package/lib/esm/resources/promo/types/promo-details.js +0 -2
  432. package/lib/esm/resources/promo/types/promo-list-item.d.ts +0 -40
  433. package/lib/esm/resources/promo/types/promo-list-item.js +0 -2
  434. package/lib/esm/resources/publisher/index.d.ts +0 -1
  435. package/lib/esm/resources/publisher/index.js +0 -2
  436. package/lib/esm/resources/publisher/publisher.d.ts +0 -6
  437. package/lib/esm/resources/publisher/publisher.js +0 -9
  438. package/lib/esm/resources/publisher/types/index.d.ts +0 -2
  439. package/lib/esm/resources/publisher/types/index.js +0 -3
  440. package/lib/esm/resources/publisher/types/publisher-details.d.ts +0 -71
  441. package/lib/esm/resources/publisher/types/publisher-details.js +0 -2
  442. package/lib/esm/resources/publisher/types/publisher-list-item.d.ts +0 -61
  443. package/lib/esm/resources/publisher/types/publisher-list-item.js +0 -8
  444. package/lib/esm/resources/resource-factory.d.ts +0 -8
  445. package/lib/esm/resources/resource-factory.js +0 -16
  446. package/lib/esm/resources/resource-list.d.ts +0 -19
  447. package/lib/esm/resources/resource-list.js +0 -20
  448. package/lib/esm/resources/resource-map.d.ts +0 -7
  449. package/lib/esm/resources/resource-map.js +0 -36
  450. package/lib/esm/resources/resource-type.d.ts +0 -21
  451. package/lib/esm/resources/resource-type.js +0 -24
  452. package/lib/esm/resources/series/index.d.ts +0 -1
  453. package/lib/esm/resources/series/index.js +0 -2
  454. package/lib/esm/resources/series/series.d.ts +0 -6
  455. package/lib/esm/resources/series/series.js +0 -9
  456. package/lib/esm/resources/series/types/index.d.ts +0 -2
  457. package/lib/esm/resources/series/types/index.js +0 -3
  458. package/lib/esm/resources/series/types/series-details.d.ts +0 -68
  459. package/lib/esm/resources/series/types/series-details.js +0 -2
  460. package/lib/esm/resources/series/types/series-list-item.d.ts +0 -18
  461. package/lib/esm/resources/series/types/series-list-item.js +0 -2
  462. package/lib/esm/resources/story-arc/index.d.ts +0 -1
  463. package/lib/esm/resources/story-arc/index.js +0 -2
  464. package/lib/esm/resources/story-arc/story-arc.d.ts +0 -6
  465. package/lib/esm/resources/story-arc/story-arc.js +0 -9
  466. package/lib/esm/resources/story-arc/types/index.d.ts +0 -2
  467. package/lib/esm/resources/story-arc/types/index.js +0 -3
  468. package/lib/esm/resources/story-arc/types/story-arc-details.d.ts +0 -62
  469. package/lib/esm/resources/story-arc/types/story-arc-details.js +0 -2
  470. package/lib/esm/resources/story-arc/types/story-arc-list-item.d.ts +0 -53
  471. package/lib/esm/resources/story-arc/types/story-arc-list-item.js +0 -2
  472. package/lib/esm/resources/team/index.d.ts +0 -1
  473. package/lib/esm/resources/team/index.js +0 -2
  474. package/lib/esm/resources/team/team.d.ts +0 -6
  475. package/lib/esm/resources/team/team.js +0 -9
  476. package/lib/esm/resources/team/types/index.d.ts +0 -2
  477. package/lib/esm/resources/team/types/index.js +0 -3
  478. package/lib/esm/resources/team/types/team-details.d.ts +0 -80
  479. package/lib/esm/resources/team/types/team-details.js +0 -2
  480. package/lib/esm/resources/team/types/team-list-item.d.ts +0 -56
  481. package/lib/esm/resources/team/types/team-list-item.js +0 -2
  482. package/lib/esm/resources/thing/index.d.ts +0 -1
  483. package/lib/esm/resources/thing/index.js +0 -2
  484. package/lib/esm/resources/thing/thing.d.ts +0 -6
  485. package/lib/esm/resources/thing/thing.js +0 -9
  486. package/lib/esm/resources/thing/types/index.d.ts +0 -2
  487. package/lib/esm/resources/thing/types/index.js +0 -3
  488. package/lib/esm/resources/thing/types/thing-details.d.ts +0 -62
  489. package/lib/esm/resources/thing/types/thing-details.js +0 -2
  490. package/lib/esm/resources/thing/types/thing-list-item.d.ts +0 -55
  491. package/lib/esm/resources/thing/types/thing-list-item.js +0 -2
  492. package/lib/esm/resources/video/index.d.ts +0 -1
  493. package/lib/esm/resources/video/index.js +0 -2
  494. package/lib/esm/resources/video/types/index.d.ts +0 -2
  495. package/lib/esm/resources/video/types/index.js +0 -3
  496. package/lib/esm/resources/video/types/video-details.d.ts +0 -63
  497. package/lib/esm/resources/video/types/video-details.js +0 -2
  498. package/lib/esm/resources/video/types/video-list-item.d.ts +0 -85
  499. package/lib/esm/resources/video/types/video-list-item.js +0 -25
  500. package/lib/esm/resources/video/video.d.ts +0 -6
  501. package/lib/esm/resources/video/video.js +0 -9
  502. package/lib/esm/resources/video-category/index.d.ts +0 -1
  503. package/lib/esm/resources/video-category/index.js +0 -2
  504. package/lib/esm/resources/video-category/types/index.d.ts +0 -2
  505. package/lib/esm/resources/video-category/types/index.js +0 -3
  506. package/lib/esm/resources/video-category/types/video-category-details.d.ts +0 -24
  507. package/lib/esm/resources/video-category/types/video-category-details.js +0 -2
  508. package/lib/esm/resources/video-category/types/video-category-list-item.d.ts +0 -24
  509. package/lib/esm/resources/video-category/types/video-category-list-item.js +0 -2
  510. package/lib/esm/resources/video-category/video-category.d.ts +0 -6
  511. package/lib/esm/resources/video-category/video-category.js +0 -9
  512. package/lib/esm/resources/video-type/index.d.ts +0 -1
  513. package/lib/esm/resources/video-type/index.js +0 -2
  514. package/lib/esm/resources/video-type/types/index.d.ts +0 -2
  515. package/lib/esm/resources/video-type/types/index.js +0 -3
  516. package/lib/esm/resources/video-type/types/video-type-details.d.ts +0 -22
  517. package/lib/esm/resources/video-type/types/video-type-details.js +0 -2
  518. package/lib/esm/resources/video-type/types/video-type-list-item.d.ts +0 -22
  519. package/lib/esm/resources/video-type/types/video-type-list-item.js +0 -2
  520. package/lib/esm/resources/video-type/video-type.d.ts +0 -6
  521. package/lib/esm/resources/video-type/video-type.js +0 -9
  522. package/lib/esm/resources/volume/index.d.ts +0 -1
  523. package/lib/esm/resources/volume/index.js +0 -2
  524. package/lib/esm/resources/volume/types/index.d.ts +0 -2
  525. package/lib/esm/resources/volume/types/index.js +0 -3
  526. package/lib/esm/resources/volume/types/volume-details.d.ts +0 -77
  527. package/lib/esm/resources/volume/types/volume-details.js +0 -2
  528. package/lib/esm/resources/volume/types/volume-list-item.d.ts +0 -63
  529. package/lib/esm/resources/volume/types/volume-list-item.js +0 -2
  530. package/lib/esm/resources/volume/volume.d.ts +0 -6
  531. package/lib/esm/resources/volume/volume.js +0 -9
  532. package/lib/esm/types/apply-override.d.ts +0 -1
  533. package/lib/esm/types/apply-override.js +0 -2
  534. package/lib/esm/types/http-client.d.ts +0 -4
  535. package/lib/esm/types/http-client.js +0 -2
  536. package/lib/esm/types/index.d.ts +0 -7
  537. package/lib/esm/types/index.js +0 -8
  538. package/lib/esm/types/iso-date.d.ts +0 -7
  539. package/lib/esm/types/iso-date.js +0 -2
  540. package/lib/esm/types/pick-filters.d.ts +0 -6
  541. package/lib/esm/types/pick-filters.js +0 -2
  542. package/lib/esm/types/request.d.ts +0 -31
  543. package/lib/esm/types/request.js +0 -2
  544. package/lib/esm/types/response.d.ts +0 -10
  545. package/lib/esm/types/response.js +0 -2
  546. package/lib/esm/types/url-builder.d.ts +0 -6
  547. package/lib/esm/types/url-builder.js +0 -2
  548. package/lib/esm/types/valueof.d.ts +0 -1
  549. package/lib/esm/types/valueof.js +0 -2
  550. package/lib/esm/utils/case-converter.d.ts +0 -4
  551. package/lib/esm/utils/case-converter.js +0 -27
  552. package/lib/esm/utils/index.d.ts +0 -2
  553. package/lib/esm/utils/index.js +0 -3
  554. package/lib/esm/utils/is-object.d.ts +0 -1
  555. package/lib/esm/utils/is-object.js +0 -4
  556. package/scripts/create-package-json.ts +0 -29
  557. package/vitest.config.ts +0 -8
package/README.md CHANGED
@@ -1,761 +1,65 @@
1
1
  # Comic Vine SDK
2
2
 
3
- [![NPM Version](https://img.shields.io/npm/v/comic-vine-sdk)](https://www.npmjs.com/package/comic-vine-sdk)
4
- [![License](https://img.shields.io/npm/l/comic-vine-sdk)](https://github.com/AllyMurray/comic-vine/blob/main/LICENSE)
5
- [![Node.js Version](https://img.shields.io/node/v/comic-vine-sdk)](https://nodejs.org/)
6
- [![TypeScript](https://img.shields.io/badge/TypeScript-Ready-blue)](https://www.typescriptlang.org/)
3
+ A TypeScript client library for the [Comic Vine API](https://comicvine.gamespot.com/api/) with built-in caching, deduplication, and rate limiting. HTTP, caching, deduplication, and rate limiting are delegated to [`@http-client-toolkit/core`](https://github.com/AllyMurray/http-client-toolkit).
7
4
 
8
- The Comic Vine SDK provides convenient access to the [Comic Vine API][comic-vine-api] from applications written in JavaScript/TypeScript. The API provides full access to the structured-wiki content.
5
+ ## Features
9
6
 
10
- ## Table of Contents
11
-
12
- - [Requirements](#requirements)
13
- - [Installation](#installation)
14
- - [Quick Start](#quick-start)
15
- - [API Key Security](#api-key-security)
16
- - [Rate Limiting](#rate-limiting)
17
- - [Error Handling](#error-handling)
18
- - [Advanced Usage](#advanced-usage)
19
- - [Roadmap](#roadmap)
20
- - [Comic Vine Resources](#comic-vine-resources)
21
- - [Usage/Examples](#usageexamples)
22
- - [Initialization](#initialization)
23
- - [Options](#options)
24
- - [Fetch a single resource](#fetch-a-single-resource)
25
- - [Fetch a resource list](#fetch-a-resource-list)
26
- - [Limit the fields in the response payload](#limit-the-fields-in-the-response-payload)
27
- - [Pagination](#pagination)
28
- - [Auto Pagination](#auto-pagination)
29
- - [Run Locally](#run-locally)
30
- - [Authors](#authors)
31
-
32
- ## Requirements
33
-
34
- - Node.js 20.0.0 or higher
35
- - npm, yarn, or pnpm
36
-
37
- ## Installation
38
-
39
- Choose your preferred package manager:
40
-
41
- **pnpm**
42
-
43
- ```sh
44
- pnpm add comic-vine-sdk
45
- ```
46
-
47
- **npm**
48
-
49
- ```sh
50
- npm install comic-vine-sdk
51
- ```
52
-
53
- **yarn**
54
-
55
- ```sh
56
- yarn add comic-vine-sdk
57
- ```
7
+ - **Type-safe API** with detailed type definitions for all 19 Comic Vine resources
8
+ - **Field selection** with automatic TypeScript type narrowing
9
+ - **Automatic pagination** via async iteration
10
+ - **Caching, deduplication, and rate limiting** via `@http-client-toolkit/core`
11
+ - **Comprehensive error handling** with domain-specific error types
58
12
 
59
13
  ## Quick Start
60
14
 
61
- ```js
62
- import ComicVine from 'comic-vine-sdk';
63
-
64
- // Initialize the client
65
- const comicVine = new ComicVine('your-api-key-here');
66
-
67
- // Fetch a single publisher
68
- const publisher = await comicVine.publisher.retrieve(1859);
69
- console.log(publisher.name);
70
-
71
- // Fetch a list of issues
72
- const issues = await comicVine.issue.list({ limit: 10 });
73
- console.log(issues.data.map((issue) => issue.name));
74
-
75
- // Fetch with field limiting
76
- const limitedIssue = await comicVine.issue.retrieve(1234, {
77
- fieldList: ['id', 'name', 'description'],
78
- });
79
- console.log(limitedIssue.name);
80
- ```
81
-
82
- ## API Key Security
83
-
84
- ⚠️ **Important**: Never expose your API key in client-side code or commit it to version control.
85
-
86
- ### Environment Variables (Recommended)
87
-
88
- **Create a .env file:**
89
-
90
- ```bash
91
- # .env file
92
- COMIC_VINE_API_KEY=your-api-key-here
93
- ```
94
-
95
- **Use in your application:**
96
-
97
- ```js
15
+ ```typescript
98
16
  import ComicVine from 'comic-vine-sdk';
99
17
 
100
- const comicVine = new ComicVine(process.env.COMIC_VINE_API_KEY);
101
- ```
102
-
103
- ### Browser Usage
104
-
105
- The Comic Vine API doesn't support CORS. For browser usage, you'll need:
106
-
107
- - A backend proxy to make API calls
108
- - Server-side API key storage (never send keys to the browser)
109
-
110
- **Example proxy setup:**
111
-
112
- ```js
113
- // Backend API route (Express.js example)
114
- app.get('/api/comic-vine/publisher/:id', async (req, res) => {
115
- try {
116
- const comicVine = new ComicVine(process.env.COMIC_VINE_API_KEY);
117
- const publisher = await comicVine.publisher.retrieve(req.params.id);
118
- res.json(publisher);
119
- } catch (error) {
120
- res.status(500).json({ error: error.message });
121
- }
122
- });
123
- ```
124
-
125
- ## TypeScript Typings
126
-
127
- There's a good chance you may find an issue with the typings in the API response objects. They were generated using sample data from the API, if you find a problem [open an issue](https://github.com/AllyMurray/comic-vine/issues/new) detailing the problem along with the request details so I can add that request to the sample dataset. While you wait for it to be fixed add `// @ts-expect-error` above the line causing the problem. This will allow you to compile in the meantime but will flag when the problem has been fixed.
128
-
129
- ## Rate Limiting
130
-
131
- The Comic Vine API implements rate limiting to ensure fair usage and API health for all users.
132
-
133
- > ⚠️ **Note**: This library will soon include built-in solutions for caching, request deduplication, and rate limiting. The examples below are temporary workarounds until these features are available.
134
-
135
- ### Limits
136
-
137
- - **200 requests per resource per hour** - Official limit per user
138
- - **Velocity detection** - Prevents too many requests per second
139
- - **Temporary blocks** - May occur if limits are exceeded
140
-
141
- ### Best Practices
142
-
143
- **Cache responses** to avoid duplicate requests:
144
-
145
- ```js
146
- // Example: Simple in-memory cache
147
- const cache = new Map();
148
-
149
- async function getCachedPublisher(id) {
150
- const cacheKey = `publisher-${id}`;
151
-
152
- if (cache.has(cacheKey)) {
153
- return cache.get(cacheKey);
154
- }
155
-
156
- const publisher = await comicVine.publisher.retrieve(id);
157
- cache.set(cacheKey, publisher);
158
-
159
- return publisher;
160
- }
161
- ```
162
-
163
- **Implement delays** between requests:
164
-
165
- ```js
166
- // Example: Add delay between requests
167
- async function fetchMultipleIssues(ids) {
168
- const issues = [];
169
-
170
- for (const id of ids) {
171
- const issue = await comicVine.issue.retrieve(id);
172
- issues.push(issue);
173
-
174
- // Wait 100ms between requests
175
- await new Promise((resolve) => setTimeout(resolve, 100));
176
- }
177
-
178
- return issues;
179
- }
180
- ```
181
-
182
- **Use pagination wisely**:
183
-
184
- ```js
185
- // Instead of making many small requests
186
- const issues = await comicVine.issue.list({ limit: 100 }); // Better
187
- // Rather than
188
- const issues = await comicVine.issue.list({ limit: 10 }); // Less efficient
189
- ```
190
-
191
- ## Error Handling
192
-
193
- The Comic Vine SDK provides specific error types to help you handle different failure scenarios gracefully.
194
-
195
- ### Error Types
196
-
197
- All errors extend the base `BaseError` class and include:
198
-
199
- - `message`: Human-readable error description
200
- - `help`: Guidance on how to resolve the issue
201
-
202
- **Common Error Types:**
203
-
204
- | Error Type | When It Occurs | How to Handle |
205
- | ------------------------------ | ----------------------- | -------------------------------- |
206
- | `ComicVineUnauthorizedError` | Invalid API key | Check your API key |
207
- | `ComicVineObjectNotFoundError` | Resource doesn't exist | Verify the resource ID |
208
- | `OptionsValidationError` | Invalid request options | Check your parameters |
209
- | `ComicVineGenericRequestError` | API request failed | Retry or check API status |
210
- | `ComicVineSubscriberOnlyError` | Premium content access | Requires Comic Vine subscription |
211
-
212
- ### Basic Error Handling
213
-
214
- **Simple try-catch:**
215
-
216
- ```js
217
- import ComicVine from 'comic-vine-sdk';
218
-
219
- const comicVine = new ComicVine('your-api-key-here');
220
-
221
- try {
222
- const publisher = await comicVine.publisher.retrieve(999999);
223
- console.log(publisher.name);
224
- } catch (error) {
225
- console.error('Error:', error.message);
226
- console.error('Help:', error.help);
227
- }
228
- ```
229
-
230
- ### Specific Error Handling
231
-
232
- **Handle different error types:**
233
-
234
- ```js
235
- import ComicVine, {
236
- ComicVineUnauthorizedError,
237
- ComicVineObjectNotFoundError,
238
- OptionsValidationError,
239
- } from 'comic-vine-sdk';
240
-
241
- const comicVine = new ComicVine('your-api-key-here');
242
-
243
- try {
244
- const issue = await comicVine.issue.retrieve(999999);
245
- } catch (error) {
246
- if (error instanceof ComicVineUnauthorizedError) {
247
- console.error(
248
- 'Invalid API key. Get one from: https://comicvine.gamespot.com/api/',
249
- );
250
- } else if (error instanceof ComicVineObjectNotFoundError) {
251
- console.error('Issue not found. Please check the ID.');
252
- } else if (error instanceof OptionsValidationError) {
253
- console.error('Invalid request parameters:', error.message);
254
- } else {
255
- console.error('Unexpected error:', error.message);
256
- }
257
- }
258
- ```
259
-
260
- ### Robust Error Handling with Retry
261
-
262
- **Implement retry logic for transient errors:**
263
-
264
- ```js
265
- async function fetchWithRetry(fetchFn, maxRetries = 3) {
266
- for (let attempt = 1; attempt <= maxRetries; attempt++) {
267
- try {
268
- return await fetchFn();
269
- } catch (error) {
270
- // Don't retry on client errors
271
- if (
272
- error instanceof ComicVineUnauthorizedError ||
273
- error instanceof ComicVineObjectNotFoundError ||
274
- error instanceof OptionsValidationError
275
- ) {
276
- throw error;
277
- }
278
-
279
- // Retry on server errors
280
- if (attempt === maxRetries) {
281
- throw error;
282
- }
283
-
284
- // Wait before retrying (exponential backoff)
285
- const delay = Math.pow(2, attempt) * 1000;
286
- await new Promise((resolve) => setTimeout(resolve, delay));
287
- }
288
- }
289
- }
290
-
291
- // Usage
292
- try {
293
- const publisher = await fetchWithRetry(() =>
294
- comicVine.publisher.retrieve(1859),
295
- );
296
- console.log(publisher.name);
297
- } catch (error) {
298
- console.error('Failed after retries:', error.message);
299
- }
300
- ```
301
-
302
- ### Error Handling in Lists
303
-
304
- **Handle errors when processing multiple items:**
305
-
306
- ```js
307
- async function fetchMultipleIssues(ids) {
308
- const results = [];
309
- const errors = [];
310
-
311
- for (const id of ids) {
312
- try {
313
- const issue = await comicVine.issue.retrieve(id);
314
- results.push({ id, issue });
315
- } catch (error) {
316
- errors.push({ id, error: error.message });
317
- }
318
- }
319
-
320
- return { results, errors };
321
- }
322
-
323
- // Usage
324
- const { results, errors } = await fetchMultipleIssues([1, 2, 999999]);
325
- console.log(`Successfully fetched: ${results.length}`);
326
- console.log(`Errors: ${errors.length}`);
327
- ```
328
-
329
- ## Advanced Usage
330
-
331
- ### Available Filters
332
-
333
- Common filter options for list methods:
334
-
335
- **Filter by name:**
336
-
337
- ```js
338
- const issues = await comicVine.issue.list({
339
- filter: { name: 'The Boys' },
340
- });
341
- ```
342
-
343
- **Filter by date range:**
344
-
345
- ```js
346
- const recentIssues = await comicVine.issue.list({
347
- filter: {
348
- date_added: '2024-01-01 00:00:00|2024-12-31 23:59:59',
349
- },
350
- });
351
- ```
352
-
353
- **Multiple filters:**
18
+ const client = new ComicVine({ apiKey: 'your-api-key' });
354
19
 
355
- ```js
356
- const filteredIssues = await comicVine.issue.list({
357
- filter: {
358
- name: 'Spider-Man',
359
- date_added: '2024-01-01 00:00:00|2024-12-31 23:59:59',
360
- },
361
- });
362
- ```
363
-
364
- **Publisher-specific content:**
365
-
366
- ```js
367
- const marvelIssues = await comicVine.issue.list({
368
- filter: {
369
- publisher: 'Marvel Comics',
370
- },
371
- limit: 50,
372
- });
373
- ```
374
-
375
- ### Common Field Lists
376
-
377
- **Minimal issue data:**
378
-
379
- ```js
380
- const lightIssue = await comicVine.issue.retrieve(1234, {
381
- fieldList: ['id', 'name', 'issue_number'],
382
- });
383
- ```
384
-
385
- **Full issue details:**
386
-
387
- ```js
388
- const fullIssue = await comicVine.issue.retrieve(1234, {
389
- fieldList: ['id', 'name', 'description', 'cover_date', 'image', 'volume'],
390
- });
391
- ```
20
+ // Get a specific issue
21
+ const issue = await client.issue.retrieve(1);
392
22
 
393
- **Character essentials:**
394
-
395
- ```js
396
- const character = await comicVine.character.retrieve(1234, {
397
- fieldList: ['id', 'name', 'description', 'image', 'publisher', 'powers'],
398
- });
399
- ```
400
-
401
- **Publisher overview:**
402
-
403
- ```js
404
- const publisher = await comicVine.publisher.retrieve(1234, {
405
- fieldList: [
406
- 'id',
407
- 'name',
408
- 'description',
409
- 'image',
410
- 'date_added',
411
- 'location_city',
412
- ],
413
- });
414
- ```
415
-
416
- ### Sorting and Ordering
417
-
418
- **Sort by date (newest first):**
419
-
420
- ```js
421
- const recentIssues = await comicVine.issue.list({
422
- sort: 'date_added:desc',
23
+ // Search for characters
24
+ const characters = await client.character.list({
25
+ filter: { name: 'Spider-Man' },
423
26
  limit: 10,
424
27
  });
425
- ```
426
-
427
- **Sort by name:**
428
-
429
- ```js
430
- const sortedCharacters = await comicVine.character.list({
431
- sort: 'name:asc',
432
- limit: 100,
433
- });
434
- ```
435
-
436
- ### Complex Queries
437
-
438
- **Combine multiple options:**
439
-
440
- ```js
441
- const complexQuery = await comicVine.issue.list({
442
- filter: {
443
- name: 'Spider-Man',
444
- date_added: '2024-01-01 00:00:00|2024-12-31 23:59:59',
445
- },
446
- fieldList: ['id', 'name', 'issue_number', 'cover_date', 'image'],
447
- sort: 'cover_date:desc',
448
- limit: 25,
449
- offset: 0,
450
- });
451
- ```
452
-
453
- ## Roadmap
454
-
455
- - Expandable responses
456
-
457
- - Cached responses
458
-
459
- - Rate limiting
460
-
461
- ## Comic Vine Resources
462
-
463
- [Comic Vine resources list][comic-vine-docs]
464
-
465
- The library exposes an object for each Comic Vine resource, the object names are singular and expose a retrieve method that maps to the singular resource and a list method that maps to the plural resource.
466
-
467
- The following table lists the resources that have been implemented and how the `retrieve` and `list` methods map to the API. Most resources are a direct mapping but `object` has been mapped to `thing`, this is due to `object` being a reserved word in JS and `thing` matches the Comic Vine wiki.
468
-
469
- | Library resource object | Retrieve Method API Resource | List Method API Resource |
470
- | ----------------------- | ------------------------------------- | ----------------------------------------- |
471
- | character | [character][character-docs] | [characters][characters-docs] |
472
- | concept | [concept][concept-docs] | [concepts][concepts-docs] |
473
- | episode | [episode][episode-docs] | [episodes][episodes-docs] |
474
- | issue | [issue][issue-docs] | [issues][issues-docs] |
475
- | location | [location][location-docs] | [locations][locations-docs] |
476
- | movie | [movie][movie-docs] | [movies][movies-docs] |
477
- | origin | [origin][origin-docs] | [origins][origins-docs] |
478
- | person | [person][person-docs] | [people][people-docs] |
479
- | power | [power][power-docs] | [powers][powers-docs] |
480
- | promo | [promo][promo-docs] | [promos][promos-docs] |
481
- | publisher | [publisher][publisher-docs] | [publishers][publishers-docs] |
482
- | series | [series][series-docs] | [series_list][series-list-docs] |
483
- | storyArc | [story_arc][story-arc-docs] | [story_arcs][story-arcs-docs] |
484
- | team | [team][team-docs] | [teams][teams-docs] |
485
- | thing | [object][object-docs] | [objects][objects-docs] |
486
- | video | [video][video-docs] | [videos][videos-docs] |
487
- | videoCategory | [video_category][video-category-docs] | [video_categories][video-categories-docs] |
488
- | videoType | [video_type][video-type-docs] | [video_types][video-types-docs] |
489
- | volume | [volume][volume-docs] | [volumes][volumes-docs] |
490
28
 
491
- ## Usage/Examples
492
-
493
- ### Initialization
494
-
495
- The package needs to be configured with your API key, [Grab an API key][comic-vine-api]. Require it with the key's value:
496
-
497
- ```js
498
- const ComicVine = require('comic-vine-sdk');
499
- const comicVine = new ComicVine('your-api-key-here');
500
-
501
- comicVine.publisher
502
- .retrieve(1859)
503
- .then((publisher) => console.log(publisher.id))
504
- .catch((error) => console.error(error));
505
- ```
506
-
507
- Or using ES modules and `async`/`await`:
508
-
509
- ```js
510
- import ComicVine from 'comic-vine-sdk';
511
- const comicVine = new ComicVine('your-api-key-here');
512
-
513
- (async () => {
514
- try {
515
- const publisher = await comicVine.publisher.retrieve(1859);
516
- console.log(publisher.name);
517
- } catch (error) {
518
- console.error(error);
519
- }
520
- })();
521
- ```
522
-
523
- ### Options
524
-
525
- The second parameter of the constructor accepts options to configure the library
526
-
527
- ```js
528
- new ComicVine('your-api-key-here', options);
529
- ```
530
-
531
- ### `baseUrl`
532
-
533
- **Type: <code>string | undefined</code>**
534
-
535
- **Default: https://comicvine.gamespot.com/api/**
536
-
537
- If using this package in node this should not need set, the default value will work.
538
-
539
- If using the package in a web browser then The Comic Vine API does not allow [cross-origin](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) requests. This option could be used to proxy the request assuming you have some safe way for the web client to fetch your api key, you don't want to send the api key to the browser in your JS bundle.
540
-
541
- ```js
542
- import ComicVine from 'comic-vine-sdk';
543
-
544
- // This is just an example, to try it out you would
545
- // have to visit (https://cors-anywhere.herokuapp.com)
546
- // to request temporary access.
547
- const comicVine = new ComicVine('your-api-key-here', {
548
- baseUrl: 'https://cors-anywhere.herokuapp.com/https://www.comicvine.com/api/',
549
- });
550
-
551
- (async () => {
552
- try {
553
- const publisher = await comicVine.publisher.retrieve(1859);
554
- console.log(publisher.name);
555
- } catch (error) {
556
- console.error(error);
557
- }
558
- })();
559
- ```
560
-
561
- ### Fetch a single resource
562
-
563
- All resources have a retrieve method, the following example retrieves a publisher
564
-
565
- ```js
566
- import ComicVine from 'comic-vine-sdk';
567
- const comicVine = new ComicVine('your-api-key-here');
568
-
569
- (async () => {
570
- try {
571
- const publisher = await comicVine.publisher.retrieve(1859);
572
- console.log(publisher.name);
573
- } catch (error) {
574
- console.error(error);
575
- }
576
- })();
577
- ```
578
-
579
- ### Fetch a resource list
580
-
581
- All resources have a list method, the following example retrieves a list of publishers
582
-
583
- ```js
584
- import ComicVine from 'comic-vine-sdk';
585
- const comicVine = new ComicVine('your-api-key-here');
586
-
587
- (async () => {
588
- try {
589
- const publishers = await comicVine.publisher.list();
590
- console.log(publishers.data);
591
- } catch (error) {
592
- console.error(error);
593
- }
594
- })();
595
- ```
596
-
597
- ### Limit the fields in the response payload
598
-
599
- When making a request it's likely that only certain properties are required. Both the retrieve and list methods accept options as the second parameter. This can be used to specify the field list.
600
-
601
- When using TypeScript this is type safe, the return type is narrowed to the field list so that intellisense only displays the properties available in the response.
602
-
603
- ```js
604
- import ComicVine from 'comic-vine-sdk';
605
- const comicVine = new ComicVine('your-api-key-here');
606
-
607
- (async () => {
608
- try {
609
- const issue = await comicVine.issue.retrieve(1234, {
610
- fieldList: ['id', 'name', 'description'],
611
- });
612
-
613
- // The id property is in the fieldList and will be available
614
- console.log(issue.id);
615
-
616
- // In JS dateAdded will be undefined at runtime
617
- // in TS the compiler will produce an error because it wasn't in the fieldList
618
- console.log(issue.dateAdded);
619
-
620
- // An object containing the id, name and description properties
621
- console.log(issue);
622
- } catch (error) {
623
- console.error(error);
624
- }
625
- })();
626
- ```
627
-
628
- ### Pagination
629
-
630
- The Comic Vine API provides offset based pagination, this is done by providing a `limit` and `offset` in the request. The `limit` is the number of items to be returned in one page and the offset is the number of items to skip.
631
-
632
- To fetch a page with 50 results and then move to the next page:
633
-
634
- ```js
635
- import ComicVine from 'comic-vine-sdk';
636
- const comicVine = new ComicVine('your-api-key-here');
637
-
638
- (async () => {
639
- try {
640
- const limit = 50;
641
- const filter = { name: 'The Boys' };
642
-
643
- // Retrieve the first 50 issues of The Boys (Page 1)
644
- const issuesPage1 = await comicVine.issue.list({ limit, filter });
645
- console.log(`Total issues: ${issuesPage1.data.length}`);
646
- console.log(issuesPage1.data.map((issue) => issue.name).join(', '));
647
-
648
- // Retrieve the next 50 issues of The Boys (Page 2)
649
- const issuesPage2 = await comicVine.issue.list({
650
- limit,
651
- filter,
652
- offset: 50,
653
- });
654
- console.log(`Total issues: ${issuesPage2.data.length}`);
655
- console.log(issuesPage2.data.map((issue) => issue.name).join(', '));
656
- } catch (error) {
657
- console.error(error);
658
- }
659
- })();
29
+ // Auto pagination
30
+ for await (const issue of client.issue.list({ filter: { volume: 796 } })) {
31
+ console.log(issue.name);
32
+ }
660
33
  ```
661
34
 
662
- #### Auto Pagination
663
-
664
- This feature allows calling any list method on a resource with `for await...of` rather than having to track the offset for making subsequent requests.
35
+ ## Documentation
665
36
 
666
- It will make the first request and return an item from that response on each iteration, when there are no more items to return it will automatically fetch the next page from the API. This will continue until all pages have been retrieved.
37
+ Full documentation is available at **[allymurray.github.io/comic-vine](https://allymurray.github.io/comic-vine)**, including:
667
38
 
668
- ```js
669
- import ComicVine from 'comic-vine-sdk';
670
- const comicVine = new ComicVine('your-api-key-here');
671
-
672
- (async () => {
673
- try {
674
- const listOptions = {
675
- filter: { name: 'The Boys' },
676
- limit: 50,
677
- };
39
+ - [Getting Started](https://allymurray.github.io/comic-vine/getting-started/introduction/) - Installation, configuration, and quick start
40
+ - [Migration Guide](https://allymurray.github.io/comic-vine/getting-started/migrating-from-v1/) - Upgrading from `@comic-vine/client` v1 to `comic-vine-sdk` v2
41
+ - [Guides](https://allymurray.github.io/comic-vine/guides/field-selection/) - Field selection, filtering, pagination, caching, and rate limiting
42
+ - [API Reference](https://allymurray.github.io/comic-vine/api/resources/) - All 19 resources with full TypeScript interfaces
43
+ - [Examples](https://allymurray.github.io/comic-vine/examples/basic-usage/) - Basic and advanced usage patterns
678
44
 
679
- let issueNames = [];
680
- for await (const issue of comicVine.issue.list(listOptions)) {
681
- issueNames.push(issue.name);
682
- }
683
-
684
- console.log(`Total issues: ${issueNames.length}`);
685
- console.log(issueNames);
686
- } catch (error) {
687
- console.error(error);
688
- }
689
- })();
690
- ```
45
+ For store internals, custom implementations, and advanced caching or rate limiting behavior, see the **[HTTP Client Toolkit documentation](https://allymurray.github.io/http-client-toolkit/)**.
691
46
 
692
- ## Run Locally
693
-
694
- Clone the project
695
-
696
- ```bash
697
- git clone https://github.com/AllyMurray/comic-vine.git
698
- ```
47
+ ## Code Generation
699
48
 
700
- Go to the project directory
49
+ Resource types, classes, tests, and mock data are generated from sample API responses. See [`scripts/README.md`](scripts/README.md) for the full pipeline documentation and architecture diagrams.
701
50
 
702
51
  ```bash
703
- cd comic-vine
704
- ```
52
+ # Generate all types, resource classes, tests, and mock data from samples
53
+ pnpm sdk:generate
705
54
 
706
- Install dependencies
707
-
708
- ```bash
709
- npm install
55
+ # Fetch fresh API samples (requires COMIC_VINE_API_KEY)
56
+ COMIC_VINE_API_KEY=your-key pnpm samples:fetch
710
57
  ```
711
58
 
712
- Run the tests
713
-
714
- ```bash
715
- npm run test
716
- ```
59
+ ## Contributing
717
60
 
718
- ## Authors
61
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development setup and contribution guidelines.
719
62
 
720
- - [@AllyMurray](https://github.com/AllyMurray)
63
+ ## License
721
64
 
722
- [comic-vine-api]: https://comicvine.gamespot.com/api
723
- [comic-vine-docs]: https://comicvine.gamespot.com/api/documentation
724
- [character-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-2
725
- [characters-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-3
726
- [concept-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-6
727
- [concepts-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-7
728
- [episode-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-8
729
- [episodes-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-9
730
- [issue-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-10
731
- [issues-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-11
732
- [location-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-12
733
- [locations-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-13
734
- [movie-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-14
735
- [movies-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-15
736
- [object-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-16
737
- [objects-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-17
738
- [origin-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-18
739
- [origins-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-19
740
- [person-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-20
741
- [people-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-21
742
- [power-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-22
743
- [powers-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-23
744
- [promo-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-24
745
- [promos-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-25
746
- [publisher-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-26
747
- [publishers-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-27
748
- [series-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-28
749
- [series-list-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-29
750
- [story-arc-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-31
751
- [story-arcs-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-32
752
- [team-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-33
753
- [teams-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-34
754
- [video-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-36
755
- [videos-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-37
756
- [video-type-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-38
757
- [video-types-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-39
758
- [video-category-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-40
759
- [video-categories-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-41
760
- [volume-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-42
761
- [volumes-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-43
65
+ MIT - see [LICENSE](LICENSE) for details.