comic-vine-sdk 1.0.1 → 1.0.3
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.
package/README.md
CHANGED
|
@@ -1,10 +1,44 @@
|
|
|
1
|
-
# Comic Vine
|
|
1
|
+
# Comic Vine SDK
|
|
2
2
|
|
|
3
|
-
The Comic Vine
|
|
4
|
-
|
|
3
|
+
The Comic Vine SDK provides convenient access to the [Comic Vine API][comic-vine-api] from server side applications written in JavaScript/TypeScript. The API provides full access to the structured-wiki content.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Installation](#installation)
|
|
8
|
+
- [Browser Support](#browser-support)
|
|
9
|
+
- [Roadmap](#roadmap)
|
|
10
|
+
- [Comic Vine Resources](#comic-vine-resources)
|
|
11
|
+
- [Usage/Examples](#usageexamples)
|
|
12
|
+
- [Initialization](#initialization)
|
|
13
|
+
- [Fetch a single resource](#fetch-a-single-resource)
|
|
14
|
+
- [Fetch a resource list](#fetch-a-resource-list)
|
|
15
|
+
- [Limit the fields in the response payload](#limit-the-fields-in-the-response-payload)
|
|
16
|
+
- [Pagination](#pagination)
|
|
17
|
+
- [Run Locally](#run-locally)
|
|
18
|
+
- [Authors](#authors)
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
Install the package with:
|
|
23
|
+
|
|
24
|
+
```sh
|
|
25
|
+
npm install comic-vine-sdk
|
|
26
|
+
# or
|
|
27
|
+
yarn add comic-vine-sdk
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Browser support
|
|
31
|
+
|
|
32
|
+
This package does not currently work in a web browser, the Comic Vine API does not allow [cross-origin](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) requests. The recommended approach would be to use it server side, however, in a future update an option to set the baseUrl will be added. 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.
|
|
33
|
+
|
|
34
|
+
## TypeScript Typings
|
|
35
|
+
|
|
36
|
+
There's a good change 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.
|
|
5
37
|
|
|
6
38
|
## Roadmap
|
|
7
39
|
|
|
40
|
+
- Add option to set baseUrl when initializing the library
|
|
41
|
+
|
|
8
42
|
- Automatic Pagination
|
|
9
43
|
|
|
10
44
|
- Expandable responses
|
|
@@ -15,49 +49,39 @@ applications written in JavaScript/TypeScript. The API provides full access to t
|
|
|
15
49
|
|
|
16
50
|
## Comic Vine Resources
|
|
17
51
|
|
|
18
|
-
[Comic Vine resources list]
|
|
52
|
+
[Comic Vine resources list][comic-vine-docs]
|
|
19
53
|
|
|
20
54
|
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.
|
|
21
55
|
|
|
22
56
|
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.
|
|
23
57
|
|
|
24
|
-
| Library resource object | Retrieve Method API Resource
|
|
25
|
-
| ----------------------- |
|
|
26
|
-
| character | character
|
|
27
|
-
| concept | concept
|
|
28
|
-
| episode | episode
|
|
29
|
-
| issue | issue
|
|
30
|
-
| location | location
|
|
31
|
-
| movie | movie
|
|
32
|
-
| origin | origin
|
|
33
|
-
| person | person
|
|
34
|
-
| power | power
|
|
35
|
-
| promo | promo
|
|
36
|
-
| publisher | publisher
|
|
37
|
-
| series | series
|
|
38
|
-
| storyArc | story_arc
|
|
39
|
-
| team | team
|
|
40
|
-
| thing | object
|
|
41
|
-
| video | video
|
|
42
|
-
| videoCategory | video_category
|
|
43
|
-
| videoType | video_type
|
|
44
|
-
| volume | volume
|
|
45
|
-
|
|
46
|
-
## Installation
|
|
47
|
-
|
|
48
|
-
Install the package with:
|
|
49
|
-
|
|
50
|
-
```sh
|
|
51
|
-
npm install comic-vine-sdk
|
|
52
|
-
# or
|
|
53
|
-
yarn add comic-vine-sdk
|
|
54
|
-
```
|
|
58
|
+
| Library resource object | Retrieve Method API Resource | List Method API Resource |
|
|
59
|
+
| ----------------------- | ------------------------------------- | ----------------------------------------- |
|
|
60
|
+
| character | [character][character-docs] | [characters][characters-docs] |
|
|
61
|
+
| concept | [concept][concept-docs] | [concepts][concepts-docs] |
|
|
62
|
+
| episode | [episode][episode-docs] | [episodes][episodes-docs] |
|
|
63
|
+
| issue | [issue][issue-docs] | [issues][issues-docs] |
|
|
64
|
+
| location | [location][location-docs] | [locations][locations-docs] |
|
|
65
|
+
| movie | [movie][movie-docs] | [movies][movies-docs] |
|
|
66
|
+
| origin | [origin][origin-docs] | [origins][origins-docs] |
|
|
67
|
+
| person | [person][person-docs] | [people][people-docs] |
|
|
68
|
+
| power | [power][power-docs] | [powers][powers-docs] |
|
|
69
|
+
| promo | [promo][promo-docs] | [promos][promos-docs] |
|
|
70
|
+
| publisher | [publisher][publisher-docs] | [publishers][publishers-docs] |
|
|
71
|
+
| series | [series][series-docs] | [series_list][series-list-docs] |
|
|
72
|
+
| storyArc | [story_arc][story-arc-docs] | [story_arcs][story-arcs-docs] |
|
|
73
|
+
| team | [team][team-docs] | [teams][teams-docs] |
|
|
74
|
+
| thing | [object][object-docs] | [objects][objects-docs] |
|
|
75
|
+
| video | [video][video-docs] | [videos][videos-docs] |
|
|
76
|
+
| videoCategory | [video_category][video-category-docs] | [video_categories][video-categories-docs] |
|
|
77
|
+
| videoType | [video_type][video-type-docs] | [video_types][video-types-docs] |
|
|
78
|
+
| volume | [volume][volume-docs] | [volumes][volumes-docs] |
|
|
55
79
|
|
|
56
80
|
## Usage/Examples
|
|
57
81
|
|
|
58
82
|
### Initialization
|
|
59
83
|
|
|
60
|
-
The package needs to be configured with your API key, [Grab an API key]
|
|
84
|
+
The package needs to be configured with your API key, [Grab an API key][comic-vine-api]. Require it with the key's value:
|
|
61
85
|
|
|
62
86
|
```js
|
|
63
87
|
const ComicVine = require('comic-vine-sdk');
|
|
@@ -217,3 +241,44 @@ Run the tests
|
|
|
217
241
|
## Authors
|
|
218
242
|
|
|
219
243
|
- [@AllyMurray](https://github.com/AllyMurray)
|
|
244
|
+
|
|
245
|
+
[comic-vine-api]: https://comicvine.gamespot.com/api
|
|
246
|
+
[comic-vine-docs]: https://comicvine.gamespot.com/api/documentation
|
|
247
|
+
[character-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-2
|
|
248
|
+
[characters-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-3
|
|
249
|
+
[concept-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-6
|
|
250
|
+
[concepts-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-7
|
|
251
|
+
[episode-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-8
|
|
252
|
+
[episodes-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-9
|
|
253
|
+
[issue-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-10
|
|
254
|
+
[issues-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-11
|
|
255
|
+
[location-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-12
|
|
256
|
+
[locations-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-13
|
|
257
|
+
[movie-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-14
|
|
258
|
+
[movies-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-15
|
|
259
|
+
[object-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-16
|
|
260
|
+
[objects-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-17
|
|
261
|
+
[origin-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-18
|
|
262
|
+
[origins-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-19
|
|
263
|
+
[person-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-20
|
|
264
|
+
[people-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-21
|
|
265
|
+
[power-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-22
|
|
266
|
+
[powers-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-23
|
|
267
|
+
[promo-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-24
|
|
268
|
+
[promos-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-25
|
|
269
|
+
[publisher-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-26
|
|
270
|
+
[publishers-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-27
|
|
271
|
+
[series-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-28
|
|
272
|
+
[series-list-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-29
|
|
273
|
+
[story-arc-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-31
|
|
274
|
+
[story-arcs-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-32
|
|
275
|
+
[team-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-33
|
|
276
|
+
[teams-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-34
|
|
277
|
+
[video-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-36
|
|
278
|
+
[videos-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-37
|
|
279
|
+
[video-type-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-38
|
|
280
|
+
[video-types-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-39
|
|
281
|
+
[video-category-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-40
|
|
282
|
+
[video-categories-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-41
|
|
283
|
+
[volume-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-42
|
|
284
|
+
[volumes-docs]: https://comicvine.gamespot.com/api/documentation#toc-0-43
|
|
@@ -2,11 +2,11 @@ import { SiteResource, IssueApiResource, ApiResource, Image } from '../../common
|
|
|
2
2
|
export interface CharacterDetails {
|
|
3
3
|
aliases: null | string;
|
|
4
4
|
apiDetailUrl: string;
|
|
5
|
-
birth: null;
|
|
5
|
+
birth: null | string;
|
|
6
6
|
characterEnemies: Array<SiteResource>;
|
|
7
7
|
characterFriends: Array<SiteResource>;
|
|
8
8
|
countOfIssueAppearances: number;
|
|
9
|
-
creators:
|
|
9
|
+
creators: Array<SiteResource>;
|
|
10
10
|
dateAdded: Date;
|
|
11
11
|
dateLastUpdated: Date;
|
|
12
12
|
deck: null | string;
|
|
@@ -26,7 +26,7 @@ export interface CharacterDetails {
|
|
|
26
26
|
siteDetailUrl: string;
|
|
27
27
|
storyArcCredits: Array<SiteResource>;
|
|
28
28
|
teamEnemies: Array<SiteResource>;
|
|
29
|
-
teamFriends:
|
|
29
|
+
teamFriends: Array<SiteResource>;
|
|
30
30
|
teams: Array<SiteResource>;
|
|
31
31
|
volumeCredits: Array<SiteResource>;
|
|
32
32
|
}
|
|
@@ -2,11 +2,11 @@ import { SiteResource, IssueApiResource, ApiResource, Image } from '../../common
|
|
|
2
2
|
export interface CharacterDetails {
|
|
3
3
|
aliases: null | string;
|
|
4
4
|
apiDetailUrl: string;
|
|
5
|
-
birth: null;
|
|
5
|
+
birth: null | string;
|
|
6
6
|
characterEnemies: Array<SiteResource>;
|
|
7
7
|
characterFriends: Array<SiteResource>;
|
|
8
8
|
countOfIssueAppearances: number;
|
|
9
|
-
creators:
|
|
9
|
+
creators: Array<SiteResource>;
|
|
10
10
|
dateAdded: Date;
|
|
11
11
|
dateLastUpdated: Date;
|
|
12
12
|
deck: null | string;
|
|
@@ -26,7 +26,7 @@ export interface CharacterDetails {
|
|
|
26
26
|
siteDetailUrl: string;
|
|
27
27
|
storyArcCredits: Array<SiteResource>;
|
|
28
28
|
teamEnemies: Array<SiteResource>;
|
|
29
|
-
teamFriends:
|
|
29
|
+
teamFriends: Array<SiteResource>;
|
|
30
30
|
teams: Array<SiteResource>;
|
|
31
31
|
volumeCredits: Array<SiteResource>;
|
|
32
32
|
}
|