aniql 1.4.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -15,29 +15,36 @@
15
15
 
16
16
  ## Usage
17
17
 
18
- `aniql` is available via server-side (Bun & Node.js), as well as in browser.
18
+ `aniql` is ESM-only and works in Bun, modern Node.js, and browsers with `fetch`.
19
19
 
20
20
  ```ts
21
- import { AniQLClient } from "aniql";
21
+ import { AniQLClient } from 'aniql';
22
22
 
23
- const client = new AniQLClient({
24
- token: Bun.env.TOKEN,
25
- });
23
+ const client = new AniQLClient(); // `new AniQLClient({ client_id: 123 })` also works
26
24
 
27
25
  const user = await client.query({
28
- User: {
29
- __args: { name: "itss0n1c" },
30
- id: true,
31
- name: true,
32
- avatar: {
33
- large: true,
34
- medium: true,
35
- },
36
- },
26
+ User: {
27
+ __args: { name: 'itss0n1c' },
28
+ id: true,
29
+ name: true,
30
+ avatar: {
31
+ large: true,
32
+ medium: true,
33
+ },
34
+ },
37
35
  });
38
36
  console.log(user.User);
39
37
  ```
40
38
 
39
+ Public AniList queries don't require OAuth or send a client ID. If you already
40
+ have an access token, use `new AniQLClient({ token: accessToken })`, or provide
41
+ `get_token: () => accessToken` if it can change. Pass `{ token }` as the second
42
+ argument to `query` or `mutation` to override the client token for one request.
43
+ Both the client and individual requests accept an `AbortSignal` via `signal`.
44
+
45
+ Set `auth` only if you use `auth_url` or `auth_exchange`. For OAuth code
46
+ exchange, keep the client secret on your server.
47
+
41
48
  ## Note
42
49
 
43
50
  This library is not affiliated with AniList, and is not an official AniList library.