Character
Access comic book character data from the Comic Vine API. Official API docs: /character | /characters
const character = client.character;Methods
Section titled “Methods”retrieve(id, options?)
Section titled “retrieve(id, options?)”Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
id | number | Yes | The unique ID of the character |
options.fieldList | string[] | No | Only return the specified fields |
Returns: Promise<CharacterDetails>
const character = await client.character.retrieve(1699);
// With field selectionconst character = await client.character.retrieve(1699, { fieldList: ['id', 'name', 'realName', 'publisher'],});interface CharacterDetails { /** List of aliases the character is known by. A \n (newline) seperates each alias. */ aliases: null | string; /** URL pointing to the character detail resource. */ apiDetailUrl: string; /** A date, if one exists, that the character was born on. Not an origin date. */ birth: null | string; /** List of characters that are enemies with this character. */ characterEnemies: Array<SiteResource>; /** List of characters that are friends with this character. */ characterFriends: Array<SiteResource>; /** Number of issues this character appears in. */ countOfIssueAppearances: number; /** List of the real life people who created this character. */ creators: Array<SiteResource>; /** Date the character was added to Comic Vine. */ dateAdded: Date; /** Date the character was last updated on Comic Vine. */ dateLastUpdated: Date; /** Brief summary of the character. */ deck: null | string; /** Description of the character. */ description: null | string; /** Issue where the character made its first appearance. */ firstAppearedInIssue: IssueApiResource; /** Gender of the character. Available options are: Male, Female, Other */ gender: number; /** Unique ID of the character. */ id: number; /** Main image of the character. */ image: Image; issueCredits: Array<SiteResource>; /** List of issues this character died in. */ issuesDiedIn: Array<SiteResource>; /** Movies the character was in. */ movies: Array<SiteResource>; /** Name of the character. */ name: string; /** The origin of the character. Human, Alien, Robot ...etc */ origin: ApiResource | null; /** List of super powers a character has. */ powers: Array<ApiResource>; /** The primary publisher a character is attached to. */ publisher: ApiResource; /** Real name of the character. */ realName: null | string; /** URL pointing to the character on Giant Bomb. */ siteDetailUrl: string; storyArcCredits: Array<SiteResource>; /** List of teams that are enemies of this character. */ teamEnemies: Array<SiteResource>; /** List of teams that are friends with this character. */ teamFriends: Array<SiteResource>; /** List of teams this character is a member of. */ teams: Array<SiteResource>; volumeCredits: Array<SiteResource>;}list(options?)
Section titled “list(options?)”Parameters:
| Name | Type | Required | Description |
|---|---|---|---|
options.fieldList | string[] | No | Only return the specified fields |
options.limit | number | No | Number of results to return (default: 100) |
options.offset | number | No | Number of results to skip |
options.sort | SortOption | No | Sort field and direction |
options.filter | object | No | Filter results by field values |
Returns: Promise<PageData> & AsyncIterable<CharacterListItem>
const characters = await client.character.list({ filter: { name: 'Batman' },});
// With auto paginationfor await (const character of client.character.list()) { console.log(character.name);}interface CharacterListItem { /** List of aliases the character is known by. A \n (newline) seperates each alias. */ aliases: null | string; /** URL pointing to the character detail resource. */ apiDetailUrl: string; /** A date, if one exists, that the character was born on. Not an origin date. */ birth: null | string; /** Number of issues this character appears in. */ countOfIssueAppearances: number; /** Date the character was added to Comic Vine. */ dateAdded: Date; /** Date the character was last updated on Comic Vine. */ dateLastUpdated: Date; /** Brief summary of the character. */ deck: null | string; /** Description of the character. */ description: null | string; /** Issue where the character made its first appearance. */ firstAppearedInIssue: IssueApiResource; /** Gender of the character. Available options are: Male, Female, Other */ gender: number; /** Unique ID of the character. */ id: number; /** Main image of the character. */ image: Image; /** Name of the character. */ name: string; /** The origin of the character. Human, Alien, Robot ...etc */ origin: ApiResource | null; /** The primary publisher a character is attached to. */ publisher: ApiResource; /** Real name of the character. */ realName: null | string; /** URL pointing to the character on Giant Bomb. */ siteDetailUrl: string;}