-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathperson.example.ts
More file actions
28 lines (23 loc) · 803 Bytes
/
person.example.ts
File metadata and controls
28 lines (23 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { TMDB, type Person, type PersonImages, type PersonCombinedCredits } from "@vo1x/tmdb";
/**
* A minimal example demonstrating how to use the Person service.
*/
async function main() {
const tmdb = new TMDB({
apiKey: process.env.TMDB_TOKEN!,
language: "en-US",
});
const personId = 287; // Christian Bale
const person: Person = await tmdb.person.get(personId);
const images: PersonImages = await tmdb.person.images(personId);
const credits: PersonCombinedCredits = await tmdb.person.combinedCredits(personId);
console.log({
name: person.name,
knownFor: person.knownForDepartment,
profileImageCount: images.profiles?.length,
totalCastCredits: credits.cast?.length,
});
}
main().catch((err) => {
console.error("An error occurred:", err.message);
});