@natsuneko-laboratory/catalyst-sdk 0.5.0 → 0.5.2

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
@@ -0,0 +1,57 @@
1
+ # CatalystTS
2
+
3
+ Official Catalyst SDK for TypeScript / JavaScript / Node.js, built for both browser and server environments.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ $ npm install @natsuneko-laboratory/catalyst-sdk --save
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ // authentication
15
+ import { CatalystTS, PKCE } from "@natsuneko-laboratory/catalyst-sdk";
16
+ import { v4 } from "uuid";
17
+
18
+ const API_KEY = {
19
+ clientId: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
20
+ clientSecret: "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
21
+ redirectUri: "https://example.com/callback",
22
+ };
23
+
24
+ const client = new CatalystTS({
25
+ clientId: API_KEY.clientId,
26
+ clientSecret: API_KEY.clientSecret,
27
+ accessToken: "",
28
+ refreshToken: "",
29
+ });
30
+ const pkce = await PKCE.create();
31
+ const state = v4();
32
+ const redirect = client.oauth.getAuthorizeURL(API_KEY.redirectUri, pkce, state);
33
+
34
+ // redirected to `redirectUri`
35
+ const searchParams = new URLSearchParams(window.location.search);
36
+ const code = searchParams.get("code");
37
+ const returnedState = searchParams.get("state");
38
+
39
+ if (code && returnedState === state) {
40
+ const { accessToken, refreshToken } = await client.oauth.getAccessTokenByCode(
41
+ code,
42
+ API_KEY.redirectUri,
43
+ pkce,
44
+ );
45
+
46
+ console.log("accessToken:", accessToken);
47
+ console.log("refreshToken:", refreshToken);
48
+ }
49
+
50
+ // call user specified APIs
51
+ const me = await client.egeria.me();
52
+ console.log({ me });
53
+ ```
54
+
55
+ ## License
56
+
57
+ MIT by [@6jz](https://twitter.com/6jz)
package/dist/index.d.mts CHANGED
@@ -411,7 +411,7 @@ interface CatalystUserVoteRights {
411
411
  }
412
412
 
413
413
  interface ReportRequest {
414
- type: "nsfw" | "tos_violation" | "harassment" | "spam" | "other";
414
+ reason: "nsfw" | "tos_violation" | "harassment" | "spam" | "other";
415
415
  description?: string;
416
416
  }
417
417
 
package/dist/index.d.ts CHANGED
@@ -411,7 +411,7 @@ interface CatalystUserVoteRights {
411
411
  }
412
412
 
413
413
  interface ReportRequest {
414
- type: "nsfw" | "tos_violation" | "harassment" | "spam" | "other";
414
+ reason: "nsfw" | "tos_violation" | "harassment" | "spam" | "other";
415
415
  description?: string;
416
416
  }
417
417
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@natsuneko-laboratory/catalyst-sdk",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "TypeScript/JavaScript SDK for the Natsuneko Laboratory platform",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",