|
1 |
| -<h1 align="center"> |
2 |
| - 🚀 AniList API Wrapper for TypeScript |
3 |
| -</h1> |
| 1 | +# AniList API Wrapper for TypeScript |
4 | 2 |
|
5 |
| -<p align="center"> |
6 |
| - <a href="https://www.npmjs.com/package/@tdanks2000/anilist-wrapper"><img alt="npm version" src="https://img.shields.io/npm/v/@tdanks2000/anilist-wrapper"></a> |
7 |
| - <a href="https://github.com/tdanks2000/anilist-wrapper/blob/master/LICENSE"><img alt="license" src="https://img.shields.io/npm/l/@tdanks2000/anilist-wrapper"></a> |
8 |
| - <a href="https://github.com/tdanks2000/anilist-wrapper/actions/workflows/ci.yml"><img alt="build status" src="https://github.com/tdanks2000/anilist-wrapper/actions/workflows/ci.yml/badge.svg"></a> |
9 |
| - <a href="https://bundlephobia.com/package/@tdanks2000/anilist-wrapper"><img alt="bundle size" src="https://img.shields.io/bundlephobia/minzip/@tdanks2000/anilist-wrapper"></a> |
10 |
| -</p> |
| 3 | +A simple, type-safe TypeScript wrapper for the AniList API. Build awesome anime and manga apps without the hassle of dealing with raw GraphQL queries. |
11 | 4 |
|
12 |
| -<p align="center"> |
13 |
| - Simplify your integration with the <a href="https://docs.anilist.co/">AniList API</a>, a comprehensive database for anime and manga. This robust and type-safe TypeScript wrapper provides an intuitive way to access various AniList functionalities, making it easier than ever to build amazing applications related to anime and manga. |
14 |
| -</p> |
| 5 | +[](https://www.npmjs.com/package/@tdanks2000/anilist-wrapper) |
| 6 | +[](https://github.com/tdanks2000/anilist-wrapper/blob/master/LICENSE) |
| 7 | +[](https://github.com/tdanks2000/anilist-wrapper/actions/workflows/ci.yml) |
| 8 | +[](https://bundlephobia.com/package/@tdanks2000/anilist-wrapper) |
| 9 | + |
| 10 | +## What's this? |
15 | 11 |
|
16 |
| -## 📖 Table of Contents |
17 |
| - |
18 |
| -- [✨ Key Features](#key-features) |
19 |
| -- [🚀 Quick Start](#quick-start) |
20 |
| -- [📦 Installation](#installation) |
21 |
| -- [🛠️ Usage](#usage) |
22 |
| - - [Basic Initialization](#basic-initialization) |
23 |
| - - [Making API Calls](#making-api-calls) |
24 |
| -- [🔑 Authentication](#authentication) |
25 |
| -- [⚙️ Functionality](#functionality) |
26 |
| - - [Anime Service](#anime-service) |
27 |
| - - [Character Service](#character-service) |
28 |
| - - [Manga Service](#manga-service) |
29 |
| - - [Media Service](#media-service) |
30 |
| - - [MediaList Service](#medialist-service) |
31 |
| - - [Staff Service](#staff-service) |
32 |
| - - [User Service](#user-service) |
33 |
| -- [🤝 Contributing](#contributing) |
34 |
| -- [📜 License](#license) |
35 |
| -- [💖 Support](#support) |
36 |
| - |
37 |
| -## ✨ Key Features |
38 |
| - |
39 |
| -- **Type-Safe TypeScript:** Enjoy the benefits of static typing and improved developer experience. |
40 |
| -- **Comprehensive Coverage:** Access a wide range of AniList API endpoints, including anime, manga, characters, staff, user lists, and more. |
41 |
| -- **Simplified Requests:** Abstract away the complexities of making raw HTTP requests to the AniList GraphQL API. |
42 |
| -- **Modular Design:** Well-organized services for different aspects of the AniList API. |
43 |
| -- **Easy Authentication:** Simple integration with AniList's authentication mechanism. |
44 |
| - |
45 |
| -## 🚀 Quick Start |
46 |
| - |
47 |
| -Get up and running with the AniList API Wrapper in minutes! |
48 |
| - |
49 |
| -1. **Install the package:** |
| 12 | +Ever wanted to build something cool with anime data but got stuck trying to figure out AniList's GraphQL API? This wrapper makes it dead simple. Just import, initialize, and start fetching data. |
| 13 | + |
| 14 | +Built with TypeScript for that sweet autocomplete and type safety. No more guessing what properties are available on your anime objects! |
| 15 | + |
| 16 | +## Quick Start |
50 | 17 |
|
51 | 18 | ```bash
|
52 |
| -# npm |
53 | 19 | npm install @tdanks2000/anilist-wrapper
|
54 |
| -# yarn |
55 |
| -yarn install @tdanks2000/anilist-wrapper |
56 |
| -# pnpm |
57 |
| -pnpm install @tdanks2000/anilist-wrapper |
58 |
| -# bun |
59 |
| -bun install @tdanks2000/anilist-wrapper |
60 | 20 | ```
|
61 | 21 |
|
62 |
| -2. **Import and initialize:** |
63 |
| - |
64 |
| -```ts |
| 22 | +```typescript |
65 | 23 | import { Anilist } from "@tdanks2000/anilist-wrapper";
|
66 | 24 |
|
67 |
| -// For public endpoints |
| 25 | +// Create an instance (no token needed for public data) |
68 | 26 | const anilist = new Anilist();
|
69 |
| -// OR for authenticated endpoints |
70 |
| -const anilist = new Anilist("YOUR_ACCESS_TOKEN"); |
71 |
| -``` |
72 | 27 |
|
73 |
| -3. **Start making API calls:** |
| 28 | +// Get info about Attack on Titan |
| 29 | +const aot = await anilist.anime.getAnimeById(16498); |
| 30 | +console.log(aot.title.english); // "Attack on Titan" |
74 | 31 |
|
75 |
| -```ts |
76 |
| -const data = await anilist.anime.getAnimeById(1); |
77 |
| -console.log(data); |
| 32 | +// Search for anime |
| 33 | +const results = await anilist.anime.searchAnime("One Piece"); |
| 34 | +console.log(results.length); // Number of results found |
78 | 35 | ```
|
79 | 36 |
|
80 |
| -## 📦 Installation |
| 37 | +## What can you do? |
81 | 38 |
|
82 |
| -To integrate the AniList TypeScript Wrapper into your project, use one of the following package managers: |
| 39 | +### Anime |
| 40 | +- Get anime by ID or search by title |
| 41 | +- Fetch characters, staff, and recommendations |
| 42 | +- Get trending and popular anime |
| 43 | +- Find anime by genre |
83 | 44 |
|
84 |
| -```bash |
85 |
| -# npm |
86 |
| -npm install @tdanks2000/anilist-wrapper |
87 |
| -# yarn |
88 |
| -yarn install @tdanks2000/anilist-wrapper |
89 |
| -# pnpm |
90 |
| -pnpm install @tdanks2000/anilist-wrapper |
91 |
| -# bun |
92 |
| -bun install @tdanks2000/anilist-wrapper |
93 |
| -``` |
| 45 | +### Manga |
| 46 | +- Same features as anime, but for manga |
| 47 | +- Search, get details, characters, staff, etc. |
94 | 48 |
|
95 |
| -## 🛠️ Usage |
| 49 | +### Characters & Staff |
| 50 | +- Get character info and birthdays |
| 51 | +- Find staff members and their work |
| 52 | +- Toggle favorites (with auth) |
96 | 53 |
|
97 |
| -Learn how to use the AniList TypeScript Wrapper in your TypeScript project. |
| 54 | +### Users |
| 55 | +- Get user profiles and statistics |
| 56 | +- Fetch user's anime/manga lists |
| 57 | +- Requires authentication |
98 | 58 |
|
99 |
| -### Basic Initialization |
| 59 | +### Media Lists |
| 60 | +- Manage user's anime and manga lists |
| 61 | +- Add, update, remove entries |
| 62 | +- Requires authentication |
100 | 63 |
|
101 |
| -Import the `Anilist` class from the package: |
| 64 | +## Authentication |
102 | 65 |
|
103 |
| -``` |
104 |
| - import { Anilist } from "@tdanks2000/anilist-wrapper"; |
| 66 | +Some features need you to be logged in. Get an access token from [AniList's auth guide](https://docs.anilist.co/guide/auth/) and pass it to the constructor: |
| 67 | + |
| 68 | +```typescript |
| 69 | +const anilist = new Anilist("your_access_token_here"); |
105 | 70 | ```
|
106 | 71 |
|
107 |
| -Create an instance of the `Anilist` class. You can optionally provide an access token for authenticated requests: |
| 72 | +## Examples |
108 | 73 |
|
| 74 | +### Get trending anime |
| 75 | +```typescript |
| 76 | +const trending = await anilist.anime.getAnimeTrending(); |
| 77 | +console.log(trending[0].title.english); |
109 | 78 | ```
|
110 |
| - // For accessing public endpoints |
111 |
| - const anilist = new Anilist(); |
112 | 79 |
|
113 |
| -// For accessing authenticated endpoints (requires an access token) |
114 |
| -const anilistWithToken = new Anilist("YOUR_ACCESS_TOKEN"); |
| 80 | +### Search for characters |
| 81 | +```typescript |
| 82 | +const characters = await anilist.character.getCharacterById(1); |
| 83 | +console.log(characters.name.full); |
115 | 84 | ```
|
116 | 85 |
|
117 |
| -### Making API Calls |
118 |
| - |
119 |
| -The `anilist` object provides access to various services, each dedicated to a specific area of the AniList API. Here's a basic example of fetching anime details: |
120 |
| - |
121 |
| -```ts |
122 |
| -const data = await anilist.anime.getAnimeById(1); |
123 |
| -console.log(data); |
| 86 | +### Get user's anime list |
| 87 | +```typescript |
| 88 | +const userList = await anilist.user.getUserAnimeList("username"); |
| 89 | +console.log(userList.length); // Number of anime in their list |
124 | 90 | ```
|
125 | 91 |
|
126 |
| -Refer to the [Functionality](#functionality) section for a list of available services and their purpose. Consult the individual service files or generated documentation for specific methods and parameters. |
127 |
| - |
128 |
| -## 🔑 Authentication |
129 |
| - |
130 |
| -Some features of the AniList API require authentication. To authenticate, you need to obtain an OAuth access token from the AniList website. [Follow their official documentation](https://docs.anilist.co/guide/auth/) for instructions on how to generate an access token. |
131 |
| - |
132 |
| -Once you have your access token, you can provide it when creating an instance of the `Anilist` class: |
133 |
| - |
134 |
| -``` |
135 |
| - const anilist = new Anilist("YOUR_ACCESS_TOKEN"); |
| 92 | +### Find anime by genre |
| 93 | +```typescript |
| 94 | +const actionAnime = await anilist.anime.getAnimeListByGenre("Action"); |
| 95 | +console.log(actionAnime.length); // Number of action anime |
136 | 96 | ```
|
137 | 97 |
|
138 |
| -This will enable you to access authenticated endpoints and perform actions on behalf of a user. |
139 |
| - |
140 |
| -## ⚙️ Functionality |
141 |
| - |
142 |
| -The AniList API Wrapper organizes its functionality into the following services: |
143 |
| - |
144 |
| -### Anime Service |
145 |
| - |
146 |
| -Provides methods for accessing anime-related information, such as: |
147 |
| - |
148 |
| -- Fetching details about a specific anime. |
149 |
| -- Retrieving characters and staff associated with an anime. |
150 |
| -- Getting recommendations for similar anime. |
151 |
| -- Exploring related anime entries. |
152 |
| - |
153 |
| -### Character Service |
154 |
| - |
155 |
| -Allows you to retrieve information about specific anime and manga characters. |
156 |
| - |
157 |
| -### Manga Service |
158 |
| - |
159 |
| -Offers methods for accessing manga-related information, similar to the Anime Service, including details, characters, staff, and recommendations. |
160 |
| - |
161 |
| -### Media Service |
162 |
| - |
163 |
| -Provides general functions for searching and retrieving information about both anime and manga (media). This might include broader search capabilities or combined results. |
164 |
| - |
165 |
| -### MediaList Service |
166 |
| - |
167 |
| -Enables you to manage a user's anime and manga lists, including adding, updating, and retrieving entries. This requires authentication. |
168 |
| - |
169 |
| -### Staff Service |
170 |
| - |
171 |
| -Allows you to retrieve information about staff members involved in the production of anime and manga (e.g., voice actors, directors, writers). |
172 |
| - |
173 |
| -### User Service |
174 |
| - |
175 |
| -Provides access to user profiles, statistics, and their anime and manga lists. Many of these endpoints require authentication. |
| 98 | +## Contributing |
176 | 99 |
|
177 |
| -## 🤝 Contributing |
| 100 | +Found a bug? Want to add a feature? Contributions are welcome! Check out the [contributing guide](CONTRIBUTING.md) to get started. |
178 | 101 |
|
179 |
| -We welcome contributions to the AniList TypeScript Wrapper! If you have any bug reports, feature requests, or would like to contribute code, please follow the guidelines outlined in the repository's `CONTRIBUTING.md` file. |
| 102 | +## License |
180 | 103 |
|
181 |
| -## 📜 License |
| 104 | +MIT License - use it however you want! |
182 | 105 |
|
183 |
| -The AniList TypeScript Wrapper is open-source and licensed under the [MIT License](https://github.com/Api-Wrappers/anilist-wrapper/blob/main/LICENSE). Feel free to use, modify, and distribute this library according to the terms of the license. |
| 106 | +## Support |
184 | 107 |
|
185 |
| -## 💖 Support |
| 108 | +Having trouble? Open an issue on [GitHub](https://github.com/tdanks2000/anilist-wrapper/issues) and I'll help you out. |
186 | 109 |
|
187 |
| -Thank you for using the AniList API Wrapper! If you encounter any issues or have questions, please don't hesitate to: |
| 110 | +--- |
188 | 111 |
|
189 |
| -- Open an issue on the [GitHub repository](https://github.com/tdanks2000/anilist-wrapper/issues). |
| 112 | +# ❤️ |
190 | 113 |
|
191 | 114 | <p align="center">
|
192 | 115 | <a target="_blank" href="https://tdanks.com/mental-health/quote">
|
193 |
| -❤️ Reminder that <strong\><i\>you are great, you are enough, and your presence is valued.</i\>\</strong\> If you are struggling with your mental health, please reach out to someone you love and consult a professional. You are not alone. ❤️ |
| 116 | +❤️ Quick reminder: <strong><i>you are great, you are enough, and we value your presence.</i></strong> If you're going through a tough time with your mental health, please reach out to someone you trust and consider talking to a professional. You're never alone. ❤️ |
194 | 117 | </a>
|
195 | 118 | </p>
|
0 commit comments