update README.md

This commit is contained in:
DrakeTDL 2023-10-10 00:05:07 -07:00
parent ef9a36e21b
commit 387a42f259
No known key found for this signature in database
1 changed files with 12 additions and 11 deletions

View File

@ -2,8 +2,10 @@
An UNOFFICIAL wrapper for the anilist api written in typescript.
You can visit the official graphql docs for anilist [here](https://anilist.github.io/ApiV2-GraphQL-Docs/) to find out
everything you can do[^*].
You can visit the official graphql docs for anilist
[here](https://anilist.github.io/ApiV2-GraphQL-Docs/) to find out everything you can do[^*].
This wrapper is still in an early state. Interface may change.
[[_TOC_]]
@ -55,8 +57,8 @@ query ($userName: String) {
##### Fetching without building the query
If you build the query and try to fetch it without telling which fields to return it will default to returning `id` to
avoid errors.
If you build the query and try to fetch it without telling which fields to return it will default to
returning `id` to avoid errors.
```js
const query = Client().query.MediaList({ userName: "Josh" })
@ -78,7 +80,8 @@ await query.fetch()
##### Creating a complete search query
As the library follows the builder pattern you can just nest functions until you have every field you want.
As the library follows the builder pattern you can just nest functions until you have every field
you want.
```js
const query = Client().query.MediaList({ userName: "Josh" }, (fields) => {
@ -110,16 +113,14 @@ await query.fetch()
## OAuth
The library provides 2 helpers methods for OAuth and i will explain them here
### Using Token
Once you have a token, you can pass it into `Client({ token })`.
### Getting a token from an authorization code grant
This method allows you to convert the Authorization Code Grant into an access token. The response is a type
`Authorization`.
This method allows you to convert the Authorization Code Grant into an access token. The response is
a type `Authorization`.
```ts
const token = Client().auth.getToken({
@ -143,5 +144,5 @@ const token = Client().auth.getToken({
}
```
[^*]: Not everything is supported yet, please refer to the todo list to see what has full implementation or open an
issue to talk about it
[^*]: Not everything is supported yet, please refer to the todo list to see what has full
implementation or open an issue to talk about it