rotur-sdk 1.0.3 → 1.0.4
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 +29 -18
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,8 +31,8 @@ const rotur = new Rotur({ token: "your-token-here" });
|
|
|
31
31
|
await rotur.login({ system: "my-app", timeout: 60_000 });
|
|
32
32
|
|
|
33
33
|
// Check current auth state
|
|
34
|
-
rotur.loggedIn;
|
|
35
|
-
rotur.token;
|
|
34
|
+
rotur.loggedIn; // boolean
|
|
35
|
+
rotur.token; // string | null
|
|
36
36
|
|
|
37
37
|
// Set/refresh token manually
|
|
38
38
|
rotur.setToken("new-token");
|
|
@@ -117,7 +117,11 @@ await rotur.keys.buy("key-id");
|
|
|
117
117
|
### Items
|
|
118
118
|
|
|
119
119
|
```ts
|
|
120
|
-
const item = await rotur.items.create({
|
|
120
|
+
const item = await rotur.items.create({
|
|
121
|
+
name: "sword",
|
|
122
|
+
price: 100,
|
|
123
|
+
selling: true,
|
|
124
|
+
});
|
|
121
125
|
const item = await rotur.items.get("sword");
|
|
122
126
|
const items = await rotur.items.list("username");
|
|
123
127
|
await rotur.items.buy("sword");
|
|
@@ -138,9 +142,11 @@ await rotur.gifts.claim("code");
|
|
|
138
142
|
const { permissions, groups } = await rotur.tokens.permissions();
|
|
139
143
|
const { tokens } = await rotur.tokens.list();
|
|
140
144
|
|
|
141
|
-
const sub = await rotur.tokens.create(
|
|
142
|
-
"
|
|
143
|
-
|
|
145
|
+
const sub = await rotur.tokens.create(
|
|
146
|
+
"bot-token",
|
|
147
|
+
["posts:view", "posts:create", "account:profile"],
|
|
148
|
+
{ expiresInHrs: 24, origin: "my-app" },
|
|
149
|
+
);
|
|
144
150
|
|
|
145
151
|
await rotur.tokens.revoke(sub.id);
|
|
146
152
|
```
|
|
@@ -178,7 +184,9 @@ const files = await rotur.files.index();
|
|
|
178
184
|
const { used, max } = await rotur.files.usage();
|
|
179
185
|
const file = await rotur.files.getByUUID("uuid");
|
|
180
186
|
const file = await rotur.files.getByPath("path/to/file");
|
|
181
|
-
await rotur.files.upload({
|
|
187
|
+
await rotur.files.upload({
|
|
188
|
+
/* file data */
|
|
189
|
+
});
|
|
182
190
|
```
|
|
183
191
|
|
|
184
192
|
### Push Notifications
|
|
@@ -187,7 +195,10 @@ await rotur.files.upload({ /* file data */ });
|
|
|
187
195
|
const { public_key } = await rotur.push.vapidKeys();
|
|
188
196
|
await rotur.push.register(endpoint, p256dh, auth, "my-app", "fingerprint");
|
|
189
197
|
const { endpoints } = await rotur.push.endpoints();
|
|
190
|
-
await rotur.push.send("username", "my-app", {
|
|
198
|
+
await rotur.push.send("username", "my-app", {
|
|
199
|
+
title: "Hi!",
|
|
200
|
+
body: "You have a message",
|
|
201
|
+
});
|
|
191
202
|
```
|
|
192
203
|
|
|
193
204
|
### Status & Validators
|
|
@@ -262,8 +273,8 @@ try {
|
|
|
262
273
|
await rotur.me.transfer("user", 1000);
|
|
263
274
|
} catch (e) {
|
|
264
275
|
if (e instanceof ApiError) {
|
|
265
|
-
console.log(e.status);
|
|
266
|
-
console.log(e.data);
|
|
276
|
+
console.log(e.status); // HTTP status code
|
|
277
|
+
console.log(e.data); // response body
|
|
267
278
|
console.log(e.message); // human-readable error
|
|
268
279
|
}
|
|
269
280
|
}
|
|
@@ -288,14 +299,14 @@ npm test # vitest
|
|
|
288
299
|
|
|
289
300
|
## Exports
|
|
290
301
|
|
|
291
|
-
| Export
|
|
292
|
-
|
|
293
|
-
| `Rotur`
|
|
294
|
-
| `RoturSocket`
|
|
295
|
-
| `ApiError`
|
|
296
|
-
| `performAuth`, `AuthError`
|
|
297
|
-
| `AuthOptions`, `AuthResult` | Auth option types
|
|
298
|
-
| All types from `types.ts`
|
|
302
|
+
| Export | Description |
|
|
303
|
+
| --------------------------- | ---------------------------------------------------------- |
|
|
304
|
+
| `Rotur` | Main client class |
|
|
305
|
+
| `RoturSocket` | WebSocket connection (real-time presence) |
|
|
306
|
+
| `ApiError` | HTTP error with `status` and `data` |
|
|
307
|
+
| `performAuth`, `AuthError` | Browser auth flow |
|
|
308
|
+
| `AuthOptions`, `AuthResult` | Auth option types |
|
|
309
|
+
| All types from `types.ts` | `UserProfile`, `NetPost`, `GroupPublic`, `WSMessage`, etc. |
|
|
299
310
|
|
|
300
311
|
## License
|
|
301
312
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rotur-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "The official SDK for the Rotur platform - auth, profiles, posts, credits, keys, groups, items, gifts, tokens, validators, status, files, cosmetics, push notifications, and more",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|