@oasisomniverse/web5-api 1.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.
Files changed (92) hide show
  1. package/README.md +250 -0
  2. package/docs/README.md +44 -0
  3. package/docs/modules/Avatar.md +606 -0
  4. package/docs/modules/CelestialBodies.md +1051 -0
  5. package/docs/modules/CelestialBodiesMetaData.md +949 -0
  6. package/docs/modules/CelestialSpaces.md +1051 -0
  7. package/docs/modules/Chapters.md +955 -0
  8. package/docs/modules/Competition.md +594 -0
  9. package/docs/modules/Cosmic.md +3653 -0
  10. package/docs/modules/Games.md +2619 -0
  11. package/docs/modules/GeoHotSpots.md +1027 -0
  12. package/docs/modules/GeoNFTs.md +1049 -0
  13. package/docs/modules/Health.md +90 -0
  14. package/docs/modules/Holons.md +1139 -0
  15. package/docs/modules/HolonsMetaData.md +949 -0
  16. package/docs/modules/InventoryItems.md +1071 -0
  17. package/docs/modules/Libraries.md +1052 -0
  18. package/docs/modules/Missions.md +1286 -0
  19. package/docs/modules/NFTs.md +1008 -0
  20. package/docs/modules/OAPPs.md +1190 -0
  21. package/docs/modules/Parks.md +1079 -0
  22. package/docs/modules/Plugins.md +1138 -0
  23. package/docs/modules/Quests.md +1941 -0
  24. package/docs/modules/Runtimes.md +1112 -0
  25. package/docs/modules/STAR.md +178 -0
  26. package/docs/modules/Templates.md +990 -0
  27. package/docs/modules/Zomes.md +1049 -0
  28. package/docs/modules/ZomesMetaData.md +949 -0
  29. package/index.d.ts +97 -0
  30. package/index.js +3 -0
  31. package/index.mjs +4 -0
  32. package/package.json +117 -0
  33. package/src/core/httpClient.js +110 -0
  34. package/src/core/routeHelper.js +85 -0
  35. package/src/core/tokenStore.js +52 -0
  36. package/src/core/types.d.ts +18 -0
  37. package/src/index.js +60 -0
  38. package/src/modules/Auth.d.ts +15 -0
  39. package/src/modules/Auth.js +62 -0
  40. package/src/modules/Avatar.d.ts +45 -0
  41. package/src/modules/Avatar.js +47 -0
  42. package/src/modules/CelestialBodies.d.ts +72 -0
  43. package/src/modules/CelestialBodies.js +65 -0
  44. package/src/modules/CelestialBodiesMetaData.d.ts +69 -0
  45. package/src/modules/CelestialBodiesMetaData.js +61 -0
  46. package/src/modules/CelestialSpaces.d.ts +72 -0
  47. package/src/modules/CelestialSpaces.js +65 -0
  48. package/src/modules/Chapters.d.ts +66 -0
  49. package/src/modules/Chapters.js +61 -0
  50. package/src/modules/Competition.d.ts +33 -0
  51. package/src/modules/Competition.js +39 -0
  52. package/src/modules/Cosmic.d.ts +222 -0
  53. package/src/modules/Cosmic.js +165 -0
  54. package/src/modules/Games.d.ts +171 -0
  55. package/src/modules/Games.js +131 -0
  56. package/src/modules/GeoHotSpots.d.ts +66 -0
  57. package/src/modules/GeoHotSpots.js +61 -0
  58. package/src/modules/GeoNFTs.d.ts +72 -0
  59. package/src/modules/GeoNFTs.js +65 -0
  60. package/src/modules/Health.d.ts +12 -0
  61. package/src/modules/Health.js +25 -0
  62. package/src/modules/Holons.d.ts +78 -0
  63. package/src/modules/Holons.js +69 -0
  64. package/src/modules/HolonsMetaData.d.ts +69 -0
  65. package/src/modules/HolonsMetaData.js +61 -0
  66. package/src/modules/InventoryItems.d.ts +69 -0
  67. package/src/modules/InventoryItems.js +63 -0
  68. package/src/modules/Libraries.d.ts +72 -0
  69. package/src/modules/Libraries.js +65 -0
  70. package/src/modules/Missions.d.ts +87 -0
  71. package/src/modules/Missions.js +75 -0
  72. package/src/modules/NFTs.d.ts +69 -0
  73. package/src/modules/NFTs.js +63 -0
  74. package/src/modules/OAPPs.d.ts +69 -0
  75. package/src/modules/OAPPs.js +61 -0
  76. package/src/modules/Parks.d.ts +72 -0
  77. package/src/modules/Parks.js +65 -0
  78. package/src/modules/Plugins.d.ts +78 -0
  79. package/src/modules/Plugins.js +69 -0
  80. package/src/modules/Quests.d.ts +129 -0
  81. package/src/modules/Quests.js +101 -0
  82. package/src/modules/Runtimes.d.ts +81 -0
  83. package/src/modules/Runtimes.js +69 -0
  84. package/src/modules/STAR.d.ts +18 -0
  85. package/src/modules/STAR.js +29 -0
  86. package/src/modules/Templates.d.ts +72 -0
  87. package/src/modules/Templates.js +63 -0
  88. package/src/modules/Zomes.d.ts +72 -0
  89. package/src/modules/Zomes.js +65 -0
  90. package/src/modules/ZomesMetaData.d.ts +69 -0
  91. package/src/modules/ZomesMetaData.js +61 -0
  92. package/src/modules/index.js +67 -0
@@ -0,0 +1,606 @@
1
+ # Avatar — `star.avatar`
2
+
3
+ Source controller: [`AvatarController.cs`](https://github.com/NextGenSoftwareUK/OASIS2/blob/main/STAR%20ODK/NextGenSoftware.OASIS.STAR.WebAPI/Controllers/AvatarController.cs)
4
+ Route prefix: `api/avatar`
5
+ 13 operation(s).
6
+
7
+ Every method takes a single args object: any key matching a `{token}` in the route is substituted into the URL; everything else becomes the query string (GET/DELETE) or JSON body (POST/PUT). Every call resolves to the standard OASIS envelope:
8
+
9
+ ```ts
10
+ {
11
+ isError: boolean;
12
+ isWarning: boolean;
13
+ message: string;
14
+ errorCode?: string;
15
+ result: T; // see each endpoint's Response section below
16
+ }
17
+ ```
18
+
19
+ ## Operations
20
+
21
+ ### `addItemToInventory`
22
+
23
+ Adds an item to the avatar's inventory. Accepts InventoryItem object directly (ASP.NET Core automatically deserializes JSON). Delegates to WEB4 OASIS API.
24
+
25
+ **POST** `api/avatar/inventory`
26
+
27
+ **Request**
28
+
29
+ Body type: `InventoryItem`
30
+
31
+ | Field | Type |
32
+ | --- | --- |
33
+ | `Image2D` | `byte[]` |
34
+ | `Image2DURI` | `Uri` |
35
+ | `ThumbnailUrl` | `string` |
36
+ | `Object3D` | `byte[]` |
37
+ | `Object3DURI` | `Uri` |
38
+ | `Quantity` | `int` |
39
+ | `Stack` | `bool` |
40
+ | `GameSource` | `string` |
41
+ | `ItemType` | `string` |
42
+ | `NftId` | `string` |
43
+ | `InventoryItemType` | `InventoryItemType` |
44
+ | `Rarity` | `string` |
45
+ | `MaxQuantity` | `int` |
46
+ | `Weight` | `float` |
47
+ | `IsUsable` | `bool` |
48
+ | `IsTradeable` | `bool` |
49
+ | `OwnerAvatarId` | `string` |
50
+ | `AcquiredOn` | `DateTime` |
51
+ | `LastUsedOn` | `DateTime` |
52
+ | `Properties` | `Dictionary<string, object>` |
53
+
54
+ **Response**
55
+
56
+ Standard `OASISResult` envelope (see top of this page) with:
57
+
58
+ `result` type: `IActionResult` (not part of the request/response payload).
59
+
60
+ **Example**
61
+
62
+ ```js
63
+ const { isError, message, result } = await star.avatar.addItemToInventory({
64
+ image2D: "<base64-bytes>",
65
+ image2DURI: "https://example.com/asset.png",
66
+ thumbnailUrl: "example string",
67
+ object3D: "<base64-bytes>",
68
+ object3DURI: "https://example.com/asset.png",
69
+ quantity: 1,
70
+ stack: true,
71
+ gameSource: "example string",
72
+ itemType: "example string",
73
+ nftId: "example string",
74
+ inventoryItemType: { },
75
+ rarity: "example string",
76
+ maxQuantity: 1,
77
+ weight: 1.0,
78
+ isUsable: true,
79
+ isTradeable: true,
80
+ ownerAvatarId: "example string",
81
+ acquiredOn: "2026-01-01T00:00:00Z",
82
+ lastUsedOn: "2026-01-01T00:00:00Z",
83
+ properties: { "<string>": {} }
84
+ });
85
+ if (isError) throw new Error(message);
86
+ console.log(result);
87
+ ```
88
+
89
+ Example response:
90
+
91
+ ```json
92
+ {
93
+ "isError": false,
94
+ "message": "",
95
+ "result": null
96
+ }
97
+ ```
98
+
99
+ ---
100
+
101
+ ### `addXp`
102
+
103
+ Add experience points to the authenticated avatar (e.g. from game actions like killing monsters). Amount 0 is allowed (returns current XP without change; used to refresh cache after beam-in). Forwards to WEB4 OASIS API.
104
+
105
+ **POST** `api/avatar/add-xp`
106
+
107
+ **Request**
108
+
109
+ Body type: `AddXpRequest`
110
+
111
+ | Field | Type |
112
+ | --- | --- |
113
+ | `Amount` | `int` |
114
+
115
+ **Response**
116
+
117
+ Standard `OASISResult` envelope (see top of this page) with:
118
+
119
+ `result` type: `IActionResult` (not part of the request/response payload).
120
+
121
+ **Example**
122
+
123
+ ```js
124
+ const { isError, message, result } = await star.avatar.addXp({
125
+ amount: 1
126
+ });
127
+ if (isError) throw new Error(message);
128
+ console.log(result);
129
+ ```
130
+
131
+ Example response:
132
+
133
+ ```json
134
+ {
135
+ "isError": false,
136
+ "message": "",
137
+ "result": null
138
+ }
139
+ ```
140
+
141
+ ---
142
+
143
+ ### `authenticate`
144
+
145
+ Authenticates with the WEB4 OASIS API and returns a JWT token for subsequent requests.
146
+
147
+ **POST** `api/avatar/authenticate`
148
+
149
+ **Request**
150
+
151
+ Body type: `AuthenticateRequest`
152
+
153
+ _No fields._
154
+
155
+ **Response**
156
+
157
+ Standard `OASISResult` envelope (see top of this page) with:
158
+
159
+ `result` type: `IActionResult` (not part of the request/response payload).
160
+
161
+ **Example**
162
+
163
+ ```js
164
+ const { isError, message, result } = await star.avatar.authenticate({});
165
+ if (isError) throw new Error(message);
166
+ console.log(result);
167
+ ```
168
+
169
+ Example response:
170
+
171
+ ```json
172
+ {
173
+ "isError": false,
174
+ "message": "",
175
+ "result": null
176
+ }
177
+ ```
178
+
179
+ ---
180
+
181
+ ### `getCurrentAvatar`
182
+
183
+ Gets the current authenticated avatar with XP and active quest/objective (for STAR client refresh). Delegates to WEB4 get-logged-in-avatar-with-xp so response includes AvatarDetail.XP, ActiveQuestId, ActiveObjectiveId.
184
+
185
+ **GET** `api/avatar/current`
186
+
187
+ **Request**
188
+
189
+ No request body.
190
+
191
+ **Response**
192
+
193
+ Standard `OASISResult` envelope (see top of this page) with:
194
+
195
+ `result` type: `IActionResult` (not part of the request/response payload).
196
+
197
+ **Example**
198
+
199
+ ```js
200
+ const { isError, message, result } = await star.avatar.getCurrentAvatar({});
201
+ if (isError) throw new Error(message);
202
+ console.log(result);
203
+ ```
204
+
205
+ Example response:
206
+
207
+ ```json
208
+ {
209
+ "isError": false,
210
+ "message": "",
211
+ "result": null
212
+ }
213
+ ```
214
+
215
+ ---
216
+
217
+ ### `getInventory`
218
+
219
+ Gets all inventory items owned by the authenticated avatar. This is the avatar's actual inventory (items they own), not items they created. Inventory is shared across all games, apps, websites, and services. Delegates to WEB4 OASIS API.
220
+
221
+ **GET** `api/avatar/inventory`
222
+
223
+ **Request**
224
+
225
+ No request body.
226
+
227
+ **Response**
228
+
229
+ Standard `OASISResult` envelope (see top of this page) with:
230
+
231
+ `result` type: `IActionResult` (not part of the request/response payload).
232
+
233
+ **Example**
234
+
235
+ ```js
236
+ const { isError, message, result } = await star.avatar.getInventory({});
237
+ if (isError) throw new Error(message);
238
+ console.log(result);
239
+ ```
240
+
241
+ Example response:
242
+
243
+ ```json
244
+ {
245
+ "isError": false,
246
+ "message": "",
247
+ "result": null
248
+ }
249
+ ```
250
+
251
+ ---
252
+
253
+ ### `getInventoryItem`
254
+
255
+ Gets a specific item from the avatar's inventory by ID. Delegates to WEB4 OASIS API.
256
+
257
+ **GET** `api/avatar/inventory/{itemId}`
258
+
259
+ Route parameters:
260
+
261
+ | Field | Type |
262
+ | --- | --- |
263
+ | `itemId` | `Guid` |
264
+
265
+ **Request**
266
+
267
+ No request body.
268
+
269
+ **Response**
270
+
271
+ Standard `OASISResult` envelope (see top of this page) with:
272
+
273
+ `result` type: `IActionResult` (not part of the request/response payload).
274
+
275
+ **Example**
276
+
277
+ ```js
278
+ const { isError, message, result } = await star.avatar.getInventoryItem({
279
+ itemId: '<itemId>'
280
+ });
281
+ if (isError) throw new Error(message);
282
+ console.log(result);
283
+ ```
284
+
285
+ Example response:
286
+
287
+ ```json
288
+ {
289
+ "isError": false,
290
+ "message": "",
291
+ "result": null
292
+ }
293
+ ```
294
+
295
+ ---
296
+
297
+ ### `hasItem`
298
+
299
+ Checks if the avatar has a specific item in their inventory. Delegates to WEB4 OASIS API.
300
+
301
+ **GET** `api/avatar/inventory/{itemId}/has`
302
+
303
+ Route parameters:
304
+
305
+ | Field | Type |
306
+ | --- | --- |
307
+ | `itemId` | `Guid` |
308
+
309
+ **Request**
310
+
311
+ No request body.
312
+
313
+ **Response**
314
+
315
+ Standard `OASISResult` envelope (see top of this page) with:
316
+
317
+ `result` type: `IActionResult` (not part of the request/response payload).
318
+
319
+ **Example**
320
+
321
+ ```js
322
+ const { isError, message, result } = await star.avatar.hasItem({
323
+ itemId: '<itemId>'
324
+ });
325
+ if (isError) throw new Error(message);
326
+ console.log(result);
327
+ ```
328
+
329
+ Example response:
330
+
331
+ ```json
332
+ {
333
+ "isError": false,
334
+ "message": "",
335
+ "result": null
336
+ }
337
+ ```
338
+
339
+ ---
340
+
341
+ ### `hasItemByName`
342
+
343
+ Checks if the avatar has a specific item by name in their inventory. Delegates to WEB4 OASIS API.
344
+
345
+ **GET** `api/avatar/inventory/has-by-name`
346
+
347
+ **Request**
348
+
349
+ Query parameters:
350
+
351
+ | Field | Type |
352
+ | --- | --- |
353
+ | `itemName` | `string` |
354
+
355
+ **Response**
356
+
357
+ Standard `OASISResult` envelope (see top of this page) with:
358
+
359
+ `result` type: `IActionResult` (not part of the request/response payload).
360
+
361
+ **Example**
362
+
363
+ ```js
364
+ const { isError, message, result } = await star.avatar.hasItemByName({
365
+ itemName: 'example string'
366
+ });
367
+ if (isError) throw new Error(message);
368
+ console.log(result);
369
+ ```
370
+
371
+ Example response:
372
+
373
+ ```json
374
+ {
375
+ "isError": false,
376
+ "message": "",
377
+ "result": null
378
+ }
379
+ ```
380
+
381
+ ---
382
+
383
+ ### `removeItemFromInventory`
384
+
385
+ Removes an item from the avatar's inventory. Delegates to WEB4 OASIS API.
386
+
387
+ **DELETE** `api/avatar/inventory/{itemId}`
388
+
389
+ Route parameters:
390
+
391
+ | Field | Type |
392
+ | --- | --- |
393
+ | `itemId` | `Guid` |
394
+
395
+ **Request**
396
+
397
+ No request body.
398
+
399
+ **Response**
400
+
401
+ Standard `OASISResult` envelope (see top of this page) with:
402
+
403
+ `result` type: `IActionResult` (not part of the request/response payload).
404
+
405
+ **Example**
406
+
407
+ ```js
408
+ const { isError, message, result } = await star.avatar.removeItemFromInventory({
409
+ itemId: '<itemId>'
410
+ });
411
+ if (isError) throw new Error(message);
412
+ console.log(result);
413
+ ```
414
+
415
+ Example response:
416
+
417
+ ```json
418
+ {
419
+ "isError": false,
420
+ "message": "",
421
+ "result": null
422
+ }
423
+ ```
424
+
425
+ ---
426
+
427
+ ### `searchInventory`
428
+
429
+ Searches the avatar's inventory by name or description. Delegates to WEB4 OASIS API.
430
+
431
+ **GET** `api/avatar/inventory/search`
432
+
433
+ **Request**
434
+
435
+ Query parameters:
436
+
437
+ | Field | Type |
438
+ | --- | --- |
439
+ | `searchTerm` | `string` |
440
+
441
+ **Response**
442
+
443
+ Standard `OASISResult` envelope (see top of this page) with:
444
+
445
+ `result` type: `IActionResult` (not part of the request/response payload).
446
+
447
+ **Example**
448
+
449
+ ```js
450
+ const { isError, message, result } = await star.avatar.searchInventory({
451
+ searchTerm: 'example string'
452
+ });
453
+ if (isError) throw new Error(message);
454
+ console.log(result);
455
+ ```
456
+
457
+ Example response:
458
+
459
+ ```json
460
+ {
461
+ "isError": false,
462
+ "message": "",
463
+ "result": null
464
+ }
465
+ ```
466
+
467
+ ---
468
+
469
+ ### `sendItemToAvatar`
470
+
471
+ Sends an item from the authenticated avatar's inventory to another avatar. Target is the recipient's username or avatar Id. Forwards to WEB4 OASIS API.
472
+
473
+ **POST** `api/avatar/inventory/send-to-avatar`
474
+
475
+ **Request**
476
+
477
+ Body type: `SendItemRequest`
478
+
479
+ | Field | Type |
480
+ | --- | --- |
481
+ | `Target` | `string` |
482
+ | `ItemName` | `string` |
483
+ | `ItemId` | `Guid?` |
484
+ | `Quantity` | `int` |
485
+
486
+ **Response**
487
+
488
+ Standard `OASISResult` envelope (see top of this page) with:
489
+
490
+ `result` type: `IActionResult` (not part of the request/response payload).
491
+
492
+ **Example**
493
+
494
+ ```js
495
+ const { isError, message, result } = await star.avatar.sendItemToAvatar({
496
+ target: "example string",
497
+ itemName: "example string",
498
+ itemId: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
499
+ quantity: 1
500
+ });
501
+ if (isError) throw new Error(message);
502
+ console.log(result);
503
+ ```
504
+
505
+ Example response:
506
+
507
+ ```json
508
+ {
509
+ "isError": false,
510
+ "message": "",
511
+ "result": null
512
+ }
513
+ ```
514
+
515
+ ---
516
+
517
+ ### `sendItemToClan`
518
+
519
+ Sends an item from the authenticated avatar's inventory to a clan. Target is the clan name. Forwards to WEB4 OASIS API.
520
+
521
+ **POST** `api/avatar/inventory/send-to-clan`
522
+
523
+ **Request**
524
+
525
+ Body type: `SendItemRequest`
526
+
527
+ | Field | Type |
528
+ | --- | --- |
529
+ | `Target` | `string` |
530
+ | `ItemName` | `string` |
531
+ | `ItemId` | `Guid?` |
532
+ | `Quantity` | `int` |
533
+
534
+ **Response**
535
+
536
+ Standard `OASISResult` envelope (see top of this page) with:
537
+
538
+ `result` type: `IActionResult` (not part of the request/response payload).
539
+
540
+ **Example**
541
+
542
+ ```js
543
+ const { isError, message, result } = await star.avatar.sendItemToClan({
544
+ target: "example string",
545
+ itemName: "example string",
546
+ itemId: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
547
+ quantity: 1
548
+ });
549
+ if (isError) throw new Error(message);
550
+ console.log(result);
551
+ ```
552
+
553
+ Example response:
554
+
555
+ ```json
556
+ {
557
+ "isError": false,
558
+ "message": "",
559
+ "result": null
560
+ }
561
+ ```
562
+
563
+ ---
564
+
565
+ ### `setActiveQuest`
566
+
567
+ Sets the active quest and objective for the logged-in avatar (tracker state). Persisted on AvatarDetail; restored after beam-in. Forwards to WEB4.
568
+
569
+ **POST** `api/avatar/set-active-quest`
570
+
571
+ **Request**
572
+
573
+ Body type: `SetActiveQuestRequest`
574
+
575
+ | Field | Type |
576
+ | --- | --- |
577
+ | `ActiveQuestId` | `Guid?` |
578
+ | `ActiveObjectiveId` | `Guid?` |
579
+
580
+ **Response**
581
+
582
+ Standard `OASISResult` envelope (see top of this page) with:
583
+
584
+ `result` type: `IActionResult` (not part of the request/response payload).
585
+
586
+ **Example**
587
+
588
+ ```js
589
+ const { isError, message, result } = await star.avatar.setActiveQuest({
590
+ activeQuestId: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
591
+ activeObjectiveId: "3fa85f64-5717-4562-b3fc-2c963f66afa6"
592
+ });
593
+ if (isError) throw new Error(message);
594
+ console.log(result);
595
+ ```
596
+
597
+ Example response:
598
+
599
+ ```json
600
+ {
601
+ "isError": false,
602
+ "message": "",
603
+ "result": null
604
+ }
605
+ ```
606
+