-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v2 #3
Comments
@system32uwu so what do you think about this:
this would mean more requests but base feedback is small, so console.log(media.getStudios()); // would return the studios (or the entire info again but with the studios)
// I was thinking .getStudios, .getGenres, etc just appends to the info, but maybe it should be promise based fetching? such as:
media.getStudios().then(studios => console.log(studios)) do you think fetching methods for media, characters, users, etc. should be promise based? or just append to the information |
Hello, to make it as efficient as possible you can implement a function like the one I did in my package, it will merge two objects and fill in the missing properties of each, returning a third object with all the data from those two. That way you can reduce bandwidth consumption and also data fetching will be faster. And yes, pretty much everything should be promise based, in case there's an error you need to communicate that to the final app that's going to use your package. |
about to push changes, but I just created some of the fetching methods for media const media = await client.getMedia(1);
const genres = await media.getGenres();
const tags = await media.getTags();
const studios = await media.getStudios();
const meta = await media.getMeta();
//@ts-ignore
media.genres = genres;
//@ts-ignore
media.tags = tags;
//@ts-ignore
media.studios = studios;
//@ts-ignore
media.meta = meta;
console.log(media); meta is description: 'Enter a world in the distant future, where Bounty Hunters roam the solar system. Spike and Jet, bounty hunting partners, set out on journeys in an ever struggling effort to win bounty rewards to survive.<br><br>\n' +
'While traveling, they meet up with other very interesting people. Could Faye, the beautiful and ridiculously poor gambler, Edward, the computer genius, and Ein, the engineered dog be a good addition to the group?',
format: 'TV',
status: 'FINISHED',
coverImage: {
extraLarge: 'https://s4.anilist.co/file/anilistcdn/media/anime/cover/large/bx1-CXtrrkMpJ8Zq.png',
large: 'https://s4.anilist.co/file/anilistcdn/media/anime/cover/medium/bx1-CXtrrkMpJ8Zq.png',
medium: 'https://s4.anilist.co/file/anilistcdn/media/anime/cover/small/bx1-CXtrrkMpJ8Zq.png',
color: '#f1785d'
},
bannerImage: 'https://s4.anilist.co/file/anilistcdn/media/anime/banner/1-T3PJUjFJyRwg.jpg',
startDate: { year: 1998, month: 4, day: 3 },
endDate: { year: 1999, month: 4, day: 24 },
season: 'SPRING',
seasonYear: 1998 I was considering adding format and status to the base media though |
I like that. Yes, format and status is important for base media, as well as episodes (usually you get an integer here but sometimes when the anime hasn't been released yet or it's airing it will return null). About being able to specify a token each time you invoke a function which you showcased earlier, I see it useful if this were to be used in a node environment, having a single instance of the client object. |
V2 Specific Plans:
The text was updated successfully, but these errors were encountered: